* 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.
This commit is contained in:
Christopher Faylor 2002-09-25 12:24:23 +00:00
parent bba0272654
commit 38c77307c5
4 changed files with 31 additions and 34 deletions

View File

@ -1,3 +1,10 @@
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.
2002-09-24 Corinna Vinschen <corinna@vinschen.de>
* errno.cc (errmap): Map ERROR_INVALID_ADDRESS to new errno code
@ -1603,7 +1610,7 @@
(fhandler_socket::close): Ditto.
(fhandler_socket::ioctl): Ditto.
* ioctl.cc (ioctl): Add sigframe.
*net.cc (cygwin_sendto): Ditto.
* net.cc (cygwin_sendto): Ditto.
(cygwin_recvfrom): Ditto.
(cygwin_recvfrom): Ditto.
(cygwin_connect): Ditto.

View File

@ -115,7 +115,7 @@ EXTRA_OFILES=$(bupdir1)/libiberty/random.o $(bupdir1)/libiberty/strsignal.o
MALLOC_OFILES=@MALLOC_OFILES@
DLL_IMPORTS:=$(w32api_lib)/libuuid.a $(w32api_lib)/libshell32.a $(w32api_lib)/libkernel32.a
DLL_IMPORTS:=$(w32api_lib)/libkernel32.a
# Please maintain this list in sorted order, with maximum files per 80 col line
DLL_OFILES:=assert.o autoload.o cygheap.o cygserver_client.o \

View File

@ -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,8 +487,8 @@ format_process_stat (_pinfo *p, char *destbuf, size_t maxsize)
"%lu",
p->pid, cmd,
state,
p->ppid, p->pgid, p->sid, p->ctty, -1,
0, fault_count, fault_count, 0, 0, utime, stime,
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,
vmrss, vmmaxrss
@ -556,6 +557,9 @@ format_process_status (_pinfo *p, char *destbuf, size_t maxsize)
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 *destbuf, size_t maxsize)
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 ()
);

View File

@ -237,8 +237,7 @@ grp32togrp16 (struct __group16 *gp16, struct __group32 *gp32)
return gp16;
}
extern "C"
struct __group32 *
extern "C" struct __group32 *
getgrgid32 (__gid32_t gid)
{
struct __group32 * default_grp = NULL;
@ -256,8 +255,7 @@ getgrgid32 (__gid32_t gid)
return allow_ntsec ? NULL : default_grp;
}
extern "C"
struct __group16 *
extern "C" struct __group16 *
getgrgid (__gid16_t gid)
{
static struct __group16 g16;
@ -265,8 +263,7 @@ getgrgid (__gid16_t gid)
return grp32togrp16 (&g16, getgrgid32 ((__gid32_t) gid));
}
extern "C"
struct __group32 *
extern "C" struct __group32 *
getgrnam32 (const char *name)
{
if (group_state <= initializing)
@ -280,8 +277,7 @@ getgrnam32 (const char *name)
return NULL;
}
extern "C"
struct __group16 *
extern "C" struct __group16 *
getgrnam (const char *name)
{
static struct __group16 g16;
@ -289,15 +285,13 @@ getgrnam (const char *name)
return grp32togrp16 (&g16, getgrnam32 (name));
}
extern "C"
void
extern "C" void
endgrent ()
{
grp_pos = 0;
}
extern "C"
struct __group32 *
extern "C" struct __group32 *
getgrent32 ()
{
if (group_state <= initializing)
@ -309,8 +303,7 @@ getgrent32 ()
return NULL;
}
extern "C"
struct __group16 *
extern "C" struct __group16 *
getgrent ()
{
static struct __group16 g16;
@ -318,8 +311,7 @@ getgrent ()
return grp32togrp16 (&g16, getgrent32 ());
}
extern "C"
void
extern "C" void
setgrent ()
{
grp_pos = 0;
@ -413,16 +405,14 @@ error:
return -1;
}
extern "C"
int
extern "C" int
getgroups32 (int gidsetsize, __gid32_t *grouplist)
{
return getgroups32 (gidsetsize, grouplist, myself->gid,
cygheap->user.name ());
}
extern "C"
int
extern "C" int
getgroups (int gidsetsize, __gid16_t *grouplist)
{
__gid32_t *grouplist32 = NULL;
@ -445,8 +435,7 @@ getgroups (int gidsetsize, __gid16_t *grouplist)
return ret;
}
extern "C"
int
extern "C" int
initgroups32 (const char *, __gid32_t)
{
if (wincap.has_security ())
@ -454,16 +443,14 @@ initgroups32 (const char *, __gid32_t)
return 0;
}
extern "C"
int
extern "C" int
initgroups (const char * name, __gid16_t gid)
{
return initgroups32 (name, gid16togid32(gid));
}
/* setgroups32: standards? */
extern "C"
int
extern "C" int
setgroups32 (int ngroups, const __gid32_t *grouplist)
{
if (ngroups < 0 || (ngroups > 0 && !grouplist))
@ -504,8 +491,7 @@ setgroups32 (int ngroups, const __gid32_t *grouplist)
return 0;
}
extern "C"
int
extern "C" int
setgroups (int ngroups, const __gid16_t *grouplist)
{
__gid32_t *grouplist32 = NULL;