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>
25 static void usage(const char *);
28 main(int argc, char **argv)
30 int count = 1, c, error, port, fd;
33 ent = getservbyname ("nfs", "udp");
35 port = ntohs (ent->s_port);
39 while ((c = getopt(argc, argv, "hp:P:")) != EOF) {
41 case 'P': /* XXX for nfs-server compatibility */
44 if (port <= 0 || port > 65535) {
45 fprintf(stderr, "%s: bad port number: %s\n",
57 if (chdir(NFS_STATEDIR)) {
58 fprintf(stderr, "%s: chdir(%s) failed: %s\n",
59 argv [0], NFS_STATEDIR, strerror(errno));
64 if ((count = atoi(argv[optind])) < 0) {
65 /* insane # of servers */
67 "%s: invalid server count (%d), using 1\n",
74 Some kernels let nfsd kernel threads inherit open files
75 from the program that spawns them (i.e. us). So close
76 everything before spawning kernel threads. --Chip */
77 fd = open("/dev/null", O_RDWR);
87 if ((error = nfssvc(port, count)) < 0) {
89 openlog("nfsd", LOG_PID, LOG_DAEMON);
90 syslog(LOG_ERR, "nfssvc: %s", strerror(e));
98 usage(const char *prog)
100 fprintf(stderr, "usage:\n"
101 "%s nrservs\n", prog);