Date: Fri, 13 Dec 2019 18:39:37 +0000 (UTC) From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355722 - in head/sys: compat/linux kern sys Message-ID: <201912131839.xBDIdbDr035758@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: trasz Date: Fri Dec 13 18:39:36 2019 New Revision: 355722 URL: https://svnweb.freebsd.org/changeset/base/355722 Log: Add kern_getsid() and use it in Linuxulator; no functional changes. Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22647 Modified: head/sys/compat/linux/linux_misc.c head/sys/kern/kern_prot.c head/sys/sys/syscallsubr.h Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Fri Dec 13 18:35:48 2019 (r355721) +++ head/sys/compat/linux/linux_misc.c Fri Dec 13 18:39:36 2019 (r355722) @@ -1599,14 +1599,11 @@ linux_getuid(struct thread *td, struct linux_getuid_ar 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 Modified: head/sys/kern/kern_prot.c ============================================================================== --- head/sys/kern/kern_prot.c Fri Dec 13 18:35:48 2019 (r355721) +++ head/sys/kern/kern_prot.c Fri Dec 13 18:39:36 2019 (r355722) @@ -190,14 +190,21 @@ struct getsid_args { 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); Modified: head/sys/sys/syscallsubr.h ============================================================================== --- head/sys/sys/syscallsubr.h Fri Dec 13 18:35:48 2019 (r355721) +++ head/sys/sys/syscallsubr.h Fri Dec 13 18:39:36 2019 (r355722) @@ -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,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912131839.xBDIdbDr035758>