]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
rpc.nfsd to write to /proc/fs/nfs/threads if available nfs-utils-1-1-0-pre9
authorneilbrown <neilbrown>
Thu, 3 Jul 2003 01:57:11 +0000 (01:57 +0000)
committerneilbrown <neilbrown>
Thu, 3 Jul 2003 01:57:11 +0000 (01:57 +0000)
ChangeLog
support/nfs/nfssvc.c

index 3b936367dca2a980207d106ac271b0f66ccbdcc6..5ea42f9b4f3a5de34b5a2ca0f8cf2f26dc6486b0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-07-03 NeilBrown <neilb@cse.unsw.edu.au>
+
+       * support/nfs/nfssvc.c(nfssvc): If /proc/fs/nfs/threads exists,
+       set number of threads by writing to there.  This means it will
+       still work when the syscall interface goes away in 2.7.
+
 2003-07-03 NeilBrown <neilb@cse.unsw.edu.au>
        fumihiko kakuma <kakmy@mvh.biglobe.ne.jp>
 
index 7419baf079c00e5b09bb91c556733d3346a35a15..dae16f7f7adc59a540b565e210e8861f71cacd37 100644 (file)
@@ -8,12 +8,33 @@
 
 #include "config.h"
 
+#include <unistd.h>
+#include <fcntl.h>
+
 #include "nfslib.h"
 
 int
 nfssvc(int port, int nrservs)
 {
        struct nfsctl_arg       arg;
+       int fd;
+
+       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;