1275970Scydnl ###################################################################### 2275970Scydnl rlimit capabilities checks 3275970ScyAC_DEFUN([NTP_RLIMIT_ITEMS], [ 4275970Scy 5275970ScyAC_CACHE_CHECK( 6275970Scy [for RLIMIT_MEMLOCK], 7275970Scy [ntp_cv_rlimit_memlock], 8275970Scy [AC_COMPILE_IFELSE( 9275970Scy [AC_LANG_PROGRAM( 10275970Scy [[ 11275970Scy #ifdef HAVE_SYS_TYPES_H 12275970Scy # include <sys/types.h> 13275970Scy #endif 14275970Scy #ifdef HAVE_SYS_TIME_H 15275970Scy # include <sys/time.h> 16275970Scy #endif 17275970Scy #ifdef HAVE_SYS_RESOURCE_H 18275970Scy # include <sys/resource.h> 19275970Scy #endif 20275970Scy ]], 21275970Scy [[ 22275970Scy getrlimit(RLIMIT_MEMLOCK, 0); 23275970Scy ]] 24275970Scy )], 25275970Scy [ntp_cv_rlimit_memlock=yes], 26275970Scy [ntp_cv_rlimit_memlock=no] 27275970Scy )] 28275970Scy) 29289764Sglebiuscase "$host" in 30289764Sglebius *-*-*linux*) 31289764Sglebius ntp_dflt_rlimit_memlock="-1" ;; 32289764Sglebius *) ntp_dflt_rlimit_memlock="32" ;; 33289764Sglebiusesac 34275970Scycase "$ntp_cv_rlimit_memlock" in 35275970Scy yes) 36275970Scy AC_SUBST([HAVE_RLIMIT_MEMLOCK]) 37289764Sglebius HAVE_RLIMIT_MEMLOCK=" memlock $ntp_dflt_rlimit_memlock" ;; 38275970Scyesac 39275970Scy 40275970ScyAC_CACHE_CHECK( 41275970Scy [for RLIMIT_STACK], 42275970Scy [ntp_cv_rlimit_stack], 43275970Scy [AC_COMPILE_IFELSE( 44275970Scy [AC_LANG_PROGRAM( 45275970Scy [[ 46275970Scy #ifdef HAVE_SYS_TYPES_H 47275970Scy # include <sys/types.h> 48275970Scy #endif 49275970Scy #ifdef HAVE_SYS_TIME_H 50275970Scy # include <sys/time.h> 51275970Scy #endif 52275970Scy #ifdef HAVE_SYS_RESOURCE_H 53275970Scy # include <sys/resource.h> 54275970Scy #endif 55275970Scy ]], 56275970Scy [[ 57275970Scy getrlimit(RLIMIT_STACK, 0); 58275970Scy ]] 59275970Scy )], 60275970Scy [ntp_cv_rlimit_stack=yes], 61275970Scy [ntp_cv_rlimit_stack=no] 62275970Scy )] 63275970Scy) 64275970Scycase "$ntp_cv_rlimit_stack" in 65275970Scy yes) 66275970Scy AC_SUBST([HAVE_RLIMIT_STACK]) 67275970Scy HAVE_RLIMIT_STACK=" stacksize 50" 68275970Scyesac 69275970Scy 70289764Sglebius# HMS: Only if we are doing the MLOCKALL stuff... 71289764SglebiusAC_MSG_CHECKING([for the default number of 4k stack pages]) 72289764SglebiusAC_ARG_WITH( 73289764Sglebius [stack-limit], 74289764Sglebius [AS_HELP_STRING( 75289764Sglebius [--with-stack-limit], 76289764Sglebius [? =50 (200 for openbsd) 4k pages] 77289764Sglebius )], 78289764Sglebius [ans=$withval], 79289764Sglebius [ans=yes] 80289764Sglebius) 81289764Sglebiuscase "$ans" in 82289764Sglebius yes | no) 83289764Sglebius case "$host" in 84289764Sglebius *-*-openbsd*) 85289764Sglebius ans=200 86289764Sglebius ;; 87289764Sglebius *) ans=50 88289764Sglebius ;; 89289764Sglebius esac 90289764Sglebius ;; 91289764Sglebius [[1-9]][[0-9]]*) 92289764Sglebius ;; 93289764Sglebius *) AC_MSG_ERROR(["--with-stack-limit requires an integer argument."]) 94289764Sglebius ;; 95289764Sglebiusesac 96289764SglebiusAC_MSG_RESULT([$ans]) 97289764SglebiusAC_DEFINE_UNQUOTED([DFLT_RLIMIT_STACK], [$ans], 98289764Sglebius [Default number of 4k pages for RLIMIT_STACK]) 99289764Sglebius 100289764Sglebius# HMS: only if we have RLIMIT_MEMLOCK 101289764SglebiusAC_MSG_CHECKING([for the default number of megabytes to MEMLOCK]) 102289764SglebiusAC_ARG_WITH( 103289764Sglebius [memlock], 104289764Sglebius [AS_HELP_STRING( 105289764Sglebius [--with-memlock], 106289764Sglebius [? =32 (-1 on linux) megabytes] 107289764Sglebius )], 108289764Sglebius [ans=$withval], 109289764Sglebius [ans=yes] 110289764Sglebius) 111289764Sglebiuscase "$ans" in 112289764Sglebius yes | no) 113289764Sglebius ans=$ntp_dflt_rlimit_memlock 114289764Sglebius ;; 115289764Sglebius [[1-9]][[0-9]]*) ;; 116289764Sglebius *) AC_MSG_ERROR(["--with-memlock requires an integer argument."]) 117289764Sglebius ;; 118289764Sglebiusesac 119289764SglebiusAC_MSG_RESULT([$ans]) 120289764SglebiusAC_DEFINE_UNQUOTED([DFLT_RLIMIT_MEMLOCK], [$ans], 121289764Sglebius [Default number of megabytes for RLIMIT_MEMLOCK]) 122289764Sglebius 123275970Scy])dnl 124289764Sglebius 125275970Scydnl ====================================================================== 126