Define 3 new functions:

* sys_getpid_with_ppid()
* sys_getuid_with_euid()
* sys_getgid_with_egid()
that do the retval[1] hack.  Use them when COMPAT_43 is defined.
This commit is contained in:
mycroft 2000-12-09 07:04:47 +00:00
parent c6e883d603
commit 02d8d5f9bf
2 changed files with 53 additions and 15 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_prot.c,v 1.61 2000/12/01 20:34:17 jdolecek Exp $ */
/* $NetBSD: kern_prot.c,v 1.62 2000/12/09 07:04:47 mycroft Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1990, 1991, 1993
@ -67,11 +67,19 @@ sys_getpid(p, v, retval)
{
*retval = p->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);
}
/* ARGSUSED */
int
sys_getpid_with_ppid(p, v, retval)
struct proc *p;
void *v;
register_t *retval;
{
retval[0] = p->p_pid;
retval[1] = p->p_pptr->p_pid;
return (0);
}
@ -150,10 +158,19 @@ sys_getuid(p, v, retval)
{
*retval = p->p_cred->p_ruid;
#ifndef COMPAT_43
if (p->p_emul->e_flags & EMUL_GETID_PASS_EID)
#endif
retval[1] = p->p_ucred->cr_uid;
return (0);
}
/* ARGSUSED */
int
sys_getuid_with_euid(p, v, retval)
struct proc *p;
void *v;
register_t *retval;
{
retval[0] = p->p_cred->p_ruid;
retval[1] = p->p_ucred->cr_uid;
return (0);
}
@ -178,10 +195,19 @@ sys_getgid(p, v, retval)
{
*retval = p->p_cred->p_rgid;
#ifndef COMPAT_43
if (p->p_emul->e_flags & EMUL_GETID_PASS_EID)
#endif
retval[1] = p->p_ucred->cr_gid;
return (0);
}
/* ARGSUSED */
int
sys_getgid_with_egid(p, v, retval)
struct proc *p;
void *v;
register_t *retval;
{
retval[0] = p->p_cred->p_rgid;
retval[1] = p->p_ucred->cr_gid;
return (0);
}

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.103 2000/12/09 05:27:31 mycroft Exp $
$NetBSD: syscalls.master,v 1.104 2000/12/09 07:04:48 mycroft Exp $
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@ -85,12 +85,20 @@
int flags); }
19 COMPAT_43 { long sys_lseek(int fd, long offset, int whence); } \
olseek
#ifdef COMPAT_43
20 STD { pid_t sys_getpid_with_ppid(void); } getpid
#else
20 STD { pid_t sys_getpid(void); }
#endif
21 STD { int sys_mount(const char *type, const char *path, \
int flags, void *data); }
22 STD { int sys_unmount(const char *path, int flags); }
23 STD { int sys_setuid(uid_t uid); }
#ifdef COMPAT_43
24 STD { uid_t sys_getuid_with_euid(void); } getuid
#else
24 STD { uid_t sys_getuid(void); }
#endif
25 STD { uid_t sys_geteuid(void); }
26 STD { int sys_ptrace(int req, pid_t pid, caddr_t addr, \
int data); }
@ -131,7 +139,11 @@
46 COMPAT_13 { int sys_sigaction(int signum, \
const struct sigaction13 *nsa, \
struct sigaction13 *osa); } sigaction13
#ifdef COMPAT_43
47 STD { gid_t sys_getgid_with_egid(void); } getgid
#else
47 STD { gid_t sys_getgid(void); }
#endif
48 COMPAT_13 { int sys_sigprocmask(int how, \
int mask); } sigprocmask13
49 STD { int sys___getlogin(char *namebuf, size_t namelen); }