From: Wouter Wijngaards Date: Mon, 5 Jul 2010 14:20:24 +0000 (+0000) Subject: * Check for setrlimit separate from getrlimit. X-Git-Tag: release-1.4.6rc1~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e246782048c66896f5b7674ccc3b820e8c74e95;p=thirdparty%2Funbound.git * Check for setrlimit separate from getrlimit. * include sys/time.h for struct timeval definition * cast for printf, on Minix. git-svn-id: file:///svn/unbound/trunk@2177 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/configure.ac b/configure.ac index 95d0231ba..8d504070b 100644 --- a/configure.ac +++ b/configure.ac @@ -608,7 +608,7 @@ if test $ac_cv_func_daemon = yes; then fi AC_SEARCH_LIBS([setusercontext], [util]) -AC_CHECK_FUNCS([tzset sigprocmask fcntl getpwnam getrlimit setsid sbrk chroot kill sleep usleep random srandom recvmsg sendmsg writev glob initgroups strftime localtime_r setusercontext _beginthreadex]) +AC_CHECK_FUNCS([tzset sigprocmask fcntl getpwnam getrlimit setrlimit setsid sbrk chroot kill sleep usleep random srandom recvmsg sendmsg writev glob initgroups strftime localtime_r setusercontext _beginthreadex]) AC_CHECK_FUNCS([setresuid],,[AC_CHECK_FUNCS([setreuid])]) AC_CHECK_FUNCS([setresgid],,[AC_CHECK_FUNCS([setregid])]) diff --git a/daemon/unbound.c b/daemon/unbound.c index 251057ef5..1e51c4d49 100644 --- a/daemon/unbound.c +++ b/daemon/unbound.c @@ -44,6 +44,7 @@ #ifdef HAVE_GETOPT_H #include #endif +#include #include "util/log.h" #include "daemon/daemon.h" #include "daemon/remote.h" @@ -213,8 +214,12 @@ checkrlimits(struct config_file* cfg) avail = (size_t)rlim.rlim_cur; rlim.rlim_cur = (rlim_t)(total + 10); rlim.rlim_max = (rlim_t)(total + 10); +#ifdef HAVE_SETRLIMIT if(setrlimit(RLIMIT_NOFILE, &rlim) < 0) { log_warn("setrlimit: %s", strerror(errno)); +#else + if(0) { +#endif log_warn("cannot increase max open fds from %u to %u", (unsigned)avail, (unsigned)total+10); /* check that calculation below does not underflow, diff --git a/util/storage/slabhash.c b/util/storage/slabhash.c index ac8358a76..9c0c50711 100644 --- a/util/storage/slabhash.c +++ b/util/storage/slabhash.c @@ -135,7 +135,7 @@ void slabhash_status(struct slabhash* sl, const char* id, int extended) size_t i; char num[17]; log_info("Slabhash %s: %u tables mask=%x shift=%d", - id, (unsigned)sl->size, sl->mask, sl->shift); + id, (unsigned)sl->size, (unsigned)sl->mask, sl->shift); for(i=0; isize; i++) { snprintf(num, sizeof(num), "table %u", (unsigned)i); lruhash_status(sl->array[i], num, extended);