18585484eSchristosdnl ###################################################################### 28585484eSchristosdnl rlimit capabilities checks 38585484eSchristosAC_DEFUN([NTP_RLIMIT_ITEMS], [ 48585484eSchristos 58585484eSchristosAC_CACHE_CHECK( 68585484eSchristos [for RLIMIT_MEMLOCK], 78585484eSchristos [ntp_cv_rlimit_memlock], 88585484eSchristos [AC_COMPILE_IFELSE( 98585484eSchristos [AC_LANG_PROGRAM( 108585484eSchristos [[ 118585484eSchristos #ifdef HAVE_SYS_TYPES_H 128585484eSchristos # include <sys/types.h> 138585484eSchristos #endif 148585484eSchristos #ifdef HAVE_SYS_TIME_H 158585484eSchristos # include <sys/time.h> 168585484eSchristos #endif 178585484eSchristos #ifdef HAVE_SYS_RESOURCE_H 188585484eSchristos # include <sys/resource.h> 198585484eSchristos #endif 208585484eSchristos ]], 218585484eSchristos [[ 228585484eSchristos getrlimit(RLIMIT_MEMLOCK, 0); 238585484eSchristos ]] 248585484eSchristos )], 258585484eSchristos [ntp_cv_rlimit_memlock=yes], 268585484eSchristos [ntp_cv_rlimit_memlock=no] 278585484eSchristos )] 288585484eSchristos) 29*a6f3f22fSchristoscase "$host" in 30*a6f3f22fSchristos *-*-*linux*) 31*a6f3f22fSchristos ntp_dflt_rlimit_memlock="-1" ;; 32*a6f3f22fSchristos *) ntp_dflt_rlimit_memlock="32" ;; 33*a6f3f22fSchristosesac 348585484eSchristoscase "$ntp_cv_rlimit_memlock" in 358585484eSchristos yes) 368585484eSchristos AC_SUBST([HAVE_RLIMIT_MEMLOCK]) 37*a6f3f22fSchristos HAVE_RLIMIT_MEMLOCK=" memlock $ntp_dflt_rlimit_memlock" ;; 388585484eSchristosesac 398585484eSchristos 408585484eSchristosAC_CACHE_CHECK( 418585484eSchristos [for RLIMIT_STACK], 428585484eSchristos [ntp_cv_rlimit_stack], 438585484eSchristos [AC_COMPILE_IFELSE( 448585484eSchristos [AC_LANG_PROGRAM( 458585484eSchristos [[ 468585484eSchristos #ifdef HAVE_SYS_TYPES_H 478585484eSchristos # include <sys/types.h> 488585484eSchristos #endif 498585484eSchristos #ifdef HAVE_SYS_TIME_H 508585484eSchristos # include <sys/time.h> 518585484eSchristos #endif 528585484eSchristos #ifdef HAVE_SYS_RESOURCE_H 538585484eSchristos # include <sys/resource.h> 548585484eSchristos #endif 558585484eSchristos ]], 568585484eSchristos [[ 578585484eSchristos getrlimit(RLIMIT_STACK, 0); 588585484eSchristos ]] 598585484eSchristos )], 608585484eSchristos [ntp_cv_rlimit_stack=yes], 618585484eSchristos [ntp_cv_rlimit_stack=no] 628585484eSchristos )] 638585484eSchristos) 648585484eSchristoscase "$ntp_cv_rlimit_stack" in 658585484eSchristos yes) 668585484eSchristos AC_SUBST([HAVE_RLIMIT_STACK]) 678585484eSchristos HAVE_RLIMIT_STACK=" stacksize 50" 688585484eSchristosesac 698585484eSchristos 70*a6f3f22fSchristos# HMS: Only if we are doing the MLOCKALL stuff... 71*a6f3f22fSchristosAC_MSG_CHECKING([for the default number of 4k stack pages]) 72*a6f3f22fSchristosAC_ARG_WITH( 73*a6f3f22fSchristos [stack-limit], 74*a6f3f22fSchristos [AS_HELP_STRING( 75*a6f3f22fSchristos [--with-stack-limit], 76*a6f3f22fSchristos [? =50 (200 for openbsd) 4k pages] 77*a6f3f22fSchristos )], 78*a6f3f22fSchristos [ans=$withval], 79*a6f3f22fSchristos [ans=yes] 80*a6f3f22fSchristos) 81*a6f3f22fSchristoscase "$ans" in 82*a6f3f22fSchristos yes | no) 83*a6f3f22fSchristos case "$host" in 84*a6f3f22fSchristos *-*-openbsd*) 85*a6f3f22fSchristos ans=200 86*a6f3f22fSchristos ;; 87*a6f3f22fSchristos *) ans=50 88*a6f3f22fSchristos ;; 89*a6f3f22fSchristos esac 90*a6f3f22fSchristos ;; 91*a6f3f22fSchristos [[1-9]][[0-9]]*) 92*a6f3f22fSchristos ;; 93*a6f3f22fSchristos *) AC_MSG_ERROR(["--with-stack-limit requires an integer argument."]) 94*a6f3f22fSchristos ;; 95*a6f3f22fSchristosesac 96*a6f3f22fSchristosAC_MSG_RESULT([$ans]) 97*a6f3f22fSchristosAC_DEFINE_UNQUOTED([DFLT_RLIMIT_STACK], [$ans], 98*a6f3f22fSchristos [Default number of 4k pages for RLIMIT_STACK]) 99*a6f3f22fSchristos 100*a6f3f22fSchristos# HMS: only if we have RLIMIT_MEMLOCK 101*a6f3f22fSchristosAC_MSG_CHECKING([for the default number of megabytes to MEMLOCK]) 102*a6f3f22fSchristosAC_ARG_WITH( 103*a6f3f22fSchristos [memlock], 104*a6f3f22fSchristos [AS_HELP_STRING( 105*a6f3f22fSchristos [--with-memlock], 106*a6f3f22fSchristos [? =32 (-1 on linux) megabytes] 107*a6f3f22fSchristos )], 108*a6f3f22fSchristos [ans=$withval], 109*a6f3f22fSchristos [ans=yes] 110*a6f3f22fSchristos) 111*a6f3f22fSchristoscase "$ans" in 112*a6f3f22fSchristos yes | no) 113*a6f3f22fSchristos ans=$ntp_dflt_rlimit_memlock 114*a6f3f22fSchristos ;; 115*a6f3f22fSchristos [[1-9]][[0-9]]*) ;; 116*a6f3f22fSchristos *) AC_MSG_ERROR(["--with-memlock requires an integer argument."]) 117*a6f3f22fSchristos ;; 118*a6f3f22fSchristosesac 119*a6f3f22fSchristosAC_MSG_RESULT([$ans]) 120*a6f3f22fSchristosAC_DEFINE_UNQUOTED([DFLT_RLIMIT_MEMLOCK], [$ans], 121*a6f3f22fSchristos [Default number of megabytes for RLIMIT_MEMLOCK]) 122*a6f3f22fSchristos 1238585484eSchristos])dnl 124*a6f3f22fSchristos 1258585484eSchristosdnl ====================================================================== 126