X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=support%2Fnfs%2Fnfssvc.c;h=38240a020f190ffbe12c5591752929e1c6baed30;hp=7419baf079c00e5b09bb91c556733d3346a35a15;hb=0523fd513c6baa8dbf45d1a7afea2044262aeb3d;hpb=8b7ad01b14df1e7529b9ba8a1ea17df0d6004ef9 diff --git a/support/nfs/nfssvc.c b/support/nfs/nfssvc.c index 7419baf..38240a0 100644 --- a/support/nfs/nfssvc.c +++ b/support/nfs/nfssvc.c @@ -6,7 +6,12 @@ * Copyright (C) 1995, 1996 Olaf Kirch */ -#include "config.h" +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include #include "nfslib.h" @@ -14,6 +19,26 @@ int nfssvc(int port, int nrservs) { struct nfsctl_arg arg; + int fd; + + fd = open("/proc/fs/nfsd/threads", O_WRONLY); + if (fd < 0) + fd = open("/proc/fs/nfs/threads", O_WRONLY); + if (fd >= 0) { + /* 2.5+ kernel with nfsd filesystem mounted. + * Just write the number in. + * Cannot handle port number yet, but does anyone care? + */ + char buf[20]; + int n; + snprintf(buf, 20,"%d\n", nrservs); + n = write(fd, buf, strlen(buf)); + close(fd); + if (n != strlen(buf)) + return -1; + else + return 0; + } arg.ca_version = NFSCTL_VERSION; arg.ca_svc.svc_nthreads = nrservs;