6 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
21 nfssvc_versbits(unsigned int ctlbits)
24 char buf[BUFSIZ], *ptr;
28 fd = open("/proc/fs/nfsd/versions", O_WRONLY);
32 for (n = NFSD_MINVERS; n <= NFSD_MAXVERS; n++) {
33 if (NFSCTL_VERISSET(ctlbits, n))
34 off += snprintf(ptr+off, BUFSIZ - off, "+%d ", n);
36 off += snprintf(ptr+off, BUFSIZ - off, "-%d ", n);
38 snprintf(ptr+off, BUFSIZ - off, "\n");
39 if (write(fd, buf, strlen(buf)) != strlen(buf)) {
40 syslog(LOG_ERR, "nfssvc: Setting version failed: errno %d (%s)",
41 errno, strerror(errno));
48 nfssvc(int port, int nrservs, unsigned int versbits)
50 struct nfsctl_arg arg;
53 nfssvc_versbits(versbits);
55 fd = open("/proc/fs/nfsd/threads", O_WRONLY);
57 fd = open("/proc/fs/nfs/threads", O_WRONLY);
59 /* 2.5+ kernel with nfsd filesystem mounted.
60 * Just write the number in.
61 * Cannot handle port number yet, but does anyone care?
65 snprintf(buf, 20,"%d\n", nrservs);
66 n = write(fd, buf, strlen(buf));
74 arg.ca_version = NFSCTL_VERSION;
75 arg.ca_svc.svc_nthreads = nrservs;
76 arg.ca_svc.svc_port = port;
77 return nfsctl(NFSCTL_SVC, &arg, NULL);