mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-14 17:18:09 +00:00
Merge branch 'master' into mpx
Conflicts: Xi/extinit.c Xi/grabdev.c Xi/setmode.c Xi/ungrdev.c dix/devices.c dix/events.c dix/getevents.c include/dix.h mi/midispcur.c mi/misprite.c xkb/xkbActions.c xkb/xkbEvents.c xkb/xkbPrKeyEv.c
This commit is contained in:
65
os/utils.c
65
os/utils.c
@@ -160,6 +160,7 @@ _X_EXPORT Bool noFontCacheExtension = FALSE;
|
||||
#endif
|
||||
#ifdef GLXEXT
|
||||
_X_EXPORT Bool noGlxExtension = FALSE;
|
||||
_X_EXPORT Bool noGlxVisualInit = FALSE;
|
||||
#endif
|
||||
#ifdef SCREENSAVER
|
||||
_X_EXPORT Bool noScreenSaverExtension = FALSE;
|
||||
@@ -287,7 +288,8 @@ OsSignal(sig, handler)
|
||||
sigaddset(&act.sa_mask, sig);
|
||||
act.sa_flags = 0;
|
||||
act.sa_handler = handler;
|
||||
sigaction(sig, &act, &oact);
|
||||
if (sigaction(sig, &act, &oact))
|
||||
perror("sigaction");
|
||||
return oact.sa_handler;
|
||||
#endif
|
||||
}
|
||||
@@ -577,7 +579,6 @@ void UseMsg(void)
|
||||
ErrorF("-c turns off key-click\n");
|
||||
ErrorF("c # key-click volume (0-100)\n");
|
||||
ErrorF("-cc int default color visual class\n");
|
||||
ErrorF("-co file color database file\n");
|
||||
#ifdef COMMANDLINE_CHALLENGED_OPERATING_SYSTEMS
|
||||
ErrorF("-config file read options from file\n");
|
||||
#endif
|
||||
@@ -783,13 +784,6 @@ ProcessCommandLine(int argc, char *argv[])
|
||||
else
|
||||
UseMsg();
|
||||
}
|
||||
else if ( strcmp( argv[i], "-co") == 0)
|
||||
{
|
||||
if(++i < argc)
|
||||
rgbPath = argv[i];
|
||||
else
|
||||
UseMsg();
|
||||
}
|
||||
else if ( strcmp( argv[i], "-core") == 0)
|
||||
{
|
||||
CoreDump = TRUE;
|
||||
@@ -1513,10 +1507,6 @@ XNFstrdup(const char *s)
|
||||
|
||||
#ifdef SMART_SCHEDULE
|
||||
|
||||
unsigned long SmartScheduleIdleCount;
|
||||
Bool SmartScheduleIdle;
|
||||
Bool SmartScheduleTimerStopped;
|
||||
|
||||
#ifdef SIGVTALRM
|
||||
#define SMART_SCHEDULE_POSSIBLE
|
||||
#endif
|
||||
@@ -1526,7 +1516,7 @@ Bool SmartScheduleTimerStopped;
|
||||
#define SMART_SCHEDULE_TIMER ITIMER_REAL
|
||||
#endif
|
||||
|
||||
static void
|
||||
void
|
||||
SmartScheduleStopTimer (void)
|
||||
{
|
||||
#ifdef SMART_SCHEDULE_POSSIBLE
|
||||
@@ -1537,38 +1527,28 @@ SmartScheduleStopTimer (void)
|
||||
timer.it_value.tv_sec = 0;
|
||||
timer.it_value.tv_usec = 0;
|
||||
(void) setitimer (ITIMER_REAL, &timer, 0);
|
||||
SmartScheduleTimerStopped = TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
Bool
|
||||
void
|
||||
SmartScheduleStartTimer (void)
|
||||
{
|
||||
#ifdef SMART_SCHEDULE_POSSIBLE
|
||||
struct itimerval timer;
|
||||
|
||||
SmartScheduleTimerStopped = FALSE;
|
||||
timer.it_interval.tv_sec = 0;
|
||||
timer.it_interval.tv_usec = SmartScheduleInterval * 1000;
|
||||
timer.it_value.tv_sec = 0;
|
||||
timer.it_value.tv_usec = SmartScheduleInterval * 1000;
|
||||
return setitimer (ITIMER_REAL, &timer, 0) >= 0;
|
||||
setitimer (ITIMER_REAL, &timer, 0);
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef SMART_SCHEDULE_POSSIBLE
|
||||
static void
|
||||
SmartScheduleTimer (int sig)
|
||||
{
|
||||
int olderrno = errno;
|
||||
|
||||
SmartScheduleTime += SmartScheduleInterval;
|
||||
if (SmartScheduleIdle)
|
||||
{
|
||||
SmartScheduleStopTimer ();
|
||||
}
|
||||
errno = olderrno;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1592,14 +1572,6 @@ SmartScheduleInit (void)
|
||||
perror ("sigaction for smart scheduler");
|
||||
return FALSE;
|
||||
}
|
||||
/* Set up the virtual timer */
|
||||
if (!SmartScheduleStartTimer ())
|
||||
{
|
||||
perror ("scheduling timer");
|
||||
return FALSE;
|
||||
}
|
||||
/* stop the timer and wait for WaitForSomething to start it */
|
||||
SmartScheduleStopTimer ();
|
||||
return TRUE;
|
||||
#else
|
||||
return FALSE;
|
||||
@@ -1686,6 +1658,10 @@ System(char *command)
|
||||
|
||||
#ifdef SIGCHLD
|
||||
csig = signal(SIGCHLD, SIG_DFL);
|
||||
if (csig == SIG_ERR) {
|
||||
perror("signal");
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
@@ -1710,7 +1686,10 @@ System(char *command)
|
||||
}
|
||||
|
||||
#ifdef SIGCHLD
|
||||
signal(SIGCHLD, csig);
|
||||
if (signal(SIGCHLD, csig) == SIG_ERR) {
|
||||
perror("signal");
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
return p == -1 ? -1 : status;
|
||||
@@ -1722,6 +1701,8 @@ static struct pid {
|
||||
int pid;
|
||||
} *pidlist;
|
||||
|
||||
void (*old_alarm)(int) = NULL; /* XXX horrible awful hack */
|
||||
|
||||
pointer
|
||||
Popen(char *command, char *type)
|
||||
{
|
||||
@@ -1743,11 +1724,20 @@ Popen(char *command, char *type)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Ignore the smart scheduler while this is going on */
|
||||
old_alarm = signal(SIGALRM, SIG_IGN);
|
||||
if (old_alarm == SIG_ERR) {
|
||||
perror("signal");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (pid = fork()) {
|
||||
case -1: /* error */
|
||||
close(pdes[0]);
|
||||
close(pdes[1]);
|
||||
xfree(cur);
|
||||
if (signal(SIGALRM, old_alarm) == SIG_ERR)
|
||||
perror("signal");
|
||||
return NULL;
|
||||
case 0: /* child */
|
||||
if (setgid(getgid()) == -1)
|
||||
@@ -1923,6 +1913,11 @@ Pclose(pointer iop)
|
||||
/* allow EINTR again */
|
||||
OsReleaseSignals ();
|
||||
|
||||
if (old_alarm && signal(SIGALRM, old_alarm) == SIG_ERR) {
|
||||
perror("signal");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return pid == -1 ? -1 : pstat;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user