diff options
author | neilbrown <neilbrown> | 2003-07-03 01:57:11 +0000 |
---|---|---|
committer | neilbrown <neilbrown> | 2003-07-03 01:57:11 +0000 |
commit | 1c4fdb00a0cb5208294d745e7491ce58b153606b (patch) | |
tree | 05f2c69f32cab2094534b6d4b05015cb9026c470 | |
parent | f68785e72129ab643d6c793bd5a11bdf0010eff9 (diff) | |
download | nfs-utils-1c4fdb00a0cb5208294d745e7491ce58b153606b.tar.gz nfs-utils-1c4fdb00a0cb5208294d745e7491ce58b153606b.tar.xz nfs-utils-1c4fdb00a0cb5208294d745e7491ce58b153606b.zip |
rpc.nfsd to write to /proc/fs/nfs/threads if available
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | support/nfs/nfssvc.c | 21 |
2 files changed, 27 insertions, 0 deletions
@@ -1,4 +1,10 @@ 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> * utils/exportfs/exportfs.c(unexportfs): improve host comparison diff --git a/support/nfs/nfssvc.c b/support/nfs/nfssvc.c index 7419baf..dae16f7 100644 --- a/support/nfs/nfssvc.c +++ b/support/nfs/nfssvc.c @@ -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; |