Merge remote-tracking branch 'jturney/mingw-patches'
This commit is contained in:
commit
1712a45422
|
@ -223,7 +223,11 @@ UpdateCurrentTimeIf(void)
|
|||
#define SMART_SCHEDULE_DEFAULT_INTERVAL 20 /* ms */
|
||||
#define SMART_SCHEDULE_MAX_SLICE 200 /* ms */
|
||||
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
Bool SmartScheduleDisable = TRUE;
|
||||
#else
|
||||
Bool SmartScheduleDisable = FALSE;
|
||||
#endif
|
||||
long SmartScheduleSlice = SMART_SCHEDULE_DEFAULT_INTERVAL;
|
||||
long SmartScheduleInterval = SMART_SCHEDULE_DEFAULT_INTERVAL;
|
||||
long SmartScheduleMaxSlice = SMART_SCHEDULE_MAX_SLICE;
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
#ifdef __MINGW64_VERSION_MAJOR
|
||||
#include_next <ddraw.h>
|
||||
#define __XWIN_DDRAW_H
|
||||
#endif
|
||||
#ifndef __XWIN_DDRAW_H
|
||||
#define __XWIN_DDRAW_H
|
||||
|
||||
|
|
|
@ -133,6 +133,8 @@
|
|||
|
||||
#define WIN_MAX_KEYS_PER_KEY 4
|
||||
|
||||
#define NONAMELESSUNION
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#define HAS_WINSOCK 1
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
#include "winclipboard.h"
|
||||
#ifdef __CYGWIN__
|
||||
#include <errno.h>
|
||||
|
@ -431,7 +432,7 @@ winClipboardProc(void *pvNotUsed)
|
|||
else {
|
||||
ErrorF("winClipboardProc - Clipboard disabled - Exit from server \n");
|
||||
/* clipboard thread has exited, stop server as well */
|
||||
kill(getpid(), SIGTERM);
|
||||
raise(SIGTERM);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
* Authors: Harold L Hunt II
|
||||
*/
|
||||
|
||||
#define NONAMELESSUNION
|
||||
#define DIRECTDRAW_VERSION 0x0300
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
|
|
@ -102,6 +102,7 @@ OsRegisterSigWrapper(OsSigWrapperPtr newSigWrapper)
|
|||
* OsSigHandler --
|
||||
* Catch unexpected signals and exit or continue cleanly.
|
||||
*/
|
||||
#if !defined(WIN32) || defined(__CYGWIN__)
|
||||
static void
|
||||
#ifdef SA_SIGINFO
|
||||
OsSigHandler(int signo, siginfo_t * sip, void *unused)
|
||||
|
@ -146,6 +147,7 @@ OsSigHandler(int signo)
|
|||
FatalError("Caught signal %d (%s). Server aborting\n",
|
||||
signo, strsignal(signo));
|
||||
}
|
||||
#endif /* !WIN32 || __CYGWIN__ */
|
||||
|
||||
void
|
||||
OsInit(void)
|
||||
|
@ -155,6 +157,7 @@ OsInit(void)
|
|||
char fname[PATH_MAX];
|
||||
|
||||
if (!been_here) {
|
||||
#if !defined(WIN32) || defined(__CYGWIN__)
|
||||
struct sigaction act, oact;
|
||||
int i;
|
||||
|
||||
|
@ -181,6 +184,8 @@ OsInit(void)
|
|||
siglist[i], strerror(errno));
|
||||
}
|
||||
}
|
||||
#endif /* !WIN32 || __CYGWIN__ */
|
||||
|
||||
#ifdef HAVE_BACKTRACE
|
||||
/*
|
||||
* initialize the backtracer, since the ctor calls dlopen(), which
|
||||
|
@ -241,8 +246,10 @@ OsInit(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
#if !defined(WIN32) || defined(__CYGWIN__)
|
||||
if (getpgrp() == 0)
|
||||
setpgid(0, 0);
|
||||
#endif
|
||||
|
||||
#ifdef RLIMIT_DATA
|
||||
if (limitDataSpace >= 0) {
|
||||
|
|
17
os/utils.c
17
os/utils.c
|
@ -71,6 +71,7 @@ __stdcall unsigned long GetTickCount(void);
|
|||
#if !defined(WIN32) || !defined(__MINGW32__)
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
# define SMART_SCHEDULE_POSSIBLE
|
||||
#endif
|
||||
#include "misc.h"
|
||||
#include <X11/X.h>
|
||||
|
@ -212,6 +213,9 @@ sig_atomic_t inSignalContext = FALSE;
|
|||
OsSigHandlerPtr
|
||||
OsSignal(int sig, OsSigHandlerPtr handler)
|
||||
{
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
return signal(sig, handler);
|
||||
#else
|
||||
struct sigaction act, oact;
|
||||
|
||||
sigemptyset(&act.sa_mask);
|
||||
|
@ -222,6 +226,7 @@ OsSignal(int sig, OsSigHandlerPtr handler)
|
|||
if (sigaction(sig, &act, &oact))
|
||||
perror("sigaction");
|
||||
return oact.sa_handler;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -894,6 +899,7 @@ ProcessCommandLine(int argc, char *argv[])
|
|||
i = skip - 1;
|
||||
}
|
||||
#endif
|
||||
#ifdef SMART_SCHEDULE_POSSIBLE
|
||||
else if (strcmp(argv[i], "-dumbSched") == 0) {
|
||||
SmartScheduleDisable = TRUE;
|
||||
}
|
||||
|
@ -912,6 +918,7 @@ ProcessCommandLine(int argc, char *argv[])
|
|||
else
|
||||
UseMsg();
|
||||
}
|
||||
#endif
|
||||
else if (strcmp(argv[i], "-render") == 0) {
|
||||
if (++i < argc) {
|
||||
int policy = PictureParseCmapPolicy(argv[i]);
|
||||
|
@ -1123,6 +1130,7 @@ XNFstrdup(const char *s)
|
|||
void
|
||||
SmartScheduleStopTimer(void)
|
||||
{
|
||||
#ifdef SMART_SCHEDULE_POSSIBLE
|
||||
struct itimerval timer;
|
||||
|
||||
if (SmartScheduleDisable)
|
||||
|
@ -1132,11 +1140,13 @@ SmartScheduleStopTimer(void)
|
|||
timer.it_value.tv_sec = 0;
|
||||
timer.it_value.tv_usec = 0;
|
||||
(void) setitimer(ITIMER_REAL, &timer, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
SmartScheduleStartTimer(void)
|
||||
{
|
||||
#ifdef SMART_SCHEDULE_POSSIBLE
|
||||
struct itimerval timer;
|
||||
|
||||
if (SmartScheduleDisable)
|
||||
|
@ -1146,6 +1156,7 @@ SmartScheduleStartTimer(void)
|
|||
timer.it_value.tv_sec = 0;
|
||||
timer.it_value.tv_usec = SmartScheduleInterval * 1000;
|
||||
setitimer(ITIMER_REAL, &timer, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1157,6 +1168,7 @@ SmartScheduleTimer(int sig)
|
|||
void
|
||||
SmartScheduleInit(void)
|
||||
{
|
||||
#ifdef SMART_SCHEDULE_POSSIBLE
|
||||
struct sigaction act;
|
||||
|
||||
if (SmartScheduleDisable)
|
||||
|
@ -1172,6 +1184,7 @@ SmartScheduleInit(void)
|
|||
perror("sigaction for smart scheduler");
|
||||
SmartScheduleDisable = TRUE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SIG_BLOCK
|
||||
|
@ -1227,10 +1240,10 @@ OsBlockSIGIO(void)
|
|||
sigprocmask(SIG_BLOCK, &set, &PreviousSigIOMask);
|
||||
ret = sigismember(&PreviousSigIOMask, SIGIO);
|
||||
return ret;
|
||||
} else
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in New Issue