1/*
2 * Copyright (c) 1982, 1986, 1989, 1990, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.
--- 26 unchanged lines hidden (view full) ---
35 * @(#)kern_prot.c 8.6 (Berkeley) 1/21/94
36 */
37
38/*
39 * System calls related to processes and protection
40 */
41
42#include <sys/cdefs.h>
43__FBSDID("$FreeBSD: head/sys/kern/kern_prot.c 127911 2004-04-05 21:03:37Z imp $");
44
45#include "opt_compat.h"
46#include "opt_mac.h"
47
48#include <sys/param.h>
49#include <sys/systm.h>
50#include <sys/acct.h>
51#include <sys/kernel.h>
--- 27 unchanged lines hidden (view full) ---
79 */
80/* ARGSUSED */
81int
82getpid(struct thread *td, struct getpid_args *uap)
83{
84 struct proc *p = td->td_proc;
85
86 td->td_retval[0] = p->p_pid;
87#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
88 PROC_LOCK(p);
89 td->td_retval[1] = p->p_pptr->p_pid;
90 PROC_UNLOCK(p);
91#endif
92 return (0);
93}
94
95#ifndef _SYS_SYSPROTO_H_
--- 115 unchanged lines hidden (view full) ---
211 * MPSAFE
212 */
213/* ARGSUSED */
214int
215getuid(struct thread *td, struct getuid_args *uap)
216{
217
218 td->td_retval[0] = td->td_ucred->cr_ruid;
219#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
220 td->td_retval[1] = td->td_ucred->cr_uid;
221#endif
222 return (0);
223}
224
225#ifndef _SYS_SYSPROTO_H_
226struct geteuid_args {
227 int dummy;
--- 20 unchanged lines hidden (view full) ---
248 * MPSAFE
249 */
250/* ARGSUSED */
251int
252getgid(struct thread *td, struct getgid_args *uap)
253{
254
255 td->td_retval[0] = td->td_ucred->cr_rgid;
256#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
257 td->td_retval[1] = td->td_ucred->cr_groups[0];
258#endif
259 return (0);
260}
261
262/*
263 * Get effective group ID. The "egid" is groups[0], and could be obtained
264 * via getgroups. This syscall exists because it is somewhat painful to do
--- 1766 unchanged lines hidden ---
2 * Copyright (c) 1982, 1986, 1989, 1990, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.
--- 26 unchanged lines hidden (view full) ---
35 * @(#)kern_prot.c 8.6 (Berkeley) 1/21/94
36 */
37
38/*
39 * System calls related to processes and protection
40 */
41
42#include <sys/cdefs.h>
43__FBSDID("$FreeBSD: head/sys/kern/kern_prot.c 127911 2004-04-05 21:03:37Z imp $");
44
45#include "opt_compat.h"
46#include "opt_mac.h"
47
48#include <sys/param.h>
49#include <sys/systm.h>
50#include <sys/acct.h>
51#include <sys/kernel.h>
--- 27 unchanged lines hidden (view full) ---
79 */
80/* ARGSUSED */
81int
82getpid(struct thread *td, struct getpid_args *uap)
83{
84 struct proc *p = td->td_proc;
85
86 td->td_retval[0] = p->p_pid;
87#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
88 PROC_LOCK(p);
89 td->td_retval[1] = p->p_pptr->p_pid;
90 PROC_UNLOCK(p);
91#endif
92 return (0);
93}
94
95#ifndef _SYS_SYSPROTO_H_
--- 115 unchanged lines hidden (view full) ---
211 * MPSAFE
212 */
213/* ARGSUSED */
214int
215getuid(struct thread *td, struct getuid_args *uap)
216{
217
218 td->td_retval[0] = td->td_ucred->cr_ruid;
219#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
220 td->td_retval[1] = td->td_ucred->cr_uid;
221#endif
222 return (0);
223}
224
225#ifndef _SYS_SYSPROTO_H_
226struct geteuid_args {
227 int dummy;
--- 20 unchanged lines hidden (view full) ---
248 * MPSAFE
249 */
250/* ARGSUSED */
251int
252getgid(struct thread *td, struct getgid_args *uap)
253{
254
255 td->td_retval[0] = td->td_ucred->cr_rgid;
256#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
257 td->td_retval[1] = td->td_ucred->cr_groups[0];
258#endif
259 return (0);
260}
261
262/*
263 * Get effective group ID. The "egid" is groups[0], and could be obtained
264 * via getgroups. This syscall exists because it is somewhat painful to do
--- 1766 unchanged lines hidden ---