* 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:
parent
bba0272654
commit
38c77307c5
|
@ -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>
|
2002-09-24 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* errno.cc (errmap): Map ERROR_INVALID_ADDRESS to new errno code
|
* errno.cc (errmap): Map ERROR_INVALID_ADDRESS to new errno code
|
||||||
|
@ -1603,7 +1610,7 @@
|
||||||
(fhandler_socket::close): Ditto.
|
(fhandler_socket::close): Ditto.
|
||||||
(fhandler_socket::ioctl): Ditto.
|
(fhandler_socket::ioctl): Ditto.
|
||||||
* ioctl.cc (ioctl): Add sigframe.
|
* ioctl.cc (ioctl): Add sigframe.
|
||||||
*net.cc (cygwin_sendto): Ditto.
|
* net.cc (cygwin_sendto): Ditto.
|
||||||
(cygwin_recvfrom): Ditto.
|
(cygwin_recvfrom): Ditto.
|
||||||
(cygwin_recvfrom): Ditto.
|
(cygwin_recvfrom): Ditto.
|
||||||
(cygwin_connect): Ditto.
|
(cygwin_connect): Ditto.
|
||||||
|
|
|
@ -115,7 +115,7 @@ EXTRA_OFILES=$(bupdir1)/libiberty/random.o $(bupdir1)/libiberty/strsignal.o
|
||||||
|
|
||||||
MALLOC_OFILES=@MALLOC_OFILES@
|
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
|
# 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 \
|
DLL_OFILES:=assert.o autoload.o cygheap.o cygserver_client.o \
|
||||||
|
|
|
@ -25,6 +25,7 @@ details. */
|
||||||
#include "ntdll.h"
|
#include "ntdll.h"
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <sys/sysmacros.h>
|
||||||
|
|
||||||
#define _COMPILING_NEWLIB
|
#define _COMPILING_NEWLIB
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
@ -486,8 +487,8 @@ format_process_stat (_pinfo *p, char *destbuf, size_t maxsize)
|
||||||
"%lu",
|
"%lu",
|
||||||
p->pid, cmd,
|
p->pid, cmd,
|
||||||
state,
|
state,
|
||||||
p->ppid, p->pgid, p->sid, p->ctty, -1,
|
p->ppid, p->pgid, p->sid, makedev (FH_TTYS, p->ctty),
|
||||||
0, fault_count, fault_count, 0, 0, utime, stime,
|
-1, 0, fault_count, fault_count, 0, 0, utime, stime,
|
||||||
utime, stime, priority, 0, 0, 0,
|
utime, stime, priority, 0, 0, 0,
|
||||||
start_time, vmsize,
|
start_time, vmsize,
|
||||||
vmrss, vmmaxrss
|
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;
|
vmsize *= page_size; vmrss *= page_size; vmdata *= page_size;
|
||||||
vmtext *= page_size; vmlib *= 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"
|
return __small_sprintf (destbuf, "Name: %s\n"
|
||||||
"State: %c (%s)\n"
|
"State: %c (%s)\n"
|
||||||
"Tgid: %d\n"
|
"Tgid: %d\n"
|
||||||
|
@ -578,8 +582,8 @@ format_process_status (_pinfo *p, char *destbuf, size_t maxsize)
|
||||||
p->pgid,
|
p->pgid,
|
||||||
p->pid,
|
p->pid,
|
||||||
p->ppid,
|
p->ppid,
|
||||||
p->uid, cygheap->user.real_uid, cygheap->user.real_uid, p->uid,
|
p->uid, p->uid, p->uid, p->uid,
|
||||||
p->gid, cygheap->user.real_gid, cygheap->user.real_gid, p->gid,
|
p->gid, p->gid, p->gid, p->gid,
|
||||||
vmsize >> 10, 0, vmrss >> 10, vmdata >> 10, 0, vmtext >> 10, vmlib >> 10,
|
vmsize >> 10, 0, vmrss >> 10, vmdata >> 10, 0, vmtext >> 10, vmlib >> 10,
|
||||||
0, 0, p->getsigmask ()
|
0, 0, p->getsigmask ()
|
||||||
);
|
);
|
||||||
|
|
|
@ -237,8 +237,7 @@ grp32togrp16 (struct __group16 *gp16, struct __group32 *gp32)
|
||||||
return gp16;
|
return gp16;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" struct __group32 *
|
||||||
struct __group32 *
|
|
||||||
getgrgid32 (__gid32_t gid)
|
getgrgid32 (__gid32_t gid)
|
||||||
{
|
{
|
||||||
struct __group32 * default_grp = NULL;
|
struct __group32 * default_grp = NULL;
|
||||||
|
@ -256,8 +255,7 @@ getgrgid32 (__gid32_t gid)
|
||||||
return allow_ntsec ? NULL : default_grp;
|
return allow_ntsec ? NULL : default_grp;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" struct __group16 *
|
||||||
struct __group16 *
|
|
||||||
getgrgid (__gid16_t gid)
|
getgrgid (__gid16_t gid)
|
||||||
{
|
{
|
||||||
static struct __group16 g16;
|
static struct __group16 g16;
|
||||||
|
@ -265,8 +263,7 @@ getgrgid (__gid16_t gid)
|
||||||
return grp32togrp16 (&g16, getgrgid32 ((__gid32_t) gid));
|
return grp32togrp16 (&g16, getgrgid32 ((__gid32_t) gid));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" struct __group32 *
|
||||||
struct __group32 *
|
|
||||||
getgrnam32 (const char *name)
|
getgrnam32 (const char *name)
|
||||||
{
|
{
|
||||||
if (group_state <= initializing)
|
if (group_state <= initializing)
|
||||||
|
@ -280,8 +277,7 @@ getgrnam32 (const char *name)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" struct __group16 *
|
||||||
struct __group16 *
|
|
||||||
getgrnam (const char *name)
|
getgrnam (const char *name)
|
||||||
{
|
{
|
||||||
static struct __group16 g16;
|
static struct __group16 g16;
|
||||||
|
@ -289,15 +285,13 @@ getgrnam (const char *name)
|
||||||
return grp32togrp16 (&g16, getgrnam32 (name));
|
return grp32togrp16 (&g16, getgrnam32 (name));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" void
|
||||||
void
|
|
||||||
endgrent ()
|
endgrent ()
|
||||||
{
|
{
|
||||||
grp_pos = 0;
|
grp_pos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" struct __group32 *
|
||||||
struct __group32 *
|
|
||||||
getgrent32 ()
|
getgrent32 ()
|
||||||
{
|
{
|
||||||
if (group_state <= initializing)
|
if (group_state <= initializing)
|
||||||
|
@ -309,8 +303,7 @@ getgrent32 ()
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" struct __group16 *
|
||||||
struct __group16 *
|
|
||||||
getgrent ()
|
getgrent ()
|
||||||
{
|
{
|
||||||
static struct __group16 g16;
|
static struct __group16 g16;
|
||||||
|
@ -318,8 +311,7 @@ getgrent ()
|
||||||
return grp32togrp16 (&g16, getgrent32 ());
|
return grp32togrp16 (&g16, getgrent32 ());
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" void
|
||||||
void
|
|
||||||
setgrent ()
|
setgrent ()
|
||||||
{
|
{
|
||||||
grp_pos = 0;
|
grp_pos = 0;
|
||||||
|
@ -413,16 +405,14 @@ error:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
getgroups32 (int gidsetsize, __gid32_t *grouplist)
|
getgroups32 (int gidsetsize, __gid32_t *grouplist)
|
||||||
{
|
{
|
||||||
return getgroups32 (gidsetsize, grouplist, myself->gid,
|
return getgroups32 (gidsetsize, grouplist, myself->gid,
|
||||||
cygheap->user.name ());
|
cygheap->user.name ());
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
getgroups (int gidsetsize, __gid16_t *grouplist)
|
getgroups (int gidsetsize, __gid16_t *grouplist)
|
||||||
{
|
{
|
||||||
__gid32_t *grouplist32 = NULL;
|
__gid32_t *grouplist32 = NULL;
|
||||||
|
@ -445,8 +435,7 @@ getgroups (int gidsetsize, __gid16_t *grouplist)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
initgroups32 (const char *, __gid32_t)
|
initgroups32 (const char *, __gid32_t)
|
||||||
{
|
{
|
||||||
if (wincap.has_security ())
|
if (wincap.has_security ())
|
||||||
|
@ -454,16 +443,14 @@ initgroups32 (const char *, __gid32_t)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
initgroups (const char * name, __gid16_t gid)
|
initgroups (const char * name, __gid16_t gid)
|
||||||
{
|
{
|
||||||
return initgroups32 (name, gid16togid32(gid));
|
return initgroups32 (name, gid16togid32(gid));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* setgroups32: standards? */
|
/* setgroups32: standards? */
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
setgroups32 (int ngroups, const __gid32_t *grouplist)
|
setgroups32 (int ngroups, const __gid32_t *grouplist)
|
||||||
{
|
{
|
||||||
if (ngroups < 0 || (ngroups > 0 && !grouplist))
|
if (ngroups < 0 || (ngroups > 0 && !grouplist))
|
||||||
|
@ -504,8 +491,7 @@ setgroups32 (int ngroups, const __gid32_t *grouplist)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
setgroups (int ngroups, const __gid16_t *grouplist)
|
setgroups (int ngroups, const __gid16_t *grouplist)
|
||||||
{
|
{
|
||||||
__gid32_t *grouplist32 = NULL;
|
__gid32_t *grouplist32 = NULL;
|
||||||
|
|
Loading…
Reference in New Issue