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>
23 static void usage(const char *);
26 main(int argc, char **argv)
28 int count = 1, c, error, port, fd;
31 ent = getservbyname ("nfs", "udp");
33 port = ntohs (ent->s_port);
37 while ((c = getopt(argc, argv, "hp:P:")) != EOF) {
39 case 'P': /* XXX for nfs-server compatibility */
42 if (port <= 0 || port > 65535) {
43 fprintf(stderr, "%s: bad port number: %s\n",
55 if (chdir(NFS_STATEDIR)) {
56 fprintf(stderr, "%s: chdir(%s) failed: %s\n",
57 argv [0], NFS_STATEDIR, strerror(errno));
62 if ((count = atoi(argv[optind])) < 0) {
63 /* insane # of servers */
65 "%s: invalid server count (%d), using 1\n",
72 Some kernels let nfsd kernel threads inherit open files
73 from the program that spawns them (i.e. us). So close
74 everything before spawning kernel threads. --Chip */
75 fd = open("/dev/null", O_RDWR);
83 fd = sysconf(_SC_OPEN_MAX);
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);