[Git][NTPsec/ntpsec][master] Remove #ifdef-s for RLIMIT_*

Hal Murray gitlab at mg.gitlab.com
Mon Sep 16 18:30:44 UTC 2019



Hal Murray pushed to branch master at NTPsec / ntpsec


Commits:
36128757 by Hal Murray at 2019-09-16T18:29:04Z
Remove #ifdef-s for RLIMIT_*

setrlimit and friends are part of POSIX.1-2001

- - - - -


2 changed files:

- ntpd/ntp_config.c
- ntpd/ntpd.c


Changes:

=====================================
ntpd/ntp_config.c
=====================================
@@ -3632,13 +3632,10 @@ ntp_rlimit(
 #endif
 
 	switch (rl_what) {
-#ifdef RLIMIT_MEMLOCK
 	    case RLIMIT_MEMLOCK:
 		/* ignore - for backward compatibility only */
 		break;
-#endif /* RLIMIT_MEMLOCK */
 
-#ifdef RLIMIT_NOFILE
 	    case RLIMIT_NOFILE:
 		/*
 		 * For large systems the default file descriptor limit may
@@ -3650,9 +3647,7 @@ ntp_rlimit(
 		if (setrlimit(RLIMIT_NOFILE, &rl) == -1)
 			msyslog(LOG_ERR, "CONFIG: Cannot set RLIMIT_NOFILE: %s", strerror(errno));
 		break;
-#endif /* RLIMIT_NOFILE */
 
-#ifdef RLIMIT_STACK
 	    case RLIMIT_STACK:
 		/*
 		 * Provide a way to set the stack limit to something
@@ -3678,7 +3673,6 @@ ntp_rlimit(
 			}
 		}
 		break;
-#endif /* RLIMIT_STACK */
 
 	    default:
 		INSIST(!"Unexpected setrlimit() case!");


=====================================
ntpd/ntpd.c
=====================================
@@ -804,14 +804,9 @@ ntpdmain(
 	{
 	    struct rlimit rlim;
 	    rlim.rlim_max = rlim.rlim_cur = RLIM_INFINITY;
-#ifdef RLIMIT_MEMLOCK
 	    if (setrlimit(RLIMIT_MEMLOCK, &rlim) < 0)
 		msyslog(LOG_WARNING, "INIT: setrlimit() failed: not locking into RAM");
 	    else
-#endif
-	    if (mlockall(MCL_CURRENT|MCL_FUTURE) < 0)
-		msyslog(LOG_WARNING, "INIT: mlockall() failed: not locking into RAM");
-	    else
 		msyslog(LOG_INFO, "INIT: successfully locked into RAM");
 	}
 



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/36128757fbb6613fc4cea2705cc3717fbd7dc7fb

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/36128757fbb6613fc4cea2705cc3717fbd7dc7fb
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20190916/c3193bd1/attachment-0001.htm>


More information about the vc mailing list