Changeset View
Changeset View
Standalone View
Standalone View
head/sys/kern/kern_prot.c
Show First 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | |||||
#ifndef _SYS_SYSPROTO_H_ | #ifndef _SYS_SYSPROTO_H_ | ||||
struct getsid_args { | struct getsid_args { | ||||
pid_t pid; | pid_t pid; | ||||
}; | }; | ||||
#endif | #endif | ||||
int | int | ||||
sys_getsid(struct thread *td, struct getsid_args *uap) | sys_getsid(struct thread *td, struct getsid_args *uap) | ||||
{ | { | ||||
return (kern_getsid(td, uap->pid)); | |||||
} | |||||
int | |||||
kern_getsid(struct thread *td, pid_t pid) | |||||
{ | |||||
struct proc *p; | struct proc *p; | ||||
int error; | int error; | ||||
if (uap->pid == 0) { | if (pid == 0) { | ||||
p = td->td_proc; | p = td->td_proc; | ||||
PROC_LOCK(p); | PROC_LOCK(p); | ||||
} else { | } else { | ||||
p = pfind(uap->pid); | p = pfind(pid); | ||||
if (p == NULL) | if (p == NULL) | ||||
return (ESRCH); | return (ESRCH); | ||||
error = p_cansee(td, p); | error = p_cansee(td, p); | ||||
if (error) { | if (error) { | ||||
PROC_UNLOCK(p); | PROC_UNLOCK(p); | ||||
return (error); | return (error); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 2,072 Lines • Show Last 20 Lines |