aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/os
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-03-28 17:43:20 +0100
committermarha <marha@users.sourceforge.net>2014-03-28 17:43:20 +0100
commitf0f09f4aa3cdd0267f58b362a7c9fc5ae0921afd (patch)
treeafbeb028495328a2817aedbac7aae484a2c71a83 /xorg-server/os
parentbf0cbcc1d00962ef2221cb4ceae87cc5ae737454 (diff)
parentcbfb19790917d271b8ca6156554b16acc802719f (diff)
downloadvcxsrv-f0f09f4aa3cdd0267f58b362a7c9fc5ae0921afd.tar.gz
vcxsrv-f0f09f4aa3cdd0267f58b362a7c9fc5ae0921afd.tar.bz2
vcxsrv-f0f09f4aa3cdd0267f58b362a7c9fc5ae0921afd.zip
Merge remote-tracking branch 'origin/released'
Conflicts: X11/xtrans/Xtrans.c
Diffstat (limited to 'xorg-server/os')
-rw-r--r--xorg-server/os/connection.c41
-rw-r--r--xorg-server/os/utils.c4
2 files changed, 37 insertions, 8 deletions
diff --git a/xorg-server/os/connection.c b/xorg-server/os/connection.c
index 7c48d46b0..80489f0e2 100644
--- a/xorg-server/os/connection.c
+++ b/xorg-server/os/connection.c
@@ -145,6 +145,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 */
#if !defined(_MSC_VER)
static Bool RunFromSmartParent; /* send SIGUSR1 to parent process */
@@ -438,7 +439,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)
@@ -477,9 +481,10 @@ CreateWellKnownSockets(void)
}
}
- 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);
@@ -1300,8 +1305,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)
{
@@ -1323,7 +1327,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;
}
@@ -1356,4 +1360,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;
+}
diff --git a/xorg-server/os/utils.c b/xorg-server/os/utils.c
index cbd5c7ad5..c514ae11a 100644
--- a/xorg-server/os/utils.c
+++ b/xorg-server/os/utils.c
@@ -290,7 +290,7 @@ LockServer(void)
int len;
char port[20];
- if (nolock)
+ if (nolock || NoListenAll)
return;
/*
* Path names
@@ -411,7 +411,7 @@ LockServer(void)
void
UnlockServer(void)
{
- if (nolock)
+ if (nolock || NoListenAll)
return;
if (!StillLocking) {