aboutsummaryrefslogtreecommitdiff
path: root/lib/libutil/login_class.c
diff options
context:
space:
mode:
authorJohn Birrell <jb@FreeBSD.org>1998-06-03 08:12:00 +0000
committerJohn Birrell <jb@FreeBSD.org>1998-06-03 08:12:00 +0000
commitac4898ab0db734e4cfff873ddd91aff2473838f9 (patch)
tree27c504fa3d9fdfc17e9d08d65281625fcf814c8b /lib/libutil/login_class.c
parentfdea3b6b0fb28b39a8ec8a64b46a0d9c00517000 (diff)
downloadsrc-ac4898ab0db734e4cfff873ddd91aff2473838f9.tar.gz
src-ac4898ab0db734e4cfff873ddd91aff2473838f9.zip
If using NetBSD syscalls the rtprio syscall doesn't exist, so just
don't try to use it to set special priorities.
Notes
Notes: svn path=/head/; revision=36607
Diffstat (limited to 'lib/libutil/login_class.c')
-rw-r--r--lib/libutil/login_class.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/libutil/login_class.c b/lib/libutil/login_class.c
index fbabc42da646..ba0a31d0e7a7 100644
--- a/lib/libutil/login_class.c
+++ b/lib/libutil/login_class.c
@@ -21,7 +21,7 @@
*
* High-level routines relating to use of the user capabilities database
*
- * $Id: login_class.c,v 1.6 1997/05/10 18:55:38 davidn Exp $
+ * $Id: login_class.c,v 1.7 1998/05/25 03:55:23 steve Exp $
*/
#include <stdio.h>
@@ -316,7 +316,9 @@ setusercontext(login_cap_t *lc, const struct passwd *pwd, uid_t uid, unsigned in
quad_t p;
mode_t mymask;
login_cap_t *llc = NULL;
+#ifndef __NETBSD_SYSCALLS
struct rtprio rtp;
+#endif
if (lc == NULL) {
if (pwd != NULL && (lc = login_getpwclass(pwd)) != NULL)
@@ -335,19 +337,23 @@ setusercontext(login_cap_t *lc, const struct passwd *pwd, uid_t uid, unsigned in
p = login_getcapnum(lc, "priority", LOGIN_DEFPRI, LOGIN_DEFPRI);
if(p > PRIO_MAX) {
+#ifndef __NETBSD_SYSCALLS
rtp.type = RTP_PRIO_IDLE;
rtp.prio = p - PRIO_MAX - 1;
p = (rtp.prio > RTP_PRIO_MAX) ? 31 : p;
if(rtprio(RTP_SET, 0, &rtp))
syslog(LOG_WARNING, "rtprio '%s' (%s): %m",
pwd->pw_name, lc ? lc->lc_class : LOGIN_DEFCLASS);
+#endif
} else if(p < PRIO_MIN) {
+#ifndef __NETBSD_SYSCALLS
rtp.type = RTP_PRIO_REALTIME;
rtp.prio = abs(p - PRIO_MIN + RTP_PRIO_MAX);
p = (rtp.prio > RTP_PRIO_MAX) ? 1 : p;
if(rtprio(RTP_SET, 0, &rtp))
syslog(LOG_WARNING, "rtprio '%s' (%s): %m",
pwd->pw_name, lc ? lc->lc_class : LOGIN_DEFCLASS);
+#endif
} else {
if (setpriority(PRIO_PROCESS, 0, (int)p) != 0)
syslog(LOG_WARNING, "setpriority '%s' (%s): %m",