diff options
author | NeilBrown <neilb@suse.de> | 2012-11-28 14:35:25 -0500 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2012-11-28 14:48:02 -0500 |
commit | 7c5cb5e732a4b8704f8c79ec819c5d271e040339 (patch) | |
tree | 19159a7318eae6f510d92b2cdf090a8f7ec8e071 | |
parent | 19024076a7497a2423ff06d36496385f27395332 (diff) | |
download | nfs-utils-7c5cb5e732a4b8704f8c79ec819c5d271e040339.tar.gz nfs-utils-7c5cb5e732a4b8704f8c79ec819c5d271e040339.tar.xz nfs-utils-7c5cb5e732a4b8704f8c79ec819c5d271e040339.zip |
gssd: base the size of the fd array on the RLIMIT_NOFILE limit.
We have previously raised the size of the 'pollarray' once (32 -> 256)
and I have had another request to make it bigger.
Rather than changing the hard-coded value, make it depend on
RLIMIT_NOFILE. This is an upper limit on the size of the array
that can be passed to poll() anyway.
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r-- | utils/gssd/gssd_proc.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/utils/gssd/gssd_proc.c b/utils/gssd/gssd_proc.c index 6f9840e..d01ba2f 100644 --- a/utils/gssd/gssd_proc.c +++ b/utils/gssd/gssd_proc.c @@ -52,6 +52,7 @@ #include <sys/socket.h> #include <arpa/inet.h> #include <sys/fsuid.h> +#include <sys/resource.h> #include <stdio.h> #include <stdlib.h> @@ -472,9 +473,13 @@ fail_keep_client: void init_client_list(void) { + struct rlimit rlim; TAILQ_INIT(&clnt_list); /* Eventually plan to grow/shrink poll array: */ pollsize = FD_ALLOC_BLOCK; + if (getrlimit(RLIMIT_NOFILE, &rlim) < 0 && + rlim.rlim_cur != RLIM_INFINITY) + pollsize = rlim.rlim_cur; pollarray = calloc(pollsize, sizeof(struct pollfd)); } |