summaryrefslogtreecommitdiff
path: root/os
diff options
context:
space:
mode:
Diffstat (limited to 'os')
-rw-r--r--os/WaitFor.c3
-rw-r--r--os/access.c7
-rw-r--r--os/backtrace.c25
-rw-r--r--os/io.c8
-rw-r--r--os/osdep.h6
-rw-r--r--os/osinit.c14
-rw-r--r--os/utils.c5
7 files changed, 46 insertions, 22 deletions
diff --git a/os/WaitFor.c b/os/WaitFor.c
index 4b5952565..dfe85e515 100644
--- a/os/WaitFor.c
+++ b/os/WaitFor.c
@@ -111,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 {
diff --git a/os/access.c b/os/access.c
index 34478768b..8c5b50af0 100644
--- a/os/access.c
+++ b/os/access.c
@@ -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)))
)
@@ -1458,7 +1457,7 @@ 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)
{
@@ -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;
diff --git a/os/backtrace.c b/os/backtrace.c
index 3cfae3e16..a421140fb 100644
--- a/os/backtrace.c
+++ b/os/backtrace.c
@@ -29,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 */
+ void *array[64];
+ char *mod;
int size, i;
- char **strings;
+ 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/os/io.c b/os/io.c
index 45e193801..64b64ae75 100644
--- a/os/io.c
+++ b/os/io.c
@@ -105,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) : \
@@ -273,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
@@ -377,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);
}
@@ -445,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
diff --git a/os/osdep.h b/os/osdep.h
index b0d30e9ee..3d75bbaab 100644
--- a/os/osdep.h
+++ b/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;
@@ -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/os/osinit.c b/os/osinit.c
index 17a2bedc7..e8fcd4540 100644
--- a/os/osinit.c
+++ b/os/osinit.c
@@ -59,6 +59,10 @@ SOFTWARE.
#ifdef HAVE_DLFCN_H
# include <dlfcn.h>
#endif
+#ifdef HAVE_BACKTRACE
+#include <execinfo.h>
+#endif
+
#include "dixstruct.h"
@@ -192,6 +196,16 @@ OsInit(void)
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
#ifdef RTLD_DI_SETSIGNAL
/* Tell runtime linker to send a signal we can catch instead of SIGKILL
diff --git a/os/utils.c b/os/utils.c
index 00abd6396..3718b170c 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -482,7 +482,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("-cursor enable the cursor (default)\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");
@@ -666,10 +665,6 @@ ProcessCommandLine(int argc, char *argv[])
{
EnableCursor = FALSE;
}
- else if ( strcmp( argv[i], "-cursor") == 0)
- {
- EnableCursor = TRUE;
- }
else if ( strcmp( argv[i], "-dpi") == 0)
{
if(++i < argc)