From owner-svn-src-stable-10@freebsd.org Sat Jan 9 15:28:07 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2DE64A68CCA; Sat, 9 Jan 2016 15:28:07 +0000 (UTC) (envelope-from dchagin@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 mx1.freebsd.org (Postfix) with ESMTPS id E57361CA9; Sat, 9 Jan 2016 15:28:06 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u09FS6W5018517; Sat, 9 Jan 2016 15:28:06 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u09FS5FI018510; Sat, 9 Jan 2016 15:28:05 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201601091528.u09FS5FI018510@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 9 Jan 2016 15:28:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r293503 - in stable/10/sys: amd64/linux32 compat/linux i386/linux X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2016 15:28:07 -0000 Author: dchagin Date: Sat Jan 9 15:28:05 2016 New Revision: 293503 URL: https://svnweb.freebsd.org/changeset/base/293503 Log: MFC r283394: Implement waitid() system call. Modified: stable/10/sys/amd64/linux32/linux32_dummy.c stable/10/sys/amd64/linux32/syscalls.master stable/10/sys/compat/linux/linux_misc.c stable/10/sys/compat/linux/linux_misc.h stable/10/sys/i386/linux/linux_dummy.c stable/10/sys/i386/linux/syscalls.master Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/linux32/linux32_dummy.c ============================================================================== --- stable/10/sys/amd64/linux32/linux32_dummy.c Sat Jan 9 15:26:20 2016 (r293502) +++ stable/10/sys/amd64/linux32/linux32_dummy.c Sat Jan 9 15:28:05 2016 (r293503) @@ -85,7 +85,6 @@ DUMMY(mq_timedreceive); DUMMY(mq_notify); DUMMY(mq_getsetattr); DUMMY(kexec_load); -DUMMY(waitid); /* linux 2.6.11: */ DUMMY(add_key); DUMMY(request_key); Modified: stable/10/sys/amd64/linux32/syscalls.master ============================================================================== --- stable/10/sys/amd64/linux32/syscalls.master Sat Jan 9 15:26:20 2016 (r293502) +++ stable/10/sys/amd64/linux32/syscalls.master Sat Jan 9 15:28:05 2016 (r293503) @@ -466,7 +466,9 @@ 281 AUE_NULL STD { int linux_mq_notify(void); } 282 AUE_NULL STD { int linux_mq_getsetattr(void); } 283 AUE_NULL STD { int linux_kexec_load(void); } -284 AUE_NULL STD { int linux_waitid(void); } +284 AUE_WAIT6 STD { int linux_waitid(int idtype, l_pid_t id, \ + l_siginfo_t *info, int options, \ + struct l_rusage *rusage); } 285 AUE_NULL UNIMPL ; linux 2.6.11: 286 AUE_NULL STD { int linux_add_key(void); } Modified: stable/10/sys/compat/linux/linux_misc.c ============================================================================== --- stable/10/sys/compat/linux/linux_misc.c Sat Jan 9 15:26:20 2016 (r293502) +++ stable/10/sys/compat/linux/linux_misc.c Sat Jan 9 15:28:05 2016 (r293503) @@ -916,6 +916,68 @@ linux_wait4(struct thread *td, struct li } int +linux_waitid(struct thread *td, struct linux_waitid_args *args) +{ + int status, options, sig; + struct __wrusage wru; + siginfo_t siginfo; + l_siginfo_t lsi; + idtype_t idtype; + struct proc *p; + int error; + + options = 0; + linux_to_bsd_waitopts(args->options, &options); + + if (options & ~(WNOHANG | WNOWAIT | WEXITED | WUNTRACED | WCONTINUED)) + return (EINVAL); + if (!(options & (WEXITED | WUNTRACED | WCONTINUED))) + return (EINVAL); + + switch (args->idtype) { + case LINUX_P_ALL: + idtype = P_ALL; + break; + case LINUX_P_PID: + if (args->id <= 0) + return (EINVAL); + idtype = P_PID; + break; + case LINUX_P_PGID: + if (args->id <= 0) + return (EINVAL); + idtype = P_PGID; + break; + default: + return (EINVAL); + } + + error = kern_wait6(td, idtype, args->id, &status, options, + &wru, &siginfo); + if (error != 0) + return (error); + if (args->rusage != NULL) { + error = linux_copyout_rusage(&wru.wru_children, + args->rusage); + if (error != 0) + return (error); + } + if (args->info != NULL) { + p = td->td_proc; + if (td->td_retval[0] == 0) + bzero(&lsi, sizeof(lsi)); + else { + sig = BSD_TO_LINUX_SIGNAL(siginfo.si_signo); + siginfo_to_lsiginfo(&siginfo, &lsi, sig); + } + error = copyout(&lsi, args->info, sizeof(lsi)); + } + td->td_retval[0] = 0; + + return (error); +} + +int linux_mknod(struct thread *td, struct linux_mknod_args *args) { char *path; Modified: stable/10/sys/compat/linux/linux_misc.h ============================================================================== --- stable/10/sys/compat/linux/linux_misc.h Sat Jan 9 15:26:20 2016 (r293502) +++ stable/10/sys/compat/linux/linux_misc.h Sat Jan 9 15:28:05 2016 (r293503) @@ -123,6 +123,12 @@ extern int stclohz; #define __WALL 0x40000000 #define __WCLONE 0x80000000 +/* Linux waitid idtype */ +#define LINUX_P_ALL 0 +#define LINUX_P_PID 1 +#define LINUX_P_PGID 2 + + int linux_common_wait(struct thread *td, int pid, int *status, int options, struct rusage *ru); void linux_to_bsd_waitopts(int options, int *bsdopts); Modified: stable/10/sys/i386/linux/linux_dummy.c ============================================================================== --- stable/10/sys/i386/linux/linux_dummy.c Sat Jan 9 15:26:20 2016 (r293502) +++ stable/10/sys/i386/linux/linux_dummy.c Sat Jan 9 15:28:05 2016 (r293503) @@ -81,7 +81,6 @@ DUMMY(mbind); DUMMY(get_mempolicy); DUMMY(set_mempolicy); DUMMY(kexec_load); -DUMMY(waitid); /* linux 2.6.11: */ DUMMY(add_key); DUMMY(request_key); Modified: stable/10/sys/i386/linux/syscalls.master ============================================================================== --- stable/10/sys/i386/linux/syscalls.master Sat Jan 9 15:26:20 2016 (r293502) +++ stable/10/sys/i386/linux/syscalls.master Sat Jan 9 15:28:05 2016 (r293503) @@ -474,7 +474,9 @@ 282 AUE_NULL STD { int linux_mq_getsetattr(l_mqd_t mqd, const struct mq_attr *attr, \ struct mq_attr *oattr); } 283 AUE_NULL STD { int linux_kexec_load(void); } -284 AUE_NULL STD { int linux_waitid(void); } +284 AUE_WAIT6 STD { int linux_waitid(int idtype, l_pid_t id, \ + l_siginfo_t *info, int options, \ + void *rusage); } 285 AUE_NULL UNIMPL ; linux 2.6.11: 286 AUE_NULL STD { int linux_add_key(void); }