changes to /proc ctty and uid/gid handling
Chris January
chris@atomice.net
Tue Sep 24 06:17:00 GMT 2002
I hope this isn't too late for 1.3.13.
This fixes the bug where processes showed up as the wrong user in procps.
Also, procps should now report the correct tty a proces is running on.
Chris
---
2002-09-24 Christopher January <chris@atomice.net>
* fhandler_proc.cc (format_process_stat): make ctty a real device number.
(format_process_status): use effective uid/gid as real and saved uid/gid.
---
Index: fhandler_process.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/fhandler_process.cc,v
retrieving revision 1.19
diff -u -3 -p -u -p -r1.19 fhandler_process.cc
--- fhandler_process.cc 31 Aug 2002 16:37:51 -0000 1.19
+++ fhandler_process.cc 24 Sep 2002 13:13:30 -0000
@@ -25,6 +25,7 @@ details. */
#include "ntdll.h"
#include <sys/param.h>
#include <assert.h>
+#include <sys/sysmacros.h>
#define _COMPILING_NEWLIB
#include <dirent.h>
@@ -486,7 +487,7 @@ format_process_stat (_pinfo *p, char *de
"%lu",
p->pid, cmd,
state,
- p->ppid, p->pgid, p->sid, p->ctty, -1,
+ p->ppid, p->pgid, p->sid, makedev (FH_TTYS, p->ctty), -1,
0, fault_count, fault_count, 0, 0, utime, stime,
utime, stime, priority, 0, 0, 0,
start_time, vmsize,
@@ -556,6 +557,9 @@ format_process_status (_pinfo *p, char *
vmsize *= page_size; vmrss *= page_size; vmdata *= page_size;
vmtext *= page_size; vmlib *= page_size;
}
+ // The real uid value for *this* process is stored at
cygheap->user.real_uid
+ // but we can't get at the real uid value for any other process, so
+ // just fake it as p->uid. Similar for p->gid.
return __small_sprintf (destbuf, "Name: %s\n"
"State: %c (%s)\n"
"Tgid: %d\n"
@@ -578,8 +582,8 @@ format_process_status (_pinfo *p, char *
p->pgid,
p->pid,
p->ppid,
- p->uid, cygheap->user.real_uid, cygheap->user.real_uid, p->uid,
- p->gid, cygheap->user.real_gid, cygheap->user.real_gid, p->gid,
+ p->uid, p->uid, p->uid, p->uid,
+ p->gid, p->gid, p->gid, p->gid,
vmsize >> 10, 0, vmrss >> 10, vmdata >> 10, 0, vmtext >> 10, vmlib >>
10,
0, 0, p->getsigmask ()
);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ChangeLog
Type: application/octet-stream
Size: 203 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20020924/9625892a/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: proc.patch
Type: application/octet-stream
Size: 1797 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20020924/9625892a/attachment-0001.obj>
More information about the Cygwin-patches
mailing list