diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2002-05-29 20:10:27 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2002-05-29 20:10:27 +0000 |
commit | 50674f2dc3ee6b192919936f4b037f9a1e68c2d3 (patch) | |
tree | c9aa04af76ea59c2bbacb36a93d747aa842b9978 /winsup/utils/ps.cc | |
parent | 3a571063b3dd83f264405ef1c0ae7ec20ba230b9 (diff) | |
download | newlib-50674f2dc3ee6b192919936f4b037f9a1e68c2d3.zip newlib-50674f2dc3ee6b192919936f4b037f9a1e68c2d3.tar.gz newlib-50674f2dc3ee6b192919936f4b037f9a1e68c2d3.tar.bz2 |
* ps.cc (main): Use uid or uid32 member of struct external_pinfo
dependent of the value of the struct's version member.
Diffstat (limited to 'winsup/utils/ps.cc')
-rw-r--r-- | winsup/utils/ps.cc | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/winsup/utils/ps.cc b/winsup/utils/ps.cc index ec52a8d..6866ccb 100644 --- a/winsup/utils/ps.cc +++ b/winsup/utils/ps.cc @@ -325,8 +325,14 @@ main (int argc, char *argv[]) (p = (external_pinfo *) cygwin_internal (query, pid | CW_NEXTPID)); pid = p->pid) { - if (!aflag && p->uid32 != (__uid32_t) uid) - continue; + if (!aflag) + if (p->version >= EXTERNAL_PINFO_VERSION_32_BIT) + { + if (p->uid32 != (__uid32_t) uid) + continue; + } + else if (p->uid != uid) + continue; char status = ' '; if (p->process_state & PID_STOPPED) status = 'S'; @@ -349,7 +355,8 @@ main (int argc, char *argv[]) } 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) continue; HMODULE hm[1000]; @@ -370,19 +377,25 @@ main (int argc, char *argv[]) { 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); else - sprintf (uname, "%u", (unsigned) p->uid32); + sprintf (uname, "%u", (unsigned) + (p->version >= EXTERNAL_PINFO_VERSION_32_BIT ? + p->uid32 : p->uid)); } if (sflag) printf (dfmt, p->pid, ttynam (p->ctty), start_time (p), pname); 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) 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); |