Tags: patch

I tried this patch from here[1] and seems to works all fine. This issue seems 
solved.

[1] http://ubuntustudio.com/wiki/index.php/Breezy:Rlimits-Aware_PAM
diff -ru pam-0.76/Linux-PAM/modules/pam_limits/pam_limits.c pam-0.76-patched/Linux-PAM/modules/pam_limits/pam_limits.c
--- pam-0.76/Linux-PAM/modules/pam_limits/pam_limits.c	2006-02-04 15:32:27.000000000 -0500
+++ pam-0.76-patched/Linux-PAM/modules/pam_limits/pam_limits.c	2006-02-04 15:35:52.000000000 -0500
@@ -34,6 +34,11 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/resource.h>
+/* hack: glibc-2.3.6 doesn't yet know about these yet */
+#define RLIMIT_NICE 13
+#define RLIMIT_RTPRIO 14
+#undef RLIM_NLIMITS
+#define RLIM_NLIMITS 15
 
 #include <utmp.h>
 #ifndef UT_USER  /* some systems have ut_name instead of ut_user */
@@ -367,6 +372,14 @@
     else if (strcmp(lim_item, "locks") == 0)
 	limit_item = RLIMIT_LOCKS;
 #endif
+#ifdef RLIMIT_RTPRIO
+    else if (strcmp(lim_item, "rtprio") == 0)
+    limit_item = RLIMIT_RTPRIO;
+#endif
+#ifdef RLIMIT_NICE
+    else if (strcmp(lim_item, "nice") == 0)
+    limit_item = RLIMIT_NICE;
+#endif
     else if (strcmp(lim_item, "maxlogins") == 0) {
 	limit_item = LIMIT_LOGIN;
 	pl->flag_numsyslogins = 0;
@@ -443,6 +456,15 @@
 #endif
             limit_value *= 1024;
             break;
+#ifdef RLIMIT_NICE
+        case RLIMIT_NICE:
+            if (limit_value > 19)
+               limit_value = 19;
+            if (limit_value < -20)
+               limit_value = -20;
+			limit_value = 19 - limit_value;
+            break;
+#endif
     }
 
     if ( (limit_item != LIMIT_LOGIN)
Only in pam-0.76-patched/Linux-PAM/modules/pam_limits: pam_limits.c.orig
diff -ru pam-0.76/Linux-PAM/modules/pam_limits/README pam-0.76-patched/Linux-PAM/modules/pam_limits/README
--- pam-0.76/Linux-PAM/modules/pam_limits/README	2002-09-15 16:08:50.000000000 -0400
+++ pam-0.76-patched/Linux-PAM/modules/pam_limits/README	2006-02-04 15:34:54.000000000 -0500
@@ -39,6 +39,9 @@
 	- maxsyslogins - max number of logins on the system
 	- priority - lower the priority by given value (value can be -ve)
 	- locks - max locked files (Linux 2.4 and higher)
+	- nice - max nice priority allowed to raise to. (Linux 2.6.12 and higher)
+	- rtprio - max realtime priority allowed for non-priviledged processes
+         (Linux 2.6.12 and higher)
 
 Note, if you specify a type of '-' but neglect to supply the item and
 value fields then the module will never enforce any limits on the

Reply via email to