4 * This is the user level part of nfsd. This is very primitive, because
5 * all the work is now done in the kernel module.
7 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
22 static void usage(const char *);
25 main(int argc, char **argv)
27 int count = 1, c, error, port, fd;
31 /* FIXME: Check for nfs in /etc/services */
33 while ((c = getopt(argc, argv, "hp:P:")) != EOF) {
35 case 'P': /* XXX for nfs-server compatibility */
38 if (port <= 0 || port > 65535) {
39 fprintf(stderr, "%s: bad port number: %s\n",
51 if (chdir(NFS_STATEDIR)) {
52 fprintf(stderr, "%s: chdir(%s) failed: %s\n",
53 argv [0], NFS_STATEDIR, strerror(errno));
58 if ((count = atoi(argv[optind])) < 0) {
59 /* insane # of servers */
61 "%s: invalid server count (%d), using 1\n",
68 Some kernels let nfsd kernel threads inherit open files
69 from the program that spawns them (i.e. us). So close
70 everything before spawning kernel threads. --Chip */
71 fd = open("/dev/null", O_RDWR);
79 fd = sysconf(_SC_OPEN_MAX);
83 if ((error = nfssvc(port, count)) < 0) {
85 openlog("nfsd", LOG_PID, LOG_DAEMON);
86 syslog(LOG_ERR, "nfssvc: %s", strerror(e));
94 usage(const char *prog)
96 fprintf(stderr, "usage:\n"
97 "%s nrservs\n", prog);