XDARWIN: Add launchd support
This adds a bit of glue to configure.ac to support launchd detection; on OS X (or other platforms which choose to implement launchd), this allows the system to automagically start the Xserver as necessary to serve clients.
This commit is contained in:
		
							parent
							
								
									71c21dea74
								
							
						
					
					
						commit
						bf1641b94c
					
				| 
						 | 
				
			
			@ -1075,6 +1075,10 @@ XSERVER_SYS_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS}"
 | 
			
		|||
AC_SUBST([XSERVER_LIBS])
 | 
			
		||||
AC_SUBST([XSERVER_SYS_LIBS])
 | 
			
		||||
 | 
			
		||||
if test "x$HAVE_LAUNCHD" = xyes; then
 | 
			
		||||
   XSERVER_CFLAGS="$XSERVER_CFLAGS -DHAVE_LAUNCHD"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# The Xorg binary needs to export symbols so that they can be used from modules
 | 
			
		||||
# Some platforms require extra flags to do this.   gcc should set these flags
 | 
			
		||||
# when -rdynamic is passed to it, other compilers/linkers may need to be added
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -74,6 +74,9 @@ SOFTWARE.
 | 
			
		|||
#define TRANS_SERVER
 | 
			
		||||
#define TRANS_REOPEN
 | 
			
		||||
#include <X11/Xtrans/Xtrans.h>
 | 
			
		||||
#ifdef HAVE_LAUNCHD
 | 
			
		||||
#include <X11/Xtrans/Xtransint.h>
 | 
			
		||||
#endif
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <signal.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -660,10 +663,21 @@ ClientAuthorized(ClientPtr client,
 | 
			
		|||
    XID	 		auth_id;
 | 
			
		||||
    char	 	*reason = NULL;
 | 
			
		||||
    XtransConnInfo	trans_conn;
 | 
			
		||||
#ifdef HAVE_LAUNCHD
 | 
			
		||||
    struct sockaddr     *saddr;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    priv = (OsCommPtr)client->osPrivate;
 | 
			
		||||
    trans_conn = priv->trans_conn;
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_LAUNCHD
 | 
			
		||||
    saddr = (struct sockaddr *) (trans_conn->addr);
 | 
			
		||||
    /* Allow any client to connect without authorization on a launchd socket,
 | 
			
		||||
       because it is securely created -- this prevents a race condition on launch */
 | 
			
		||||
    if (saddr->sa_len > 11 && saddr->sa_family == AF_UNIX &&
 | 
			
		||||
        !strncmp(saddr->sa_data, "/tmp/launch", 11)) goto done;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    auth_id = CheckAuthorization (proto_n, auth_proto,
 | 
			
		||||
				  string_n, auth_string, client, &reason);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -719,6 +733,7 @@ ClientAuthorized(ClientPtr client,
 | 
			
		|||
	}
 | 
			
		||||
    }
 | 
			
		||||
    priv->auth_id = auth_id;
 | 
			
		||||
 done:
 | 
			
		||||
    priv->conn_time = 0;
 | 
			
		||||
 | 
			
		||||
#ifdef XDMCP
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue