diff options
Diffstat (limited to 'xorg-server/os/utils.c')
-rw-r--r-- | xorg-server/os/utils.c | 125 |
1 files changed, 57 insertions, 68 deletions
diff --git a/xorg-server/os/utils.c b/xorg-server/os/utils.c index b1009494b..3718b170c 100644 --- a/xorg-server/os/utils.c +++ b/xorg-server/os/utils.c @@ -56,6 +56,11 @@ OR PERFORMANCE OF THIS SOFTWARE. #ifdef __CYGWIN__ #include <stdlib.h> #include <signal.h> +/* + Sigh... We really need a prototype for this to know it is stdcall, + but #include-ing <windows.h> here is not a good idea... +*/ +__stdcall unsigned long GetTickCount(void); #endif #if defined(WIN32) && !defined(__CYGWIN__) @@ -113,85 +118,82 @@ OR PERFORMANCE OF THIS SOFTWARE. #include "dixstruct.h" -#ifdef XKB -#include <xkbsrv.h> -#endif +#include "xkbsrv.h" #ifdef RENDER #include "picture.h" #endif -_X_EXPORT Bool noTestExtensions; +Bool noTestExtensions; #ifdef COMPOSITE -_X_EXPORT Bool noCompositeExtension = FALSE; +Bool noCompositeExtension = FALSE; #endif #ifdef DAMAGE -_X_EXPORT Bool noDamageExtension = FALSE; +Bool noDamageExtension = FALSE; #endif #ifdef DBE -_X_EXPORT Bool noDbeExtension = FALSE; +Bool noDbeExtension = FALSE; #endif #ifdef DPMSExtension -_X_EXPORT Bool noDPMSExtension = FALSE; +Bool noDPMSExtension = FALSE; #endif #ifdef GLXEXT -_X_EXPORT Bool noGlxExtension = FALSE; -_X_EXPORT Bool noGlxVisualInit = FALSE; +Bool noGlxExtension = FALSE; +Bool noGlxVisualInit = FALSE; #endif #ifdef SCREENSAVER -_X_EXPORT Bool noScreenSaverExtension = FALSE; +Bool noScreenSaverExtension = FALSE; #endif #ifdef MITSHM -_X_EXPORT Bool noMITShmExtension = FALSE; +Bool noMITShmExtension = FALSE; #endif #ifdef MULTIBUFFER -_X_EXPORT Bool noMultibufferExtension = FALSE; +Bool noMultibufferExtension = FALSE; #endif #ifdef RANDR -_X_EXPORT Bool noRRExtension = FALSE; +Bool noRRExtension = FALSE; #endif #ifdef RENDER -_X_EXPORT Bool noRenderExtension = FALSE; +Bool noRenderExtension = FALSE; #endif #ifdef XCSECURITY -_X_EXPORT Bool noSecurityExtension = FALSE; +Bool noSecurityExtension = FALSE; #endif #ifdef RES -_X_EXPORT Bool noResExtension = FALSE; +Bool noResExtension = FALSE; #endif #ifdef XF86BIGFONT -_X_EXPORT Bool noXFree86BigfontExtension = FALSE; +Bool noXFree86BigfontExtension = FALSE; #endif #ifdef XFreeXDGA -_X_EXPORT Bool noXFree86DGAExtension = FALSE; +Bool noXFree86DGAExtension = FALSE; #endif #ifdef XF86DRI -_X_EXPORT Bool noXFree86DRIExtension = FALSE; +Bool noXFree86DRIExtension = FALSE; #endif #ifdef XF86VIDMODE -_X_EXPORT Bool noXFree86VidModeExtension = FALSE; +Bool noXFree86VidModeExtension = FALSE; #endif #ifdef XFIXES -_X_EXPORT Bool noXFixesExtension = FALSE; +Bool noXFixesExtension = FALSE; #endif -/* |noXkbExtension| is defined in xc/programs/Xserver/xkb/xkbInit.c */ #ifdef PANORAMIX /* Xinerama is disabled by default unless enabled via +xinerama */ -_X_EXPORT Bool noPanoramiXExtension = TRUE; +Bool noPanoramiXExtension = TRUE; #endif #ifdef XSELINUX -_X_EXPORT Bool noSELinuxExtension = FALSE; -_X_EXPORT int selinuxEnforcingState = SELINUX_MODE_DEFAULT; +Bool noSELinuxExtension = FALSE; +int selinuxEnforcingState = SELINUX_MODE_DEFAULT; #endif #ifdef XV -_X_EXPORT Bool noXvExtension = FALSE; +Bool noXvExtension = FALSE; #endif #ifdef DRI2 -_X_EXPORT Bool noDRI2Extension = FALSE; +Bool noDRI2Extension = FALSE; #endif -_X_EXPORT Bool noGEExtension = FALSE; +Bool noGEExtension = FALSE; #define X_INCLUDE_NETDB_H #include <X11/Xos_r.h> @@ -213,9 +215,7 @@ int auditTrailLevel = 1; static char *dev_tty_from_init = NULL; /* since we need to parse it anyway */ OsSigHandlerPtr -OsSignal(sig, handler) - int sig; - OsSigHandlerPtr handler; +OsSignal(int sig, OsSigHandlerPtr handler) { struct sigaction act, oact; @@ -400,8 +400,7 @@ UnlockServer(void) /* Force connections to close on SIGHUP from init */ -/*ARGSUSED*/ -SIGVAL +void AutoResetServer (int sig) { int olderrno = errno; @@ -413,8 +412,7 @@ AutoResetServer (int sig) /* Force connections to close and then exit on SIGTERM, SIGINT */ -/*ARGSUSED*/ -_X_EXPORT SIGVAL +void GiveUp(int sig) { int olderrno = errno; @@ -424,14 +422,14 @@ GiveUp(int sig) errno = olderrno; } -#if defined WIN32 && defined __MINGW32__ -_X_EXPORT CARD32 +#if (defined WIN32 && defined __MINGW32__) || defined(__CYGWIN__) +CARD32 GetTimeInMillis (void) { return GetTickCount (); } #else -_X_EXPORT CARD32 +CARD32 GetTimeInMillis(void) { struct timeval tv; @@ -447,7 +445,7 @@ GetTimeInMillis(void) } #endif -_X_EXPORT void +void AdjustWaitForDelay (pointer waitTime, unsigned long newdelay) { static struct timeval delay_val; @@ -484,10 +482,10 @@ 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("-nocursor disable the cursor\n"); ErrorF("-core generate core dump on fatal error\n"); ErrorF("-dpi int screen resolution in dots per inch\n"); #ifdef DPMSExtension - ErrorF("dpms enables VESA DPMS monitor control\n"); ErrorF("-dpms disables VESA DPMS monitor control\n"); #endif ErrorF("-deferglyphs [none|all|16] defer loading of [no|all|16-bit] glyphs\n"); @@ -535,7 +533,6 @@ void UseMsg(void) ErrorF("-v screen-saver without video blanking\n"); ErrorF("-wm WhenMapped default backing-store\n"); ErrorF("-wr create root window with white background\n"); - ErrorF("-x string loads named extension at init time \n"); ErrorF("-maxbigreqsize set maximal bigrequest size \n"); #ifdef PANORAMIX ErrorF("+xinerama Enable XINERAMA extension\n"); @@ -548,9 +545,7 @@ void UseMsg(void) #ifdef XDMCP XdmcpUseMsg(); #endif -#ifdef XKB XkbUseMsg(); -#endif ddxUseMsg(); } @@ -658,15 +653,19 @@ ProcessCommandLine(int argc, char *argv[]) } else if ( strcmp( argv[i], "-core") == 0) { - CoreDump = TRUE; #if !defined(WIN32) || !defined(__MINGW32__) struct rlimit core_limit; getrlimit (RLIMIT_CORE, &core_limit); core_limit.rlim_cur = core_limit.rlim_max; setrlimit (RLIMIT_CORE, &core_limit); #endif + CoreDump = TRUE; } - else if ( strcmp( argv[i], "-dpi") == 0) + else if ( strcmp( argv[i], "-nocursor") == 0) + { + EnableCursor = FALSE; + } + else if ( strcmp( argv[i], "-dpi") == 0) { if(++i < argc) monitorResolution = atoi(argv[i]); @@ -675,7 +674,7 @@ ProcessCommandLine(int argc, char *argv[]) } #ifdef DPMSExtension else if ( strcmp( argv[i], "dpms") == 0) - DPMSEnabledSwitch = TRUE; + /* ignored for compatibility */ ; else if ( strcmp( argv[i], "-dpms") == 0) DPMSDisabledSwitch = TRUE; #endif @@ -719,13 +718,11 @@ ProcessCommandLine(int argc, char *argv[]) UseMsg(); exit(0); } -#ifdef XKB else if ( (skip=XkbProcessArguments(argc,argv,i))!=0 ) { if (skip>0) i+= skip-1; else UseMsg(); } -#endif #ifdef RLIMIT_DATA else if ( strcmp( argv[i], "-ld") == 0) { @@ -888,14 +885,6 @@ ProcessCommandLine(int argc, char *argv[]) PanoramiXExtensionDisabledHack = TRUE; } #endif - else if ( strcmp( argv[i], "-x") == 0) - { - if(++i >= argc) - UseMsg(); - /* For U**x, which doesn't support dynamic loading, there's nothing - * to do when we see a -x. Either the extension is linked in or - * it isn't */ - } else if ( strcmp( argv[i], "-I") == 0) { /* ignore all remaining arguments */ @@ -1049,7 +1038,7 @@ set_font_authorizations(char **authorizations, int *authlen, pointer client) #ifndef INTERNAL_MALLOC -_X_EXPORT void * +void * Xalloc(unsigned long amount) { void *ptr; @@ -1068,7 +1057,7 @@ Xalloc(unsigned long amount) * "no failure" realloc *****************/ -_X_EXPORT void * +void * XNFalloc(unsigned long amount) { void *ptr; @@ -1087,7 +1076,7 @@ XNFalloc(unsigned long amount) * Xcalloc *****************/ -_X_EXPORT void * +void * Xcalloc(unsigned long amount) { void *ret; @@ -1102,7 +1091,7 @@ Xcalloc(unsigned long amount) * XNFcalloc *****************/ -_X_EXPORT void * +void * XNFcalloc(unsigned long amount) { void *ret; @@ -1119,7 +1108,7 @@ XNFcalloc(unsigned long amount) * Xrealloc *****************/ -_X_EXPORT void * +void * Xrealloc(pointer ptr, unsigned long amount) { if ((long)amount <= 0) @@ -1142,7 +1131,7 @@ Xrealloc(pointer ptr, unsigned long amount) * "no failure" realloc *****************/ -_X_EXPORT void * +void * XNFrealloc(pointer ptr, unsigned long amount) { if ((ptr = Xrealloc(ptr, amount)) == NULL) @@ -1158,7 +1147,7 @@ XNFrealloc(pointer ptr, unsigned long amount) * calls free *****************/ -_X_EXPORT void +void Xfree(pointer ptr) { if (ptr) @@ -1182,7 +1171,7 @@ Xstrdup(const char *s) } -_X_EXPORT char * +char * XNFstrdup(const char *s) { char *sd; @@ -1408,7 +1397,7 @@ Popen(char *command, char *type) if ((*type != 'r' && *type != 'w') || type[1]) return NULL; - if ((cur = (struct pid *)xalloc(sizeof(struct pid))) == NULL) + if ((cur = xalloc(sizeof(struct pid))) == NULL) return NULL; if (pipe(pdes) < 0) { @@ -1494,7 +1483,7 @@ Fopen(char *file, char *type) if ((*type != 'r' && *type != 'w') || type[1]) return NULL; - if ((cur = (struct pid *)xalloc(sizeof(struct pid))) == NULL) + if ((cur = xalloc(sizeof(struct pid))) == NULL) return NULL; if (pipe(pdes) < 0) { @@ -1613,7 +1602,7 @@ Pclose(pointer iop) return pid == -1 ? -1 : pstat; } -int +int Fclose(pointer iop) { #ifdef HAS_SAVED_IDS_AND_SETEUID |