|
|
1.1 root 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: *
8: * Redistribution and use in source and binary forms are permitted provided
9: * that: (1) source distributions retain this entire copyright notice and
10: * comment, and (2) distributions including binaries display the following
11: * acknowledgement: ``This product includes software developed by the
12: * University of California, Berkeley and its contributors'' in the
13: * documentation or other materials provided with the distribution and in
14: * all advertising materials mentioning features or use of this software.
15: * Neither the name of the University nor the names of its contributors may
16: * be used to endorse or promote products derived from this software without
17: * specific prior written permission.
18: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
19: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
20: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21: */
22:
23: #ifndef lint
24: char copyright[] =
25: "@(#) Copyright (c) 1989 Regents of the University of California.\n\
26: All rights reserved.\n";
27: #endif not lint
28:
29: #ifndef lint
30: static char sccsid[] = "@(#)nfsiod.c 5.4 (Berkeley) 6/29/90";
31: #endif not lint
32:
33: #include <stdio.h>
34: #include <signal.h>
35: #include <fcntl.h>
36: #include <sys/types.h>
37: #include <sys/ioctl.h>
38:
39: /* Global defs */
40: #ifdef DEBUG
41: int debug = 1;
42: #else
43: int debug = 0;
44: #endif
45:
46: /*
47: * Nfsiod does asynchronous buffered I/O on behalf of the NFS client.
48: * It does not have to be running for correct operation, but will improve
49: * throughput. The one optional argument is the number of children to fork.
50: */
51: main(argc, argv)
52: int argc;
53: char *argv[];
54: {
55: register int i;
56: int cnt;
57:
58: if (debug == 0) {
59: daemon(0, 0);
60: signal(SIGINT, SIG_IGN);
61: signal(SIGQUIT, SIG_IGN);
62: signal(SIGTERM, SIG_IGN);
63: signal(SIGHUP, SIG_IGN);
64: }
65: if (argc != 2 || (cnt = atoi(argv[1])) <= 0 || cnt > 20)
66: cnt = 1;
67: for (i = 1; i < cnt; i++)
68: if (fork() == 0)
69: break;
70: async_daemon(); /* Never returns */
71: exit(1);
72: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.