From owner-freebsd-bugs Tue Sep 19 13: 0:13 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 82F3037B42C for ; Tue, 19 Sep 2000 13:00:01 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id NAA51165; Tue, 19 Sep 2000 13:00:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from mail.inka.de (quechua.inka.de [212.227.14.2]) by hub.freebsd.org (Postfix) with ESMTP id 64DBC37B423 for ; Tue, 19 Sep 2000 12:58:38 -0700 (PDT) Received: from ganerc.mips.inka.de (uucp@) by mail.inka.de with local-bsmtp id 13bTXJ-0001SK-00; Tue, 19 Sep 2000 21:58:37 +0200 Received: (from naddy@localhost) by ganerc.mips.inka.de (8.11.0/8.11.0) id e8JJVg208733; Tue, 19 Sep 2000 21:31:42 +0200 (CEST) (envelope-from naddy) Message-Id: <200009191931.e8JJVg208733@ganerc.mips.inka.de> Date: Tue, 19 Sep 2000 21:31:42 +0200 (CEST) From: Christian Weisgerber Reply-To: naddy@mips.inka.de To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: kern/21402: Linuxulator: getpgid(0) fails Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 21402 >Category: kern >Synopsis: Linuxulator: getpgid(0) fails >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Sep 19 13:00:01 PDT 2000 >Closed-Date: >Last-Modified: >Originator: Christian Weisgerber >Release: FreeBSD 5.0-CURRENT i386 >Organization: >Environment: COMPAT_LINUX >Description: Under the Linux syscall compatibility layer, getpgid(0) fails with ESRCH rather than returning the process group ID of the current process. This can be fixed easily in sys/compat/linux/linux_misc.c:linux_getpgid(). However, as far as I can tell, the semantics of getpgid() are exactly the same for BSD, Linux, and POSIX. The only functional difference between our native getpgid() and linux_getpgid() I can detect is that the latter fails to handle being called with 0. Therefore I suggest that linux_getpgid() is dropped entirely and the Linux system call #132 passed on directly to getpgid(), which is both simpler and more correct. >How-To-Repeat: >Fix: --- sys/compat/linux/linux_misc.c.orig Tue Sep 19 14:10:58 2000 +++ sys/compat/linux/linux_misc.c Tue Sep 19 14:11:37 2000 @@ -524,24 +524,6 @@ return error; } -int -linux_getpgid(struct proc *p, struct linux_getpgid_args *args) -{ - struct proc *curp; - -#ifdef DEBUG - printf("Linux-emul(%ld): getpgid(%d)\n", (long)p->p_pid, args->pid); -#endif - if (args->pid != p->p_pid) { - if (!(curp = pfind(args->pid))) - return ESRCH; - } - else - curp = p; - p->p_retval[0] = curp->p_pgid; - return 0; -} - int linux_mremap(struct proc *p, struct linux_mremap_args *args) { --- sys/i386/linux/syscalls.master.orig Tue Sep 19 14:14:31 2000 +++ sys/i386/linux/syscalls.master Tue Sep 19 14:16:24 2000 @@ -196,7 +196,7 @@ 129 STD LINUX { int linux_delete_module(void); } 130 STD LINUX { int linux_get_kernel_syms(void); } 131 STD LINUX { int linux_quotactl(void); } -132 STD LINUX { int linux_getpgid(int pid); } +132 NOPROTO LINUX { int getpgid(int pid); } 133 NOPROTO LINUX { int fchdir(int fd); } 134 STD LINUX { int linux_bdflush(void); } 135 STD LINUX { int linux_sysfs(int option, u_long arg1, \ >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message