diff options
Diffstat (limited to 'xorg-server/os')
-rw-r--r-- | xorg-server/os/Makefile.in | 35 | ||||
-rw-r--r-- | xorg-server/os/WaitFor.c | 15 | ||||
-rw-r--r-- | xorg-server/os/access.c | 21 | ||||
-rw-r--r-- | xorg-server/os/backtrace.c | 48 | ||||
-rw-r--r-- | xorg-server/os/connection.c | 44 | ||||
-rw-r--r-- | xorg-server/os/io.c | 35 | ||||
-rw-r--r-- | xorg-server/os/log.c | 27 | ||||
-rw-r--r-- | xorg-server/os/mitauth.c | 4 | ||||
-rw-r--r-- | xorg-server/os/osdep.h | 8 | ||||
-rw-r--r-- | xorg-server/os/osinit.c | 122 | ||||
-rw-r--r-- | xorg-server/os/rpcauth.c | 4 | ||||
-rw-r--r-- | xorg-server/os/utils.c | 122 | ||||
-rw-r--r-- | xorg-server/os/xdmauth.c | 8 | ||||
-rw-r--r-- | xorg-server/os/xdmcp.c | 9 |
14 files changed, 317 insertions, 185 deletions
diff --git a/xorg-server/os/Makefile.in b/xorg-server/os/Makefile.in index 14ece8f09..13a5d616a 100644 --- a/xorg-server/os/Makefile.in +++ b/xorg-server/os/Makefile.in @@ -42,8 +42,11 @@ host_triplet = @host@ subdir = os DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ + $(top_srcdir)/m4/dolt.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/shave.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -53,7 +56,8 @@ CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ - $(top_builddir)/include/kdrive-config.h + $(top_builddir)/include/kdrive-config.h \ + $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) @@ -99,6 +103,7 @@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ +AM_MAKEFLAGS = @AM_MAKEFLAGS@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_ID = @APPLE_APPLICATION_ID@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ @@ -119,9 +124,12 @@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CWARNFLAGS = @CWARNFLAGS@ +CXX = @CXX@ CYGPATH_W = @CYGPATH_W@ DARWIN_LIBS = @DARWIN_LIBS@ DBUS_CFLAGS = @DBUS_CFLAGS@ @@ -150,7 +158,9 @@ DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ +DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ +DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -159,9 +169,13 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +F77 = @F77@ +FC = @FC@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ @@ -200,12 +214,13 @@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ +MAIN_LIB = @MAIN_LIB@ +MAKEFLAGS = @MAKEFLAGS@ MAKEINFO = @MAKEINFO@ MAKE_HTML = @MAKE_HTML@ MAKE_PDF = @MAKE_PDF@ MAKE_PS = @MAKE_PS@ MAKE_TEXT = @MAKE_TEXT@ -MESA_SOURCE = @MESA_SOURCE@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ @@ -225,7 +240,6 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ @@ -235,6 +249,7 @@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ PROJECTROOT = @PROJECTROOT@ PS2PDF = @PS2PDF@ +Q = @Q@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ @@ -248,11 +263,10 @@ STRIP = @STRIP@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ -VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@ -VENDOR_NAME = @VENDOR_NAME@ +V = @V@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ -VENDOR_RELEASE = @VENDOR_RELEASE@ VERSION = @VERSION@ +WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ @@ -288,6 +302,7 @@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ +XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ @@ -312,7 +327,6 @@ YFLAGS = @YFLAGS@ __XCONFIGFILE__ = @__XCONFIGFILE__@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ -abi_font = @abi_font@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ abs_builddir = @abs_builddir@ @@ -335,6 +349,7 @@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ +distcleancheck_listfiles = @distcleancheck_listfiles@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ @@ -366,7 +381,9 @@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ +shavedir = @shavedir@ srcdir = @srcdir@ +symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ diff --git a/xorg-server/os/WaitFor.c b/xorg-server/os/WaitFor.c index 7235708f7..7199680cd 100644 --- a/xorg-server/os/WaitFor.c +++ b/xorg-server/os/WaitFor.c @@ -92,6 +92,8 @@ SOFTWARE. #define GetErrno() errno #endif +/* like ffs, but uses fd_mask instead of int as argument, so it works + when fd_mask is longer than an int, such as common 64-bit platforms */ /* modifications by raphael */ int mffs(fd_mask mask) @@ -109,8 +111,7 @@ mffs(fd_mask mask) } #ifdef DPMSExtension -#define DPMS_SERVER -#include <X11/extensions/dpms.h> +#include <X11/extensions/dpmsconst.h> #endif struct _OsTimerRec { @@ -342,7 +343,7 @@ WaitForSomething(int *pClientsReady) { int client_priority, client_index; - curclient = ffs (clientsReadable.fds_bits[i]) - 1; + curclient = mffs (clientsReadable.fds_bits[i]) - 1; client_index = /* raphael: modified */ ConnectionTranslation[curclient + (i * (sizeof(fd_mask) * 8))]; #else @@ -427,7 +428,7 @@ DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev) TimerSet(timer, 0, newTime, timer->callback, timer->arg); } -_X_EXPORT OsTimerPtr +OsTimerPtr TimerSet(OsTimerPtr timer, int flags, CARD32 millis, OsTimerCallback func, pointer arg) { @@ -436,7 +437,7 @@ TimerSet(OsTimerPtr timer, int flags, CARD32 millis, if (!timer) { - timer = (OsTimerPtr)xalloc(sizeof(struct _OsTimerRec)); + timer = xalloc(sizeof(struct _OsTimerRec)); if (!timer) return NULL; } @@ -498,7 +499,7 @@ TimerForce(OsTimerPtr timer) } -_X_EXPORT void +void TimerCancel(OsTimerPtr timer) { OsTimerPtr *prev; @@ -515,7 +516,7 @@ TimerCancel(OsTimerPtr timer) } } -_X_EXPORT void +void TimerFree(OsTimerPtr timer) { if (!timer) diff --git a/xorg-server/os/access.c b/xorg-server/os/access.c index 50fc5f9f2..8c5b50af0 100644 --- a/xorg-server/os/access.c +++ b/xorg-server/os/access.c @@ -216,7 +216,7 @@ typedef struct _host { int requested; } HOST; -#define MakeHost(h,l) (h)=(HOST *) xalloc(sizeof *(h)+(l));\ +#define MakeHost(h,l) (h)=xalloc(sizeof *(h)+(l));\ if (h) { \ (h)->addr=(unsigned char *) ((h) + 1);\ (h)->requested = FALSE; \ @@ -415,8 +415,7 @@ DefineSelf (int fd) */ if (family == FamilyInternet && !(len == 4 && - ((addr[0] == 127 && addr[1] == 0 && - addr[2] == 0 && addr[3] == 1) || + ((addr[0] == 127) || (addr[0] == 0 && addr[1] == 0 && addr[2] == 0 && addr[3] == 0))) ) @@ -1095,7 +1094,7 @@ ResetHosts (char *display) } /* Is client on the local host */ -_X_EXPORT Bool LocalClient(ClientPtr client) +Bool LocalClient(ClientPtr client) { int alen, family, notused; Xtransaddr *from = NULL; @@ -1109,12 +1108,12 @@ _X_EXPORT Bool LocalClient(ClientPtr client) &alen, (pointer *)&addr); if (family == -1) { - xfree ((char *) from); + xfree (from); return FALSE; } if (family == FamilyLocal) { - xfree ((char *) from); + xfree (from); return TRUE; } for (host = selfhosts; host; host = host->next) @@ -1122,7 +1121,7 @@ _X_EXPORT Bool LocalClient(ClientPtr client) if (addrEqual (family, addr, alen, host)) return TRUE; } - xfree ((char *) from); + xfree (from); } return FALSE; } @@ -1458,11 +1457,11 @@ GetHosts ( for (host = validhosts; host; host = host->next) { nHosts++; - n += (((host->len + 3) >> 2) << 2) + sizeof(xHostEntry); + n += pad_to_int32(host->len) + sizeof(xHostEntry); } if (n) { - *data = ptr = (pointer) xalloc (n); + *data = ptr = xalloc (n); if (!ptr) { return(BadAlloc); @@ -1474,7 +1473,7 @@ GetHosts ( ((xHostEntry *)ptr)->length = len; ptr += sizeof(xHostEntry); acopy (host->addr, ptr, len); - ptr += ((len + 3) >> 2) << 2; + ptr += pad_to_int32(len); } } else { *data = NULL; @@ -1721,7 +1720,7 @@ siTypeAdd(const char *typeName, siAddrMatchFunc addrMatch, } } - s = (struct siType *) xalloc(sizeof(struct siType)); + s = xalloc(sizeof(struct siType)); if (s == NULL) return BadAlloc; diff --git a/xorg-server/os/backtrace.c b/xorg-server/os/backtrace.c index b52dcded8..a421140fb 100644 --- a/xorg-server/os/backtrace.c +++ b/xorg-server/os/backtrace.c @@ -2,22 +2,23 @@ * Copyright 2008 Red Hat, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software") - * to deal in the software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * them Software is furnished to do so, subject to the following conditions: + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTIBILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H @@ -28,19 +29,30 @@ #include "misc.h" #ifdef HAVE_BACKTRACE +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#include <dlfcn.h> #include <execinfo.h> void xorg_backtrace(void) { - void *array[32]; /* deeper nesting than this means something's wrong */ - size_t size, i; - char **strings; + void *array[64]; + char *mod; + int size, i; + Dl_info info; ErrorF("\nBacktrace:\n"); - size = backtrace(array, 32); - strings = backtrace_symbols(array, size); - for (i = 0; i < size; i++) - ErrorF("%d: %s\n", i, strings[i]); - free(strings); + size = backtrace(array, 64); + for (i = 0; i < size; i++) { + dladdr(array[i], &info); + mod = (info.dli_fname && *info.dli_fname) ? info.dli_fname : "(vdso)"; + if (info.dli_saddr) + ErrorF("%d: %s (%s+0x%lx) [%p]\n", i, mod, + info.dli_sname, array[i] - info.dli_saddr, array[i]); + else + ErrorF("%d: %s (%p+0x%lx) [%p]\n", i, mod, + info.dli_fbase, array[i] - info.dli_fbase, array[i]); + } } #else /* not glibc or glibc < 2.1 */ diff --git a/xorg-server/os/connection.c b/xorg-server/os/connection.c index 9148b4ea8..eabfdaee0 100644 --- a/xorg-server/os/connection.c +++ b/xorg-server/os/connection.c @@ -150,7 +150,7 @@ Bool NewOutputPending; /* not yet attempted to write some new output */ Bool AnyClientsWriteBlocked; /* true if some client blocked on write */ static Bool RunFromSmartParent; /* send SIGUSR1 to parent process */ -Bool PartialNetwork; /* continue even if unable to bind all addrs */ +Bool PartialNetwork; /* continue even if unable to bind all addrs */ static Pid_t ParentProcess; static Bool debug_conns = FALSE; @@ -160,7 +160,7 @@ static fd_set GrabImperviousClients; static fd_set SavedAllClients; static fd_set SavedAllSockets; static fd_set SavedClientsWithInput; -_X_EXPORT int GrabInProgress = 0; +int GrabInProgress = 0; #if !defined(WIN32) int *ConnectionTranslation = NULL; @@ -176,7 +176,6 @@ int *ConnectionTranslation = NULL; #define MAXSOCKS 500 #undef MAXSELECT #define MAXSELECT 500 -#define MAXFD 500 struct _ct_node { struct _ct_node *next; @@ -231,7 +230,7 @@ void SetConnectionTranslation(int conn, int client) } node = &((*node)->next); } - *node = (struct _ct_node*)xalloc(sizeof(struct _ct_node)); + *node = xalloc(sizeof(struct _ct_node)); (*node)->next = NULL; (*node)->key = conn; (*node)->value = client; @@ -350,15 +349,6 @@ InitParentProcess(void) RunFromSmartParent = TRUE; OsSignal(SIGUSR1, handler); ParentProcess = getppid (); -#ifdef __UNIXOS2__ - /* - * fg030505: under OS/2, xinit is not the parent process but - * the "grant parent" process of the server because execvpe() - * presents us an additional process number; - * GetPPID(pid) is part of libemxfix - */ - ParentProcess = GetPPID (ParentProcess); -#endif /* __UNIXOS2__ */ #endif } @@ -411,7 +401,7 @@ CreateWellKnownSockets(void) } else { - ListenTransFds = (int *) xalloc (ListenTransCount * sizeof (int)); + ListenTransFds = xalloc (ListenTransCount * sizeof (int)); for (i = 0; i < ListenTransCount; i++) { @@ -649,7 +639,7 @@ AuthorizationIDOfClient(ClientPtr client) * *****************************************************************/ -char * +char * ClientAuthorized(ClientPtr client, unsigned int proto_n, char *auth_proto, unsigned int string_n, char *auth_string) @@ -693,7 +683,7 @@ ClientAuthorized(ClientPtr client, proto_n, auth_proto, auth_id); } - xfree ((char *) from); + xfree (from); } if (auth_id == (XID) ~0L) { @@ -715,7 +705,7 @@ ClientAuthorized(ClientPtr client, AuthAudit(client, TRUE, (struct sockaddr *) from, fromlen, proto_n, auth_proto, auth_id); - xfree ((char *) from); + xfree (from); } } priv->auth_id = auth_id; @@ -751,7 +741,7 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time) #endif ) return NullClient; - oc = (OsCommPtr)xalloc(sizeof(OsCommRec)); + oc = xalloc(sizeof(OsCommRec)); if (!oc) return NullClient; oc->trans_conn = trans_conn; @@ -841,7 +831,7 @@ EstablishNewConnections(ClientPtr clientUnused, pointer closure) int status; #ifndef WIN32 - curconn = ffs (readyconnections.fds_bits[i]) - 1; + curconn = mffs (readyconnections.fds_bits[i]) - 1; readyconnections.fds_bits[i] &= ~((fd_mask)1 << curconn); curconn += (i * (sizeof(fd_mask)*8)); #else @@ -1006,7 +996,7 @@ CheckConnections(void) mask = AllClients.fds_bits[i]; while (mask) { - curoff = ffs (mask) - 1; + curoff = mffs (mask) - 1; curclient = curoff + (i * (sizeof(fd_mask)*8)); FD_ZERO(&tmask); FD_SET(curclient, &tmask); @@ -1060,7 +1050,7 @@ CloseDownConnection(ClientPtr client) AuditF("client %d disconnected\n", client->index); } -_X_EXPORT void +void AddGeneralSocket(int fd) { FD_SET(fd, &AllSockets); @@ -1068,14 +1058,14 @@ AddGeneralSocket(int fd) FD_SET(fd, &SavedAllSockets); } -_X_EXPORT void +void AddEnabledDevice(int fd) { FD_SET(fd, &EnabledDevices); AddGeneralSocket(fd); } -_X_EXPORT void +void RemoveGeneralSocket(int fd) { FD_CLR(fd, &AllSockets); @@ -1083,7 +1073,7 @@ RemoveGeneralSocket(int fd) FD_CLR(fd, &SavedAllSockets); } -_X_EXPORT void +void RemoveEnabledDevice(int fd) { FD_CLR(fd, &EnabledDevices); @@ -1155,7 +1145,7 @@ ListenToAllClients(void) * Must have cooresponding call to AttendClient. ****************/ -_X_EXPORT void +void IgnoreClient (ClientPtr client) { OsCommPtr oc = (OsCommPtr)client->osPrivate; @@ -1190,7 +1180,7 @@ IgnoreClient (ClientPtr client) * Adds one client back into the input masks. ****************/ -_X_EXPORT void +void AttendClient (ClientPtr client) { OsCommPtr oc = (OsCommPtr)client->osPrivate; @@ -1264,7 +1254,7 @@ MakeClientGrabPervious(ClientPtr client) #ifdef XQUARTZ /* Add a fd (from launchd) to our listeners */ -_X_EXPORT void ListenOnOpenFD(int fd, int noxauth) { +void ListenOnOpenFD(int fd, int noxauth) { char port[256]; XtransConnInfo ciptr; diff --git a/xorg-server/os/io.c b/xorg-server/os/io.c index afe6d99d4..beccdf5b1 100644 --- a/xorg-server/os/io.c +++ b/xorg-server/os/io.c @@ -73,7 +73,6 @@ SOFTWARE. #include <sys/uio.h> #endif #include <X11/X.h> -#define NEED_REPLIES #include <X11/Xproto.h> #include "os.h" #include "osdep.h" @@ -82,8 +81,8 @@ SOFTWARE. #include "dixstruct.h" #include "misc.h" -_X_EXPORT CallbackListPtr ReplyCallback; -_X_EXPORT CallbackListPtr FlushCallback; +CallbackListPtr ReplyCallback; +CallbackListPtr FlushCallback; static ConnectionInputPtr AllocateInputBuffer(void); static ConnectionOutputPtr AllocateOutputBuffer(void); @@ -106,7 +105,7 @@ static OsCommPtr AvailableInput = (OsCommPtr)NULL; #define get_req_len(req,cli) ((cli)->swapped ? \ lswaps((req)->length) : (req)->length) -#include <X11/extensions/bigreqstr.h> +#include <X11/extensions/bigreqsproto.h> #define get_big_req_len(req,cli) ((cli)->swapped ? \ lswapl(((xBigReq *)(req))->length) : \ @@ -274,7 +273,7 @@ ReadRequestFromClient(ClientPtr client) if (gotnow < sizeof(xBigReq)) { /* Still need more data to tell just how big. */ - needed = sizeof(xBigReq) >> 2; /* needed is in CARD32s now */ + needed = bytes_to_int32(sizeof(xBigReq)); /* needed is in CARD32s now */ need_header = TRUE; } else @@ -378,7 +377,7 @@ ReadRequestFromClient(ClientPtr client) { move_header = TRUE; if (gotnow < sizeof(xBigReq)) - needed = sizeof(xBigReq) >> 2; + needed = bytes_to_int32(sizeof(xBigReq)); else needed = get_big_req_len(request, client); } @@ -446,7 +445,7 @@ ReadRequestFromClient(ClientPtr client) oci->bufptr += (sizeof(xBigReq) - sizeof(xReq)); *(xReq *)oci->bufptr = *request; oci->lenLastReq -= (sizeof(xBigReq) - sizeof(xReq)); - client->req_len -= (sizeof(xBigReq) - sizeof(xReq)) >> 2; + client->req_len -= bytes_to_int32(sizeof(xBigReq) - sizeof(xReq)); } client->requestBuffer = (pointer)oci->bufptr; #ifdef DEBUG_COMMUNICATION @@ -539,7 +538,7 @@ InsertFakeRequest(ClientPtr client, char *data, int count) * **********************/ -_X_EXPORT void +void ResetCurrentRequest(ClientPtr client) { OsCommPtr oc = (OsCommPtr)client->osPrivate; @@ -679,7 +678,7 @@ FlushIfCriticalOutputPending(void) FlushAllOutput(); } -_X_EXPORT void +void SetCriticalOutputPending(void) { CriticalOutputPending = TRUE; @@ -696,7 +695,7 @@ SetCriticalOutputPending(void) * this routine as int. *****************/ -_X_EXPORT int +int WriteToClient (ClientPtr who, int count, const void *__buf) { OsCommPtr oc = (OsCommPtr)who->osPrivate; @@ -1013,14 +1012,14 @@ AllocateInputBuffer(void) { ConnectionInputPtr oci; - oci = (ConnectionInputPtr)xalloc(sizeof(ConnectionInput)); + oci = xalloc(sizeof(ConnectionInput)); if (!oci) - return (ConnectionInputPtr)NULL; - oci->buffer = (char *)xalloc(BUFSIZE); + return NULL; + oci->buffer = xalloc(BUFSIZE); if (!oci->buffer) { xfree(oci); - return (ConnectionInputPtr)NULL; + return NULL; } oci->size = BUFSIZE; oci->bufptr = oci->buffer; @@ -1034,14 +1033,14 @@ AllocateOutputBuffer(void) { ConnectionOutputPtr oco; - oco = (ConnectionOutputPtr)xalloc(sizeof(ConnectionOutput)); + oco = xalloc(sizeof(ConnectionOutput)); if (!oco) - return (ConnectionOutputPtr)NULL; - oco->buf = (unsigned char *) xcalloc(1, BUFSIZE); + return NULL; + oco->buf = xcalloc(1, BUFSIZE); if (!oco->buf) { xfree(oco); - return (ConnectionOutputPtr)NULL; + return NULL; } oco->size = BUFSIZE; oco->count = 0; diff --git a/xorg-server/os/log.c b/xorg-server/os/log.c index ef34b1afe..75b3375c0 100644 --- a/xorg-server/os/log.c +++ b/xorg-server/os/log.c @@ -104,6 +104,10 @@ OR PERFORMANCE OF THIS SOFTWARE. #define S_ISREG(m) (((m)&_S_IFMT) == _S_IFREG) #endif +#ifdef XF86BIGFONT +#define _XF86BIGFONT_SERVER_ +#include <X11/extensions/xf86bigfont.h> +#endif #ifdef DDXOSVERRORF void (*OsVendorVErrorFProc)(const char *, va_list args) = NULL; @@ -255,7 +259,7 @@ LogSetParameter(LogParameter param, int value) /* This function does the actual log message writes. */ -_X_EXPORT void +void LogVWrite(int verb, const char *f, va_list args) { static char tmpBuffer[1024]; @@ -304,7 +308,7 @@ LogVWrite(int verb, const char *f, va_list args) } } -_X_EXPORT void +void LogWrite(int verb, const char *f, ...) { va_list args; @@ -314,7 +318,7 @@ LogWrite(int verb, const char *f, ...) va_end(args); } -_X_EXPORT void +void LogVMessageVerb(MessageType type, int verb, const char *format, va_list args) { const char *s = X_UNKNOWN_STRING; @@ -369,7 +373,7 @@ LogVMessageVerb(MessageType type, int verb, const char *format, va_list args) } /* Log message with verbosity level specified. */ -_X_EXPORT void +void LogMessageVerb(MessageType type, int verb, const char *format, ...) { va_list ap; @@ -380,7 +384,7 @@ LogMessageVerb(MessageType type, int verb, const char *format, ...) } /* Log a message with the standard verbosity level of 1. */ -_X_EXPORT void +void LogMessage(MessageType type, const char *format, ...) { va_list ap; @@ -397,6 +401,9 @@ void AbortServer(void) __attribute__((noreturn)); void AbortServer(void) { +#ifdef XF86BIGFONT + XF86BigfontCleanup(); +#endif CloseWellKnownConnections(); OsCleanup(TRUE); CloseDownDevices(); @@ -416,7 +423,7 @@ static int nrepeat = 0; static int oldlen = -1; static OsTimerPtr auditTimer = NULL; -void +void FreeAuditTimer(void) { if (auditTimer != NULL) { @@ -506,7 +513,7 @@ VAuditF(const char *f, va_list args) free(prefix); } -_X_EXPORT void +void FatalError(const char *f, ...) { va_list args; @@ -531,7 +538,7 @@ FatalError(const char *f, ...) /*NOTREACHED*/ } -_X_EXPORT void +void VErrorF(const char *f, va_list args) { #ifdef DDXOSVERRORF @@ -544,7 +551,7 @@ VErrorF(const char *f, va_list args) #endif } -_X_EXPORT void +void ErrorF(const char * f, ...) { va_list args; @@ -556,7 +563,7 @@ ErrorF(const char * f, ...) /* A perror() workalike. */ -_X_EXPORT void +void Error(char *str) { char *err = NULL; diff --git a/xorg-server/os/mitauth.c b/xorg-server/os/mitauth.c index db66c44fb..a7968cbd7 100644 --- a/xorg-server/os/mitauth.c +++ b/xorg-server/os/mitauth.c @@ -55,10 +55,10 @@ MitAddCookie ( { struct auth *new; - new = (struct auth *) xalloc (sizeof (struct auth)); + new = xalloc (sizeof (struct auth)); if (!new) return 0; - new->data = (char *) xalloc ((unsigned) data_length); + new->data = xalloc ((unsigned) data_length); if (!new->data) { xfree(new); return 0; diff --git a/xorg-server/os/osdep.h b/xorg-server/os/osdep.h index e719f9a70..3d75bbaab 100644 --- a/xorg-server/os/osdep.h +++ b/xorg-server/os/osdep.h @@ -56,7 +56,9 @@ SOFTWARE. #define BUFSIZE 4096 #define BUFWATERMARK 8192 +#if defined(XDMCP) || defined(HASXDMAUTH) #include <X11/Xdmcp.h> +#endif #ifdef _POSIX_SOURCE #include <limits.h> @@ -109,9 +111,11 @@ SOFTWARE. #include <stddef.h> +#if defined(XDMCP) || defined(HASXDMAUTH) typedef Bool (*ValidatorFunc)(ARRAY8Ptr Auth, ARRAY8Ptr Data, int packet_type); typedef Bool (*GeneratorFunc)(ARRAY8Ptr Auth, ARRAY8Ptr Data, int packet_type); typedef Bool (*AddAuthorFunc)(unsigned name_length, char *name, unsigned data_length, char *data); +#endif typedef struct _connectionInput { struct _connectionInput *next; @@ -204,7 +208,7 @@ extern Bool AnyClientsWriteBlocked; extern WorkQueuePtr workQueue; -/* added by raphael */ +/* in WaitFor.c */ #ifdef WIN32 typedef long int fd_mask; #endif @@ -244,6 +248,7 @@ extern int SecureRPCRemove (AuthRemCArgs); extern int SecureRPCReset (AuthRstCArgs); #endif +#ifdef XDMCP /* in xdmcp.c */ extern void XdmcpUseMsg (void); extern int XdmcpOptions(int argc, char **argv, int i); @@ -268,6 +273,7 @@ extern void XdmcpRegisterAuthentication ( struct sockaddr_in; extern void XdmcpRegisterBroadcastAddress (struct sockaddr_in *addr); +#endif #ifdef HASXDMAUTH extern void XdmAuthenticationInit (char *cookie, int cookie_length); diff --git a/xorg-server/os/osinit.c b/xorg-server/os/osinit.c index 49dfe4999..23a45e5b7 100644 --- a/xorg-server/os/osinit.c +++ b/xorg-server/os/osinit.c @@ -54,6 +54,15 @@ SOFTWARE. #include "os.h" #include "osdep.h" #include <X11/Xos.h> +#include <signal.h> +#include <errno.h> +#ifdef HAVE_DLFCN_H +# include <dlfcn.h> +#endif +#ifdef HAVE_BACKTRACE +#include <execinfo.h> +#endif + #include "dixstruct.h" @@ -88,6 +97,66 @@ int limitStackSpace = -1; int limitNoFile = -1; #endif +static OsSigWrapperPtr OsSigWrapper = NULL; + +OsSigWrapperPtr +OsRegisterSigWrapper(OsSigWrapperPtr newSigWrapper) +{ + OsSigWrapperPtr oldSigWrapper = OsSigWrapper; + + OsSigWrapper = newSigWrapper; + + return oldSigWrapper; +} + +/* + * OsSigHandler -- + * Catch unexpected signals and exit or continue cleanly. + */ +static void +#ifdef SA_SIGINFO +OsSigHandler(int signo, siginfo_t *sip, void *unused) +#else +OsSigHandler(int signo) +#endif +{ +#ifdef RTLD_DI_SETSIGNAL + const char *dlerr = dlerror(); + + if (dlerr) { + LogMessage(X_ERROR, "Dynamic loader error: %s\n", dlerr); + } +#endif /* RTLD_DI_SETSIGNAL */ + + if (OsSigWrapper != NULL) { + if (OsSigWrapper(signo) == 0) { + /* ddx handled signal and wants us to continue */ + return; + } + } + + /* log, cleanup, and abort */ + xorg_backtrace(); + +#ifdef SA_SIGINFO + if (sip->si_code == SI_USER) { + ErrorF("Recieved signal %d sent by process %ld, uid %ld\n", + signo, (long) sip->si_pid, (long) sip->si_uid); + } else { + switch (signo) { + case SIGSEGV: + case SIGBUS: + case SIGILL: + case SIGFPE: + ErrorF("%s at address %p\n", strsignal(signo), sip->si_addr); + } + } +#endif + + FatalError("Caught signal %d (%s). Server aborting\n", + signo, strsignal(signo)); +} + void OsInit(void) { @@ -96,11 +165,58 @@ OsInit(void) static char* devnull = "/dev/null"; char fname[PATH_MAX]; -#ifdef macII - set42sig(); + if (!been_here) { +#ifndef _MSC_VER + struct sigaction act, oact; + int i; + int siglist[] = { SIGSEGV, SIGQUIT, SIGILL, SIGFPE, SIGBUS, +#ifdef SIGSYS + SIGSYS, +#endif +#ifdef SIGXCPU + SIGXCPU, +#endif +#ifdef SIGXFSZ + SIGXFSZ, +#endif +#ifdef SIGEMT + SIGEMT, +#endif + 0 /* must be last */ }; + sigemptyset(&act.sa_mask); +#ifdef SA_SIGINFO + act.sa_sigaction = OsSigHandler; + act.sa_flags = SA_SIGINFO; +#else + act.sa_handler = OsSigHandler; + act.sa_flags = 0; +#endif + for (i = 0; siglist[i] != 0; i++) { + if (sigaction(siglist[i], &act, &oact)) { + ErrorF("failed to install signal handler for signal %d: %s\n", + siglist[i], strerror(errno)); + } + } +#ifdef HAVE_BACKTRACE + /* + * initialize the backtracer, since the ctor calls dlopen(), which + * calls malloc(), which isn't signal-safe. + */ + do { + void *array; + backtrace(&array, 1); + } while (0); #endif - if (!been_here) { +#ifdef RTLD_DI_SETSIGNAL + /* Tell runtime linker to send a signal we can catch instead of SIGKILL + * for failures to load libraries/modules at runtime so we can clean up + * after ourselves. + */ + int failure_signal = SIGQUIT; + dlinfo(RTLD_SELF, RTLD_DI_SETSIGNAL, &failure_signal); +#endif +#endif #if !defined(__SCO__) && !defined(__CYGWIN__) && !defined(__UNIXWARE__) fclose(stdin); fclose(stdout); diff --git a/xorg-server/os/rpcauth.c b/xorg-server/os/rpcauth.c index 1a27c5882..5ddbe210b 100644 --- a/xorg-server/os/rpcauth.c +++ b/xorg-server/os/rpcauth.c @@ -66,7 +66,7 @@ authdes_ezdecode(char *inmsg, int len) XDR xdr; SVCXPRT xprt; - temp_inmsg = (char *) xalloc(len); + temp_inmsg = xalloc(len); memmove(temp_inmsg, inmsg, len); memset((char *)&msg, 0, sizeof(msg)); @@ -79,7 +79,7 @@ authdes_ezdecode(char *inmsg, int len) why = AUTH_FAILED; xdrmem_create(&xdr, temp_inmsg, len, XDR_DECODE); - if ((r.rq_clntcred = (caddr_t) xalloc(MAX_AUTH_BYTES)) == NULL) + if ((r.rq_clntcred = xalloc(MAX_AUTH_BYTES)) == NULL) goto bad1; r.rq_xprt = &xprt; 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 diff --git a/xorg-server/os/xdmauth.c b/xorg-server/os/xdmauth.c index 8cbcd581f..e19e4f93d 100644 --- a/xorg-server/os/xdmauth.c +++ b/xorg-server/os/xdmauth.c @@ -259,7 +259,7 @@ XdmAuthorizationValidate (unsigned char *plain, int length, *reason = "Bad XDM authorization key length"; return NULL; } - client = (XdmClientAuthPtr) xalloc (sizeof (XdmClientAuthRec)); + client = xalloc (sizeof (XdmClientAuthRec)); if (!client) return NULL; XdmClientAuthDecode (plain, client); @@ -363,7 +363,7 @@ XdmAddCookie (unsigned short data_length, char *data, XID id) /* the first octet of the key must be zero */ if (key_bits[0] != '\0') return 0; - new = (XdmAuthorizationPtr) xalloc (sizeof (XdmAuthorizationRec)); + new = xalloc (sizeof (XdmAuthorizationRec)); if (!new) return 0; new->next = xdmAuth; @@ -385,7 +385,7 @@ XdmCheckCookie (unsigned short cookie_length, char *cookie, /* Auth packets must be a multiple of 8 bytes long */ if (cookie_length & 7) return (XID) -1; - plain = (unsigned char *) xalloc (cookie_length); + plain = xalloc (cookie_length); if (!plain) return (XID) -1; for (auth = xdmAuth; auth; auth=auth->next) { @@ -430,7 +430,7 @@ XdmToID (unsigned short cookie_length, char *cookie) XdmClientAuthPtr client; unsigned char *plain; - plain = (unsigned char *) xalloc (cookie_length); + plain = xalloc (cookie_length); if (!plain) return (XID) -1; for (auth = xdmAuth; auth; auth=auth->next) { diff --git a/xorg-server/os/xdmcp.c b/xorg-server/os/xdmcp.c index 746f5985c..c1d650d46 100644 --- a/xorg-server/os/xdmcp.c +++ b/xorg-server/os/xdmcp.c @@ -391,8 +391,7 @@ XdmcpRegisterAuthentication ( AuthenticationNames.length + 1) && XdmcpReallocARRAYofARRAY8 (&AuthenticationDatas, AuthenticationDatas.length + 1) && - (newFuncs = (AuthenticationFuncsPtr) xalloc ( - (AuthenticationNames.length + 1) * sizeof (AuthenticationFuncsRec))))) + (newFuncs = xalloc ((AuthenticationNames.length + 1) * sizeof (AuthenticationFuncsRec))))) { XdmcpDisposeARRAY8 (&AuthenticationName); XdmcpDisposeARRAY8 (&AuthenticationData); @@ -534,7 +533,7 @@ XdmcpRegisterAuthorization (char *name, int namelen) ARRAY8 authName; int i; - authName.data = (CARD8 *) xalloc (namelen * sizeof (CARD8)); + authName.data = xalloc (namelen * sizeof (CARD8)); if (!authName.data) return; if (!XdmcpReallocARRAYofARRAY8 (&AuthorizationNames, AuthorizationNames.length +1)) @@ -1592,9 +1591,7 @@ get_fromaddr_by_name( #if defined(IPv6) && defined(AF_INET6) static int -get_mcast_options(argc, argv, i) - int argc, i; - char **argv; +get_mcast_options(int argc, char **argv, int i) { char *address = XDM_DEFAULT_MCAST_ADDR6; int hopcount = 1; |