aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/os/connection.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-03-28 17:35:36 +0100
committermarha <marha@users.sourceforge.net>2014-03-28 17:35:36 +0100
commitcbfb19790917d271b8ca6156554b16acc802719f (patch)
tree830af0dc6e08b5d0c7124fec143e90255f3feee3 /xorg-server/os/connection.c
parentd02e6760412c7a96abbc4d0add5dd8d5e83bbe27 (diff)
downloadvcxsrv-cbfb19790917d271b8ca6156554b16acc802719f.tar.gz
vcxsrv-cbfb19790917d271b8ca6156554b16acc802719f.tar.bz2
vcxsrv-cbfb19790917d271b8ca6156554b16acc802719f.zip
libxtrans fontconfig mesa xserver git update 28 Mar 2014
xserver commit a2880699e8f1f576e1a48ebf25e8982463323f84 libxtrans commit 68f60238c4224f954ff6556ae778c72e420175f0 fontconfig commit fcba9ef01c978323fc71c17e455d3cd6ae35edcc mesa commit 029ccd773d01a5f801c809c499516d7b0c4cc3f8
Diffstat (limited to 'xorg-server/os/connection.c')
-rw-r--r--xorg-server/os/connection.c41
1 files changed, 35 insertions, 6 deletions
diff --git a/xorg-server/os/connection.c b/xorg-server/os/connection.c
index ddf4f0a3a..b3640b8e4 100644
--- a/xorg-server/os/connection.c
+++ b/xorg-server/os/connection.c
@@ -138,6 +138,7 @@ fd_set OutputPending; /* clients with reply/event data ready to go */
int MaxClients = 0;
Bool NewOutputPending; /* not yet attempted to write some new output */
Bool AnyClientsWriteBlocked; /* true if some client blocked on write */
+Bool NoListenAll; /* Don't establish any listening sockets */
static Bool RunFromSmartParent; /* send SIGUSR1 to parent process */
Bool RunFromSigStopParent; /* send SIGSTOP to our own process; Upstart (or
@@ -406,7 +407,10 @@ CreateWellKnownSockets(void)
/* display is initialized to "0" by main(). It is then set to the display
* number if specified on the command line, or to NULL when the -displayfd
* option is used. */
- if (display) {
+ if (NoListenAll) {
+ ListenTransCount = 0;
+ }
+ else if (display) {
if (TryCreateSocket(atoi(display), &partial) &&
ListenTransCount >= 1)
if (!PartialNetwork && partial)
@@ -440,9 +444,10 @@ CreateWellKnownSockets(void)
DefineSelf (fd);
}
- if (!XFD_ANYSET(&WellKnownConnections))
+ if (!XFD_ANYSET(&WellKnownConnections) && !NoListenAll)
FatalError
("Cannot establish any listening sockets - Make sure an X server isn't already running");
+
#if !defined(WIN32)
OsSignal(SIGPIPE, SIG_IGN);
OsSignal(SIGHUP, AutoResetServer);
@@ -1253,8 +1258,7 @@ MakeClientGrabPervious(ClientPtr client)
}
}
-#ifdef XQUARTZ
-/* Add a fd (from launchd) to our listeners */
+/* Add a fd (from launchd or similar) to our listeners */
void
ListenOnOpenFD(int fd, int noxauth)
{
@@ -1276,7 +1280,7 @@ ListenOnOpenFD(int fd, int noxauth)
*/
ciptr = _XSERVTransReopenCOTSServer(5, fd, port);
if (ciptr == NULL) {
- ErrorF("Got NULL while trying to Reopen launchd port.\n");
+ ErrorF("Got NULL while trying to Reopen listen port.\n");
return;
}
@@ -1309,4 +1313,29 @@ ListenOnOpenFD(int fd, int noxauth)
#endif
}
-#endif
+/* based on TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status) */
+Bool
+AddClientOnOpenFD(int fd)
+{
+ XtransConnInfo ciptr;
+ CARD32 connect_time;
+ char port[20];
+
+ snprintf(port, sizeof(port), ":%d", atoi(display));
+ ciptr = _XSERVTransReopenCOTSServer(5, fd, port);
+ if (ciptr == NULL)
+ return FALSE;
+
+ _XSERVTransSetOption(ciptr, TRANS_NONBLOCKING, 1);
+ ciptr->flags |= TRANS_NOXAUTH;
+
+ connect_time = GetTimeInMillis();
+
+ if (!AllocNewConnection(ciptr, fd, connect_time)) {
+ ErrorConnMax(ciptr);
+ _XSERVTransClose(ciptr);
+ return FALSE;
+ }
+
+ return TRUE;
+}