fixup comments to reflect that softclock no longer gets a frame ptr
[unix-history] / usr / src / sbin / nfsiod / nfsiod.c
CommitLineData
15791df4
KM
1/*
2 * Copyright (c) 1989 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Rick Macklem at The University of Guelph.
7 *
70ab3c27 8 * %sccs.include.redist.c%
15791df4
KM
9 */
10
11#ifndef lint
12char copyright[] =
13"@(#) Copyright (c) 1989 Regents of the University of California.\n\
14 All rights reserved.\n";
15#endif not lint
16
17#ifndef lint
9a8f56c5 18static char sccsid[] = "@(#)nfsiod.c 5.5 (Berkeley) %G%";
15791df4
KM
19#endif not lint
20
21#include <stdio.h>
15791df4
KM
22#include <signal.h>
23#include <fcntl.h>
9a8f56c5
KM
24#include <sys/syslog.h>
25#include <sys/param.h>
15791df4 26#include <sys/ioctl.h>
9a8f56c5
KM
27#include <sys/wait.h>
28#include <sys/ucred.h>
29#include <nfs/nfsv2.h>
30#include <nfs/nfs.h>
15791df4
KM
31
32/* Global defs */
33#ifdef DEBUG
15791df4
KM
34int debug = 1;
35#else
36int debug = 0;
37#endif
9a8f56c5
KM
38extern int errno;
39void reapchild();
15791df4
KM
40
41/*
8fbf001c
KM
42 * Nfsiod does asynchronous buffered I/O on behalf of the NFS client.
43 * It does not have to be running for correct operation, but will improve
44 * throughput. The one optional argument is the number of children to fork.
15791df4
KM
45 */
46main(argc, argv)
47 int argc;
48 char *argv[];
49{
50 register int i;
51 int cnt;
52
9a8f56c5
KM
53 if (argc != 2 || (cnt = atoi(argv[1])) <= 0 || cnt > 20)
54 cnt = 1;
15791df4 55 if (debug == 0) {
43d42ac6 56 daemon(0, 0);
15791df4
KM
57 signal(SIGINT, SIG_IGN);
58 signal(SIGQUIT, SIG_IGN);
15791df4
KM
59 signal(SIGHUP, SIG_IGN);
60 }
9a8f56c5
KM
61 signal(SIGCHLD, reapchild);
62 openlog("nfsiod:", LOG_PID, LOG_DAEMON);
15791df4
KM
63 for (i = 1; i < cnt; i++)
64 if (fork() == 0)
65 break;
9a8f56c5
KM
66 if (nfssvc(NFSSVC_BIOD, (char *)0) < 0)
67 syslog(LOG_ERR, "nfssvc failed %m");
68}
69
70void
71reapchild()
72{
73
74 while (wait3((int *) NULL, WNOHANG, (struct rusage *) NULL))
75 ;
15791df4 76}