[Midnightbsd-cvs] src [10496] trunk/lib/libutil/login_class.c: kqueues limit is not a thing here

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Wed Jun 6 21:37:16 EDT 2018


Revision: 10496
          http://svnweb.midnightbsd.org/src/?rev=10496
Author:   laffer1
Date:     2018-06-06 21:37:15 -0400 (Wed, 06 Jun 2018)
Log Message:
-----------
kqueues limit is not a thing here

Modified Paths:
--------------
    trunk/lib/libutil/login_class.c

Modified: trunk/lib/libutil/login_class.c
===================================================================
--- trunk/lib/libutil/login_class.c	2018-06-07 01:36:09 UTC (rev 10495)
+++ trunk/lib/libutil/login_class.c	2018-06-07 01:37:15 UTC (rev 10496)
@@ -66,7 +66,6 @@
     { "vmemoryuse",      login_getcapsize, RLIMIT_VMEM    },
     { "pseudoterminals", login_getcapnum,  RLIMIT_NPTS    },
     { "swapuse",         login_getcapsize, RLIMIT_SWAP    },
-    { "kqueues",         login_getcapsize, RLIMIT_KQUEUES },
     { NULL,              0,                0              }
 };
 
@@ -424,7 +423,7 @@
 int
 setusercontext(login_cap_t *lc, const struct passwd *pwd, uid_t uid, unsigned int flags)
 {
-    quad_t	p;
+    rlim_t	p;
     mode_t	mymask;
     login_cap_t *llc = NULL;
     struct sigaction sa, prevsa;
@@ -449,8 +448,8 @@
 
 	if (p > PRIO_MAX) {
 	    rtp.type = RTP_PRIO_IDLE;
-	    rtp.prio = p - PRIO_MAX - 1;
-	    p = (rtp.prio > RTP_PRIO_MAX) ? 31 : p;
+	    p -= PRIO_MAX + 1;
+	    rtp.prio = p > RTP_PRIO_MAX ? RTP_PRIO_MAX : p;
 	    if (rtprio(RTP_SET, 0, &rtp))
 		syslog(LOG_WARNING, "rtprio '%s' (%s): %m",
 		    pwd ? pwd->pw_name : "-",
@@ -457,8 +456,8 @@
 		    lc ? lc->lc_class : LOGIN_DEFCLASS);
 	} else if (p < PRIO_MIN) {
 	    rtp.type = RTP_PRIO_REALTIME;
-	    rtp.prio = abs(p - PRIO_MIN + RTP_PRIO_MAX);
-	    p = (rtp.prio > RTP_PRIO_MAX) ? 1 : p;
+	    p -= PRIO_MIN - RTP_PRIO_MAX;
+	    rtp.prio = p < RTP_PRIO_MIN ? RTP_PRIO_MIN : p;
 	    if (rtprio(RTP_SET, 0, &rtp))
 		syslog(LOG_WARNING, "rtprio '%s' (%s): %m",
 		    pwd ? pwd->pw_name : "-",



More information about the Midnightbsd-cvs mailing list