use EMUL_GETPID_PASS_PPID or EMUL_GETID_PASS_EID to find out if one should

pass parent pid for getpid() or effective id for get[ug]id(), instead
of compile-time dependency
This commit is contained in:
jdolecek 2000-12-01 20:34:17 +00:00
parent b490742cef
commit fc181f91c6

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_prot.c,v 1.60 2000/10/17 23:38:55 christos Exp $ */
/* $NetBSD: kern_prot.c,v 1.61 2000/12/01 20:34:17 jdolecek Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1990, 1991, 1993
@ -44,12 +44,7 @@
* System calls related to processes and protection
*/
#include "opt_compat_freebsd.h"
#include "opt_compat_ibcs2.h"
#include "opt_compat_sunos.h"
#include "opt_compat_linux.h"
#include "opt_compat_43.h"
#include "opt_compat_osf1.h"
#include <sys/param.h>
#include <sys/acct.h>
@ -72,11 +67,11 @@ sys_getpid(p, v, retval)
{
*retval = p->p_pid;
#if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_IBCS2) || \
defined(COMPAT_FREEBSD) || defined(COMPAT_OSF1) || \
(defined(COMPAT_LINUX) && defined(__alpha__))
retval[1] = p->p_pptr->p_pid;
#ifndef COMPAT_43
if (p->p_emul->e_flags & EMUL_GETPID_PASS_PPID)
#endif
retval[1] = p->p_pptr->p_pid;
return (0);
}
@ -155,11 +150,10 @@ sys_getuid(p, v, retval)
{
*retval = p->p_cred->p_ruid;
#if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_IBCS2) || \
defined(COMPAT_FREEBSD) || defined(COMPAT_OSF1) || \
(defined(COMPAT_LINUX) && defined(__alpha__))
retval[1] = p->p_ucred->cr_uid;
#ifndef COMPAT_43
if (p->p_emul->e_flags & EMUL_GETID_PASS_EID)
#endif
retval[1] = p->p_ucred->cr_uid;
return (0);
}
@ -184,10 +178,10 @@ sys_getgid(p, v, retval)
{
*retval = p->p_cred->p_rgid;
#if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_FREEBSD) || \
defined(COMPAT_OSF1) || (defined(COMPAT_LINUX) && defined(alpha))
retval[1] = p->p_ucred->cr_gid;
#ifndef COMPAT_43
if (p->p_emul->e_flags & EMUL_GETID_PASS_EID)
#endif
retval[1] = p->p_ucred->cr_gid;
return (0);
}