diff options
author | marha <marha@users.sourceforge.net> | 2010-06-11 15:04:08 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2010-06-11 15:04:08 +0000 |
commit | f56cfbb54588917d9566277a669fa086a842b2f5 (patch) | |
tree | c96e64395853bcb39e04dd41bbfe7d27b673f0e1 /libX11/src | |
parent | 4c61bf84b11e26e6f22648668c95ea760a379163 (diff) | |
download | vcxsrv-f56cfbb54588917d9566277a669fa086a842b2f5.tar.gz vcxsrv-f56cfbb54588917d9566277a669fa086a842b2f5.tar.bz2 vcxsrv-f56cfbb54588917d9566277a669fa086a842b2f5.zip |
libX11 and libXext git update 11/6/2010
Diffstat (limited to 'libX11/src')
-rw-r--r-- | libX11/src/ClDisplay.c | 156 | ||||
-rw-r--r-- | libX11/src/ConnDis.c | 1251 | ||||
-rw-r--r-- | libX11/src/Makefile.am | 23 | ||||
-rw-r--r-- | libX11/src/OpenDis.c | 270 | ||||
-rw-r--r-- | libX11/src/Xintconn.h | 51 | ||||
-rw-r--r-- | libX11/src/XlibInt.c | 1540 | ||||
-rw-r--r-- | libX11/src/Xprivate.h | 8 | ||||
-rw-r--r-- | libX11/src/config.h.in | 231 | ||||
-rw-r--r-- | libX11/src/util/Makefile.am | 3 | ||||
-rw-r--r-- | libX11/src/x11_trans.c | 30 | ||||
-rw-r--r-- | libX11/src/xcms/Makefile.am | 1 | ||||
-rw-r--r-- | libX11/src/xkb/Makefile.am | 1 | ||||
-rw-r--r-- | libX11/src/xlibi18n/Makefile.am | 1 |
13 files changed, 127 insertions, 3439 deletions
diff --git a/libX11/src/ClDisplay.c b/libX11/src/ClDisplay.c index cc0e3315b..148284ff9 100644 --- a/libX11/src/ClDisplay.c +++ b/libX11/src/ClDisplay.c @@ -1,82 +1,74 @@ - -/* - -Copyright 1985, 1990, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice 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 -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP 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. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#if USE_XCB -#include "Xxcbint.h" -#else /* !USE_XCB */ -#include <X11/Xtrans/Xtrans.h> -#endif /* USE_XCB */ -#include "Xlib.h" -#include "Xlibint.h" -#include "Xintconn.h" - -/* - * XCloseDisplay - XSync the connection to the X Server, close the connection, - * and free all associated storage. Extension close procs should only free - * memory and must be careful about the types of requests they generate. - */ - -int -XCloseDisplay ( - register Display *dpy) -{ - register _XExtension *ext; - register int i; - - if (!(dpy->flags & XlibDisplayClosing)) - { - dpy->flags |= XlibDisplayClosing; - for (i = 0; i < dpy->nscreens; i++) { - register Screen *sp = &dpy->screens[i]; - XFreeGC (dpy, sp->default_gc); - } - if (dpy->cursor_font != None) { - XUnloadFont (dpy, dpy->cursor_font); - } - XSync(dpy, 1); /* throw away pending events, catch errors */ - /* call out to any extensions interested */ - for (ext = dpy->ext_procs; ext; ext = ext->next) { - if (ext->close_display) - (*ext->close_display)(dpy, &ext->codes); - } - /* if the closes generated more protocol, sync them up */ - if (dpy->request != dpy->last_request_read) - XSync(dpy, 1); - } -#if USE_XCB - xcb_disconnect(dpy->xcb->connection); -#else /* !USE_XCB */ - _XDisconnectDisplay(dpy->trans_conn); -#endif /* USE_XCB */ - _XFreeDisplayStructure (dpy); - return 0; -} +
+/*
+
+Copyright 1985, 1990, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice 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
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP 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.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include "Xxcbint.h"
+#include "Xlib.h"
+#include "Xlibint.h"
+#include "Xintconn.h"
+
+/*
+ * XCloseDisplay - XSync the connection to the X Server, close the connection,
+ * and free all associated storage. Extension close procs should only free
+ * memory and must be careful about the types of requests they generate.
+ */
+
+int
+XCloseDisplay (
+ register Display *dpy)
+{
+ register _XExtension *ext;
+ register int i;
+
+ if (!(dpy->flags & XlibDisplayClosing))
+ {
+ dpy->flags |= XlibDisplayClosing;
+ for (i = 0; i < dpy->nscreens; i++) {
+ register Screen *sp = &dpy->screens[i];
+ XFreeGC (dpy, sp->default_gc);
+ }
+ if (dpy->cursor_font != None) {
+ XUnloadFont (dpy, dpy->cursor_font);
+ }
+ XSync(dpy, 1); /* throw away pending events, catch errors */
+ /* call out to any extensions interested */
+ for (ext = dpy->ext_procs; ext; ext = ext->next) {
+ if (ext->close_display)
+ (*ext->close_display)(dpy, &ext->codes);
+ }
+ /* if the closes generated more protocol, sync them up */
+ if (dpy->request != dpy->last_request_read)
+ XSync(dpy, 1);
+ }
+ xcb_disconnect(dpy->xcb->connection);
+ _XFreeDisplayStructure (dpy);
+ return 0;
+}
diff --git a/libX11/src/ConnDis.c b/libX11/src/ConnDis.c deleted file mode 100644 index 4eb94f34d..000000000 --- a/libX11/src/ConnDis.c +++ /dev/null @@ -1,1251 +0,0 @@ -/*
-
-Copyright 1989, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice 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 MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP 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.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-*/
-
-/*
- * This file contains operating system dependencies.
- */
-
-#define NEED_EVENTS
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <X11/Xlibint.h>
-#include <X11/Xtrans/Xtrans.h>
-#include <X11/Xauth.h>
-#ifdef HASXDMAUTH
-#include <X11/Xdmcp.h>
-#endif
-#include <stdio.h>
-#include <ctype.h>
-#include <unistd.h>
-
-#if !defined(WIN32)
-#ifndef Lynx
-#include <sys/socket.h>
-#else
-#include <socket.h>
-#endif
-#else
-#include <X11/Xwindows.h>
-#endif
-
-#ifndef X_CONNECTION_RETRIES /* number retries on ECONNREFUSED */
-#define X_CONNECTION_RETRIES 5
-#endif
-
-#include "Xintconn.h"
-
-/* prototypes */
-static void GetAuthorization(
- XtransConnInfo trans_conn,
- int family,
- char *saddr,
- int saddrlen,
- int idisplay,
- char **auth_namep,
- int *auth_namelenp,
- char **auth_datap,
- int *auth_datalenp);
-
-/* functions */
-static char *copystring (const char *src, int len)
-{
- char *dst = Xmalloc (len + 1);
-
- if (dst) {
- strncpy (dst, src, len);
- dst[len] = '\0';
- }
-
- return dst;
-}
-
-#define Xstrdup(s) copystring(s, strlen(s))
-
-#ifdef TCPCONN
-# define TCP_TRANS "tcp"
-#endif
-#ifdef UNIXCONN
-# define UNIX_TRANS "unix"
-#endif
-#if defined(LOCALCONN) || defined(OS2PIPECONN)
-# define LOCAL_TRANS "local"
-#endif
-
-/*
- * Attempts to connect to server, given display name. Returns file descriptor
- * (network socket) or -1 if connection fails. Display names may be of the
- * following format:
- *
- * [protocol/] [hostname] : [:] displaynumber [.screennumber]
- *
- * A string with exactly two colons seperating hostname from the display
- * indicates a DECnet style name. Colons in the hostname may occur if an
- * IPv6 numeric address is used as the hostname. An IPv6 numeric address
- * may also end in a double colon, so three colons in a row indicates an
- * IPv6 address ending in :: followed by :display. To make it easier for
- * people to read, an IPv6 numeric address hostname may be surrounded by
- * [ ] in a similar fashion to the IPv6 numeric address URL syntax defined
- * by IETF RFC 2732.
- *
- * If no hostname and no protocol is specified, the string is interpreted
- * as the most efficient local connection to a server on the same machine.
- * This is usually:
- *
- * o shared memory
- * o local stream
- * o UNIX domain socket
- * o TCP to local host
- *
- * This function will eventually call the X Transport Interface functions
- * which expects the hostname in the format:
- *
- * [protocol/] [hostname] : [:] displaynumber
- *
- */
-XtransConnInfo
-_X11TransConnectDisplay (
- char *display_name,
- char **fullnamep, /* RETURN */
- int *dpynump, /* RETURN */
- int *screenp, /* RETURN */
- char **auth_namep, /* RETURN */
- int *auth_namelenp, /* RETURN */
- char **auth_datap, /* RETURN */
- int *auth_datalenp) /* RETURN */
-{
- int family;
- int saddrlen;
- Xtransaddr *saddr;
- char *lastp, *lastc, *p; /* char pointers */
- char *pprotocol = NULL; /* start of protocol name */
- char *phostname = NULL; /* start of host of display */
- char *pdpynum = NULL; /* start of dpynum of display */
- char *pscrnum = NULL; /* start of screen of display */
- Bool dnet = False; /* if true, then DECnet format */
- int idisplay = 0; /* required display number */
- int iscreen = 0; /* optional screen number */
- /* int (*connfunc)(); */ /* method to create connection */
- int len, hostlen; /* length tmp variable */
- int retry; /* retry counter */
- char addrbuf[128]; /* final address passed to
- X Transport Interface */
- char* address = addrbuf;
- XtransConnInfo trans_conn = NULL; /* transport connection object */
- int connect_stat;
-#if defined(LOCALCONN) || defined(UNIXCONN) || defined(TCPCONN)
- Bool reset_hostname = False; /* Reset hostname? */
- char *original_hostname = NULL;
- int local_transport_index = -1;
- const char *local_transport[] = { LOCAL_TRANSPORT_LIST, NULL };
-#endif
-
- p = display_name;
-
- saddrlen = 0; /* set so that we can clear later */
- saddr = NULL;
-
- /*
- * Step 0, find the protocol. This is delimited by the optional
- * slash ('/').
- */
- for (lastp = p; *p && *p != ':' && *p != '/'; p++) ;
- if (!*p) return NULL; /* must have a colon */
-
- if (p != lastp && *p != ':') { /* protocol given? */
- pprotocol = copystring (lastp, p - lastp);
- if (!pprotocol) goto bad; /* no memory */
- p++; /* skip the '/' */
- } else
- p = display_name; /* reset the pointer in
- case no protocol was given */
-
- /*
- * Step 1, find the hostname. This is delimited by either one colon,
- * or two colons in the case of DECnet (DECnet Phase V allows a single
- * colon in the hostname). (See note above regarding IPv6 numeric
- * addresses with triple colons or [] brackets.)
- */
-
- lastp = p;
- lastc = NULL;
- for (; *p; p++)
- if (*p == ':')
- lastc = p;
-
- if (!lastc) return NULL; /* must have a colon */
-
- if ((lastp != lastc) && (*(lastc - 1) == ':')
-#if defined(IPv6) && defined(AF_INET6)
- && ( ((lastc - 1) == lastp) || (*(lastc - 2) != ':'))
-#endif
- ) {
- /* DECnet display specified */
-
-#ifndef DNETCONN
- goto bad;
-#else
- dnet = True;
- /* override the protocol specified */
- if (pprotocol)
- Xfree (pprotocol);
- pprotocol = copystring ("dnet", 4);
- hostlen = lastc - 1 - lastp;
-#endif
- }
- else
- hostlen = lastc - lastp;
-
- if (hostlen > 0) { /* hostname given? */
- phostname = copystring (lastp, hostlen);
- if (!phostname) goto bad; /* no memory */
- }
-
- p = lastc;
-
-#if defined(LOCALCONN) || defined(UNIXCONN) || defined(TCPCONN)
- /* check if phostname == localnodename AND protocol not specified */
- if (!pprotocol && phostname) {
- char localhostname[256];
-
- if ((_XGetHostname (localhostname, sizeof localhostname) > 0)
- && (strcmp(phostname, localhostname) == 0)) {
- original_hostname = phostname;
- phostname = NULL;
- reset_hostname = True;
- }
- }
-#endif
-
-
- /*
- * Step 2, find the display number. This field is required and is
- * delimited either by a nul or a period, depending on whether or not
- * a screen number is present.
- */
-
- for (lastp = ++p; *p && isascii(*p) && isdigit(*p); p++) ;
- if ((p == lastp) || /* required field */
- (*p != '\0' && *p != '.') || /* invalid non-digit terminator */
- !(pdpynum = copystring (lastp, p - lastp))) /* no memory */
- goto bad;
- idisplay = atoi (pdpynum);
-
-
- /*
- * Step 3, find the screen number. This field is optional. It is
- * present only if the display number was followed by a period (which
- * we've already verified is the only non-nul character).
- */
-
- if (*p) {
- for (lastp = ++p; *p && isascii(*p) && isdigit (*p); p++) ;
- if (p != lastp) {
- if (*p || /* non-digits */
- !(pscrnum = copystring (lastp, p - lastp))) /* no memory */
- goto bad;
- iscreen = atoi (lastp);
- }
- }
-
- /*
- * At this point, we know the following information:
- *
- * pprotocol protocol string or NULL
- * phostname hostname string or NULL
- * idisplay display number
- * iscreen screen number
- * dnet DECnet boolean
- *
- * We can now decide which transport to use based on the defined
- * connection types and the hostname string.
- * If phostname & pprotocol are NULL, then choose the best transport.
- * If phostname is "unix" & pprotocol is NULL, then choose UNIX domain
- * sockets (if configured).
- */
-
-#if defined(TCPCONN) || defined(UNIXCONN) || defined(LOCALCONN) || defined(MNX_TCPCONN) || defined(OS2PIPECONN)
- if (!pprotocol) {
-#if defined(UNIXCONN)
- if (phostname && (strcmp (phostname, "unix") == 0)) {
- Xfree(pprotocol);
- pprotocol = copystring ("unix", 4);
- } else
-#endif
-#ifdef HAVE_LAUNCHD
- if (phostname && phostname[0]=='/') {
- pprotocol = copystring ("local", 5);
- }
-#endif
- if (!phostname)
- {
- if (local_transport[0] != NULL) {
- pprotocol = Xstrdup(local_transport[0]);
- local_transport_index = 0;
- }
- }
-
- if (!pprotocol) { /* if still not found one, tcp is our last resort */
- pprotocol = copystring ("tcp", 3);
- }
- }
-#endif
-
-
- connect:
- /*
- * This seems kind of backwards, but we need to put the protocol,
- * host, and port back together to pass to _X11TransOpenCOTSClient().
- */
-
- {
- int olen = 3 + (pprotocol ? strlen(pprotocol) : 0) +
- (phostname ? strlen(phostname) : 0) +
- (pdpynum ? strlen(pdpynum) : 0);
- if (olen > sizeof addrbuf) address = Xmalloc (olen);
- }
- if (!address) goto bad;
-
- sprintf(address,"%s/%s:%d",
- pprotocol ? pprotocol : "",
- phostname ? phostname : "",
- idisplay );
-
- /*
- * Make the connection, also need to get the auth address info for
- * the connection. Do retries in case server host has hit its
- * backlog (which, unfortunately, isn't distinguishable from there not
- * being a server listening at all, which is why we have to not retry
- * too many times).
- */
- for(retry=X_CONNECTION_RETRIES; retry>=0; retry-- )
- {
- if ( (trans_conn = _X11TransOpenCOTSClient(address)) == NULL )
- {
- break;
- }
- if ((connect_stat = _X11TransConnect(trans_conn,address)) < 0 )
- {
- _X11TransClose(trans_conn);
- trans_conn = NULL;
-
- if (connect_stat == TRANS_TRY_CONNECT_AGAIN)
- continue;
- else
- break;
- }
-
- _X11TransGetPeerAddr(trans_conn, &family, &saddrlen, &saddr);
-
- /*
- * The family is given in a socket format (ie AF_INET). This
- * will convert it to the format used by the authorization and
- * X protocol (ie FamilyInternet).
- */
-
- if( _X11TransConvertAddress(&family, &saddrlen, &saddr) < 0 )
- {
- _X11TransClose(trans_conn);
- trans_conn = NULL;
- if (saddr)
- {
- free ((char *) saddr);
- saddr = NULL;
- }
- continue;
- }
-
- break;
- }
-
- if (address != addrbuf) Xfree (address);
- address = addrbuf;
-
- if( trans_conn == NULL )
- goto bad;
-
- /*
- * Set close-on-exec so that programs that fork() doesn't get confused.
- */
-
- _X11TransSetOption(trans_conn,TRANS_CLOSEONEXEC,1);
-
- /*
- * Build the expanded display name:
- *
- * [host] : [:] dpy . scr \0
- */
-#if defined(LOCALCONN) || defined(TCPCONN) || defined(UNIXCONN)
- /*
- * If we computed the host name, get rid of it so that
- * XDisplayString() and XDisplayName() agree.
- */
- if (reset_hostname && (phostname != original_hostname)) {
- Xfree (phostname);
- phostname = original_hostname;
- original_hostname = NULL;
- }
-#endif
- len = ((phostname ? strlen(phostname) : 0) + 1 + (dnet ? 1 : 0) +
- strlen(pdpynum) + 1 + (pscrnum ? strlen(pscrnum) : 1) + 1);
- *fullnamep = (char *) Xmalloc (len);
- if (!*fullnamep) goto bad;
-
-#ifdef HAVE_LAUNCHD
- if (phostname && strlen(phostname) > 11 && !strncmp(phostname, "/tmp/launch", 11))
- sprintf (*fullnamep, "%s%s%d",
- (phostname ? phostname : ""),
- (dnet ? "::" : ":"),
- idisplay);
- else
-#endif
- sprintf (*fullnamep, "%s%s%d.%d",
- (phostname ? phostname : ""),
- (dnet ? "::" : ":"),
- idisplay, iscreen);
-
- *dpynump = idisplay;
- *screenp = iscreen;
- if (pprotocol) Xfree (pprotocol);
- if (phostname) Xfree (phostname);
- if (pdpynum) Xfree (pdpynum);
- if (pscrnum) Xfree (pscrnum);
-#if defined(LOCALCONN) || defined(UNIXCONN) || defined(TCPCONN)
- if (original_hostname) Xfree (original_hostname);
-#endif
-
- GetAuthorization(trans_conn, family, (char *) saddr, saddrlen, idisplay,
- auth_namep, auth_namelenp, auth_datap, auth_datalenp);
- return trans_conn;
-
-
- /*
- * error return; make sure everything is cleaned up.
- */
- bad:
- if (trans_conn) (void)_X11TransClose(trans_conn);
- if (saddr) free ((char *) saddr);
- if (pprotocol) Xfree (pprotocol);
- if (phostname) Xfree (phostname);
- if (address && address != addrbuf) { Xfree(address); address = addrbuf; }
-
-#if defined(LOCALCONN) || defined(UNIXCONN) || defined(TCPCONN)
- /* If connecting to the local machine, and we failed, try again with
- * the next transport type available, if there is one.
- */
- if (local_transport_index >= 0) {
- if (local_transport[++local_transport_index] != NULL) {
- pprotocol = Xstrdup(local_transport[local_transport_index]);
-#ifdef TCPCONN
- if (strcmp(pprotocol, "tcp") == 0) {
- if (original_hostname != NULL) {
- phostname = original_hostname;
- original_hostname = NULL;
- } else {
- phostname = copystring("localhost", 9);
- }
- } else
-#endif /* TCPCONN */
- {
- if ((phostname != NULL) && (original_hostname == NULL)) {
- original_hostname = phostname;
- }
- phostname = NULL;
- }
- goto connect;
- }
- }
-
- /* No more to try, we've failed all available local transports */
- if (original_hostname) Xfree(original_hostname);
-#endif /* LOCALCONN || UNIXCONN || TCPCONN */
-
- if (pdpynum) Xfree (pdpynum);
- if (pscrnum) Xfree (pscrnum);
- return NULL;
-
-}
-
-/*
- * This is gross, but we need it for compatiblity.
- * The test suite relies on the following interface.
- *
- */
-
-int _XConnectDisplay (
- char *display_name,
- char **fullnamep, /* RETURN */
- int *dpynump, /* RETURN */
- int *screenp, /* RETURN */
- char **auth_namep, /* RETURN */
- int *auth_namelenp, /* RETURN */
- char **auth_datap, /* RETURN */
- int *auth_datalenp) /* RETURN */
-{
- XtransConnInfo trans_conn;
-
- trans_conn = _X11TransConnectDisplay (
- display_name, fullnamep, dpynump, screenp,
- auth_namep, auth_namelenp, auth_datap, auth_datalenp);
-
- if (trans_conn)
- {
- int fd = _X11TransGetConnectionNumber (trans_conn);
- _X11TransFreeConnInfo (trans_conn);
- return (fd);
- }
- else
- return (-1);
-}
-
-
-/*****************************************************************************
- * *
- * Connection Utility Routines *
- * *
- *****************************************************************************/
-
-/*
- * Disconnect from server.
- */
-
-int _XDisconnectDisplay (XtransConnInfo trans_conn)
-{
- _X11TransDisconnect(trans_conn);
- _X11TransClose(trans_conn);
- return 0;
-}
-
-
-
-Bool
-_XSendClientPrefix(
- Display *dpy,
- xConnClientPrefix *client, /* contains count for auth_* */
- char *auth_proto, char *auth_string, /* NOT null-terminated */
- xConnSetupPrefix *prefix) /* prefix information */
-{
- int auth_length = client->nbytesAuthProto;
- int auth_strlen = client->nbytesAuthString;
- static char padbuf[3]; /* for padding to 4x bytes */
- int pad;
- struct iovec iovarray[5], *iov = iovarray;
- int niov = 0;
- int len = 0;
-
-#define add_to_iov(b,l) \
- { iov->iov_base = (b); iov->iov_len = (l); iov++, niov++; len += (l); }
-
- add_to_iov ((caddr_t) client, SIZEOF(xConnClientPrefix));
-
- /*
- * write authorization protocol name and data
- */
- if (auth_length > 0) {
- add_to_iov (auth_proto, auth_length);
- pad = -auth_length & 3; /* pad auth_length to a multiple of 4 */
- if (pad) add_to_iov (padbuf, pad);
- }
- if (auth_strlen > 0) {
- add_to_iov (auth_string, auth_strlen);
- pad = -auth_strlen & 3; /* pad auth_strlen to a multiple of 4 */
- if (pad) add_to_iov (padbuf, pad);
- }
-
-#undef add_to_iov
-
- len -= _X11TransWritev (dpy->trans_conn, iovarray, niov);
-
- /*
- * Set the connection non-blocking since we use select() to block.
- */
-
- _X11TransSetOption(dpy->trans_conn, TRANS_NONBLOCKING, 1);
-
- if (len != 0)
- return -1;
-
-#ifdef K5AUTH
- if (auth_length == 14 &&
- !strncmp(auth_proto, "MIT-KERBEROS-5", 14))
- {
- return k5_clientauth(dpy, prefix);
- } else
-#endif
- return 0;
-}
-
-
-#ifdef STREAMSCONN
-#ifdef SVR4
-#include <tiuser.h>
-#else
-#undef HASXDMAUTH
-#endif
-#endif
-
-#ifdef SECURE_RPC
-#include <rpc/rpc.h>
-#ifdef ultrix
-#include <time.h>
-#include <rpc/auth_des.h>
-#endif
-#endif
-
-#ifdef HASXDMAUTH
-#include <time.h>
-#define Time_t time_t
-#endif
-
-/*
- * First, a routine for setting authorization data
- */
-static int xauth_namelen = 0;
-static char *xauth_name = NULL; /* NULL means use default mechanism */
-static int xauth_datalen = 0;
-static char *xauth_data = NULL; /* NULL means get default data */
-
-/*
- * This is a list of the authorization names which Xlib currently supports.
- * Xau will choose the file entry which matches the earliest entry in this
- * array, allowing us to prioritize these in terms of the most secure first
- */
-
-static char *default_xauth_names[] = {
-#ifdef K5AUTH
- "MIT-KERBEROS-5",
-#endif
-#ifdef SECURE_RPC
- "SUN-DES-1",
-#endif
-#ifdef HASXDMAUTH
- "XDM-AUTHORIZATION-1",
-#endif
- "MIT-MAGIC-COOKIE-1"
-};
-
-static _Xconst int default_xauth_lengths[] = {
-#ifdef K5AUTH
- 14, /* strlen ("MIT-KERBEROS-5") */
-#endif
-#ifdef SECURE_RPC
- 9, /* strlen ("SUN-DES-1") */
-#endif
-#ifdef HASXDMAUTH
- 19, /* strlen ("XDM-AUTHORIZATION-1") */
-#endif
- 18 /* strlen ("MIT-MAGIC-COOKIE-1") */
-};
-
-#define NUM_DEFAULT_AUTH (sizeof (default_xauth_names) / sizeof (default_xauth_names[0]))
-
-static char **xauth_names = default_xauth_names;
-static _Xconst int *xauth_lengths = default_xauth_lengths;
-
-static int xauth_names_length = NUM_DEFAULT_AUTH;
-
-void XSetAuthorization (
- char *name, int namelen, /* *len are lengths of name and data */
- char *data, int datalen) /* name/data are NULL or arbitrary array of bytes */
-{
- char *tmpname, *tmpdata;
-
- _XLockMutex(_Xglobal_lock);
- if (xauth_name) Xfree (xauth_name); /* free any existing data */
- if (xauth_data) Xfree (xauth_data);
-
- xauth_name = xauth_data = NULL; /* mark it no longer valid */
- xauth_namelen = xauth_datalen = 0;
- _XUnlockMutex(_Xglobal_lock);
-
- if (namelen < 0) namelen = 0; /* check for bogus inputs */
- if (datalen < 0) datalen = 0; /* maybe should return? */
-
- if (namelen > 0) { /* try to allocate space */
- tmpname = Xmalloc ((unsigned) namelen);
- if (!tmpname) return;
- memcpy (tmpname, name, namelen);
- } else {
- tmpname = NULL;
- }
-
- if (datalen > 0) {
- tmpdata = Xmalloc ((unsigned) datalen);
- if (!tmpdata) {
- if (tmpname) (void) Xfree (tmpname);
- return;
- }
- memcpy (tmpdata, data, datalen);
- } else {
- tmpdata = NULL;
- }
-
- _XLockMutex(_Xglobal_lock);
- xauth_name = tmpname; /* and store the suckers */
- xauth_namelen = namelen;
- if (tmpname)
- {
- xauth_names = &xauth_name;
- xauth_lengths = &xauth_namelen;
- xauth_names_length = 1;
- }
- else
- {
- xauth_names = default_xauth_names;
- xauth_lengths = default_xauth_lengths;
- xauth_names_length = NUM_DEFAULT_AUTH;
- }
- xauth_data = tmpdata;
- xauth_datalen = datalen;
- _XUnlockMutex(_Xglobal_lock);
- return;
-}
-
-#ifdef SECURE_RPC
-/*
- * Create a credential that we can send to the X server.
- */
-static int
-auth_ezencode(
- char *servername,
- int window,
- char *cred_out,
- int *len)
-{
- AUTH *a;
- XDR xdr;
-
-#if defined(SVR4) && defined(sun)
- a = authdes_seccreate(servername, window, NULL, NULL);
-#else
- a = (AUTH *)authdes_create(servername, window, NULL, NULL);
-#endif
- if (a == (AUTH *)NULL) {
- perror("auth_create");
- return 0;
- }
- xdrmem_create(&xdr, cred_out, *len, XDR_ENCODE);
- if (AUTH_MARSHALL(a, &xdr) == FALSE) {
- perror("auth_marshall");
- AUTH_DESTROY(a);
- return 0;
- }
- *len = xdr_getpos(&xdr);
- AUTH_DESTROY(a);
- return 1;
-}
-#endif
-
-#ifdef K5AUTH
-#include <com_err.h>
-
-extern krb5_flags krb5_kdc_default_options;
-
-/*
- * k5_clientauth
- *
- * Returns non-zero if the setup prefix has been read,
- * so we can tell XOpenDisplay to not bother looking for it by
- * itself.
- */
-static int k5_clientauth(dpy, sprefix)
- Display *dpy;
- xConnSetupPrefix *sprefix;
-{
- krb5_error_code retval;
- xReq prefix;
- char *buf;
- CARD16 plen, tlen;
- krb5_data kbuf;
- krb5_ccache cc;
- krb5_creds creds;
- krb5_principal cprinc, sprinc;
- krb5_ap_rep_enc_part *repl;
-
- krb5_init_ets();
- /*
- * stage 0: get encoded principal and tgt from server
- */
- _XRead(dpy, (char *)&prefix, sz_xReq);
- if (prefix.reqType != 2 && prefix.reqType != 3)
- /* not an auth packet... so deal */
- if (prefix.reqType == 0 || prefix.reqType == 1)
- {
- memcpy((char *)sprefix, (char *)&prefix, sz_xReq);
- _XRead(dpy, (char *)sprefix + sz_xReq,
- sz_xConnSetupPrefix - sz_xReq); /* ewww... gross */
- return 1;
- }
- else
- {
- fprintf(stderr,
- "Xlib: Krb5 stage 0: got illegal connection setup success code %d\n",
- prefix.reqType);
- return -1;
- }
- if (prefix.data != 0)
- {
- fprintf(stderr, "Xlib: got out of sequence (%d) packet in Krb5 auth\n",
- prefix.data);
- return -1;
- }
- buf = (char *)malloc((prefix.length << 2) - sz_xReq);
- if (buf == NULL) /* malloc failed. Run away! */
- {
- fprintf(stderr, "Xlib: malloc bombed in Krb5 auth\n");
- return -1;
- }
- tlen = (prefix.length << 2) - sz_xReq;
- _XRead(dpy, buf, tlen);
- if (prefix.reqType == 2 && tlen < 6)
- {
- fprintf(stderr, "Xlib: Krb5 stage 0 reply from server too short\n");
- free(buf);
- return -1;
- }
- if (prefix.reqType == 2)
- {
- plen = *(CARD16 *)buf;
- kbuf.data = buf + 2;
- kbuf.length = (plen > tlen) ? tlen : plen;
- }
- else
- {
- kbuf.data = buf;
- kbuf.length = tlen;
- }
- if (XauKrb5Decode(kbuf, &sprinc))
- {
- free(buf);
- fprintf(stderr, "Xlib: XauKrb5Decode bombed\n");
- return -1;
- }
- if (prefix.reqType == 3) /* do some special stuff here */
- {
- char *sname, *hostname = NULL;
-
- sname = (char *)malloc(krb5_princ_component(sprinc, 0)->length + 1);
- if (sname == NULL)
- {
- free(buf);
- krb5_free_principal(sprinc);
- fprintf(stderr, "Xlib: malloc bombed in Krb5 auth\n");
- return -1;
- }
- memcpy(sname, krb5_princ_component(sprinc, 0)->data,
- krb5_princ_component(sprinc, 0)->length);
- sname[krb5_princ_component(sprinc, 0)->length] = '\0';
- krb5_free_principal(sprinc);
- if (dpy->display_name[0] != ':') /* hunt for a hostname */
- {
- char *t;
-
- if ((hostname = (char *)malloc(strlen(dpy->display_name)))
- == NULL)
- {
- free(buf);
- free(sname);
- fprintf(stderr, "Xlib: malloc bombed in Krb5 auth\n");
- return -1;
- }
- strcpy(hostname, dpy->display_name);
- t = strchr(hostname, ':');
- if (t == NULL)
- {
- free(buf);
- free(sname);
- free(hostname);
- fprintf(stderr,
- "Xlib: shouldn't get here! malformed display name.");
- return -1;
- }
- if ((t - hostname + 1 < strlen(hostname)) && t[1] == ':')
- t++;
- *t = '\0'; /* truncate the dpy number out */
- }
- retval = krb5_sname_to_principal(hostname, sname,
- KRB5_NT_SRV_HST, &sprinc);
- free(sname);
- if (hostname)
- free(hostname);
- if (retval)
- {
- free(buf);
- fprintf(stderr, "Xlib: krb5_sname_to_principal failed: %s\n",
- error_message(retval));
- return -1;
- }
- }
- if (retval = krb5_cc_default(&cc))
- {
- free(buf);
- krb5_free_principal(sprinc);
- fprintf(stderr, "Xlib: krb5_cc_default failed: %s\n",
- error_message(retval));
- return -1;
- }
- if (retval = krb5_cc_get_principal(cc, &cprinc))
- {
- free(buf);
- krb5_free_principal(sprinc);
- fprintf(stderr, "Xlib: cannot get Kerberos principal from \"%s\": %s\n",
- krb5_cc_default_name(), error_message(retval));
- return -1;
- }
- bzero((char *)&creds, sizeof(creds));
- creds.server = sprinc;
- creds.client = cprinc;
- if (prefix.reqType == 2)
- {
- creds.second_ticket.length = tlen - plen - 2;
- creds.second_ticket.data = buf + 2 + plen;
- retval = krb5_get_credentials(KRB5_GC_USER_USER |
- krb5_kdc_default_options,
- cc, &creds);
- }
- else
- retval = krb5_get_credentials(krb5_kdc_default_options,
- cc, &creds);
- if (retval)
- {
- free(buf);
- krb5_free_cred_contents(&creds);
- fprintf(stderr, "Xlib: cannot get Kerberos credentials: %s\n",
- error_message(retval));
- return -1;
- }
- /*
- * now format the ap_req to send to the server
- */
- if (prefix.reqType == 2)
- retval = krb5_mk_req_extended(AP_OPTS_USE_SESSION_KEY |
- AP_OPTS_MUTUAL_REQUIRED, NULL,
- 0, 0, NULL, cc,
- &creds, NULL, &kbuf);
- else
- retval = krb5_mk_req_extended(AP_OPTS_MUTUAL_REQUIRED, NULL,
- 0, 0, NULL, cc, &creds, NULL,
- &kbuf);
- free(buf);
- if (retval) /* Some manner of Kerberos lossage */
- {
- krb5_free_cred_contents(&creds);
- fprintf(stderr, "Xlib: krb5_mk_req_extended failed: %s\n",
- error_message(retval));
- return -1;
- }
- prefix.reqType = 1;
- prefix.data = 0;
- prefix.length = (kbuf.length + sz_xReq + 3) >> 2;
- /*
- * stage 1: send ap_req to server
- */
- _XSend(dpy, (char *)&prefix, sz_xReq);
- _XSend(dpy, (char *)kbuf.data, kbuf.length);
- free(kbuf.data);
- /*
- * stage 2: get ap_rep from server to mutually authenticate
- */
- _XRead(dpy, (char *)&prefix, sz_xReq);
- if (prefix.reqType != 2)
- if (prefix.reqType == 0 || prefix.reqType == 1)
- {
- memcpy((char *)sprefix, (char *)&prefix, sz_xReq);
- _XRead(dpy, (char *)sprefix + sz_xReq,
- sz_xConnSetupPrefix - sz_xReq);
- return 1;
- }
- else
- {
- fprintf(stderr,
- "Xlib: Krb5 stage 2: got illegal connection setup success code %d\n",
- prefix.reqType);
- return -1;
- }
- if (prefix.data != 2)
- return -1;
- kbuf.length = (prefix.length << 2) - sz_xReq;
- kbuf.data = (char *)malloc(kbuf.length);
- if (kbuf.data == NULL)
- {
- fprintf(stderr, "Xlib: malloc bombed in Krb5 auth\n");
- return -1;
- }
- _XRead(dpy, (char *)kbuf.data, kbuf.length);
- retval = krb5_rd_rep(&kbuf, &creds.keyblock, &repl);
- if (retval)
- {
- free(kbuf.data);
- fprintf(stderr, "Xlib: krb5_rd_rep failed: %s\n",
- error_message(retval));
- return -1;
- }
- free(kbuf.data);
- /*
- * stage 3: send a short ack to the server and return
- */
- prefix.reqType = 3;
- prefix.data = 0;
- prefix.length = sz_xReq >> 2;
- _XSend(dpy, (char *)&prefix, sz_xReq);
- return 0;
-}
-#endif /* K5AUTH */
-
-static void
-GetAuthorization(
- XtransConnInfo trans_conn,
- int family,
- char *saddr,
- int saddrlen,
- int idisplay,
- char **auth_namep, /* RETURN */
- int *auth_namelenp, /* RETURN */
- char **auth_datap, /* RETURN */
- int *auth_datalenp) /* RETURN */
-{
-#ifdef SECURE_RPC
- char rpc_cred[MAX_AUTH_BYTES];
-#endif
-#ifdef HASXDMAUTH
- unsigned char xdmcp_data[192/8];
-#endif
- char *auth_name;
- int auth_namelen;
- unsigned char *auth_data;
- int auth_datalen;
- Xauth *authptr = NULL;
-
-/*
- * Look up the authorization protocol name and data if necessary.
- */
- if (xauth_name && xauth_data) {
- auth_namelen = xauth_namelen;
- auth_name = xauth_name;
- auth_datalen = xauth_datalen;
- auth_data = (unsigned char *) xauth_data;
- } else {
- char dpynumbuf[40]; /* big enough to hold 2^64 and more */
- (void) sprintf (dpynumbuf, "%d", idisplay);
-
- authptr = XauGetBestAuthByAddr ((unsigned short) family,
- (unsigned short) saddrlen,
- saddr,
- (unsigned short) strlen (dpynumbuf),
- dpynumbuf,
- xauth_names_length,
- xauth_names,
- xauth_lengths);
- if (authptr) {
- auth_namelen = authptr->name_length;
- auth_name = (char *)authptr->name;
- auth_datalen = authptr->data_length;
- auth_data = (unsigned char *) authptr->data;
- } else {
- auth_namelen = 0;
- auth_name = NULL;
- auth_datalen = 0;
- auth_data = NULL;
- }
- }
-#ifdef HASXDMAUTH
- /*
- * build XDM-AUTHORIZATION-1 data
- */
- if (auth_namelen == 19 && !strncmp (auth_name, "XDM-AUTHORIZATION-1", 19))
- {
- int i, j;
- Time_t now;
- int family, addrlen;
- Xtransaddr *addr = NULL;
-
- for (j = 0; j < 8; j++)
- xdmcp_data[j] = auth_data[j];
-
- _X11TransGetMyAddr(trans_conn, &family, &addrlen, &addr);
-
- switch( family )
- {
-#ifdef AF_INET
- case AF_INET:
- {
- /*
- * addr will contain a sockaddr_in with all
- * of the members already in network byte order.
- */
-
- for(i=4; i<8; i++) /* do sin_addr */
- xdmcp_data[j++] = ((char *)addr)[i];
- for(i=2; i<4; i++) /* do sin_port */
- xdmcp_data[j++] = ((char *)addr)[i];
- break;
- }
-#endif /* AF_INET */
-#if defined(IPv6) && defined(AF_INET6)
- case AF_INET6:
- /* XXX This should probably never happen */
- {
- unsigned char ipv4mappedprefix[] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff };
-
- /* In the case of v4 mapped addresses send the v4
- part of the address - addr is already in network byte order */
- if (memcmp((char*)addr+8, ipv4mappedprefix, 12) == 0) {
- for (i = 20 ; i < 24; i++)
- xdmcp_data[j++] = ((char *)addr)[i];
-
- /* Port number */
- for (i=2; i<4; i++)
- xdmcp_data[j++] = ((char *)addr)[i];
- } else {
- /* Fake data to keep the data aligned. Otherwise the
- the server will bail about incorrect timing data */
- for (i = 0; i < 6; i++) {
- xdmcp_data[j++] = 0;
- }
- }
- break;
- }
-#endif /* AF_INET6 */
-#ifdef AF_UNIX
- case AF_UNIX:
- {
- /*
- * We don't use the sockaddr_un for this encoding.
- * Instead, we create a sockaddr_in filled with
- * a decreasing counter for the address, and the
- * pid for the port.
- */
-
- static unsigned long unix_addr = 0xFFFFFFFF;
- unsigned long the_addr;
- unsigned short the_port;
- unsigned long the_utime;
- struct timeval tp;
-
- X_GETTIMEOFDAY(&tp);
- _XLockMutex(_Xglobal_lock);
- the_addr = unix_addr--;
- _XUnlockMutex(_Xglobal_lock);
- the_utime = (unsigned long) tp.tv_usec;
- the_port = getpid ();
-
- xdmcp_data[j++] = (the_utime >> 24) & 0xFF;
- xdmcp_data[j++] = (the_utime >> 16) & 0xFF;
- xdmcp_data[j++] = ((the_utime >> 8) & 0xF0)
- | ((the_addr >> 8) & 0x0F);
- xdmcp_data[j++] = (the_addr >> 0) & 0xFF;
- xdmcp_data[j++] = (the_port >> 8) & 0xFF;
- xdmcp_data[j++] = (the_port >> 0) & 0xFF;
- break;
- }
-#endif /* AF_UNIX */
-#ifdef AF_DECnet
- case AF_DECnet:
- /*
- * What is the defined encoding for this?
- */
- break;
-#endif /* AF_DECnet */
- default:
- /*
- * Need to return some kind of errro status here.
- * maybe a NULL auth??
- */
- break;
- } /* switch */
-
- if (addr)
- free ((char *) addr);
-
- time (&now);
- xdmcp_data[j++] = (now >> 24) & 0xFF;
- xdmcp_data[j++] = (now >> 16) & 0xFF;
- xdmcp_data[j++] = (now >> 8) & 0xFF;
- xdmcp_data[j++] = (now >> 0) & 0xFF;
- while (j < 192 / 8)
- xdmcp_data[j++] = 0;
- _XLockMutex(_Xglobal_lock);
- /* this function might use static data, hence the lock around it */
- XdmcpWrap (xdmcp_data, auth_data + 8,
- xdmcp_data, j);
- _XUnlockMutex(_Xglobal_lock);
- auth_data = xdmcp_data;
- auth_datalen = j;
- }
-#endif /* HASXDMAUTH */
-#ifdef SECURE_RPC
- /*
- * The SUN-DES-1 authorization protocol uses the
- * "secure RPC" mechanism in SunOS 4.0+.
- */
- if (auth_namelen == 9 && !strncmp(auth_name, "SUN-DES-1", 9)) {
- char servernetname[MAXNETNAMELEN + 1];
-
- /*
- * Copy over the server's netname from the authorization
- * data field filled in by XauGetAuthByAddr().
- */
- if (auth_datalen > MAXNETNAMELEN) {
- auth_datalen = 0;
- auth_data = NULL;
- } else {
- memcpy(servernetname, auth_data, auth_datalen);
- servernetname[auth_datalen] = '\0';
-
- auth_datalen = sizeof (rpc_cred);
- if (auth_ezencode(servernetname, 100, rpc_cred,
- &auth_datalen))
- auth_data = (unsigned char *) rpc_cred;
- else {
- auth_datalen = 0;
- auth_data = NULL;
- }
- }
- }
-#endif
- if (saddr) free ((char *) saddr);
- if ((*auth_namelenp = auth_namelen))
- {
- if ((*auth_namep = Xmalloc(auth_namelen)))
- memcpy(*auth_namep, auth_name, auth_namelen);
- else
- *auth_namelenp = 0;
- }
- else
- *auth_namep = NULL;
- if ((*auth_datalenp = auth_datalen))
- {
- if ((*auth_datap = Xmalloc(auth_datalen)))
- memcpy(*auth_datap, auth_data, auth_datalen);
- else
- *auth_datalenp = 0;
- }
- else
- *auth_datap = NULL;
- if (authptr) XauDisposeAuth (authptr);
-}
diff --git a/libX11/src/Makefile.am b/libX11/src/Makefile.am index a433fa78a..d3ab2ecb3 100644 --- a/libX11/src/Makefile.am +++ b/libX11/src/Makefile.am @@ -3,7 +3,7 @@ XKB_SUBDIRS = xkb endif
SUBDIRS = util xcms xlibi18n $(XKB_SUBDIRS)
-lib_LTLIBRARIES=libX11.la
+lib_LTLIBRARIES = libX11.la libX11-xcb.la
BUILT_SOURCES=ks_tables.h
CLEANFILES=ks_tables.h ks_tables_h
@@ -21,7 +21,6 @@ AM_CPPFLAGS= \ AM_CFLAGS= \
$(X11_CFLAGS) \
$(BIGFONT_CFLAGS) \
- $(XDMCP_CFLAGS) \
$(XMALLOC_ZERO_CFLAGS) \
$(CWARNFLAGS)
@@ -312,6 +311,8 @@ libX11_la_SOURCES = \ WMProps.c \
WrBitF.c \
Xatomtype.h \
+ xcb_disp.c \
+ xcb_io.c \
Xintatom.h \
Xintconn.h \
XlibAsync.c \
@@ -320,7 +321,8 @@ libX11_la_SOURCES = \ XomGeneric.h \
Xresinternal.h \
Xrm.c \
- XrmI.h
+ XrmI.h \
+ Xxcbint.h
#
# ========================= Extra stuff ============================
@@ -347,21 +349,9 @@ EXTRA_DIST = \ udcInf.c \
UIThrStubs.c
-if XCB
-libX11_la_SOURCES += \
- xcb_disp.c \
- xcb_io.c \
- Xxcbint.h
-
-lib_LTLIBRARIES += libX11-xcb.la
libX11_xcb_la_SOURCES = x11_xcb.c Xxcbint.h
libX11_xcb_la_LDFLAGS = -version-info 1:0:0 -no-undefined
libX11_xcb_la_LIBADD = libX11.la
-else
-libX11_la_SOURCES += \
- ConnDis.c \
- x11_trans.c
-endif
#
# Figure out which sub-libraries to link into Xlib
@@ -385,8 +375,7 @@ libX11_la_LIBADD = \ $(USE_I18N_LIBS) \
$(USE_XCMS_LIBS) \
$(USE_XKB_LIBS) \
- $(X11_LIBS) \
- $(XDMCP_LIBS)
+ $(X11_LIBS)
preprocess: $(patsubst %.c,%.ii,$(libX11_la_SOURCES))
.c.ii:
diff --git a/libX11/src/OpenDis.c b/libX11/src/OpenDis.c index 02cdb260a..a642e3a8b 100644 --- a/libX11/src/OpenDis.c +++ b/libX11/src/OpenDis.c @@ -30,12 +30,7 @@ in this Software without prior written authorization from The Open Group. #include <config.h>
#endif
#include "Xlibint.h"
-#if USE_XCB
#include "Xxcbint.h"
-#else /* !USE_XCB */
-#include <X11/Xtrans/Xtrans.h>
-#include <X11/extensions/bigreqstr.h>
-#endif /* USE_XCB */
#include <X11/Xatom.h>
#include <X11/Xresource.h>
#include <stdio.h>
@@ -45,21 +40,6 @@ in this Software without prior written authorization from The Open Group. #include "XKBlib.h"
#endif /* XKB */
-#if !USE_XCB
-#ifdef X_NOT_POSIX
-#define Size_t unsigned int
-#else
-#define Size_t size_t
-#endif
-
-#define bignamelen (sizeof(XBigReqExtensionName) - 1)
-
-typedef struct {
- unsigned long seq;
- int opcode;
-} _XBigReqState;
-#endif /* !USE_XCB */
-
#ifdef XTHREADS
#include "locking.h"
int (*_XInitDisplayLock_fn)(Display *dpy) = NULL;
@@ -76,11 +56,7 @@ static xReq _dummy_request = { 0, 0, 0
};
-static void OutOfMemory(Display *dpy, char *setup);
-#if !USE_XCB
-static Bool _XBigReqHandler(Display *dpy, xReply *rep, char *buf, int len,
- XPointer data);
-#endif /* !USE_XCB */
+static void OutOfMemory(Display *dpy);
/*
* Connects to a server, creates a Display object and returns a pointer to
@@ -94,14 +70,6 @@ XOpenDisplay ( register int i;
int j, k; /* random iterator indexes */
char *display_name; /* pointer to display name */
-#if !USE_XCB
- int endian; /* to determine which endian. */
- xConnClientPrefix client; /* client information */
- int idisplay; /* display number */
- int prefixread = 0; /* setup prefix already read? */
- char *conn_auth_name, *conn_auth_data;
- int conn_auth_namelen, conn_auth_datalen;
-#endif /* !USE_XCB */
char *setup = NULL; /* memory allocated at startup */
char *fullname = NULL; /* expanded name of display */
int iscreen; /* screen number */
@@ -122,11 +90,6 @@ XOpenDisplay ( long int conn_buf_size;
char *xlib_buffer_size;
-#if !USE_XCB
- bzero((char *) &client, sizeof(client));
- bzero((char *) &prefix, sizeof(prefix));
-#endif /* !USE_XCB */
-
/*
* If the display specifier string supplied as an argument to this
* routine is NULL or a pointer to NULL, read the DISPLAY variable.
@@ -162,7 +125,6 @@ XOpenDisplay ( * will set fullname to point to the expanded name.
*/
-#if USE_XCB
if(!_XConnectXCB(dpy, display, &fullname, &iscreen)) {
/* Try falling back on other transports if no transport specified */
const char *slash = strrchr(display_name, '/');
@@ -183,22 +145,10 @@ XOpenDisplay ( }
dpy->display_name = fullname;
- OutOfMemory(dpy, NULL);
+ OutOfMemory(dpy);
return NULL;
}
fallback_success:
-#else /* !USE_XCB */
- if ((dpy->trans_conn = _X11TransConnectDisplay (
- display_name, &fullname, &idisplay,
- &iscreen, &conn_auth_name,
- &conn_auth_namelen, &conn_auth_data,
- &conn_auth_datalen)) == NULL) {
- Xfree ((char *) dpy);
- return(NULL);
- }
-
- dpy->fd = _X11TransGetConnectionNumber (dpy->trans_conn);
-#endif /* USE_XCB */
/* Initialize as much of the display structure as we can.
* Initialize pointers to NULL so that XFreeDisplayStructure will
@@ -274,12 +224,12 @@ fallback_success: /* Initialize the display lock */
if (InitDisplayLock(dpy) != 0) {
- OutOfMemory (dpy, setup);
+ OutOfMemory (dpy);
return(NULL);
}
if (!_XPollfdCacheInit(dpy)) {
- OutOfMemory (dpy, setup);
+ OutOfMemory (dpy);
return(NULL);
}
@@ -305,14 +255,11 @@ fallback_success: conn_buf_size = XLIBMINBUFSIZE;
if ((dpy->bufptr = dpy->buffer = Xcalloc(1, conn_buf_size)) == NULL) {
- OutOfMemory (dpy, setup);
+ OutOfMemory (dpy);
return(NULL);
}
- dpy->bufmax = dpy->buffer + conn_buf_size;
-#if USE_XCB
- dpy->xcb->real_bufmax = dpy->bufmax;
+ dpy->xcb->real_bufmax = dpy->buffer + conn_buf_size;
dpy->bufmax = dpy->buffer;
-#endif
/* Set up the input event queue and input event queue parameters. */
dpy->head = dpy->tail = NULL;
@@ -322,68 +269,10 @@ fallback_success: if ((dpy->free_funcs = (_XFreeFuncRec *)Xcalloc(1,
sizeof(_XFreeFuncRec)))
== NULL) {
- OutOfMemory (dpy, setup);
- return(NULL);
- }
-
-#if !USE_XCB
-/*
- * The xConnClientPrefix describes the initial connection setup information
- * and is followed by the authorization information. Sites that are interested
- * in security are strongly encouraged to use an authentication and
- * authorization system such as Kerberos.
- */
- endian = 1;
- if (*(char *) &endian)
- client.byteOrder = '\154'; /* 'l' */
- else
- client.byteOrder = '\102'; /* 'B' */
- client.majorVersion = X_PROTOCOL;
- client.minorVersion = X_PROTOCOL_REVISION;
- client.nbytesAuthProto = conn_auth_namelen;
- client.nbytesAuthString = conn_auth_datalen;
- prefixread = _XSendClientPrefix(dpy, &client,
- conn_auth_name, conn_auth_data,
- &prefix);
- if (prefixread < 0)
- {
- _XDisconnectDisplay (dpy->trans_conn);
- Xfree ((char *)dpy);
- return(NULL);
- }
- if (conn_auth_name) Xfree(conn_auth_name);
- if (conn_auth_data) Xfree(conn_auth_data);
-/*
- * Now see if connection was accepted...
- */
- /* these internal functions expect the display to be locked */
- LockDisplay(dpy);
-
- if (prefixread == 0)
- _XRead (dpy, (char *)&prefix,(long)SIZEOF(xConnSetupPrefix));
-
- /* an Authenticate reply we weren't expecting? */
- if (prefix.success != xTrue && prefix.success != xFalse) {
- fprintf (stderr,
- "Xlib: unexpected connection setup reply from server, type %d.\r\n",
- prefix.success);
- _XDisconnectDisplay (dpy->trans_conn);
- Xfree ((char *)dpy);
- return(NULL);
- }
-
- if (prefix.majorVersion != X_PROTOCOL) {
- /* XXX - printing messages marks a bad programming interface */
- fprintf (stderr,
- "Xlib: client uses different protocol version (%d) than server (%d)!\r\n",
- X_PROTOCOL, prefix.majorVersion);
- _XDisconnectDisplay (dpy->trans_conn);
- Xfree ((char *)dpy);
+ OutOfMemory (dpy);
return(NULL);
}
-#endif /* !USE_XCB */
-#if USE_XCB
{
const struct xcb_setup_t *xcbsetup = xcb_get_setup(dpy->xcb->connection);
memcpy(&prefix, xcbsetup, sizeof(prefix));
@@ -392,38 +281,6 @@ fallback_success: setup += SIZEOF(xConnSetupPrefix);
u.setup = (xConnSetup *) setup;
}
-#else /* !USE_XCB */
- setuplength = prefix.length << 2;
- if ( (u.setup = (xConnSetup *)
- (setup = Xmalloc ((unsigned) setuplength))) == NULL) {
- _XDisconnectDisplay (dpy->trans_conn);
- Xfree ((char *)dpy);
- return(NULL);
- }
- _XRead (dpy, (char *)u.setup, setuplength);
-
-/*
- * If the connection was not accepted by the server due to problems,
- * give error message to the user....
- */
- if (prefix.success != xTrue) {
- /* XXX - printing messages marks a bad programming interface */
- fprintf (stderr,
- "Xlib: connection to \"%s\" refused by server\r\nXlib: ",
- fullname);
-
- if (prefix.lengthReason > setuplength) {
- fprintf (stderr, "Xlib: Broken initial reply: length of reason > length of packet\r\n");
- }else{
- (void) fwrite (u.failure, (Size_t)sizeof(char),
- (Size_t)prefix.lengthReason, stderr);
- (void) fwrite ("\r\n", sizeof(char), 2, stderr);
- }
-
- OutOfMemory(dpy, setup);
- return (NULL);
- }
-#endif /* USE_XCB */
/*
* Check if the reply was long enough to get any information out of it.
@@ -431,7 +288,7 @@ fallback_success: usedbytes = sz_xConnSetup;
if (setuplength < usedbytes ) {
fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength);
- OutOfMemory(dpy, setup);
+ OutOfMemory(dpy);
return (NULL);
}
@@ -460,7 +317,7 @@ fallback_success: {
fprintf (stderr, "Xlib: connection to \"%s\" invalid setup\n",
fullname);
- OutOfMemory(dpy, setup);
+ OutOfMemory(dpy);
return (NULL);
}
@@ -475,13 +332,13 @@ fallback_success: */
/* Check for a sane vendor string length */
if (u.setup->nbytesVendor > 256) {
- OutOfMemory(dpy, setup);
+ OutOfMemory(dpy);
return (NULL);
}
dpy->vendor = (char *) Xmalloc((unsigned) (u.setup->nbytesVendor + 1));
if (dpy->vendor == NULL) {
- OutOfMemory(dpy, setup);
+ OutOfMemory(dpy);
return (NULL);
}
vendorlen = u.setup->nbytesVendor;
@@ -492,7 +349,7 @@ fallback_success: usedbytes += (vendorlen + 3) & ~3;
if (setuplength < usedbytes) {
fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength);
- OutOfMemory(dpy, setup);
+ OutOfMemory(dpy);
return (NULL);
}
@@ -509,7 +366,7 @@ fallback_success: (ScreenFormat *)Xmalloc(
(unsigned) (dpy->nformats *sizeof(ScreenFormat)));
if (dpy->pixmap_format == NULL) {
- OutOfMemory (dpy, setup);
+ OutOfMemory (dpy);
return(NULL);
}
/*
@@ -519,7 +376,7 @@ fallback_success: if (setuplength < usedbytes) {
fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength);
- OutOfMemory (dpy, setup);
+ OutOfMemory (dpy);
return(NULL);
}
@@ -538,7 +395,7 @@ fallback_success: dpy->screens =
(Screen *)Xmalloc((unsigned) dpy->nscreens*sizeof(Screen));
if (dpy->screens == NULL) {
- OutOfMemory (dpy, setup);
+ OutOfMemory (dpy);
return(NULL);
}
@@ -552,7 +409,7 @@ fallback_success: usedbytes += sz_xWindowRoot;
if (setuplength < usedbytes) {
fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength);
- OutOfMemory (dpy, setup);
+ OutOfMemory (dpy);
return(NULL);
}
@@ -581,7 +438,7 @@ fallback_success: sp->depths = (Depth *)Xmalloc(
(unsigned)sp->ndepths*sizeof(Depth));
if (sp->depths == NULL) {
- OutOfMemory (dpy, setup);
+ OutOfMemory (dpy);
return(NULL);
}
/*
@@ -593,7 +450,7 @@ fallback_success: usedbytes += sz_xDepth;
if (setuplength < usedbytes) {
fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength);
- OutOfMemory (dpy, setup);
+ OutOfMemory (dpy);
return(NULL);
}
@@ -604,7 +461,7 @@ fallback_success: dp->visuals =
(Visual *)Xmalloc((unsigned)dp->nvisuals*sizeof(Visual));
if (dp->visuals == NULL) {
- OutOfMemory (dpy, setup);
+ OutOfMemory (dpy);
return(NULL);
}
for (k = 0; k < dp->nvisuals; k++) {
@@ -613,7 +470,7 @@ fallback_success: usedbytes += sz_xVisualType;
if (setuplength < usedbytes) {
fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength);
- OutOfMemory (dpy, setup);
+ OutOfMemory (dpy);
return(NULL);
}
@@ -646,7 +503,7 @@ fallback_success: fprintf(stderr, "Xlib: Did not parse entire setup message: "
"parsed: %ld, message: %ld\n",
usedbytes, setuplength);
- OutOfMemory(dpy, setup);
+ OutOfMemory(dpy);
return(NULL);
}
@@ -654,30 +511,17 @@ fallback_success: * Now start talking to the server to setup all other information...
*/
-#if !USE_XCB
- Xfree (setup); /* all finished with setup information */
-#endif /* !USE_XCB */
-
/*
* Make sure default screen is legal.
*/
if (iscreen >= dpy->nscreens) {
- OutOfMemory(dpy, (char *) NULL);
+ OutOfMemory(dpy);
return(NULL);
}
-#if !USE_XCB
-/*
- * finished calling internal routines, now unlock for external routines
- */
- UnlockDisplay(dpy);
-#endif /* !USE_XCB */
-
-#if USE_XCB
dpy->bigreq_size = xcb_get_maximum_request_length(dpy->xcb->connection);
if(dpy->bigreq_size <= dpy->max_request_size)
dpy->bigreq_size = 0;
-#endif /* USE_XCB */
/*
* Set up other stuff clients are always going to use.
@@ -690,7 +534,7 @@ fallback_success: if ((sp->default_gc = XCreateGC (dpy, sp->root,
GCForeground|GCBackground,
&values)) == NULL) {
- OutOfMemory(dpy, (char *) NULL);
+ OutOfMemory(dpy);
return (NULL);
}
}
@@ -708,24 +552,6 @@ fallback_success: {
xGetPropertyReply reply;
xGetPropertyReq *req;
-#if !USE_XCB
- _XAsyncHandler async;
- _XBigReqState async_state;
- xQueryExtensionReq *qreq;
- xBigReqEnableReq *breq;
- xBigReqEnableReply brep;
-
- GetReq(QueryExtension, qreq);
- async_state.seq = dpy->request;
- async_state.opcode = 0;
- async.next = dpy->async_handlers;
- async.handler = _XBigReqHandler;
- async.data = (XPointer)&async_state;
- dpy->async_handlers = &async;
- qreq->nbytes = bignamelen;
- qreq->length += (bignamelen+3)>>2;
- Data(dpy, XBigReqExtensionName, bignamelen);
-#endif /* !USE_XCB */
GetReq (GetProperty, req);
req->window = RootWindow(dpy, 0);
@@ -746,16 +572,6 @@ fallback_success: else if (reply.propertyType != None)
_XEatData(dpy, reply.nItems * (reply.format >> 3));
}
-#if !USE_XCB
- DeqAsyncHandler(dpy, &async);
- if (async_state.opcode) {
- GetReq(BigReqEnable, breq);
- breq->reqType = async_state.opcode;
- breq->brReqType = X_BigReqEnable;
- if (_XReply(dpy, (xReply *)&brep, 0, xFalse))
- dpy->bigreq_size = brep.max_request_size;
- }
-#endif /* !USE_XCB */
}
UnlockDisplay(dpy);
@@ -774,35 +590,6 @@ fallback_success: return(dpy);
}
-#if !USE_XCB
-static Bool
-_XBigReqHandler(
- register Display *dpy,
- register xReply *rep,
- char *buf,
- int len,
- XPointer data)
-{
- _XBigReqState *state;
- xQueryExtensionReply replbuf;
- xQueryExtensionReply *repl;
-
- state = (_XBigReqState *)data;
- if (dpy->last_request_read != state->seq)
- return False;
- if (rep->generic.type == X_Error)
- return True;
- repl = (xQueryExtensionReply *)
- _XGetAsyncReply(dpy, (char *)&replbuf, rep, buf, len,
- (SIZEOF(xQueryExtensionReply) - SIZEOF(xReply)) >> 2,
- True);
- if (repl->present)
- state->opcode = repl->major_opcode;
- return True;
-}
-#endif /* !USE_XCB */
-
-
/* XFreeDisplayStructure frees all the storage associated with a
* Display. It is used by XOpenDisplay if it runs out of memory,
* and also by XCloseDisplay. It needs to check whether all pointers
@@ -938,9 +725,7 @@ void _XFreeDisplayStructure(Display *dpy) if (dpy->filedes)
Xfree (dpy->filedes);
-#if USE_XCB
_XFreeX11XCBStructure(dpy);
-#endif /* USE_XCB */
Xfree ((char *)dpy);
}
@@ -948,16 +733,9 @@ void _XFreeDisplayStructure(Display *dpy) /* OutOfMemory is called if malloc fails. XOpenDisplay returns NULL
after this returns. */
-static void OutOfMemory(Display *dpy, char *setup)
+static void OutOfMemory(Display *dpy)
{
-#if USE_XCB
if(dpy->xcb->connection)
xcb_disconnect(dpy->xcb->connection);
-#else /* !USE_XCB */
- _XDisconnectDisplay (dpy->trans_conn);
-#endif /* USE_XCB */
_XFreeDisplayStructure (dpy);
-#if !USE_XCB
- if (setup) Xfree (setup);
-#endif /* !USE_XCB */
}
diff --git a/libX11/src/Xintconn.h b/libX11/src/Xintconn.h index ee975ac44..c51e3c721 100644 --- a/libX11/src/Xintconn.h +++ b/libX11/src/Xintconn.h @@ -1,37 +1,14 @@ - -#ifndef _XINTCONN_H_ -#define _XINTCONN_H_ 1 - -#include <X11/Xfuncproto.h> - -_XFUNCPROTOBEGIN - -#if !USE_XCB -/* ConnDis.c */ - -int _XConnectDisplay ( - char *display_name, - char **fullnamep, /* RETURN */ - int *dpynump, /* RETURN */ - int *screenp, /* RETURN */ - char **auth_namep, /* RETURN */ - int *auth_namelenp, /* RETURN */ - char **auth_datap, /* RETURN */ - int *auth_datalenp); /* RETURN */ -extern int _XDisconnectDisplay(XtransConnInfo trans_conn); -extern Bool _XSendClientPrefix(Display *dpy, xConnClientPrefix *client, - char *auth_proto, char *auth_string, - xConnSetupPrefix *prefix); -extern XtransConnInfo _X11TransConnectDisplay(char *display_name, - char **fullnamep, int *dpynump, - int *screenp, char **auth_namep, - int *auth_namelenp, char **auth_datap, - int *auth_datalenp); -#endif /* !USE_XCB */ - -/* OpenDis.c */ -extern void _XFreeDisplayStructure(Display *dpy); - -_XFUNCPROTOEND - -#endif /* _XINTCONN_H_ */ +
+#ifndef _XINTCONN_H_
+#define _XINTCONN_H_ 1
+
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+/* OpenDis.c */
+extern void _XFreeDisplayStructure(Display *dpy);
+
+_XFUNCPROTOEND
+
+#endif /* _XINTCONN_H_ */
diff --git a/libX11/src/XlibInt.c b/libX11/src/XlibInt.c index ce62ae36d..9ce5a43ef 100644 --- a/libX11/src/XlibInt.c +++ b/libX11/src/XlibInt.c @@ -42,10 +42,6 @@ from The Open Group. #include "Xlibint.h"
#include "Xprivate.h"
#include <X11/Xpoll.h>
-#if !USE_XCB
-#include <X11/Xtrans/Xtrans.h>
-#include <X11/extensions/xcmiscstr.h>
-#endif /* !USE_XCB */
#include <assert.h>
#include <stdio.h>
#ifdef WIN32
@@ -78,24 +74,7 @@ xthread_t (*_Xthread_self_fn)(void) = NULL; #define XThread_Self() ((*_Xthread_self_fn)())
-#if !USE_XCB
-#define UnlockNextReplyReader(d) if ((d)->lock) \
- (*(d)->lock->pop_reader)((d),&(d)->lock->reply_awaiters,&(d)->lock->reply_awaiters_tail)
-
-#define QueueReplyReaderLock(d) ((d)->lock ? \
- (*(d)->lock->push_reader)(d,&(d)->lock->reply_awaiters_tail) : NULL)
-#define QueueEventReaderLock(d) ((d)->lock ? \
- (*(d)->lock->push_reader)(d,&(d)->lock->event_awaiters_tail) : NULL)
-#endif /* !USE_XCB */
-
-#else /* XTHREADS else */
-
-#if !USE_XCB
-#define UnlockNextReplyReader(d)
-#define UnlockNextEventReader(d)
-#endif /* !USE_XCB */
-
-#endif /* XTHREADS else */
+#endif /* XTHREADS */
/* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX
* systems are broken and return EWOULDBLOCK when they should return EAGAIN
@@ -144,50 +123,10 @@ xthread_t (*_Xthread_self_fn)(void) = NULL; #endif
#ifdef __UNIXOS2__
-#if !USE_XCB
-#define select(n,r,w,x,t) os2ClientSelect(n,r,w,x,t)
-#endif /* !USE_XCB */
#include <limits.h>
#define MAX_PATH _POSIX_PATH_MAX
#endif
-#if !USE_XCB
-#ifdef MUSTCOPY
-
-#define STARTITERATE(tpvar,type,start,endcond) \
- { register char *cpvar; \
- for (cpvar = (char *) (start); endcond; ) { \
- type dummy; memcpy ((char *) &dummy, cpvar, SIZEOF(type)); \
- tpvar = &dummy;
-#define ITERPTR(tpvar) cpvar
-#define RESETITERPTR(tpvar,type,start) cpvar = start
-#define INCITERPTR(tpvar,type) cpvar += SIZEOF(type)
-#define ENDITERATE }}
-
-#else
-
-#define STARTITERATE(tpvar,type,start,endcond) \
- for (tpvar = (type *) (start); endcond; )
-#define ITERPTR(tpvar) (char *)tpvar
-#define RESETITERPTR(tpvar,type,start) tpvar = (type *) (start)
-#define INCITERPTR(tpvar,type) tpvar++
-#define ENDITERATE
-
-#endif /* MUSTCOPY */
-
-typedef union {
- xReply rep;
- char buf[BUFSIZE];
-} _XAlignedBuffer;
-
-static char *_XAsyncReply(
- Display *dpy,
- register xReply *rep,
- char *buf,
- register int *lenp,
- Bool discard);
-#endif /* !USE_XCB */
-
/*
* The following routines are internal routines used by Xlib for protocol
* packet transmission and reception.
@@ -206,163 +145,6 @@ static char *_XAsyncReply( * the object they have created.
*/
-#if !USE_XCB
-static xReq _dummy_request = {
- 0, 0, 0
-};
-
-/*
- * This is an OS dependent routine which:
- * 1) returns as soon as the connection can be written on....
- * 2) if the connection can be read, must enqueue events and handle errors,
- * until the connection is writable.
- */
-static void
-_XWaitForWritable(
- Display *dpy
-#ifdef XTHREADS
- ,
- xcondition_t cv /* our reading condition variable */
-#endif
- )
-{
-#ifdef USE_POLL
- struct pollfd filedes;
-#else
- fd_set r_mask;
- fd_set w_mask;
-#endif
- int nfound;
-
-#ifdef USE_POLL
- filedes.fd = dpy->fd;
- filedes.events = 0;
-#else
- FD_ZERO(&r_mask);
- FD_ZERO(&w_mask);
-#endif
-
- for (;;) {
-#ifdef XTHREADS
- /* We allow only one thread at a time to read, to minimize
- passing of read data between threads.
- Now, who is it? If there is a non-NULL reply_awaiters and
- we (i.e., our cv) are not at the head of it, then whoever
- is at the head is the reader, and we don't read.
- Otherwise there is no reply_awaiters or we are at the
- head, having just appended ourselves.
- In this case, if there is a event_awaiters, then whoever
- is at the head of it got there before we did, and they are the
- reader.
-
- Last cases: no event_awaiters and we are at the head of
- reply_awaiters or reply_awaiters is NULL: we are the reader,
- since there is obviously no one else involved.
-
- XXX - what if cv is NULL and someone else comes along after
- us while we are waiting?
- */
-
- if (!dpy->lock ||
- (!dpy->lock->event_awaiters &&
- (!dpy->lock->reply_awaiters ||
- dpy->lock->reply_awaiters->cv == cv)))
-#endif
-#ifdef USE_POLL
- filedes.events = POLLIN;
- filedes.events |= POLLOUT;
-#else
- FD_SET(dpy->fd, &r_mask);
- FD_SET(dpy->fd, &w_mask);
-#endif
-
- do {
- UnlockDisplay(dpy);
-#ifdef USE_POLL
- nfound = poll (&filedes, 1, -1);
-#else
- nfound = Select (dpy->fd + 1, &r_mask, &w_mask, NULL, NULL);
-#endif
- InternalLockDisplay(dpy, cv != NULL);
- if (nfound < 0 && !(ECHECK(EINTR) || ETEST()))
- _XIOError(dpy);
- } while (nfound <= 0);
-
- if (
-#ifdef USE_POLL
- filedes.revents & POLLIN
-#else
- FD_ISSET(dpy->fd, &r_mask)
-#endif
- )
- {
- _XAlignedBuffer buf;
- BytesReadable_t pend;
- register int len;
- register xReply *rep;
-
- /* find out how much data can be read */
- if (_X11TransBytesReadable(dpy->trans_conn, &pend) < 0)
- _XIOError(dpy);
- len = pend;
-
- /* must read at least one xEvent; if none is pending, then
- we'll just block waiting for it */
- if (len < SIZEOF(xReply)
-#ifdef XTHREADS
- || dpy->async_handlers
-#endif
- )
- len = SIZEOF(xReply);
-
- /* but we won't read more than the max buffer size */
- if (len > BUFSIZE) len = BUFSIZE;
-
- /* round down to an integral number of XReps */
- len = (len / SIZEOF(xReply)) * SIZEOF(xReply);
-
- (void) _XRead (dpy, buf.buf, (long) len);
-
- STARTITERATE(rep,xReply,buf.buf,len > 0) {
- if (rep->generic.type == X_Reply) {
- int tmp = len;
- RESETITERPTR(rep,xReply,
- _XAsyncReply (dpy, rep,
- ITERPTR(rep), &tmp, True));
- len = tmp;
- pend = len;
- } else {
- if (rep->generic.type == X_Error)
- _XError (dpy, (xError *)rep);
- else /* must be an event packet */
- _XEnq (dpy, (xEvent *)rep);
- INCITERPTR(rep,xReply);
- len -= SIZEOF(xReply);
- }
- } ENDITERATE
-#ifdef XTHREADS
- if (dpy->lock && dpy->lock->event_awaiters)
- ConditionSignal(dpy, dpy->lock->event_awaiters->cv);
-#endif
- }
-#ifdef USE_POLL
- if (filedes.revents & (POLLOUT|POLLHUP|POLLERR))
-#else
- if (FD_ISSET(dpy->fd, &w_mask))
-#endif
- {
-#ifdef XTHREADS
- if (dpy->lock) {
- ConditionBroadcast(dpy, dpy->lock->writers);
- }
-#endif
- return;
- }
- }
-}
-#endif /* !USE_XCB */
-
-
#define POLLFD_CACHE_SIZE 5
/* initialize the struct array passed to poll() below */
@@ -418,138 +200,6 @@ void _XPollfdCacheDel( #endif
}
-#if !USE_XCB
-/* returns True iff there is an event in the queue newer than serial_num */
-
-static Bool
-_XNewerQueuedEvent(
- Display *dpy,
- int serial_num)
-{
- _XQEvent *qev;
-
- if (dpy->next_event_serial_num == serial_num)
- return False;
-
- qev = dpy->head;
- while (qev) {
- if (qev->qserial_num >= serial_num) {
- return True;
- }
- qev = qev->next;
- }
- return False;
-}
-
-static int
-_XWaitForReadable(
- Display *dpy)
-{
- int result;
- int fd = dpy->fd;
- struct _XConnectionInfo *ilist;
- register int saved_event_serial = 0;
- int in_read_events = 0;
- register Bool did_proc_conni = False;
-#ifdef USE_POLL
- struct pollfd *filedes;
-#else
- fd_set r_mask;
- int highest_fd = fd;
-#endif
-
-#ifdef USE_POLL
- if (dpy->im_fd_length + 1 > POLLFD_CACHE_SIZE
- && !(dpy->flags & XlibDisplayProcConni)) {
- /* XXX - this fallback is gross */
- int i;
-
- filedes = (struct pollfd *)Xmalloc(dpy->im_fd_length * sizeof(struct pollfd));
- filedes[0].fd = fd;
- filedes[0].events = POLLIN;
- for (ilist=dpy->im_fd_info, i=1; ilist; ilist=ilist->next, i++) {
- filedes[i].fd = ilist->fd;
- filedes[i].events = POLLIN;
- }
- } else {
- filedes = (struct pollfd *)dpy->filedes;
- }
-#else
- FD_ZERO(&r_mask);
-#endif
- for (;;) {
-#ifndef USE_POLL
- FD_SET(fd, &r_mask);
- if (!(dpy->flags & XlibDisplayProcConni))
- for (ilist=dpy->im_fd_info; ilist; ilist=ilist->next) {
- FD_SET(ilist->fd, &r_mask);
- if (ilist->fd > highest_fd)
- highest_fd = ilist->fd;
- }
-#endif
- UnlockDisplay(dpy);
-#ifdef USE_POLL
- result = poll(filedes,
- (dpy->flags & XlibDisplayProcConni) ? 1 : 1+dpy->im_fd_length,
- -1);
-#else
- result = Select(highest_fd + 1, &r_mask, NULL, NULL, NULL);
-#endif
- InternalLockDisplay(dpy, dpy->flags & XlibDisplayReply);
- if (result == -1 && !(ECHECK(EINTR) || ETEST())) _XIOError(dpy);
- if (result <= 0)
- continue;
-#ifdef USE_POLL
- if (filedes[0].revents & (POLLIN|POLLHUP|POLLERR))
-#else
- if (FD_ISSET(fd, &r_mask))
-#endif
- break;
- if (!(dpy->flags & XlibDisplayProcConni)) {
- int i;
-
- saved_event_serial = dpy->next_event_serial_num;
- /* dpy flags can be clobbered by internal connection callback */
- in_read_events = dpy->flags & XlibDisplayReadEvents;
- for (ilist=dpy->im_fd_info, i=1; ilist; ilist=ilist->next, i++) {
-#ifdef USE_POLL
- if (filedes[i].revents & POLLIN)
-#else
- if (FD_ISSET(ilist->fd, &r_mask))
-#endif
- {
- _XProcessInternalConnection(dpy, ilist);
- did_proc_conni = True;
- }
- }
-#ifdef USE_POLL
- if (dpy->im_fd_length + 1 > POLLFD_CACHE_SIZE)
- Xfree(filedes);
-#endif
- }
- if (did_proc_conni) {
- /* some internal connection callback might have done an
- XPutBackEvent. We notice it here and if we needed an event,
- we can return all the way. */
- if (_XNewerQueuedEvent(dpy, saved_event_serial)
- && (in_read_events
-#ifdef XTHREADS
- || (dpy->lock && dpy->lock->event_awaiters)
-#endif
- ))
- return -2;
- did_proc_conni = False;
- }
- }
-#ifdef XTHREADS
-#ifdef XTHREADS_DEBUG
- printf("thread %x _XWaitForReadable returning\n", XThread_Self());
-#endif
-#endif
- return 0;
-}
-#endif /* !USE_XCB */
-
static int sync_hazard(Display *dpy)
{
unsigned long span = dpy->request - dpy->last_request_read;
@@ -625,548 +275,6 @@ void _XSetSeqSyncFunction(Display *dpy) _XSetPrivSyncFunction (dpy);
}
-#if !USE_XCB
-#ifdef XTHREADS
-static void _XFlushInt(
- register Display *dpy,
- register xcondition_t cv);
-#endif
-
-/*
- * _XFlush - Flush the X request buffer. If the buffer is empty, no
- * action is taken. This routine correctly handles incremental writes.
- * This routine may have to be reworked if int < long.
- */
-void _XFlush(
- register Display *dpy)
-{
-#ifdef XTHREADS
- /* With multi-threading we introduce an internal routine to which
- we can pass a condition variable to do locking correctly. */
-
- _XFlushInt(dpy, NULL);
-}
-
-/* _XFlushInt - Internal version of _XFlush used to do multi-threaded
- * locking correctly.
- */
-
-static void _XFlushInt(
- register Display *dpy,
- register xcondition_t cv)
-{
-#endif /* XTHREADS*/
- register long size, todo;
- register int write_stat;
- register char *bufindex;
- _XExtension *ext;
-
- /* This fix resets the bufptr to the front of the buffer so
- * additional appends to the bufptr will not corrupt memory. Since
- * the server is down, these appends are no-op's anyway but
- * callers of _XFlush() are not verifying this before they call it.
- */
- if (dpy->flags & XlibDisplayIOError)
- {
- dpy->bufptr = dpy->buffer;
- dpy->last_req = (char *)&_dummy_request;
- return;
- }
-
-#ifdef XTHREADS
- while (dpy->flags & XlibDisplayWriting) {
- if (dpy->lock) {
- ConditionWait(dpy, dpy->lock->writers);
- } else {
- _XWaitForWritable (dpy, cv);
- }
- }
-#endif
- size = todo = dpy->bufptr - dpy->buffer;
- if (!size) return;
-#ifdef XTHREADS
- dpy->flags |= XlibDisplayWriting;
- /* make sure no one else can put in data */
- dpy->bufptr = dpy->bufmax;
-#endif
- for (ext = dpy->flushes; ext; ext = ext->next_flush)
- (*ext->before_flush)(dpy, &ext->codes, dpy->buffer, size);
- bufindex = dpy->buffer;
- /*
- * While write has not written the entire buffer, keep looping
- * until the entire buffer is written. bufindex will be
- * incremented and size decremented as buffer is written out.
- */
- while (size) {
- ESET(0);
- write_stat = _X11TransWrite(dpy->trans_conn,
- bufindex, (int) todo);
- if (write_stat >= 0) {
- size -= write_stat;
- todo = size;
- bufindex += write_stat;
- } else if (ETEST()) {
- _XWaitForWritable(dpy
-#ifdef XTHREADS
- , cv
-#endif
- );
-#ifdef SUNSYSV
- } else if (ECHECK(0)) {
- _XWaitForWritable(dpy
-#ifdef XTHREADS
- , cv
-#endif
- );
-#endif
-#ifdef ESZTEST
- } else if (ESZTEST()) {
- if (todo > 1)
- todo >>= 1;
- else {
- _XWaitForWritable(dpy
-#ifdef XTHREADS
- , cv
-#endif
- );
- }
-#endif
- } else if (!ECHECK(EINTR)) {
- /* Write failed! */
- /* errno set by write system call. */
- _XIOError(dpy);
- }
- }
- dpy->last_req = (char *)&_dummy_request;
- _XSetSeqSyncFunction(dpy);
- dpy->bufptr = dpy->buffer;
-#ifdef XTHREADS
- dpy->flags &= ~XlibDisplayWriting;
-#endif
-}
-
-int
-_XEventsQueued(
- register Display *dpy,
- int mode)
-{
- register int len;
- BytesReadable_t pend;
- _XAlignedBuffer buf;
- register xReply *rep;
- char *read_buf;
-#ifdef XTHREADS
- int entry_event_serial_num;
- struct _XCVList *cvl = NULL;
- xthread_t self;
-
-#ifdef XTHREADS_DEBUG
- printf("_XEventsQueued called in thread %x\n", XThread_Self());
-#endif
-#endif /* XTHREADS*/
-
- if (mode == QueuedAfterFlush)
- {
- _XFlush(dpy);
- if (dpy->qlen)
- return(dpy->qlen);
- }
- if (dpy->flags & XlibDisplayIOError) return(dpy->qlen);
-
-#ifdef XTHREADS
- /* create our condition variable and append to list,
- * unless we were called from within XProcessInternalConnection
- * or XLockDisplay
- */
- xthread_clear_id(self);
- if (dpy->lock && (xthread_have_id (dpy->lock->conni_thread)
- || xthread_have_id (dpy->lock->locking_thread)))
- /* some thread is in XProcessInternalConnection or XLockDisplay
- so we have to see if we are it */
- self = XThread_Self();
- if (!xthread_have_id(self)
- || (!xthread_equal(self, dpy->lock->conni_thread)
- && !xthread_equal(self, dpy->lock->locking_thread))) {
- /* In the multi-threaded case, if there is someone else
- reading events, then there aren't any available, so
- we just return. If we waited we would block.
- */
- if (dpy->lock && dpy->lock->event_awaiters)
- return dpy->qlen;
- /* nobody here but us, so lock out any newcomers */
- cvl = QueueEventReaderLock(dpy);
- }
-
- while (dpy->lock && cvl && dpy->lock->reply_first) {
- /* note which events we have already seen so we'll know
- if _XReply (in another thread) reads one */
- entry_event_serial_num = dpy->next_event_serial_num;
- ConditionWait(dpy, cvl->cv);
- /* did _XReply read an event we can return? */
- if (_XNewerQueuedEvent(dpy, entry_event_serial_num))
- {
- UnlockNextEventReader(dpy);
- return 0;
- }
- }
-#endif /* XTHREADS*/
-
- if (_X11TransBytesReadable(dpy->trans_conn, &pend) < 0)
- _XIOError(dpy);
-#ifdef XCONN_CHECK_FREQ
- /* This is a crock, required because FIONREAD or equivalent is
- * not guaranteed to detect a broken connection.
- */
- if (!pend && !dpy->qlen && ++dpy->conn_checker >= XCONN_CHECK_FREQ)
- {
- int result;
-#ifdef USE_POLL
- struct pollfd filedes;
-#else
- fd_set r_mask;
- static struct timeval zero_time;
-#endif
-
- dpy->conn_checker = 0;
-#ifdef USE_POLL
- filedes.fd = dpy->fd;
- filedes.events = POLLIN;
- if ((result = poll(&filedes, 1, 0)))
-#else
- FD_ZERO(&r_mask);
- FD_SET(dpy->fd, &r_mask);
- if ((result = Select(dpy->fd + 1, &r_mask, NULL, NULL, &zero_time)))
-#endif
- {
- if (result > 0)
- {
- if (_X11TransBytesReadable(dpy->trans_conn, &pend) < 0)
- _XIOError(dpy);
- /* we should not get zero, if we do, force a read */
- if (!pend)
- pend = SIZEOF(xReply);
- }
- else if (result < 0 && !(ECHECK(EINTR) || ETEST()))
- _XIOError(dpy);
- }
- }
-#endif /* XCONN_CHECK_FREQ */
- if (!(len = pend)) {
- /* _XFlush can enqueue events */
-#ifdef XTHREADS
- if (cvl)
-#endif
- {
- UnlockNextEventReader(dpy);
- }
- return(dpy->qlen);
- }
- /* Force a read if there is not enough data. Otherwise,
- * a select() loop at a higher-level will spin undesirably,
- * and we've seen at least one OS that appears to not update
- * the result from FIONREAD once it has returned nonzero.
- */
-#ifdef XTHREADS
- if (dpy->lock && dpy->lock->reply_awaiters) {
- read_buf = (char *)dpy->lock->reply_awaiters->buf;
- len = SIZEOF(xReply);
- } else
-#endif /* XTHREADS*/
- {
- read_buf = buf.buf;
-
- if (len < SIZEOF(xReply)
-#ifdef XTHREADS
- || dpy->async_handlers
-#endif
- )
- len = SIZEOF(xReply);
- else if (len > BUFSIZE)
- len = BUFSIZE;
- len = (len / SIZEOF(xReply)) * SIZEOF(xReply);
- }
-#ifdef XCONN_CHECK_FREQ
- dpy->conn_checker = 0;
-#endif
-
- (void) _XRead (dpy, read_buf, (long) len);
-
-#ifdef XTHREADS
- /* what did we actually read: reply or event? */
- if (dpy->lock && dpy->lock->reply_awaiters) {
- if (((xReply *)read_buf)->generic.type == X_Reply ||
- ((xReply *)read_buf)->generic.type == X_Error)
- {
- dpy->lock->reply_was_read = True;
- dpy->lock->reply_first = True;
- if (read_buf != (char *)dpy->lock->reply_awaiters->buf)
- memcpy(dpy->lock->reply_awaiters->buf, read_buf,
- len);
- if (cvl) {
- UnlockNextEventReader(dpy);
- }
- return(dpy->qlen); /* we read, so we can return */
- } else if (read_buf != buf.buf)
- memcpy(buf.buf, read_buf, len);
- }
-#endif /* XTHREADS*/
-
- STARTITERATE(rep,xReply,buf.buf,len > 0) {
- if (rep->generic.type == X_Reply) {
- int tmp = len;
- RESETITERPTR(rep,xReply,
- _XAsyncReply (dpy, rep,
- ITERPTR(rep), &tmp, True));
- len = tmp;
- pend = len;
- } else {
- if (rep->generic.type == X_Error)
- _XError (dpy, (xError *)rep);
- else /* must be an event packet */
- _XEnq (dpy, (xEvent *)rep);
- INCITERPTR(rep,xReply);
- len -= SIZEOF(xReply);
- }
- } ENDITERATE
-
-#ifdef XTHREADS
- if (cvl)
-#endif
- {
- UnlockNextEventReader(dpy);
- }
- return(dpy->qlen);
-}
-
-/* _XReadEvents - Flush the output queue,
- * then read as many events as possible (but at least 1) and enqueue them
- */
-void _XReadEvents(
- register Display *dpy)
-{
- _XAlignedBuffer buf;
- BytesReadable_t pend;
- int len;
- register xReply *rep;
- Bool not_yet_flushed = True;
- char *read_buf;
- int i;
- int entry_event_serial_num = dpy->next_event_serial_num;
-#ifdef XTHREADS
- struct _XCVList *cvl = NULL;
- xthread_t self;
-
-#ifdef XTHREADS_DEBUG
- printf("_XReadEvents called in thread %x\n",
- XThread_Self());
-#endif
- /* create our condition variable and append to list,
- * unless we were called from within XProcessInternalConnection
- * or XLockDisplay
- */
- xthread_clear_id(self);
- if (dpy->lock && (xthread_have_id (dpy->lock->conni_thread)
- || xthread_have_id (dpy->lock->locking_thread)))
- /* some thread is in XProcessInternalConnection or XLockDisplay
- so we have to see if we are it */
- self = XThread_Self();
- if (!xthread_have_id(self)
- || (!xthread_equal(self, dpy->lock->conni_thread)
- && !xthread_equal(self, dpy->lock->locking_thread)))
- cvl = QueueEventReaderLock(dpy);
-#endif /* XTHREADS */
-
- do {
-#ifdef XTHREADS
- /* if it is not our turn to read an event off the wire,
- wait til we're at head of list */
- if (dpy->lock && cvl &&
- (dpy->lock->event_awaiters != cvl ||
- dpy->lock->reply_first)) {
- ConditionWait(dpy, cvl->cv);
- continue;
- }
-#endif /* XTHREADS */
- /* find out how much data can be read */
- if (_X11TransBytesReadable(dpy->trans_conn, &pend) < 0)
- _XIOError(dpy);
- len = pend;
-
- /* must read at least one xEvent; if none is pending, then
- we'll just flush and block waiting for it */
- if (len < SIZEOF(xEvent)
-#ifdef XTHREADS
- || dpy->async_handlers
-#endif
- ) {
- len = SIZEOF(xEvent);
- /* don't flush until the first time we would block */
- if (not_yet_flushed) {
- _XFlush (dpy);
- if (_XNewerQueuedEvent(dpy, entry_event_serial_num)) {
- /* _XReply has read an event for us */
- goto got_event;
- }
- not_yet_flushed = False;
- }
- }
-
-#ifdef XTHREADS
- /* If someone is waiting for a reply, gamble that
- the reply will be the next thing on the wire
- and read it into their buffer. */
- if (dpy->lock && dpy->lock->reply_awaiters) {
- read_buf = (char *)dpy->lock->reply_awaiters->buf;
- len = SIZEOF(xReply);
- } else
-#endif /* XTHREADS*/
- {
- read_buf = buf.buf;
-
- /* but we won't read more than the max buffer size */
- if (len > BUFSIZE)
- len = BUFSIZE;
-
- /* round down to an integral number of XReps */
- len = (len / SIZEOF(xEvent)) * SIZEOF(xEvent);
- }
-
-#ifdef XTHREADS
- if (xthread_have_id(self))
- /* save value we may have to stick in conni_thread */
- dpy->lock->reading_thread = self;
-#endif /* XTHREADS */
- dpy->flags |= XlibDisplayReadEvents;
- i = _XRead (dpy, read_buf, (long) len);
- dpy->flags &= ~XlibDisplayReadEvents;
- if (i == -2) {
- /* special flag from _XRead to say that internal connection has
- done XPutBackEvent. Which we can use so we're done. */
- got_event:
-#ifdef XTHREADS
- if (dpy->lock && dpy->lock->lock_wait) {
- if (dpy->lock->event_awaiters != cvl)
- /* since it is not us, must be user lock thread */
- ConditionSignal(dpy,
- dpy->lock->event_awaiters->cv);
- (*dpy->lock->lock_wait)(dpy);
- continue;
- }
-#endif
- break;
- }
-#ifdef XTHREADS
- if (xthread_have_id(self))
- xthread_clear_id(dpy->lock->reading_thread);
-
- /* what did we actually read: reply or event? */
- if (dpy->lock && dpy->lock->reply_awaiters) {
- if (((xReply *)read_buf)->generic.type == X_Reply ||
- ((xReply *)read_buf)->generic.type == X_Error)
- {
- dpy->lock->reply_was_read = True;
- dpy->lock->reply_first = True;
- if (read_buf != (char *)dpy->lock->reply_awaiters->buf)
- memcpy(dpy->lock->reply_awaiters->buf,
- read_buf, len);
- ConditionSignal(dpy, dpy->lock->reply_awaiters->cv);
- continue;
- } else if (read_buf != buf.buf)
- memcpy(buf.buf, read_buf, len);
- }
-#endif /* XTHREADS */
-
- STARTITERATE(rep,xReply,buf.buf,len > 0) {
- if (rep->generic.type == X_Reply) {
- RESETITERPTR(rep,xReply,
- _XAsyncReply (dpy, rep,
- ITERPTR(rep), &len, True));
- pend = len;
- } else {
- if (rep->generic.type == X_Error)
- _XError (dpy, (xError *) rep);
- else /* must be an event packet */
- {
- if (rep->generic.type == GenericEvent)
- {
- int evlen;
- evlen = (rep->generic.length << 2);
- if (_XRead(dpy, &read_buf[len], evlen) == -2)
- goto got_event; /* XXX: aargh! */
- }
-
- _XEnq (dpy, (xEvent *)rep);
- }
- INCITERPTR(rep,xReply);
- len -= SIZEOF(xReply);
- }
- } ENDITERATE;
- } while (!_XNewerQueuedEvent(dpy, entry_event_serial_num));
-
- UnlockNextEventReader(dpy);
-}
-
-/*
- * _XRead - Read bytes from the socket taking into account incomplete
- * reads. This routine may have to be reworked if int < long.
- */
-int _XRead(
- register Display *dpy,
- register char *data,
- register long size)
-{
- register long bytes_read;
-#ifdef XTHREADS
- int original_size = size;
-#endif
-
- if ((dpy->flags & XlibDisplayIOError) || size == 0)
- return 0;
- ESET(0);
- while ((bytes_read = _X11TransRead(dpy->trans_conn, data, (int)size))
- != size) {
-
- if (bytes_read > 0) {
- size -= bytes_read;
- data += bytes_read;
- }
- else if (ETEST()) {
- if (_XWaitForReadable(dpy) == -2)
- return -2; /* internal connection did XPutBackEvent */
- ESET(0);
- }
-#ifdef SUNSYSV
- else if (ECHECK(0)) {
- if (_XWaitForReadable(dpy) == -2)
- return -2; /* internal connection did XPutBackEvent */
- }
-#endif
- else if (bytes_read == 0) {
- /* Read failed because of end of file! */
- ESET(EPIPE);
- _XIOError(dpy);
- }
-
- else /* bytes_read is less than 0; presumably -1 */ {
- /* If it's a system call interrupt, it's not an error. */
- if (!ECHECK(EINTR))
- _XIOError(dpy);
- }
- }
-#ifdef XTHREADS
- if (dpy->lock && dpy->lock->reply_bytes_left > 0)
- {
- dpy->lock->reply_bytes_left -= original_size;
- if (dpy->lock->reply_bytes_left == 0) {
- dpy->flags &= ~XlibDisplayReply;
- UnlockNextReplyReader(dpy);
- }
- }
-#endif /* XTHREADS*/
- return 0;
-}
-#endif /* !USE_XCB */
-
#ifdef LONG64
void _XRead32(
Display *dpy,
@@ -1306,348 +414,6 @@ void _XRead16Pad( }
#endif /* WORD64 */
-
-#if !USE_XCB
-/*
- * _XReadPad - Read bytes from the socket taking into account incomplete
- * reads. If the number of bytes is not 0 mod 4, read additional pad
- * bytes. This routine may have to be reworked if int < long.
- */
-void _XReadPad(
- register Display *dpy,
- register char *data,
- register long size)
-{
- register long bytes_read;
- struct iovec iov[2];
- char pad[3];
-#ifdef XTHREADS
- int original_size;
-#endif
-
- if ((dpy->flags & XlibDisplayIOError) || size == 0) return;
- iov[0].iov_len = (int)size;
- iov[0].iov_base = data;
- /*
- * The following hack is used to provide 32 bit long-word
- * aligned padding. The [1] vector is of length 0, 1, 2, or 3,
- * whatever is needed.
- */
-
- iov[1].iov_len = -size & 3;
- iov[1].iov_base = pad;
- size += iov[1].iov_len;
-#ifdef XTHREADS
- original_size = size;
-#endif
- ESET(0);
- while ((bytes_read = _X11TransReadv (dpy->trans_conn, iov, 2)) != size) {
-
- if (bytes_read > 0) {
- size -= bytes_read;
- if (iov[0].iov_len < bytes_read) {
- int pad_bytes_read = bytes_read - iov[0].iov_len;
- iov[1].iov_len -= pad_bytes_read;
- iov[1].iov_base =
- (char *)iov[1].iov_base + pad_bytes_read;
- iov[0].iov_len = 0;
- }
- else {
- iov[0].iov_len -= bytes_read;
- iov[0].iov_base = (char *)iov[0].iov_base + bytes_read;
- }
- }
- else if (ETEST()) {
- _XWaitForReadable(dpy);
- ESET(0);
- }
-#ifdef SUNSYSV
- else if (ECHECK(0)) {
- _XWaitForReadable(dpy);
- }
-#endif
- else if (bytes_read == 0) {
- /* Read failed because of end of file! */
- ESET(EPIPE);
- _XIOError(dpy);
- }
-
- else /* bytes_read is less than 0; presumably -1 */ {
- /* If it's a system call interrupt, it's not an error. */
- if (!ECHECK(EINTR))
- _XIOError(dpy);
- }
- }
-#ifdef XTHREADS
- if (dpy->lock && dpy->lock->reply_bytes_left > 0)
- {
- dpy->lock->reply_bytes_left -= original_size;
- if (dpy->lock->reply_bytes_left == 0) {
- dpy->flags &= ~XlibDisplayReply;
- UnlockNextReplyReader(dpy);
- }
- }
-#endif /* XTHREADS*/
-}
-
-/*
- * _XSend - Flush the buffer and send the client data. 32 bit word aligned
- * transmission is used, if size is not 0 mod 4, extra bytes are transmitted.
- * This routine may have to be reworked if int < long;
- */
-void
-_XSend (
- register Display *dpy,
- _Xconst char *data,
- register long size)
-{
- struct iovec iov[3];
- static char const pad[3] = {0, 0, 0};
- /* XText8 and XText16 require that the padding bytes be zero! */
-
- long skip, dbufsize, padsize, total, todo;
- _XExtension *ext;
-
- if (!size || (dpy->flags & XlibDisplayIOError)) return;
- dbufsize = dpy->bufptr - dpy->buffer;
-#ifdef XTHREADS
- dpy->flags |= XlibDisplayWriting;
- /* make sure no one else can put in data */
- dpy->bufptr = dpy->bufmax;
-#endif
- padsize = -size & 3;
- for (ext = dpy->flushes; ext; ext = ext->next_flush) {
- (*ext->before_flush)(dpy, &ext->codes, dpy->buffer, dbufsize);
- (*ext->before_flush)(dpy, &ext->codes, (char *)data, size);
- if (padsize)
- (*ext->before_flush)(dpy, &ext->codes, pad, padsize);
- }
- skip = 0;
- todo = total = dbufsize + size + padsize;
-
- /*
- * There are 3 pieces that may need to be written out:
- *
- * o whatever is in the display buffer
- * o the data passed in by the user
- * o any padding needed to 32bit align the whole mess
- *
- * This loop looks at all 3 pieces each time through. It uses skip
- * to figure out whether or not a given piece is needed.
- */
- while (total) {
- long before = skip; /* amount of whole thing written */
- long remain = todo; /* amount to try this time, <= total */
- int i = 0;
- long len;
-
- /* You could be very general here and have "in" and "out" iovecs
- * and write a loop without using a macro, but what the heck. This
- * translates to:
- *
- * how much of this piece is new?
- * if more new then we are trying this time, clamp
- * if nothing new
- * then bump down amount already written, for next piece
- * else put new stuff in iovec, will need all of next piece
- *
- * Note that todo had better be at least 1 or else we'll end up
- * writing 0 iovecs.
- */
-#define InsertIOV(pointer, length) \
- len = (length) - before; \
- if (len > remain) \
- len = remain; \
- if (len <= 0) { \
- before = (-len); \
- } else { \
- iov[i].iov_len = len; \
- iov[i].iov_base = (pointer) + before; \
- i++; \
- remain -= len; \
- before = 0; \
- }
-
- InsertIOV (dpy->buffer, dbufsize)
- InsertIOV ((char *)data, size)
- InsertIOV ((char *)pad, padsize)
-
- ESET(0);
- if ((len = _X11TransWritev(dpy->trans_conn, iov, i)) >= 0) {
- skip += len;
- total -= len;
- todo = total;
- } else if (ETEST()) {
- _XWaitForWritable(dpy
-#ifdef XTHREADS
- , NULL
-#endif
- );
-#ifdef SUNSYSV
- } else if (ECHECK(0)) {
- _XWaitForWritable(dpy
-#ifdef XTHREADS
- , NULL
-#endif
- );
-#endif
-#ifdef ESZTEST
- } else if (ESZTEST()) {
- if (todo > 1)
- todo >>= 1;
- else {
- _XWaitForWritable(dpy
-#ifdef XTHREADS
- , NULL
-#endif
- );
- }
-#endif
- } else if (!ECHECK(EINTR)) {
- _XIOError(dpy);
- }
- }
- dpy->last_req = (char *) & _dummy_request;
- _XSetSeqSyncFunction(dpy);
- dpy->bufptr = dpy->buffer;
-#ifdef XTHREADS
- dpy->flags &= ~XlibDisplayWriting;
-#endif
- return;
-}
-
-static void
-_XGetMiscCode(
- register Display *dpy)
-{
- xQueryExtensionReply qrep;
- register xQueryExtensionReq *qreq;
- xXCMiscGetVersionReply vrep;
- register xXCMiscGetVersionReq *vreq;
-
- if (dpy->xcmisc_opcode)
- return;
- GetReq(QueryExtension, qreq);
- qreq->nbytes = sizeof(XCMiscExtensionName) - 1;
- qreq->length += (qreq->nbytes+(unsigned)3)>>2;
- _XSend(dpy, XCMiscExtensionName, (long)qreq->nbytes);
- if (!_XReply (dpy, (xReply *)&qrep, 0, xTrue))
- dpy->xcmisc_opcode = -1;
- else {
- GetReq(XCMiscGetVersion, vreq);
- vreq->reqType = qrep.major_opcode;
- vreq->miscReqType = X_XCMiscGetVersion;
- vreq->majorVersion = XCMiscMajorVersion;
- vreq->minorVersion = XCMiscMinorVersion;
- if (!_XReply (dpy, (xReply *)&vrep, 0, xTrue))
- dpy->xcmisc_opcode = -1;
- else
- dpy->xcmisc_opcode = qrep.major_opcode;
- }
-}
-
-void
-_XIDHandler(
- register Display *dpy)
-{
- xXCMiscGetXIDRangeReply grep;
- register xXCMiscGetXIDRangeReq *greq;
-
- if (dpy->resource_max == dpy->resource_mask + 1) {
- _XGetMiscCode(dpy);
- if (dpy->xcmisc_opcode > 0) {
- GetReq(XCMiscGetXIDRange, greq);
- greq->reqType = dpy->xcmisc_opcode;
- greq->miscReqType = X_XCMiscGetXIDRange;
- if (_XReply (dpy, (xReply *)&grep, 0, xTrue) && grep.count) {
- dpy->resource_id = ((grep.start_id - dpy->resource_base) >>
- dpy->resource_shift);
- dpy->resource_max = dpy->resource_id;
- if (grep.count > 5)
- dpy->resource_max += grep.count - 6;
- dpy->resource_max <<= dpy->resource_shift;
- }
- sync_while_locked(dpy);
- }
- }
-}
-
-/*
- * _XAllocID - resource ID allocation routine.
- */
-XID _XAllocID(
- register Display *dpy)
-{
- XID id;
-
- id = dpy->resource_id << dpy->resource_shift;
- if (id >= dpy->resource_max) {
- _XSetPrivSyncFunction(dpy);
- dpy->resource_max = dpy->resource_mask + 1;
- }
- if (id <= dpy->resource_mask) {
- dpy->resource_id++;
- return (dpy->resource_base + id);
- }
- if (id != 0x10000000) {
- (void) fprintf(stderr,
- "Xlib: resource ID allocation space exhausted!\n");
- id = 0x10000000;
- dpy->resource_id = id >> dpy->resource_shift;
- }
- return id;
-}
-
-/*
- * _XAllocIDs - multiple resource ID allocation routine.
- */
-void _XAllocIDs(
- register Display *dpy,
- XID *ids,
- int count)
-{
- XID id;
- int i;
- xXCMiscGetXIDListReply grep;
- register xXCMiscGetXIDListReq *greq;
-
- id = dpy->resource_id << dpy->resource_shift;
- if (dpy->resource_max <= dpy->resource_mask &&
- id <= dpy->resource_mask &&
- (dpy->resource_max - id) > ((count - 1) << dpy->resource_shift)) {
- id += dpy->resource_base;
- for (i = 0; i < count; i++) {
- ids[i] = id;
- id += (1 << dpy->resource_shift);
- dpy->resource_id++;
- }
- return;
- }
- grep.count = 0;
- _XGetMiscCode(dpy);
- if (dpy->xcmisc_opcode > 0) {
- GetReq(XCMiscGetXIDList, greq);
- greq->reqType = dpy->xcmisc_opcode;
- greq->miscReqType = X_XCMiscGetXIDList;
- greq->count = count;
- if (_XReply(dpy, (xReply *)&grep, 0, xFalse) && grep.count) {
- _XRead32(dpy, (long *) ids, 4L * (long) (grep.count));
- for (i = 0; i < grep.count; i++) {
- id = (ids[i] - dpy->resource_base) >> dpy->resource_shift;
- if (id >= dpy->resource_id)
- dpy->resource_id = id;
- }
- if (id >= dpy->resource_max) {
- _XSetPrivSyncFunction(dpy);
- dpy->resource_max = dpy->resource_mask + 1;
- }
- }
- }
- for (i = grep.count; i < count; i++)
- ids[i] = XAllocID(dpy);
-}
-#endif /* !USE_XCB */
-
/*
* The hard part about this is that we only get 16 bits from a reply.
* We have three values that will march along, with the following invariant:
@@ -1691,263 +457,6 @@ _XSetLastRequestRead( return(newseq);
}
-#if !USE_XCB
-/*
- * _XReply - Wait for a reply packet and copy its contents into the
- * specified rep. Meanwhile we must handle error and event packets that
- * we may encounter.
- */
-Status
-_XReply (
- register Display *dpy,
- register xReply *rep,
- int extra, /* number of 32-bit words expected after the reply */
- Bool discard) /* should I discard data following "extra" words? */
-{
- /* Pull out the serial number now, so that (currently illegal) requests
- * generated by an error handler don't confuse us.
- */
- unsigned long cur_request = dpy->request;
-#ifdef XTHREADS
- struct _XCVList *cvl;
-#endif
-
- if (dpy->flags & XlibDisplayIOError)
- return 0;
-
-#ifdef XTHREADS
- /* create our condition variable and append to list */
- cvl = QueueReplyReaderLock(dpy);
- if (cvl) {
- cvl->buf = rep;
- if (dpy->lock->reply_awaiters == cvl && !dpy->lock->event_awaiters)
- dpy->lock->reply_first = True;
- }
-
-#ifdef XTHREADS_DEBUG
- printf("_XReply called in thread %x, adding %x to cvl\n",
- XThread_Self(), cvl);
-#endif
-
- _XFlushInt(dpy, cvl ? cvl->cv : NULL);
- /* if it is not our turn to read a reply off the wire,
- * wait til we're at head of list. if there is an event waiter,
- * and our reply hasn't been read, they'll be in select and will
- * hand control back to us next.
- */
- if(dpy->lock &&
- (dpy->lock->reply_awaiters != cvl || !dpy->lock->reply_first)) {
- ConditionWait(dpy, cvl->cv);
- }
- dpy->flags |= XlibDisplayReply;
-#else /* XTHREADS else */
- _XFlush(dpy);
-#endif
-
- for (;;) {
-#ifdef XTHREADS
- /* Did another thread's _XReadEvents get our reply by accident? */
- if (!dpy->lock || !dpy->lock->reply_was_read)
-#endif
- (void) _XRead(dpy, (char *)rep, (long)SIZEOF(xReply));
-#ifdef XTHREADS
- if (dpy->lock)
- dpy->lock->reply_was_read = False;
-#endif
-
- switch ((int)rep->generic.type) {
-
- case X_Reply:
- /* Reply received. Fast update for synchronous replies,
- * but deal with multiple outstanding replies.
- */
- if (rep->generic.sequenceNumber == (cur_request & 0xffff))
- dpy->last_request_read = cur_request;
- else {
- int pend = SIZEOF(xReply);
- if (_XAsyncReply(dpy, rep, (char *)rep, &pend, False)
- != (char *)rep)
- continue;
- }
- if (extra <= rep->generic.length) {
- if (extra > 0)
- /*
- * Read the extra data into storage immediately
- * following the GenericReply structure.
- */
- (void) _XRead (dpy, (char *) (NEXTPTR(rep,xReply)),
- ((long)extra) << 2);
- if (discard) {
- if (extra < rep->generic.length)
- _XEatData(dpy, (rep->generic.length - extra) << 2);
- }
-#ifdef XTHREADS
- if (dpy->lock) {
- if (discard) {
- dpy->lock->reply_bytes_left = 0;
- } else {
- dpy->lock->reply_bytes_left =
- (rep->generic.length - extra) << 2;
- }
- if (dpy->lock->reply_bytes_left == 0) {
- dpy->flags &= ~XlibDisplayReply;
- UnlockNextReplyReader(dpy);
- }
- } else
- dpy->flags &= ~XlibDisplayReply;
-#endif
- return 1;
- }
- /*
- *if we get here, then extra > rep->generic.length--meaning we
- * read a reply that's shorter than we expected. This is an
- * error, but we still need to figure out how to handle it...
- */
- (void) _XRead (dpy, (char *) (NEXTPTR(rep,xReply)),
- ((long) rep->generic.length) << 2);
- dpy->flags &= ~XlibDisplayReply;
- UnlockNextReplyReader(dpy);
- _XIOError (dpy);
- return (0);
-
- case X_Error:
- {
- register _XExtension *ext;
- register Bool ret = False;
- int ret_code;
- xError *err = (xError *) rep;
- unsigned long serial;
-
- dpy->flags &= ~XlibDisplayReply;
- serial = _XSetLastRequestRead(dpy, (xGenericReply *)rep);
- if (serial == cur_request)
- /* do not die on "no such font", "can't allocate",
- "can't grab" failures */
- switch ((int)err->errorCode) {
- case BadName:
- switch (err->majorCode) {
- case X_LookupColor:
- case X_AllocNamedColor:
- UnlockNextReplyReader(dpy);
- return(0);
- }
- break;
- case BadFont:
- if (err->majorCode == X_QueryFont) {
- UnlockNextReplyReader(dpy);
- return (0);
- }
- break;
- case BadAlloc:
- case BadAccess:
- UnlockNextReplyReader(dpy);
- return (0);
- }
- /*
- * we better see if there is an extension who may
- * want to suppress the error.
- */
- for (ext = dpy->ext_procs; !ret && ext; ext = ext->next) {
- if (ext->error)
- ret = (*ext->error)(dpy, err, &ext->codes, &ret_code);
- }
- if (!ret) {
- _XError(dpy, err);
- ret_code = 0;
- }
- if (serial == cur_request) {
- UnlockNextReplyReader(dpy);
- return(ret_code);
- }
-
- } /* case X_Error */
- break;
- default:
- _XEnq(dpy, (xEvent *) rep);
-#ifdef XTHREADS
- if (dpy->lock && dpy->lock->event_awaiters)
- ConditionSignal(dpy, dpy->lock->event_awaiters->cv);
-#endif
- break;
- }
- }
-}
-
-static char *
-_XAsyncReply(
- Display *dpy,
- register xReply *rep,
- char *buf,
- register int *lenp,
- Bool discard)
-{
- register _XAsyncHandler *async, *next;
- register int len;
- register Bool consumed = False;
- char *nbuf;
-
- (void) _XSetLastRequestRead(dpy, &rep->generic);
- len = SIZEOF(xReply) + (rep->generic.length << 2);
- if (len < SIZEOF(xReply)) {
- _XIOError (dpy);
- buf += *lenp;
- *lenp = 0;
- return buf;
- }
-
- for (async = dpy->async_handlers; async; async = next) {
- next = async->next;
- if ((consumed = (*async->handler)(dpy, rep, buf, *lenp, async->data)))
- break;
- }
- if (!consumed) {
- if (!discard)
- return buf;
- (void) fprintf(stderr,
- "Xlib: unexpected async reply (sequence 0x%lx)!\n",
- dpy->last_request_read);
-#ifdef XTHREADS
-#ifdef XTHREADS_DEBUG
- printf("thread %x, unexpected async reply\n", XThread_Self());
-#endif
-#endif
- if (len > *lenp)
- _XEatData(dpy, len - *lenp);
- }
- if (len < SIZEOF(xReply))
- {
- _XIOError (dpy);
- buf += *lenp;
- *lenp = 0;
- return buf;
- }
- if (len >= *lenp) {
- buf += *lenp;
- *lenp = 0;
- return buf;
- }
- *lenp -= len;
- buf += len;
- len = *lenp;
- nbuf = buf;
- while (len > SIZEOF(xReply)) {
- if (*buf == X_Reply)
- return nbuf;
- buf += SIZEOF(xReply);
- len -= SIZEOF(xReply);
- }
- if (len > 0 && len < SIZEOF(xReply)) {
- buf = nbuf;
- len = SIZEOF(xReply) - len;
- nbuf -= len;
- memmove(nbuf, buf, *lenp);
- (void) _XRead(dpy, nbuf + *lenp, (long)len);
- *lenp += len;
- }
- return nbuf;
-}
-#endif /* !USE_XCB */
-
/*
* Support for internal connections, such as an IM might use.
* By Stephen Gildea, X Consortium, September 1993
@@ -2097,22 +606,9 @@ void _XProcessInternalConnection( struct _XConnectionInfo *conn_info)
{
dpy->flags |= XlibDisplayProcConni;
-#if defined(XTHREADS) && !USE_XCB
- if (dpy->lock) {
- /* check cache to avoid call to thread_self */
- if (xthread_have_id(dpy->lock->reading_thread))
- dpy->lock->conni_thread = dpy->lock->reading_thread;
- else
- dpy->lock->conni_thread = XThread_Self();
- }
-#endif /* XTHREADS && !USE_XCB */
UnlockDisplay(dpy);
(*conn_info->read_callback) (dpy, conn_info->fd, conn_info->call_data);
LockDisplay(dpy);
-#if defined(XTHREADS) && !USE_XCB
- if (dpy->lock)
- xthread_clear_id(dpy->lock->conni_thread);
-#endif /* XTHREADS && !USE_XCB */
dpy->flags &= ~XlibDisplayProcConni;
}
@@ -2240,26 +736,6 @@ XRemoveConnectionWatch( /* end of internal connections support */
-
-#if !USE_XCB
-/* Read and discard "n" 8-bit bytes of data */
-
-void _XEatData(
- Display *dpy,
- register unsigned long n)
-{
-#define SCRATCHSIZE 2048
- char buf[SCRATCHSIZE];
-
- while (n > 0) {
- register long bytes_read = (n > SCRATCHSIZE) ? SCRATCHSIZE : n;
- (void) _XRead (dpy, buf, bytes_read);
- n -= bytes_read;
- }
-#undef SCRATCHSIZE
-}
-#endif /* !USE_XCB */
-
/* Cookie jar implementation
dpy->cookiejar is a linked list. _XEnq receives the events but leaves
them in the normal EQ. _XStoreEvent returns the cookie event (minus
@@ -3096,19 +1572,7 @@ int _XError ( !(*dpy->error_vec[rep->errorCode])(dpy, &event.xerror, rep))
return 0;
if (_XErrorFunction != NULL) {
- int rtn_val;
-#if defined(XTHREADS) && !USE_XCB
- if (dpy->lock)
- (*dpy->lock->user_lock_display)(dpy);
- UnlockDisplay(dpy);
-#endif /* XTHREADS && !USE_XCB */
- rtn_val = (*_XErrorFunction)(dpy, (XErrorEvent *)&event); /* upcall */
-#if defined(XTHREADS) && !USE_XCB
- LockDisplay(dpy);
- if (dpy->lock)
- (*dpy->lock->user_unlock_display)(dpy);
-#endif /* XTHREADS && !USE_XCB */
- return rtn_val;
+ return (*_XErrorFunction)(dpy, (XErrorEvent *)&event); /* upcall */
} else {
return _XDefaultError(dpy, (XErrorEvent *)&event);
}
diff --git a/libX11/src/Xprivate.h b/libX11/src/Xprivate.h index ce6e431ec..5e31befcc 100644 --- a/libX11/src/Xprivate.h +++ b/libX11/src/Xprivate.h @@ -8,10 +8,10 @@ #ifndef XPRIVATE_H
#define XPRIVATE_H
-extern void _XIDHandler(Display *dpy);
-extern void _XSeqSyncFunction(Display *dpy);
-extern void _XSetPrivSyncFunction(Display *dpy);
-extern void _XSetSeqSyncFunction(Display *dpy);
+extern _X_HIDDEN void _XIDHandler(Display *dpy);
+extern _X_HIDDEN void _XSeqSyncFunction(Display *dpy);
+extern _X_HIDDEN void _XSetPrivSyncFunction(Display *dpy);
+extern _X_HIDDEN void _XSetSeqSyncFunction(Display *dpy);
#ifdef XTHREADS
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
diff --git a/libX11/src/config.h.in b/libX11/src/config.h.in deleted file mode 100644 index 12ed0ac75..000000000 --- a/libX11/src/config.h.in +++ /dev/null @@ -1,231 +0,0 @@ -/* src/config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if `struct sockaddr_in' has a `sin_len' member */ -#undef BSD44SOCKETS - -/* Include compose table cache support */ -#undef COMPOSECACHE - -/* Has getresuid() & getresgid() functions */ -#undef HASGETRESUID - -/* Has issetugid() function */ -#undef HASSETUGID - -/* Has shm*() functions */ -#undef HAS_SHM - -/* Define to 1 if you have the `authdes_create' function. */ -#undef HAVE_AUTHDES_CREATE - -/* Define to 1 if you have the `authdes_seccreate' function. */ -#undef HAVE_AUTHDES_SECCREATE - -/* Define to 1 if you have the <dlfcn.h> header file. */ -#undef HAVE_DLFCN_H - -/* Use dlopen to load shared libraries */ -#undef HAVE_DLOPEN - -/* Define to 1 if you have the <dl.h> header file. */ -#undef HAVE_DL_H - -/* Define to 1 if you have the `getpagesize' function. */ -#undef HAVE_GETPAGESIZE - -/* Define to 1 if you have the <inttypes.h> header file. */ -#undef HAVE_INTTYPES_H - -/* launchd support available */ -#undef HAVE_LAUNCHD - -/* Define to 1 if you have the `ws2_32' library (-lws2_32). */ -#undef HAVE_LIBWS2_32 - -/* Define to 1 if you have the <memory.h> header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have a working `mmap' system call. */ -#undef HAVE_MMAP - -/* Use shl_load to load shared libraries */ -#undef HAVE_SHL_LOAD - -/* Define to 1 if the system has the type `socklen_t'. */ -#undef HAVE_SOCKLEN_T - -/* Define to 1 if you have the <stdint.h> header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the <stdlib.h> header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the <strings.h> header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the <string.h> header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the `strtol' function. */ -#undef HAVE_STRTOL - -/* Define to 1 if you have the <sys/param.h> header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define to 1 if you have the <sys/select.h> header file. */ -#undef HAVE_SYS_SELECT_H - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the <sys/types.h> header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the <unistd.h> header file. */ -#undef HAVE_UNISTD_H - -/* Support IPv6 for TCP connections */ -#undef IPv6 - -/* Support os-specific local connections */ -#undef LOCALCONN - -/* preference sorted list of transport types to try for local connections */ -#undef LOCAL_TRANSPORT_LIST - -/* Disable XLOCALEDIR environment variable */ -#undef NO_XLOCALEDIR - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Major version of this package */ -#undef PACKAGE_VERSION_MAJOR - -/* Minor version of this package */ -#undef PACKAGE_VERSION_MINOR - -/* Patch version of this package */ -#undef PACKAGE_VERSION_PATCHLEVEL - -/* Define as the return type of signal handlers (`int' or `void'). */ -#undef RETSIGTYPE - -/* Support Secure RPC ("SUN-DES-1") authentication for X11 clients */ -#undef SECURE_RPC - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Support TCP socket connections */ -#undef TCPCONN - -/* launchd support available */ -#undef TRANS_REOPEN - -/* Support UNIX socket connections */ -#undef UNIXCONN - -/* Split some i18n functions into loadable modules */ -#undef USE_DYNAMIC_LC - -/* Use the X cursor library to load cursors */ -#undef USE_DYNAMIC_XCURSOR - -/* poll() function is available */ -#undef USE_POLL - -/* Enable extensions on AIX 3, Interix. */ -#ifndef _ALL_SOURCE -# undef _ALL_SOURCE -#endif -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# undef _GNU_SOURCE -#endif -/* Enable threading extensions on Solaris. */ -#ifndef _POSIX_PTHREAD_SEMANTICS -# undef _POSIX_PTHREAD_SEMANTICS -#endif -/* Enable extensions on HP NonStop. */ -#ifndef _TANDEM_SOURCE -# undef _TANDEM_SOURCE -#endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ -#endif - - -/* Use XCB for low-level protocol implementation */ -#undef USE_XCB - -/* Version number of package */ -#undef VERSION - -/* Location of libX11 data */ -#undef X11_DATADIR - -/* Location of libX11 library data */ -#undef X11_LIBDIR - -/* Include support for XCMS */ -#undef XCMS - -/* Location of error message database */ -#undef XERRORDB - -/* Enable XF86BIGFONT extension */ -#undef XF86BIGFONT - -/* Use XKB */ -#undef XKB - -/* Location of keysym database */ -#undef XKEYSYMDB - -/* support for X Locales */ -#undef XLOCALE - -/* Location of libX11 locale data */ -#undef XLOCALEDATADIR - -/* Location of libX11 locale data */ -#undef XLOCALEDIR - -/* Location of libX11 locale libraries */ -#undef XLOCALELIBDIR - -/* Whether libX11 is compiled with thread support */ -#undef XTHREADS - -/* Whether libX11 needs to use MT safe API's */ -#undef XUSE_MTSAFE_API - -/* Define to 1 if on MINIX. */ -#undef _MINIX - -/* Define to 2 if the system does not provide POSIX.1 features except with - this defined. */ -#undef _POSIX_1_SOURCE - -/* Define to 1 if you need to in order for `stat' and other things to work. */ -#undef _POSIX_SOURCE diff --git a/libX11/src/util/Makefile.am b/libX11/src/util/Makefile.am index c0d4e7fe9..4c611316f 100644 --- a/libX11/src/util/Makefile.am +++ b/libX11/src/util/Makefile.am @@ -6,6 +6,9 @@ makekeys_CFLAGS = \ $(CWARNFLAGS)
CC = @CC_FOR_BUILD@
+CPPFLAGS = @CPPFLAGS_FOR_BUILD@
+CFLAGS = @CFLAGS_FOR_BUILD@
+LDFLAGS = @LDFLAGS_FOR_BUILD@
EXTRA_DIST = mkks.sh
diff --git a/libX11/src/x11_trans.c b/libX11/src/x11_trans.c deleted file mode 100644 index 6620b4dca..000000000 --- a/libX11/src/x11_trans.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright © 2003 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#define X11_t 1 -#define TRANS_CLIENT 1 -#include <X11/Xtrans/transport.c> - diff --git a/libX11/src/xcms/Makefile.am b/libX11/src/xcms/Makefile.am index aa4758063..3097fe7e4 100644 --- a/libX11/src/xcms/Makefile.am +++ b/libX11/src/xcms/Makefile.am @@ -14,7 +14,6 @@ AM_CPPFLAGS= \ AM_CFLAGS= \
$(X11_CFLAGS) \
$(BIGFONT_CFLAGS) \
- $(XDMCP_CFLAGS) \
$(XMALLOC_ZERO_CFLAGS) \
$(CWARNFLAGS)
diff --git a/libX11/src/xkb/Makefile.am b/libX11/src/xkb/Makefile.am index 3e7ca1951..ba21bbc7b 100644 --- a/libX11/src/xkb/Makefile.am +++ b/libX11/src/xkb/Makefile.am @@ -11,7 +11,6 @@ AM_CPPFLAGS= \ AM_CFLAGS= \
$(X11_CFLAGS) \
$(BIGFONT_CFLAGS) \
- $(XDMCP_CFLAGS) \
$(XMALLOC_ZERO_CFLAGS) \
$(CWARNFLAGS)
diff --git a/libX11/src/xlibi18n/Makefile.am b/libX11/src/xlibi18n/Makefile.am index 3215a42e6..1cdae3e39 100644 --- a/libX11/src/xlibi18n/Makefile.am +++ b/libX11/src/xlibi18n/Makefile.am @@ -12,7 +12,6 @@ AM_CPPFLAGS= \ AM_CFLAGS= \
$(X11_CFLAGS) \
$(BIGFONT_CFLAGS) \
- $(XDMCP_CFLAGS) \
$(XMALLOC_ZERO_CFLAGS) \
$(CWARNFLAGS)
|