* ps.cc (main): Use uid or uid32 member of struct external_pinfo
dependent of the value of the struct's version member.
This commit is contained in:
parent
3a571063b3
commit
50674f2dc3
@ -1,3 +1,8 @@
|
|||||||
|
2002-05-29 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* ps.cc (main): Use uid or uid32 member of struct external_pinfo
|
||||||
|
dependent of the value of the struct's version member.
|
||||||
|
|
||||||
2002-05-29 Corinna Vinschen <corinna@vinschen.de>
|
2002-05-29 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* ps.cc (main): Change print format for uid to unsigned. Use uid32
|
* ps.cc (main): Change print format for uid to unsigned. Use uid32
|
||||||
|
@ -325,7 +325,13 @@ main (int argc, char *argv[])
|
|||||||
(p = (external_pinfo *) cygwin_internal (query, pid | CW_NEXTPID));
|
(p = (external_pinfo *) cygwin_internal (query, pid | CW_NEXTPID));
|
||||||
pid = p->pid)
|
pid = p->pid)
|
||||||
{
|
{
|
||||||
if (!aflag && p->uid32 != (__uid32_t) uid)
|
if (!aflag)
|
||||||
|
if (p->version >= EXTERNAL_PINFO_VERSION_32_BIT)
|
||||||
|
{
|
||||||
|
if (p->uid32 != (__uid32_t) uid)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (p->uid != uid)
|
||||||
continue;
|
continue;
|
||||||
char status = ' ';
|
char status = ' ';
|
||||||
if (p->process_state & PID_STOPPED)
|
if (p->process_state & PID_STOPPED)
|
||||||
@ -349,7 +355,8 @@ main (int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if (query == CW_GETPINFO_FULL)
|
else if (query == CW_GETPINFO_FULL)
|
||||||
{
|
{
|
||||||
HANDLE h = OpenProcess (PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, p->dwProcessId);
|
HANDLE h = OpenProcess (PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
|
||||||
|
FALSE, p->dwProcessId);
|
||||||
if (!h)
|
if (!h)
|
||||||
continue;
|
continue;
|
||||||
HMODULE hm[1000];
|
HMODULE hm[1000];
|
||||||
@ -370,19 +377,25 @@ main (int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
|
|
||||||
if ((pw = getpwuid (p->uid32)))
|
if ((pw = getpwuid (p->version >= EXTERNAL_PINFO_VERSION_32_BIT ?
|
||||||
|
p->uid32 : p->uid)))
|
||||||
strcpy (uname, pw->pw_name);
|
strcpy (uname, pw->pw_name);
|
||||||
else
|
else
|
||||||
sprintf (uname, "%u", (unsigned) p->uid32);
|
sprintf (uname, "%u", (unsigned)
|
||||||
|
(p->version >= EXTERNAL_PINFO_VERSION_32_BIT ?
|
||||||
|
p->uid32 : p->uid));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sflag)
|
if (sflag)
|
||||||
printf (dfmt, p->pid, ttynam (p->ctty), start_time (p), pname);
|
printf (dfmt, p->pid, ttynam (p->ctty), start_time (p), pname);
|
||||||
else if (fflag)
|
else if (fflag)
|
||||||
printf (ffmt, uname, p->pid, p->ppid, ttynam (p->ctty), start_time (p), pname);
|
printf (ffmt, uname, p->pid, p->ppid, ttynam (p->ctty), start_time (p),
|
||||||
|
pname);
|
||||||
else if (lflag)
|
else if (lflag)
|
||||||
printf (lfmt, status, p->pid, p->ppid, p->pgid,
|
printf (lfmt, status, p->pid, p->ppid, p->pgid,
|
||||||
p->dwProcessId, ttynam (p->ctty), p->uid32, start_time (p), pname);
|
p->dwProcessId, ttynam (p->ctty),
|
||||||
|
p->version >= EXTERNAL_PINFO_VERSION_32_BIT ? p->uid32 : p->uid,
|
||||||
|
start_time (p), pname);
|
||||||
|
|
||||||
}
|
}
|
||||||
(void) cygwin_internal (CW_UNLOCK_PINFO);
|
(void) cygwin_internal (CW_UNLOCK_PINFO);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user