On Wed, Feb 15, 2006 at 09:47:00PM -0500, Ross Vandegrift wrote:
> Ok, now I have to run an experiment.
Experiment is done. rlimits properly inherit with set_rlimits.
Granting RT privileges to any program I run is easy and transparent:
1) I added a line to set_rlimits.conf allowing anyone in the group
audio to run my window manager with RT abilities:
@audio /usr/local/enlightenment/bin/enlightenment nice=-1 rtprio=80 memlock=67108864
2) I changed my .xsession to run the window manager with set_rlimits:
exec /usr/local/bin/set_rlimits -k /usr/local/enlightenment/bin/enlightenment
The -k to set_rlimits is an option I added to continue even if
realtime privileges cannot be setup. I did this so if I ever take
myself out of the audio group, I will still be able to login to my
Xsession. Patch is below.
It's now just a bit more work to take the patch set_rlimits and edit
the system-wide display manager to invoke any users session with
set_rlimits. Then, any user can take advantage of this without
modifying their config files.
diff -ur set_rlimits-1.2.0/set_rlimits.c set_rlimits/set_rlimits.c
--- set_rlimits-1.2.0/set_rlimits.c 2005-12-20 06:37:35.000000000 -0500
+++ set_rlimits/set_rlimits.c 2006-02-16 02:04:34.000000000 -0500
@@ -98,6 +98,7 @@
signed int debug = 0;
signed int verbose = 0;
+signed int cont = 0;
/* rlimits for process */
Rlimits rlimits = {
@@ -123,6 +124,7 @@
"Available options:\n"
" -d Turn on additional debugging output.\n"
" -h Display this help message.\n"
+ " -k Continue running program even if there's an error.\n"
" -n[=<nlimit>] Set nice limit to <nlimit>. Values 0 to 39 equate to nice\n"
" levels 19 to -20 respectively.\n"
" -r[=<priority>] Set realtime priority limit to <priority>. Max available is\n"
@@ -216,6 +218,9 @@
debug = 1;
break;
case 'h': err = -1; break;
+ case 'k':
+ cont = 1;
+ break;
case 'v':
if (argv[i][2]!=0)
err = -1;
@@ -632,10 +637,14 @@
return -1;
}
/* No matching entry - permission denied */
- if (!match) {
+ if (!match && !cont) {
fprintf(stderr,"set_rlimits: no permission to run %s with elevated resource limits\n",
*exec_path);
return 0;
+ } else if (!match && cont) {
+ fprintf(stderr,"set_rlimits: no permission to run %s with elevated resource limits\n",
+ *exec_path);
+ fprintf(stderr,"set_rlimits: continuing anyway, as requested...\n");
}
if (debug) {
-- Ross Vandegrift ross@email-addr-hidden "The good Christian should beware of mathematicians, and all those who make empty prophecies. The danger already exists that the mathematicians have made a covenant with the devil to darken the spirit and to confine man in the bonds of Hell." --St. Augustine, De Genesi ad Litteram, Book II, xviii, 37Received on Thu Feb 16 12:15:04 2006
This archive was generated by hypermail 2.1.8 : Thu Feb 16 2006 - 12:15:05 EET