diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index ed2d0701af5c..bde9212d8c5a 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -1599,14 +1599,11 @@ linux_getuid(struct thread *td, struct linux_getuid_args *args) return (0); } - int linux_getsid(struct thread *td, struct linux_getsid_args *args) { - struct getsid_args bsd; - bsd.pid = args->pid; - return (sys_getsid(td, &bsd)); + return (kern_getsid(td, args->pid)); } int diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index a8e7c55ac042..7929d73316d7 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -189,15 +189,22 @@ struct getsid_args { #endif int 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; int error; - if (uap->pid == 0) { + if (pid == 0) { p = td->td_proc; PROC_LOCK(p); } else { - p = pfind(uap->pid); + p = pfind(pid); if (p == NULL) return (ESRCH); error = p_cansee(td, p); diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h index f26e66920ca0..c6c57723e02b 100644 --- a/sys/sys/syscallsubr.h +++ b/sys/sys/syscallsubr.h @@ -140,6 +140,7 @@ int kern_getppid(struct thread *); int kern_getpeername(struct thread *td, int fd, struct sockaddr **sa, socklen_t *alen); int kern_getrusage(struct thread *td, int who, struct rusage *rup); +int kern_getsid(struct thread *td, pid_t pid); int kern_getsockname(struct thread *td, int fd, struct sockaddr **sa, socklen_t *alen); int kern_getsockopt(struct thread *td, int s, int level, int name,