aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/os/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/os/utils.c')
-rw-r--r--xorg-server/os/utils.c122
1 files changed, 55 insertions, 67 deletions
diff --git a/xorg-server/os/utils.c b/xorg-server/os/utils.c
index 2d73a0c2d..79cca1a3a 100644
--- a/xorg-server/os/utils.c
+++ b/xorg-server/os/utils.c
@@ -56,6 +56,10 @@ 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
@@ -114,85 +118,82 @@ __stdcall unsigned long GetTickCount(void);
#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>
@@ -214,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)
{
#ifdef X_NOT_POSIX
return signal(sig, handler);
@@ -414,8 +413,7 @@ UnlockServer(void)
/* Force connections to close on SIGHUP from init */
-/*ARGSUSED*/
-SIGVAL
+void
AutoResetServer (int sig)
{
int olderrno = errno;
@@ -427,8 +425,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;
@@ -439,13 +436,13 @@ GiveUp(int sig)
}
#if (defined WIN32 && defined __MINGW32__) || defined(__CYGWIN__)
-_X_EXPORT CARD32
+CARD32
GetTimeInMillis (void)
{
return GetTickCount ();
}
#else
-_X_EXPORT CARD32
+CARD32
GetTimeInMillis(void)
{
struct timeval tv;
@@ -461,7 +458,7 @@ GetTimeInMillis(void)
}
#endif
-_X_EXPORT void
+void
AdjustWaitForDelay (pointer waitTime, unsigned long newdelay)
{
static struct timeval delay_val;
@@ -498,10 +495,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");
@@ -549,7 +546,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");
@@ -562,9 +558,7 @@ void UseMsg(void)
#ifdef XDMCP
XdmcpUseMsg();
#endif
-#ifdef XKB
XkbUseMsg();
-#endif
ddxUseMsg();
}
@@ -672,15 +666,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]);
@@ -689,7 +687,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
@@ -733,13 +731,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)
{
@@ -902,14 +898,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 */
@@ -1063,7 +1051,7 @@ set_font_authorizations(char **authorizations, int *authlen, pointer client)
#ifndef INTERNAL_MALLOC
-_X_EXPORT void *
+void *
Xalloc(unsigned long amount)
{
void *ptr;
@@ -1082,7 +1070,7 @@ Xalloc(unsigned long amount)
* "no failure" realloc
*****************/
-_X_EXPORT void *
+void *
XNFalloc(unsigned long amount)
{
void *ptr;
@@ -1101,7 +1089,7 @@ XNFalloc(unsigned long amount)
* Xcalloc
*****************/
-_X_EXPORT void *
+void *
Xcalloc(unsigned long amount)
{
void *ret;
@@ -1116,7 +1104,7 @@ Xcalloc(unsigned long amount)
* XNFcalloc
*****************/
-_X_EXPORT void *
+void *
XNFcalloc(unsigned long amount)
{
void *ret;
@@ -1133,7 +1121,7 @@ XNFcalloc(unsigned long amount)
* Xrealloc
*****************/
-_X_EXPORT void *
+void *
Xrealloc(pointer ptr, unsigned long amount)
{
if ((long)amount <= 0)
@@ -1156,7 +1144,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)
@@ -1172,7 +1160,7 @@ XNFrealloc(pointer ptr, unsigned long amount)
* calls free
*****************/
-_X_EXPORT void
+void
Xfree(pointer ptr)
{
if (ptr)
@@ -1196,7 +1184,7 @@ Xstrdup(const char *s)
}
-_X_EXPORT char *
+char *
XNFstrdup(const char *s)
{
char *sd;
@@ -1422,7 +1410,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) {
@@ -1508,7 +1496,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) {
@@ -1627,7 +1615,7 @@ Pclose(pointer iop)
return pid == -1 ? -1 : pstat;
}
-int
+int
Fclose(pointer iop)
{
#ifdef HAS_SAVED_IDS_AND_SETEUID