From owner-svn-src-head@freebsd.org Fri Dec 13 18:39:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E5F3A1D3F8F; Fri, 13 Dec 2019 18:39:37 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47ZKG15kQ6z4LM0; Fri, 13 Dec 2019 18:39:37 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BFD34185BB; Fri, 13 Dec 2019 18:39:37 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBDIdbWf035762; Fri, 13 Dec 2019 18:39:37 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBDIdbDr035758; Fri, 13 Dec 2019 18:39:37 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201912131839.xBDIdbDr035758@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Fri, 13 Dec 2019 18:39:37 +0000 (UTC) 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 X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head/sys: compat/linux kern sys X-SVN-Commit-Revision: 355722 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2019 18:39:38 -0000 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,