define struct selinfo; function prototypes for selrecord and selwakeup
[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
43d42ac6 18static char sccsid[] = "@(#)nfsiod.c 5.4 (Berkeley) %G%";
15791df4
KM
19#endif not lint
20
21#include <stdio.h>
15791df4
KM
22#include <signal.h>
23#include <fcntl.h>
24#include <sys/types.h>
25#include <sys/ioctl.h>
26
27/* Global defs */
28#ifdef DEBUG
15791df4
KM
29int debug = 1;
30#else
31int debug = 0;
32#endif
33
34/*
8fbf001c
KM
35 * Nfsiod does asynchronous buffered I/O on behalf of the NFS client.
36 * It does not have to be running for correct operation, but will improve
37 * throughput. The one optional argument is the number of children to fork.
15791df4
KM
38 */
39main(argc, argv)
40 int argc;
41 char *argv[];
42{
43 register int i;
44 int cnt;
45
46 if (debug == 0) {
43d42ac6 47 daemon(0, 0);
15791df4
KM
48 signal(SIGINT, SIG_IGN);
49 signal(SIGQUIT, SIG_IGN);
50 signal(SIGTERM, SIG_IGN);
51 signal(SIGHUP, SIG_IGN);
52 }
15791df4
KM
53 if (argc != 2 || (cnt = atoi(argv[1])) <= 0 || cnt > 20)
54 cnt = 1;
55 for (i = 1; i < cnt; i++)
56 if (fork() == 0)
57 break;
8fbf001c
KM
58 async_daemon(); /* Never returns */
59 exit(1);
15791df4 60}