From owner-freebsd-bugs@FreeBSD.ORG Fri May 28 19:01:04 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7ABE216A4CE for ; Fri, 28 May 2004 19:01:04 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6081143D31 for ; Fri, 28 May 2004 19:01:04 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i4T20hFf039512 for ; Fri, 28 May 2004 19:00:43 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i4T20hn5039511; Fri, 28 May 2004 19:00:43 -0700 (PDT) (envelope-from gnats) Resent-Date: Fri, 28 May 2004 19:00:43 -0700 (PDT) Resent-Message-Id: <200405290200.i4T20hn5039511@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Michael Conlen Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AAFEF16A4CE for ; Fri, 28 May 2004 18:55:29 -0700 (PDT) Received: from illicit12.candidhosting.com (illicit10.candidhosting.com [65.59.189.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3ABF143D2F for ; Fri, 28 May 2004 18:55:29 -0700 (PDT) (envelope-from root@illicit12.candidhosting.com) Received: from illicit12.candidhosting.com (localhost [127.0.0.1]) i4T1t2r6007537 for ; Fri, 28 May 2004 21:55:02 -0400 (EDT) (envelope-from root@illicit12.candidhosting.com) Received: (from root@localhost)i4T1t1Nd007536; Fri, 28 May 2004 21:55:02 -0400 (EDT) (envelope-from root) Message-Id: <200405290155.i4T1t1Nd007536@illicit12.candidhosting.com> Date: Fri, 28 May 2004 21:55:02 -0400 (EDT) From: Michael Conlen To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/67317: patch to nfsd.c to make it slightly more dynamic X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Michael Conlen List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 May 2004 02:01:04 -0000 >Number: 67317 >Category: bin >Synopsis: patch to nfsd.c to make it slightly more dynamic >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Fri May 28 19:00:43 PDT 2004 >Closed-Date: >Last-Modified: >Originator: Michael Conlen >Release: FreeBSD 5.2.1-RELEASE-p8 i386 >Organization: Obfuscated Networking >Environment: System: FreeBSD host 5.2.1-RELEASE-p8 FreeBSD 5.2.1-RELEASE-p8 #0: Thu May 27 04:36:03 EDT 2004 meconlen@obfuscated.net:/usr/obj/usr/src/sys/NFS i386 >Description: nfsd.c defines a static number of max proceses and creates an array at that size at compile time so that signal handlers can access it easily. Problme is, if you need more procs you need to edit the source and rebuild. I hacked it up so that the variables are not global and the array is not static so you can create as many processes as you want. >How-To-Repeat: to repeat: nfsd -n 21 >Fix: Apply the following patch rebuild and voila nfsd -n * Modified by Michael Conlen May 28, 2004 > * 75a78,80 > > #include > 84d88 < #define MAXNFSDCNT 20 86,87d89 < pid_t children[MAXNFSDCNT]; /* PIDs of children */ < int nfsdcnt; /* number of children */ 91c93 < void killchildren(void); --- > void killchildren(int, ...); 94c96 < void reapchild(int); --- > void reapchild(int, ...); 139a142,143 > pid_t *children; > int nfsdcnt; 159,163d162 < if (nfsdcnt < 1 || nfsdcnt > MAXNFSDCNT) { < warnx("nfsd count %d; reset to %d", nfsdcnt, < DEFNFSDCNT); < nfsdcnt = DEFNFSDCNT; < } 203,207d201 < if (nfsdcnt < 1 || nfsdcnt > MAXNFSDCNT) { < warnx("nfsd count %d; reset to %d", nfsdcnt, < DEFNFSDCNT); < nfsdcnt = DEFNFSDCNT; < } 335a330,339 > > /* allocate children */ > children = calloc(nfsdcnt, sizeof(pid_t)); > if(children == NULL ) { > syslog(LOG_ERR, "malloc: %m"); > nfsd_exit(1); > } > reapchild(0, children, nfsdcnt); > killchildren(0, children, nfsdcnt); > 770,771c774 < reapchild(signo) < int signo; --- > reapchild(int signo, ...) 775a779,791 > va_list argp; > pid_t *children; > int nfsdcnt; > > if(signo == 0) { > va_start(argp, signo); > children = va_arg(argp, pid_t *); > nfsdcnt = va_arg(argp, int); > va_end(argp); > return; > } > > 791,792c807,809 < void < killchildren() --- > /* we need something before the ..., better hack than globals */ > > void killchildren(int signo, ...) 795a813,826 > > va_list argp; > pid_t *children; > int nfsdcnt; > > if(signo == 0) { > va_start(argp, signo); > children = va_arg(argp, pid_t *); > nfsdcnt = va_arg(argp, int); > va_end(argp); > return; > } > > 823c854 < killchildren(); --- > killchildren(0); 842a874 > >Release-Note: >Audit-Trail: >Unformatted: