Date: Sat, 29 May 2004 00:10:09 -0700 (PDT) From: Michael Conlen <meconlen@obfuscated.net> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/67317: patch to nfsd.c to make it slightly more dynamic Message-ID: <200405290710.i4T7A9xW016896@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/67317; it has been noted by GNATS. From: Michael Conlen <meconlen@obfuscated.net> To: freebsd-gnats-submit@FreeBSD.org, meconlen@obfuscated.net Cc: Subject: Re: bin/67317: patch to nfsd.c to make it slightly more dynamic Date: Sat, 29 May 2004 03:01:13 -0400 Proper diffs. Forgot that the variables in the functions should be static, not sure how to test that properly, but I'd suspect a system might act funny when you tried to kill nfsd with the previous patch, until it segfaulted. This is the first C code I've done in six months, so look over it, though it seems to work fine on a system doing lots of volume. Cheers. 7a8,9 > * Modified by Michael Conlen May 28, 2004 > * 75a78,80 > > #include <stdarg.h> > 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 >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200405290710.i4T7A9xW016896>