On Thu, 2003-02-06 at 13:47, gabor wrote: > and now back to the topic: > IS GIVING A HIGHER PRIORITY TO X A GOOD IDEA OR NOT ?
I can't say whether it is, or not. But, I can say that I already do.
Doesn't really seem to make any real difference tho, but I never really
had a problem before (or they were so random and rare it's nigh on
impossible to say).
Someone posted this a while ago, what I use now, works perfectly.
/* wrapper.c
* Casey Cain <[EMAIL PROTECTED]>
*
* This is a quick hack that starts X with a priority
* of -10 for increased responsiveness. It should work
* but it may not :) There is no warranty or anything.
* Although I can't see anything possibly going wrong as
* there's only about 3 lines of code, worst case you
* have to reinstall X. Basically, you should never run
* code that you don't understand. That said:
*
* To use this program, verify that /usr/X11R6/bin/X is
* really a symlink to /usr/X11R6/bin/XFree86 (the actual
* server binary) If not, then change the *app to point to
* the actual binary.
* At the console (be careful..no typos):
* kill X and anything X-related (ie: xdm, kdm)
* $ gcc wrapper.c -o XFree86.wrapper
* $ su
* $ cp XFree86.wrapper /usr/X11R6/bin
* $ cd /usr/X11R6/bin
* $ ls -alk X (make sure its a symlink..if not STOP!!!!)
* $ rm X
* $ chown root.root XFree86.wrapper
* $ chmod u+s XFree86.wrapper
* $ ln -s XFree86.wrapper X
* $ exit
*
* You should now be able to startx or xdm or whatever.
* Open an xterm and run 'top'. The process XFree86
* (which is the server) should be running at nice -10.
*
* If not, then make sure the XFree86.wrapper is suid
* root, executable by all, owned by root, and pointed
* to by /usr/X11R6/bin/X.
*
* To revert is easy.
* $ su
* $ cd /usr/X11R6/bin
* $ rm X
* $ ln -s XFree86 X
* $ exit
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
const char *app = "/usr/X11R6/bin/XFree86"; // the actual binary
const int root = 0; // root's uid
const int n = -10; // desired nice priority valid range -20..20.
int main(int argc, char **argv)
{
seteuid(root); // The X server must be started as root under any
Linux
nice(n); // Makes it nice
execv(app, argv); // This is it!
/* Should never see this unless *app points to invalid binary */
fprintf(stderr, "Failed to execv %s with nice value of %d\n", app, n);
exit(1);
}
--
Mike Williams <[EMAIL PROTECTED]>
signature.asc
Description: This is a digitally signed message part
