From 02d8d5f9bf62b42d4f59c30ee77ede3b53d5eeed Mon Sep 17 00:00:00 2001 From: mycroft Date: Sat, 9 Dec 2000 07:04:47 +0000 Subject: [PATCH] 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. --- sys/kern/kern_prot.c | 54 +++++++++++++++++++++++++++++----------- sys/kern/syscalls.master | 14 ++++++++++- 2 files changed, 53 insertions(+), 15 deletions(-) diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index 9215a87af627..f32e8368ab2e 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -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); } diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index fa711aa96cbc..dbaf2ec4db59 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -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); }