summaryrefslogtreecommitdiff
path: root/launchd
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2012-11-06 21:14:35 -0800
committerAnas Nashif <anas.nashif@intel.com>2012-11-06 21:14:35 -0800
commit1d888804982d06910f10c1b6a9b29e7b9a23f550 (patch)
tree941a477f65ef36d20cc766559dce431f5cea9816 /launchd
downloadxinit-1d888804982d06910f10c1b6a9b29e7b9a23f550.tar.gz
xinit-1d888804982d06910f10c1b6a9b29e7b9a23f550.tar.bz2
xinit-1d888804982d06910f10c1b6a9b29e7b9a23f550.zip
Imported Upstream version 1.3.2upstream/1.3.2
Diffstat (limited to 'launchd')
-rw-r--r--launchd/Makefile.am3
-rw-r--r--launchd/Makefile.in510
-rw-r--r--launchd/console_redirect.c418
-rw-r--r--launchd/console_redirect.h44
-rwxr-xr-xlaunchd/privileged_startx/10-tmpdirs.cpp46
-rwxr-xr-xlaunchd/privileged_startx/20-font_cache.cpp35
-rw-r--r--launchd/privileged_startx/Makefile.am82
-rw-r--r--launchd/privileged_startx/Makefile.in643
-rw-r--r--launchd/privileged_startx/client.c66
-rw-r--r--launchd/privileged_startx/privileged_startx.c63
-rw-r--r--launchd/privileged_startx/privileged_startx.defs40
-rw-r--r--launchd/privileged_startx/privileged_startx.plist.cpp28
-rw-r--r--launchd/privileged_startx/privileged_startx_types.h10
-rw-r--r--launchd/privileged_startx/server.c320
-rw-r--r--launchd/user_startx/Makefile.am53
-rw-r--r--launchd/user_startx/Makefile.in573
-rw-r--r--launchd/user_startx/launchd_startx.c84
-rw-r--r--launchd/user_startx/startx.plist.cpp29
18 files changed, 3047 insertions, 0 deletions
diff --git a/launchd/Makefile.am b/launchd/Makefile.am
new file mode 100644
index 0000000..f8781ed
--- /dev/null
+++ b/launchd/Makefile.am
@@ -0,0 +1,3 @@
+SUBDIRS = privileged_startx user_startx
+
+EXTRA_DIST = console_redirect.h
diff --git a/launchd/Makefile.in b/launchd/Makefile.in
new file mode 100644
index 0000000..4d5cadf
--- /dev/null
+++ b/launchd/Makefile.in
@@ -0,0 +1,510 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = launchd
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_CFLAGS = @BASE_CFLAGS@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CHANGELOG_CMD = @CHANGELOG_CMD@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CWARNFLAGS = @CWARNFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_CMD = @INSTALL_CMD@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAN_SUBSTS = @MAN_SUBSTS@
+MCOOKIE = @MCOOKIE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SCOMAN = @SCOMAN@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHELL_CMD = @SHELL_CMD@
+STARTX_COOKIE_FLAGS = @STARTX_COOKIE_FLAGS@
+STRICT_CFLAGS = @STRICT_CFLAGS@
+STRIP = @STRIP@
+TWM = @TWM@
+VERSION = @VERSION@
+XAUTH = @XAUTH@
+XCLOCK = @XCLOCK@
+XCONFIGFILE = @XCONFIGFILE@
+XCONFIGFILEMAN = @XCONFIGFILEMAN@
+XINIT = @XINIT@
+XINITDIR = @XINITDIR@
+XINIT_CFLAGS = @XINIT_CFLAGS@
+XINIT_LIBS = @XINIT_LIBS@
+XMODMAP = @XMODMAP@
+XORG_MAN_PAGE = @XORG_MAN_PAGE@
+XRDB = @XRDB@
+XSERVER = @XSERVER@
+XSERVERNAME = @XSERVERNAME@
+XTERM = @XTERM@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+bundleidprefix = @bundleidprefix@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+launchagentxserver = @launchagentxserver@
+launchdaemonsdir = @launchdaemonsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+SUBDIRS = privileged_startx user_startx
+EXTRA_DIST = console_redirect.h
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign launchd/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign launchd/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic ctags \
+ ctags-recursive distclean distclean-generic distclean-tags \
+ distdir dvi dvi-am html html-am info info-am install \
+ install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
+ tags-recursive uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/launchd/console_redirect.c b/launchd/console_redirect.c
new file mode 100644
index 0000000..7ce3626
--- /dev/null
+++ b/launchd/console_redirect.c
@@ -0,0 +1,418 @@
+/* Copyright (c) 2011 Apple Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * 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 ABOVE LISTED COPYRIGHT
+ * HOLDER(S) 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(s) of the above
+ * copyright holders shall not be used in advertising or otherwise to
+ * promote the sale, use or other dealings in this Software without
+ * prior written authorization.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#else
+#define DEBUG_CONSOLE_REDIRECT 1
+#define HAVE_LIBDISPATCH 1
+#endif
+
+#include <assert.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/event.h>
+#include <asl.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#include "console_redirect.h"
+
+#define BUF_SIZE 512
+
+#ifdef HAVE_LIBDISPATCH
+#include <dispatch/dispatch.h>
+
+static dispatch_queue_t redirect_serial_q;
+static dispatch_group_t read_source_group;
+#else
+#include <pthread.h>
+
+static pthread_t redirect_pthread;
+static pthread_mutex_t redirect_fds_lock = PTHREAD_MUTEX_INITIALIZER;
+
+static int kq;
+
+/* Notifications to our reader thread */
+#define ASL_REDIRECT_TERMINATE ((void *)(uintptr_t)1)
+#endif
+
+typedef struct {
+ int level;
+ aslclient asl;
+ aslmsg msg;
+
+ /* Buffered reading */
+ char *buf;
+ char *w;
+
+#ifdef HAVE_LIBDISPATCH
+ dispatch_source_t read_source;
+#endif
+} asl_redirect;
+
+static asl_redirect *redirect_fds = NULL;
+static int n_redirect_fds = 0;
+
+/* Read from the FD until there is no more to read and redirect to ASL.
+ * Preconditions:
+ * 1: pthread_mutex_lock lock is held (pthreads) or called
+ * from the appropriate serial queue for operating on
+ * redirect_fds
+ * 2: fd corresponds to a valid entry in redirect_fds
+ *
+ * Return values:
+ * If the pipe is closed, EOF is returned regardless of how many bytes
+ * were processed. If the pipe is still open, the number of read bytes
+ * is returned.
+ */
+static inline int _read_redirect(int fd, int flush) {
+ int total_read = 0;
+ int nbytes;
+ asl_redirect *aslr = &redirect_fds[fd];
+
+ while((nbytes = read(fd, aslr->w, BUF_SIZE - (aslr->w - aslr->buf) - 1)) > 0) {
+ char *s, *p;
+
+ /* Increment our returned number read */
+ total_read += nbytes;
+
+ nbytes += (aslr->w - aslr->buf);
+ aslr->buf[nbytes] = '\0';
+
+ /* One line at a time */
+ for(p=aslr->buf; *p && (p - aslr->buf) < nbytes; p = s + 1) {
+ // Find null or \n
+ for(s=p; *s && *s != '\n'; s++);
+ if(*s == '\n') {
+ *s='\0';
+ asl_log(aslr->asl, aslr->msg, aslr->level, "%s", p);
+ } else if(aslr->buf != p) {
+ memmove(aslr->buf, p, BUF_SIZE - (p - aslr->buf));
+ aslr->w = aslr->buf + (s - p);
+ break;
+ } else if(nbytes == BUF_SIZE - 1) {
+ asl_log(aslr->asl, aslr->msg, aslr->level, "%s", p);
+ aslr->w = aslr->buf;
+ break;
+ }
+ }
+ }
+
+ /* Flush if requested or we're at EOF */
+ if(flush || nbytes == 0) {
+ if(aslr->w > aslr->buf) {
+ *aslr->w = '\0';
+ asl_log(aslr->asl, aslr->msg, aslr->level, "%s", aslr->buf);
+ }
+ }
+
+ if(nbytes == 0)
+ return EOF;
+ return total_read;
+}
+
+#ifdef HAVE_LIBDISPATCH
+static void read_from_source(void *_source) {
+ dispatch_source_t source = (dispatch_source_t)_source;
+ int fd = dispatch_source_get_handle(source);
+ if(_read_redirect(fd, 0) == EOF) {
+ dispatch_source_cancel(source);
+ }
+}
+
+static void cancel_source(void *_source) {
+ dispatch_source_t source = (dispatch_source_t)_source;
+ int fd = dispatch_source_get_handle(source);
+ asl_redirect *aslr = &redirect_fds[fd];
+
+ /* Flush the buffer */
+ _read_redirect(fd, 1);
+
+ close(fd);
+ free(aslr->buf);
+ memset(aslr, 0, sizeof(*aslr));
+ dispatch_release(source);
+ dispatch_group_leave(read_source_group);
+}
+
+#else /* !HAVE_LIBDISPATCH */
+static void *redirect_thread(void *ctx __unused) {
+ struct kevent ev;
+ int n;
+
+ while(1) {
+ n = kevent(kq, NULL, 0, &ev, 1, NULL);
+
+ /* Bail on errors */
+ if(n < 0) {
+ asl_log(NULL, NULL, ASL_LEVEL_ERR, "kevent failure: %s", strerror(errno));
+ break;
+ }
+
+ /* This should not happen */
+ if(n == 0)
+ continue;
+
+ switch(ev.filter) {
+ case EVFILT_READ:
+ pthread_mutex_lock(&redirect_fds_lock);
+ {
+ int fd = ev.ident;
+ int close_fd = 0;
+ asl_redirect *aslr = &redirect_fds[fd];
+
+ if(fd < 0 || fd >= n_redirect_fds || aslr->buf == NULL) {
+ asl_log(NULL, NULL, ASL_LEVEL_ERR, "Unexpected file descriptor: %d", fd);
+ goto next;
+ }
+
+ if(ev.flags & EV_EOF) {
+ close_fd = 1;
+ if(EOF != _read_redirect(fd, 1)) {
+ asl_log(NULL, NULL, ASL_LEVEL_ERR, "kevent reported EOF on %d, but read doesn't concur.", fd);
+ }
+ } else {
+ close_fd = (EOF == _read_redirect(fd, 0));
+ }
+
+ if(close_fd) {
+ EV_SET(&ev, fd, EVFILT_READ, EV_DELETE, 0, 0, 0);
+ kevent(kq, &ev, 1, NULL, 0, NULL);
+ close(fd);
+ free(aslr->buf);
+ memset(aslr, 0, sizeof(*aslr));
+ }
+ }
+ next:
+ pthread_mutex_unlock(&redirect_fds_lock);
+
+ case EVFILT_TIMER:
+ if(ev.udata == ASL_REDIRECT_TERMINATE)
+ return NULL;
+
+ default:
+ ;;
+ }
+ }
+
+ return NULL;
+}
+#endif
+
+static void redirect_atexit(void) {
+ /* stdout is linebuffered, so flush the buffer */
+ if(redirect_fds[STDOUT_FILENO].buf)
+ fflush(stdout);
+
+#ifdef HAVE_LIBDISPATCH
+ {
+ int i;
+
+ /* Cancel all of our dispatch sources, so they flush to ASL */
+ for(i=0; i < n_redirect_fds; i++)
+ if(redirect_fds[i].read_source)
+ dispatch_source_cancel(redirect_fds[i].read_source);
+
+ /* Wait at least three seconds for our sources to flush to ASL */
+ dispatch_group_wait(read_source_group, dispatch_time(DISPATCH_TIME_NOW, 3LL * NSEC_PER_SEC));
+ }
+#else
+ {
+ struct kevent ev;
+
+ /* Tell our reader thread it is time to pack up and go home */
+ EV_SET(&ev, 0, EVFILT_TIMER, EV_ADD | EV_ONESHOT, 0, 0, ASL_REDIRECT_TERMINATE);
+ kevent(kq, &ev, 1, NULL, 0, NULL);
+
+ pthread_join(redirect_pthread, NULL);
+ }
+#endif
+}
+
+#ifdef HAVE_LIBDISPATCH
+static void xi_asl_init(void *ctx __unused)
+#else
+static void xi_asl_init(void)
+#endif
+{
+ assert((redirect_fds = calloc(16, sizeof(*redirect_fds))) != NULL);
+ n_redirect_fds = 16;
+
+#ifdef HAVE_LIBDISPATCH
+ redirect_serial_q = dispatch_queue_create("com.apple.asl-redirect", NULL);
+ assert(redirect_serial_q != NULL);
+
+ read_source_group = dispatch_group_create();
+ assert(read_source_group != NULL);
+#else
+ assert((kq = kqueue()) != -1);
+ assert(pthread_create(&redirect_pthread, NULL, redirect_thread, NULL) == 0);
+#endif
+
+ atexit(redirect_atexit);
+}
+
+int xi_asl_log_fd(aslclient asl, aslmsg msg, int level, int fd) {
+#ifdef HAVE_LIBDISPATCH
+ int err __block = 0;
+ static dispatch_once_t once_control;
+ dispatch_once_f(&once_control, NULL, xi_asl_init);
+#else
+ int err = 0;
+ static pthread_once_t once_control = PTHREAD_ONCE_INIT;
+ assert(pthread_once(&once_control, xi_asl_init) == 0);
+#endif
+
+ if(fd < 0)
+ return EBADF;
+
+#ifdef HAVE_LIBDISPATCH
+#define BLOCK_DONE return
+ dispatch_sync(redirect_serial_q, ^
+#else
+#define BLOCK_DONE goto done
+ assert(pthread_mutex_lock(&redirect_fds_lock) == 0);
+#endif
+ {
+ /* Reallocate if we need more space */
+ if(fd >= n_redirect_fds) {
+ size_t new_n = 1 << (ffs(fd) + 1);
+ asl_redirect *new_array = realloc(redirect_fds, new_n * sizeof(*redirect_fds));
+ if(!new_array) {
+ err = errno;
+ BLOCK_DONE;
+ }
+ redirect_fds = new_array;
+ memset(redirect_fds + n_redirect_fds, 0, new_n - n_redirect_fds);
+ n_redirect_fds = new_n;
+ }
+
+ /* If we're already listening on it, return error. */
+ if(redirect_fds[fd].buf != NULL) {
+ err = EBADF;
+ BLOCK_DONE;
+ }
+
+ /* Initialize our buffer */
+ redirect_fds[fd].buf = (char *)malloc(BUF_SIZE);
+ if(redirect_fds[fd].buf == NULL) {
+ err = errno;
+ BLOCK_DONE;
+ }
+ redirect_fds[fd].w = redirect_fds[fd].buf;
+
+ /* Store our ASL settings */
+ redirect_fds[fd].level = level;
+ redirect_fds[fd].asl = asl;
+ redirect_fds[fd].msg = msg;
+
+ /* Don't block on reads from this fd */
+ fcntl(fd, F_SETFL, O_NONBLOCK);
+
+ /* Start listening */
+#ifdef HAVE_LIBDISPATCH
+ {
+ dispatch_source_t read_source = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ, fd, 0, redirect_serial_q);
+ redirect_fds[fd].read_source = read_source;
+ dispatch_set_context(read_source, read_source);
+ dispatch_source_set_event_handler_f(read_source, read_from_source);
+ dispatch_source_set_cancel_handler_f(read_source, cancel_source);
+ dispatch_group_enter(read_source_group);
+ dispatch_resume(read_source);
+ }
+#else
+ {
+ struct kevent ev;
+ EV_SET(&ev, fd, EVFILT_READ, EV_ADD, 0, 0, 0);
+ kevent(kq, &ev, 1, NULL, 0, NULL);
+ }
+#endif
+ }
+#ifdef HAVE_LIBDISPATCH
+ );
+#else
+done:
+ assert(pthread_mutex_unlock(&redirect_fds_lock) == 0);
+#endif
+#undef BLOCK_DONE
+
+ return err;
+}
+
+int xi_asl_capture_fd(aslclient asl, aslmsg msg, int level, int fd) {
+ int pipepair[2];
+
+ /* Create pipe */
+ if(pipe(pipepair) == -1)
+ return errno;
+
+ /* Close the read fd but not the write fd on exec */
+ if(fcntl(pipepair[0], F_SETFD, FD_CLOEXEC) == -1)
+ return errno;
+
+ /* Replace the existing fd */
+ if(dup2(pipepair[1], fd) == -1) {
+ close(pipepair[0]);
+ close(pipepair[1]);
+ return errno;
+ }
+
+ /* If we capture STDOUT_FILENO, make sure we linebuffer stdout */
+ if(fd == STDOUT_FILENO)
+ setlinebuf(stdout);
+
+ /* Close the duplicate fds since they've been reassigned */
+ close(pipepair[1]);
+
+ /* Hand off the read end of our pipe to xi_asl_log_fd */
+ return xi_asl_log_fd(asl, msg, level, pipepair[0]);
+}
+
+#ifdef DEBUG_CONSOLE_REDIRECT
+int main(int argc __unused, char **argv __unused) {
+ xi_asl_capture_fd(NULL, NULL, ASL_LEVEL_NOTICE, STDOUT_FILENO);
+ xi_asl_capture_fd(NULL, NULL, ASL_LEVEL_ERR, STDERR_FILENO);
+
+ fprintf(stderr, "TEST ERR1\n");
+ fprintf(stdout, "TEST OUT1\n");
+ fprintf(stderr, "TEST ERR2\n");
+ fprintf(stdout, "TEST OUT2\n");
+ system("/bin/echo SYST OUT");
+ system("/bin/echo SYST ERR >&2");
+ fprintf(stdout, "TEST OUT3\n");
+ fprintf(stdout, "TEST OUT4\n");
+ fprintf(stderr, "TEST ERR3\n");
+ fprintf(stderr, "TEST ERR4\n");
+
+ exit(0);
+}
+#endif
diff --git a/launchd/console_redirect.h b/launchd/console_redirect.h
new file mode 100644
index 0000000..134def6
--- /dev/null
+++ b/launchd/console_redirect.h
@@ -0,0 +1,44 @@
+/* Copyright (c) 2011 Apple Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * 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 ABOVE LISTED COPYRIGHT
+ * HOLDER(S) 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(s) of the above
+ * copyright holders shall not be used in advertising or otherwise to
+ * promote the sale, use or other dealings in this Software without
+ * prior written authorization.
+ */
+
+#ifndef _XQUARTZ_CONSOLE_REDIRECT_H_
+#define _XQUARTZ_CONSOLE_REDIRECT_H_
+
+#include <asl.h>
+
+/* The given fd is replaced with a pipe. Anything written to it will will be
+ * logged to ASL.
+ */
+int xi_asl_capture_fd(aslclient asl, aslmsg msg, int level, int fd);
+
+/* The given fd is read from and passed along to ASL until all write ends of the
+ * pipe are closed. Once the last writer has closed the pipe, we close our end.
+ */
+int xi_asl_log_fd(aslclient asl, aslmsg msg, int level, int fd);
+
+#endif
diff --git a/launchd/privileged_startx/10-tmpdirs.cpp b/launchd/privileged_startx/10-tmpdirs.cpp
new file mode 100755
index 0000000..8012597
--- /dev/null
+++ b/launchd/privileged_startx/10-tmpdirs.cpp
@@ -0,0 +1,46 @@
+XCOMM!/bin/sh
+XCOMM Copyright (c) 2008 Apple Inc.
+XCOMM
+XCOMM Permission is hereby granted, free of charge, to any person
+XCOMM obtaining a copy of this software and associated documentation files
+XCOMM (the "Software"), to deal in the Software without restriction,
+XCOMM including without limitation the rights to use, copy, modify, merge,
+XCOMM publish, distribute, sublicense, and/or sell copies of the Software,
+XCOMM and to permit persons to whom the Software is furnished to do so,
+XCOMM subject to the following conditions:
+XCOMM
+XCOMM The above copyright notice and this permission notice shall be
+XCOMM included in all copies or substantial portions of the Software.
+XCOMM
+XCOMM THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+XCOMM EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+XCOMM MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+XCOMM NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
+XCOMM HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+XCOMM WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+XCOMM OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+XCOMM DEALINGS IN THE SOFTWARE.
+XCOMM
+XCOMM Except as contained in this notice, the name(s) of the above
+XCOMM copyright holders shall not be used in advertising or otherwise to
+XCOMM promote the sale, use or other dealings in this Software without
+XCOMM prior written authorization.
+
+XCOMM Make sure these are owned by root
+
+XCOMM Our usage of mktemp fails with GNU, so prefer /usr/bin to hopefully
+XCOMM get BSD mktemp
+if [ -x /usr/bin/mktemp ] ; then
+ MKTEMP=/usr/bin/mktemp
+else
+ MKTEMP=mktemp
+fi
+
+for dir in /tmp/.ICE-unix /tmp/.X11-unix /tmp/.font-unix ; do
+ XCOMM Use mktemp rather than mkdir to avoid possible security issue
+ XCOMM if $dir exists and is a symlink
+ if ${MKTEMP} -d ${dir} >& /dev/null ; then
+ chmod 1777 $dir
+ chown root:wheel $dir
+ fi
+done
diff --git a/launchd/privileged_startx/20-font_cache.cpp b/launchd/privileged_startx/20-font_cache.cpp
new file mode 100755
index 0000000..6d43e10
--- /dev/null
+++ b/launchd/privileged_startx/20-font_cache.cpp
@@ -0,0 +1,35 @@
+XCOMM!/bin/sh
+XCOMM Copyright (c) 2008 Apple Inc.
+XCOMM
+XCOMM Permission is hereby granted, free of charge, to any person
+XCOMM obtaining a copy of this software and associated documentation files
+XCOMM (the "Software"), to deal in the Software without restriction,
+XCOMM including without limitation the rights to use, copy, modify, merge,
+XCOMM publish, distribute, sublicense, and/or sell copies of the Software,
+XCOMM and to permit persons to whom the Software is furnished to do so,
+XCOMM subject to the following conditions:
+XCOMM
+XCOMM The above copyright notice and this permission notice shall be
+XCOMM included in all copies or substantial portions of the Software.
+XCOMM
+XCOMM THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+XCOMM EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+XCOMM MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+XCOMM NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
+XCOMM HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+XCOMM WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+XCOMM OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+XCOMM DEALINGS IN THE SOFTWARE.
+XCOMM
+XCOMM Except as contained in this notice, the name(s) of the above
+XCOMM copyright holders shall not be used in advertising or otherwise to
+XCOMM promote the sale, use or other dealings in this Software without
+XCOMM prior written authorization.
+
+if [ -x BINDIR/font_cache ] ; then
+ BINDIR/font_cache -s &
+elif [ -x BINDIR/font_cache.sh ] ; then
+ BINDIR/font_cache.sh -s &
+elif [ -x BINDIR/fc-cache ] ; then
+ BINDIR/fc-cache &
+fi
diff --git a/launchd/privileged_startx/Makefile.am b/launchd/privileged_startx/Makefile.am
new file mode 100644
index 0000000..811cbdb
--- /dev/null
+++ b/launchd/privileged_startx/Makefile.am
@@ -0,0 +1,82 @@
+# Copyright (c) 2008 Apple Inc.
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation files
+# (the "Software"), to deal in the Software without restriction,
+# including without limitation the rights to use, copy, modify, merge,
+# publish, distribute, sublicense, and/or sell copies of the Software,
+# and to permit persons to whom the Software is furnished to do so,
+# subject to the following conditions:
+#
+# 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 ABOVE LISTED COPYRIGHT
+# HOLDER(S) 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(s) of the above
+# copyright holders shall not be used in advertising or otherwise to
+# promote the sale, use or other dealings in this Software without
+# prior written authorization.
+
+include $(top_srcdir)/cpprules.in
+
+xinitrcdir = $(libdir)/X11/xinit
+privstartxdir = $(xinitrcdir)/privileged_startx.d
+
+xinitrc_PROGRAMS = privileged_startx
+privstartx_SCRIPTS = 10-tmpdirs 20-font_cache
+
+AM_CPPFLAGS = -I$(srcdir)/.. -DXINITDIR=\"$(xinitrcdir)\" -DSCRIPTDIR=\"$(privstartxdir)\" -DBINDIR=\"$(bindir)\"
+CPP_FILES_FLAGS = -DXINITDIR="$(xinitrcdir)" -DSCRIPTDIR="$(privstartxdir)" -DBINDIR="$(bindir)" -DBUNDLE_ID_PREFIX="$(bundleidprefix)"
+
+if TIGER_LAUNCHD
+CPP_FILES_FLAGS += -DTIGER_LAUNCHD
+endif
+
+dist_privileged_startx_SOURCES = \
+ $(srcdir)/../console_redirect.c \
+ server.c \
+ client.c \
+ privileged_startx.c
+
+nodist_privileged_startx_SOURCES = \
+ privileged_startxServer.c \
+ privileged_startxUser.c
+
+BUILT_SOURCES = \
+ privileged_startxServer.c \
+ privileged_startxUser.c \
+ privileged_startxServer.h \
+ privileged_startx.h
+
+$(bundleidprefix).privileged_startx.plist.cpp: privileged_startx.plist.cpp
+ cp $< $@
+
+launchdaemons_PRE = $(bundleidprefix).privileged_startx.plist.cpp
+launchdaemons_DATA = $(launchdaemons_PRE:plist.cpp=plist)
+
+10-tmpdirs: 10-tmpdirs.cpp Makefile
+20-font_cache: 20-font_cache.cpp Makefile
+
+CLEANFILES = \
+ $(privstartx_SCRIPTS) \
+ $(BUILT_SOURCES) \
+ $(launchdaemons_DATA) \
+ $(bundleidprefix).privileged_startx.plist.cpp
+
+EXTRA_DIST = \
+ 10-tmpdirs.cpp \
+ 20-font_cache.cpp \
+ privileged_startx.plist.cpp \
+ privileged_startx.defs \
+ privileged_startx_types.h
+
+$(BUILT_SOURCES): $(srcdir)/privileged_startx.defs
+ mig -sheader privileged_startxServer.h $(srcdir)/privileged_startx.defs
diff --git a/launchd/privileged_startx/Makefile.in b/launchd/privileged_startx/Makefile.in
new file mode 100644
index 0000000..7a47488
--- /dev/null
+++ b/launchd/privileged_startx/Makefile.in
@@ -0,0 +1,643 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Copyright (c) 2008 Apple Inc.
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation files
+# (the "Software"), to deal in the Software without restriction,
+# including without limitation the rights to use, copy, modify, merge,
+# publish, distribute, sublicense, and/or sell copies of the Software,
+# and to permit persons to whom the Software is furnished to do so,
+# subject to the following conditions:
+#
+# 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 ABOVE LISTED COPYRIGHT
+# HOLDER(S) 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(s) of the above
+# copyright holders shall not be used in advertising or otherwise to
+# promote the sale, use or other dealings in this Software without
+# prior written authorization.
+
+# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
+# to cpp, because that trick does not work on all ANSI C preprocessors.
+# Delete line numbers from the cpp output (-P is not portable, I guess).
+# Allow XCOMM to be preceded by whitespace and provide a means of generating
+# output lines with trailing backslashes.
+# Allow XHASH to always be substituted, even in cases where XCOMM isn't.
+
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/cpprules.in
+xinitrc_PROGRAMS = privileged_startx$(EXEEXT)
+@TIGER_LAUNCHD_TRUE@am__append_1 = -DTIGER_LAUNCHD
+subdir = launchd/privileged_startx
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(xinitrcdir)" \
+ "$(DESTDIR)$(privstartxdir)" "$(DESTDIR)$(launchdaemonsdir)"
+xinitrcPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(xinitrc_PROGRAMS)
+dist_privileged_startx_OBJECTS = console_redirect.$(OBJEXT) \
+ server.$(OBJEXT) client.$(OBJEXT) privileged_startx.$(OBJEXT)
+nodist_privileged_startx_OBJECTS = privileged_startxServer.$(OBJEXT) \
+ privileged_startxUser.$(OBJEXT)
+privileged_startx_OBJECTS = $(dist_privileged_startx_OBJECTS) \
+ $(nodist_privileged_startx_OBJECTS)
+privileged_startx_LDADD = $(LDADD)
+privstartxSCRIPT_INSTALL = $(INSTALL_SCRIPT)
+SCRIPTS = $(privstartx_SCRIPTS)
+DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(dist_privileged_startx_SOURCES) \
+ $(nodist_privileged_startx_SOURCES)
+DIST_SOURCES = $(dist_privileged_startx_SOURCES)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+launchdaemonsDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(launchdaemons_DATA)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_CFLAGS = @BASE_CFLAGS@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CHANGELOG_CMD = @CHANGELOG_CMD@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CWARNFLAGS = @CWARNFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_CMD = @INSTALL_CMD@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAN_SUBSTS = @MAN_SUBSTS@
+MCOOKIE = @MCOOKIE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SCOMAN = @SCOMAN@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHELL_CMD = @SHELL_CMD@
+STARTX_COOKIE_FLAGS = @STARTX_COOKIE_FLAGS@
+STRICT_CFLAGS = @STRICT_CFLAGS@
+STRIP = @STRIP@
+TWM = @TWM@
+VERSION = @VERSION@
+XAUTH = @XAUTH@
+XCLOCK = @XCLOCK@
+XCONFIGFILE = @XCONFIGFILE@
+XCONFIGFILEMAN = @XCONFIGFILEMAN@
+XINIT = @XINIT@
+XINITDIR = @XINITDIR@
+XINIT_CFLAGS = @XINIT_CFLAGS@
+XINIT_LIBS = @XINIT_LIBS@
+XMODMAP = @XMODMAP@
+XORG_MAN_PAGE = @XORG_MAN_PAGE@
+XRDB = @XRDB@
+XSERVER = @XSERVER@
+XSERVERNAME = @XSERVERNAME@
+XTERM = @XTERM@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+bundleidprefix = @bundleidprefix@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+launchagentxserver = @launchagentxserver@
+launchdaemonsdir = @launchdaemonsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \
+ -e '/^\#line *[0-9][0-9]* *.*$$/d' \
+ -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \
+ -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
+ -e '/^[ ]*XHASH/s/XHASH/\#/' \
+ -e '/XSLASHGLOB/s/XSLASHGLOB/\/\*/' \
+ -e '/\@\@$$/s/\@\@$$/\\/'
+
+SUFFIXES = .cpp
+xinitrcdir = $(libdir)/X11/xinit
+privstartxdir = $(xinitrcdir)/privileged_startx.d
+privstartx_SCRIPTS = 10-tmpdirs 20-font_cache
+AM_CPPFLAGS = -I$(srcdir)/.. -DXINITDIR=\"$(xinitrcdir)\" -DSCRIPTDIR=\"$(privstartxdir)\" -DBINDIR=\"$(bindir)\"
+CPP_FILES_FLAGS = -DXINITDIR="$(xinitrcdir)" \
+ -DSCRIPTDIR="$(privstartxdir)" -DBINDIR="$(bindir)" \
+ -DBUNDLE_ID_PREFIX="$(bundleidprefix)" $(am__append_1)
+dist_privileged_startx_SOURCES = \
+ $(srcdir)/../console_redirect.c \
+ server.c \
+ client.c \
+ privileged_startx.c
+
+nodist_privileged_startx_SOURCES = \
+ privileged_startxServer.c \
+ privileged_startxUser.c
+
+BUILT_SOURCES = \
+ privileged_startxServer.c \
+ privileged_startxUser.c \
+ privileged_startxServer.h \
+ privileged_startx.h
+
+launchdaemons_PRE = $(bundleidprefix).privileged_startx.plist.cpp
+launchdaemons_DATA = $(launchdaemons_PRE:plist.cpp=plist)
+CLEANFILES = \
+ $(privstartx_SCRIPTS) \
+ $(BUILT_SOURCES) \
+ $(launchdaemons_DATA) \
+ $(bundleidprefix).privileged_startx.plist.cpp
+
+EXTRA_DIST = \
+ 10-tmpdirs.cpp \
+ 20-font_cache.cpp \
+ privileged_startx.plist.cpp \
+ privileged_startx.defs \
+ privileged_startx_types.h
+
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .c .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/cpprules.in $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign launchd/privileged_startx/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign launchd/privileged_startx/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-xinitrcPROGRAMS: $(xinitrc_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(xinitrcdir)" || $(MKDIR_P) "$(DESTDIR)$(xinitrcdir)"
+ @list='$(xinitrc_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(xinitrcPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(xinitrcdir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(xinitrcPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(xinitrcdir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-xinitrcPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(xinitrc_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(xinitrcdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(xinitrcdir)/$$f"; \
+ done
+
+clean-xinitrcPROGRAMS:
+ -test -z "$(xinitrc_PROGRAMS)" || rm -f $(xinitrc_PROGRAMS)
+privileged_startx$(EXEEXT): $(privileged_startx_OBJECTS) $(privileged_startx_DEPENDENCIES)
+ @rm -f privileged_startx$(EXEEXT)
+ $(LINK) $(privileged_startx_OBJECTS) $(privileged_startx_LDADD) $(LIBS)
+install-privstartxSCRIPTS: $(privstartx_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ test -z "$(privstartxdir)" || $(MKDIR_P) "$(DESTDIR)$(privstartxdir)"
+ @list='$(privstartx_SCRIPTS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f $$d$$p; then \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ echo " $(privstartxSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(privstartxdir)/$$f'"; \
+ $(privstartxSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(privstartxdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-privstartxSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(privstartx_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(privstartxdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(privstartxdir)/$$f"; \
+ done
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/client.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/console_redirect.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/privileged_startx.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/privileged_startxServer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/privileged_startxUser.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/server.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+console_redirect.o: $(srcdir)/../console_redirect.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT console_redirect.o -MD -MP -MF $(DEPDIR)/console_redirect.Tpo -c -o console_redirect.o `test -f '$(srcdir)/../console_redirect.c' || echo '$(srcdir)/'`$(srcdir)/../console_redirect.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/console_redirect.Tpo $(DEPDIR)/console_redirect.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../console_redirect.c' object='console_redirect.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o console_redirect.o `test -f '$(srcdir)/../console_redirect.c' || echo '$(srcdir)/'`$(srcdir)/../console_redirect.c
+
+console_redirect.obj: $(srcdir)/../console_redirect.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT console_redirect.obj -MD -MP -MF $(DEPDIR)/console_redirect.Tpo -c -o console_redirect.obj `if test -f '$(srcdir)/../console_redirect.c'; then $(CYGPATH_W) '$(srcdir)/../console_redirect.c'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/../console_redirect.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/console_redirect.Tpo $(DEPDIR)/console_redirect.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../console_redirect.c' object='console_redirect.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o console_redirect.obj `if test -f '$(srcdir)/../console_redirect.c'; then $(CYGPATH_W) '$(srcdir)/../console_redirect.c'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/../console_redirect.c'; fi`
+install-launchdaemonsDATA: $(launchdaemons_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(launchdaemonsdir)" || $(MKDIR_P) "$(DESTDIR)$(launchdaemonsdir)"
+ @list='$(launchdaemons_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(launchdaemonsDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(launchdaemonsdir)/$$f'"; \
+ $(launchdaemonsDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(launchdaemonsdir)/$$f"; \
+ done
+
+uninstall-launchdaemonsDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(launchdaemons_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(launchdaemonsdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(launchdaemonsdir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(xinitrcdir)" "$(DESTDIR)$(privstartxdir)" "$(DESTDIR)$(launchdaemonsdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-generic clean-xinitrcPROGRAMS mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-launchdaemonsDATA install-privstartxSCRIPTS \
+ install-xinitrcPROGRAMS
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-launchdaemonsDATA uninstall-privstartxSCRIPTS \
+ uninstall-xinitrcPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-xinitrcPROGRAMS ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-launchdaemonsDATA install-man \
+ install-pdf install-pdf-am install-privstartxSCRIPTS \
+ install-ps install-ps-am install-strip install-xinitrcPROGRAMS \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-launchdaemonsDATA \
+ uninstall-privstartxSCRIPTS uninstall-xinitrcPROGRAMS
+
+
+.cpp:
+ $(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@
+
+$(bundleidprefix).privileged_startx.plist.cpp: privileged_startx.plist.cpp
+ cp $< $@
+
+10-tmpdirs: 10-tmpdirs.cpp Makefile
+20-font_cache: 20-font_cache.cpp Makefile
+
+$(BUILT_SOURCES): $(srcdir)/privileged_startx.defs
+ mig -sheader privileged_startxServer.h $(srcdir)/privileged_startx.defs
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/launchd/privileged_startx/client.c b/launchd/privileged_startx/client.c
new file mode 100644
index 0000000..6c3a6d6
--- /dev/null
+++ b/launchd/privileged_startx/client.c
@@ -0,0 +1,66 @@
+/* Copyright (c) 2008 Apple Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * 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 ABOVE LISTED COPYRIGHT
+ * HOLDER(S) 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(s) of the above
+ * copyright holders shall not be used in advertising or otherwise to
+ * promote the sale, use or other dealings in this Software without
+ * prior written authorization.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <mach/mach.h>
+#include <mach/mach_error.h>
+#include <servers/bootstrap.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+
+#include <AvailabilityMacros.h>
+
+#include "privileged_startx.h"
+
+int client_main(void) {
+ kern_return_t kr;
+ mach_port_t mp;
+
+ kr = bootstrap_look_up(bootstrap_port, BOOTSTRAP_NAME, &mp);
+ if (kr != KERN_SUCCESS) {
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
+ fprintf(stderr, "privileged_startx: bootstrap_look_up(%s): %s\n", BOOTSTRAP_NAME, bootstrap_strerror(kr));
+#else
+ fprintf(stderr, "privileged_startx: bootstrap_look_up(%s): %ul\n", BOOTSTRAP_NAME, (unsigned long)kr);
+#endif
+ exit(EXIT_FAILURE);
+ }
+
+ kr = privileged_startx(mp);
+ if (kr != KERN_SUCCESS) {
+ fprintf(stderr, "privileged_startx client: %s\n", mach_error_string(kr));
+ exit(EXIT_FAILURE);
+ }
+
+ exit(EXIT_SUCCESS);
+}
diff --git a/launchd/privileged_startx/privileged_startx.c b/launchd/privileged_startx/privileged_startx.c
new file mode 100644
index 0000000..b71c30b
--- /dev/null
+++ b/launchd/privileged_startx/privileged_startx.c
@@ -0,0 +1,63 @@
+/* Copyright (c) 2008 Apple Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * 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 ABOVE LISTED COPYRIGHT
+ * HOLDER(S) 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(s) of the above
+ * copyright holders shall not be used in advertising or otherwise to
+ * promote the sale, use or other dealings in this Software without
+ * prior written authorization.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <string.h>
+#include <stdio.h>
+
+#ifndef SCRIPTDIR
+#define SCRIPTDIR="/usr/X11/lib/X11/xinit/privileged_startx.d"
+#endif
+
+static void usage(const char *prog) {
+ fprintf(stderr, "%s: usage\n", prog);
+ fprintf(stderr, " %s [-d [<script dir>]]\n\n", prog);
+ fprintf(stderr, " -d: Passed when called from launchd to denote server-mode.\n");
+ fprintf(stderr, " <script dir>: Directory to use instead of %s\n", SCRIPTDIR);
+}
+
+int client_main(void);
+int server_main(const char *dir);
+
+int main(int argc, char *argv[]) {
+
+ if(argc == 1) {
+ return client_main();
+ } else if(!strncmp(argv[1], "-d", 2)) {
+ if(argc == 2)
+ return server_main(NULL);
+ else if(argc == 3)
+ return server_main(argv[2]);
+ }
+
+ usage(argv[0]);
+ return 1;
+}
diff --git a/launchd/privileged_startx/privileged_startx.defs b/launchd/privileged_startx/privileged_startx.defs
new file mode 100644
index 0000000..86f2b3a
--- /dev/null
+++ b/launchd/privileged_startx/privileged_startx.defs
@@ -0,0 +1,40 @@
+/* Copyright (c) 2008 Apple Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * 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 ABOVE LISTED COPYRIGHT
+ * HOLDER(S) 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(s) of the above
+ * copyright holders shall not be used in advertising or otherwise to
+ * promote the sale, use or other dealings in this Software without
+ * prior written authorization.
+ */
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+import "privileged_startx_types.h";
+
+subsystem privileged_startx 12345;
+serverprefix do_;
+
+routine privileged_startx(
+ port : mach_port_t);
+
+routine idle_exit(
+ port : mach_port_t);
diff --git a/launchd/privileged_startx/privileged_startx.plist.cpp b/launchd/privileged_startx/privileged_startx.plist.cpp
new file mode 100644
index 0000000..533fc32
--- /dev/null
+++ b/launchd/privileged_startx/privileged_startx.plist.cpp
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>Label</key>
+ <string>BUNDLE_ID_PREFIX.privileged_startx</string>
+ <key>ProgramArguments</key>
+ <array>
+ <string>XINITDIR/privileged_startx</string>
+ <string>-d</string>
+ <string>SCRIPTDIR</string>
+ </array>
+#ifdef TIGER_LAUNCHD
+ <key>KeepAlive</key>
+ <true/>
+#else
+ <key>MachServices</key>
+ <dict>
+ <key>BUNDLE_ID_PREFIX.privileged_startx</key>
+ <true/>
+ </dict>
+ <key>TimeOut</key>
+ <integer>120</integer>
+ <key>EnableTransactions</key>
+ <true/>
+#endif
+</dict>
+</plist>
diff --git a/launchd/privileged_startx/privileged_startx_types.h b/launchd/privileged_startx/privileged_startx_types.h
new file mode 100644
index 0000000..a0d3439
--- /dev/null
+++ b/launchd/privileged_startx/privileged_startx_types.h
@@ -0,0 +1,10 @@
+#ifndef _PRIV_STARTX_TYPES_H_
+#define _PRIV_STARTX_TYPES_H_
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#define BOOTSTRAP_NAME BUNDLE_ID_PREFIX".privileged_startx"
+
+#endif
diff --git a/launchd/privileged_startx/server.c b/launchd/privileged_startx/server.c
new file mode 100644
index 0000000..cfbb623
--- /dev/null
+++ b/launchd/privileged_startx/server.c
@@ -0,0 +1,320 @@
+/* Copyright (c) 2008-2011 Apple Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * 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 ABOVE LISTED COPYRIGHT
+ * HOLDER(S) 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(s) of the above
+ * copyright holders shall not be used in advertising or otherwise to
+ * promote the sale, use or other dealings in this Software without
+ * prior written authorization.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <mach/mach.h>
+#include <mach/mach_error.h>
+#include <servers/bootstrap.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fts.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <sys/time.h>
+#include <launch.h>
+#include <asl.h>
+#include <errno.h>
+
+#include "console_redirect.h"
+
+#include "privileged_startx.h"
+#include "privileged_startxServer.h"
+
+union MaxMsgSize {
+ union __RequestUnion__privileged_startx_subsystem req;
+ union __ReplyUnion__privileged_startx_subsystem rep;
+};
+
+#ifdef LAUNCH_JOBKEY_MACHSERVICES
+#include <pthread.h>
+static void* idle_thread(void* param __attribute__((unused)));
+
+/* globals to trigger idle exit */
+#define DEFAULT_IDLE_TIMEOUT 60 /* 60 second timeout, then the server exits */
+
+struct idle_globals {
+ mach_port_t mp;
+ long timeout;
+ struct timeval lastmsg;
+};
+
+struct idle_globals idle_globals;
+#endif
+
+#ifndef SCRIPTDIR
+#define SCRIPTDIR="/usr/X11/lib/X11/xinit/privileged_startx.d"
+#endif
+
+/* Default script dir */
+const char *script_dir = SCRIPTDIR;
+
+#ifndef LAUNCH_JOBKEY_MACHSERVICES
+static mach_port_t checkin_or_register(char *bname) {
+ kern_return_t kr;
+ mach_port_t mp;
+
+ /* If we're started by launchd or the old mach_init */
+ kr = bootstrap_check_in(bootstrap_port, bname, &mp);
+ if (kr == KERN_SUCCESS)
+ return mp;
+
+ /* We probably were not started by launchd or the old mach_init */
+ kr = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &mp);
+ if (kr != KERN_SUCCESS) {
+ asl_log(NULL, NULL, ASL_LEVEL_ERR, "mach_port_allocate(): %s", mach_error_string(kr));
+ exit(EXIT_FAILURE);
+ }
+
+ kr = mach_port_insert_right(mach_task_self(), mp, mp, MACH_MSG_TYPE_MAKE_SEND);
+ if (kr != KERN_SUCCESS) {
+ asl_log(NULL, NULL, ASL_LEVEL_ERR, "mach_port_insert_right(): %s", mach_error_string(kr));
+ exit(EXIT_FAILURE);
+ }
+
+ kr = bootstrap_register(bootstrap_port, bname, mp);
+ if (kr != KERN_SUCCESS) {
+ asl_log(NULL, NULL, ASL_LEVEL_ERR, "bootstrap_register(): %s", mach_error_string(kr));
+ exit(EXIT_FAILURE);
+ }
+
+ return mp;
+}
+#endif
+
+int server_main(const char *dir) {
+ mach_msg_size_t mxmsgsz = sizeof(union MaxMsgSize) + MAX_TRAILER_SIZE;
+ mach_port_t mp;
+ kern_return_t kr;
+#ifdef LAUNCH_JOBKEY_MACHSERVICES
+ long idle_timeout = DEFAULT_IDLE_TIMEOUT;
+#endif
+
+ launch_data_t config = NULL, checkin = NULL, label = NULL;
+ const char *labelstr = BUNDLE_ID_PREFIX".privileged_startx";
+ aslclient aslc;
+
+ checkin = launch_data_new_string(LAUNCH_KEY_CHECKIN);
+ config = launch_msg(checkin);
+ if (!config || launch_data_get_type(config) == LAUNCH_DATA_ERRNO) {
+ asl_log(NULL, NULL, ASL_LEVEL_ERR, "launchd checkin failed");
+ exit(EXIT_FAILURE);
+ }
+
+ if(dir) {
+ script_dir = dir;
+ asl_log(NULL, NULL, ASL_LEVEL_DEBUG,
+ "script directory set: %s", script_dir);
+ }
+
+ label = launch_data_dict_lookup(config, LAUNCH_JOBKEY_LABEL);
+ if (label) {
+ labelstr = launch_data_get_string(label);
+ }
+
+ aslc = asl_open(labelstr, BUNDLE_ID_PREFIX, ASL_OPT_NO_DELAY);
+ xi_asl_capture_fd(aslc, NULL, ASL_LEVEL_INFO, STDOUT_FILENO);
+ xi_asl_capture_fd(aslc, NULL, ASL_LEVEL_NOTICE, STDERR_FILENO);
+
+#ifdef LAUNCH_JOBKEY_MACHSERVICES
+ launch_data_t tmv;
+ tmv = launch_data_dict_lookup(config, LAUNCH_JOBKEY_TIMEOUT);
+ if (tmv) {
+ idle_timeout = launch_data_get_integer(tmv);
+ asl_log(NULL, NULL, ASL_LEVEL_DEBUG,
+ "idle timeout set: %ld seconds", idle_timeout);
+ }
+
+ launch_data_t svc;
+ svc = launch_data_dict_lookup(config, LAUNCH_JOBKEY_MACHSERVICES);
+ if (!svc) {
+ asl_log(NULL, NULL, ASL_LEVEL_ERR, "no mach services");
+ exit(EXIT_FAILURE);
+ }
+
+ svc = launch_data_dict_lookup(svc, BOOTSTRAP_NAME);
+ if (!svc) {
+ asl_log(NULL, NULL, ASL_LEVEL_ERR, "no mach service: %s",
+ BOOTSTRAP_NAME);
+ exit(EXIT_FAILURE);
+ }
+
+ mp = launch_data_get_machport(svc);
+#else
+ mp = checkin_or_register(BUNDLE_ID_PREFIX".privileged_startx");
+#endif
+
+ if (mp == MACH_PORT_NULL) {
+ asl_log(NULL, NULL, ASL_LEVEL_ERR, "NULL mach service: %s",
+ BOOTSTRAP_NAME);
+ exit(EXIT_FAILURE);
+ }
+
+ /* insert a send right so we can send our idle exit message */
+ kr = mach_port_insert_right(mach_task_self(), mp, mp,
+ MACH_MSG_TYPE_MAKE_SEND);
+ if (kr != KERN_SUCCESS) {
+ asl_log(NULL, NULL, ASL_LEVEL_ERR, "send right failed: %s",
+ mach_error_string(kr));
+ exit(EXIT_FAILURE);
+ }
+
+#ifdef LAUNCH_JOBKEY_MACHSERVICES
+ /* spawn a thread to monitor our idle timeout */
+ pthread_t thread;
+ idle_globals.mp = mp;
+ idle_globals.timeout = idle_timeout;
+ gettimeofday(&idle_globals.lastmsg, NULL);
+ pthread_create(&thread, NULL, &idle_thread, NULL);
+#endif
+
+ /* Main event loop */
+ kr = mach_msg_server(privileged_startx_server, mxmsgsz, mp, 0);
+ if (kr != KERN_SUCCESS) {
+ asl_log(NULL, NULL, ASL_LEVEL_ERR,
+ "mach_msg_server(mp): %s", mach_error_string(kr));
+ exit(EXIT_FAILURE);
+ }
+
+ exit(EXIT_SUCCESS);
+}
+
+static int ftscmp(const FTSENT **a, const FTSENT **b) {
+ return strcmp((**a).fts_name, (**b).fts_name);
+}
+
+kern_return_t do_privileged_startx(mach_port_t test_port __attribute__((unused))) {
+ kern_return_t retval = KERN_SUCCESS;
+ char fn_buf[PATH_MAX + 1];
+ char *s;
+ int error_code;
+ FTS *ftsp;
+ FTSENT *ftsent;
+
+ const char * path_argv[2] = {script_dir, NULL};
+
+#ifdef LAUNCH_JOBKEY_MACHSERVICES
+ /* Store that we were called, so the idle timer will reset */
+ gettimeofday(&idle_globals.lastmsg, NULL);
+#endif
+
+ /* script_dir contains a set of files to run with root privs when X11 starts */
+ ftsp = fts_open((char * const *)path_argv, FTS_PHYSICAL, ftscmp);
+ if(!ftsp) {
+ asl_log(NULL, NULL, ASL_LEVEL_ERR,
+ "do_privileged_startx: fts_open(%s): %s",
+ script_dir, strerror(errno));
+ return KERN_FAILURE;
+ }
+
+ /* Grab our dir */
+ ftsent = fts_read(ftsp);
+ if(!ftsent) {
+ asl_log(NULL, NULL, ASL_LEVEL_ERR,
+ "do_privileged_startx: fts_read(): %s", strerror(errno));
+ fts_close(ftsp);
+ return KERN_FAILURE;
+ }
+
+ /* Get a list of the files in this directory */
+ ftsent = fts_children(ftsp, 0);
+ if(!ftsent) {
+ asl_log(NULL, NULL, ASL_LEVEL_ERR,
+ "do_privileged_startx: fts_children(): %s", strerror(errno));
+ fts_close(ftsp);
+ return KERN_FAILURE;
+ }
+
+ /* Setup the buffer to have the path to the script dir */
+ strncpy(fn_buf, script_dir, PATH_MAX-1);
+ strcat(fn_buf, "/");
+ s = strrchr(fn_buf, 0);
+
+ /* Itterate over these files in alphabetical order */
+ for(; ftsent; ftsent = ftsent->fts_link) {
+ /* We only source regular files that are executable */
+ /* Note: This assumes we own them, which should always be the case */
+ if((ftsent->fts_statp->st_mode & S_IFREG) &&
+ (ftsent->fts_statp->st_mode & S_IXUSR)) {
+
+ /* Complete the full path filename in fn_buf */
+ strcpy(s, ftsent->fts_name);
+
+ /* Run it */
+ error_code = system(fn_buf);
+ if(error_code != 0) {
+ asl_log(NULL, NULL, ASL_LEVEL_ERR,
+ "do_privileged_startx: %s: exited with status %d",
+ fn_buf, error_code);
+ retval = KERN_FAILURE;
+ }
+ }
+ }
+
+ fts_close(ftsp);
+ return retval;
+}
+
+kern_return_t do_idle_exit(mach_port_t test_port __attribute__((unused))) {
+#ifdef LAUNCH_JOBKEY_MACHSERVICES
+ struct timeval now;
+ gettimeofday(&now, NULL);
+
+ long delta = now.tv_sec - idle_globals.lastmsg.tv_sec;
+ if (delta >= idle_globals.timeout) {
+ exit(EXIT_SUCCESS);
+ }
+
+ return KERN_SUCCESS;
+#else
+ return KERN_FAILURE;
+#endif
+}
+
+#ifdef LAUNCH_JOBKEY_MACHSERVICES
+static void *idle_thread(void* param __attribute__((unused))) {
+ for(;;) {
+ struct timeval now;
+ gettimeofday(&now, NULL);
+ long delta = (now.tv_sec - idle_globals.lastmsg.tv_sec);
+ if (delta < idle_globals.timeout) {
+ /* sleep for remainder of timeout */
+ sleep(idle_globals.timeout - delta);
+ } else {
+ /* timeout has elapsed, attempt to idle exit */
+ idle_exit(idle_globals.mp);
+ }
+ }
+ return NULL;
+}
+#endif
diff --git a/launchd/user_startx/Makefile.am b/launchd/user_startx/Makefile.am
new file mode 100644
index 0000000..bf18fb0
--- /dev/null
+++ b/launchd/user_startx/Makefile.am
@@ -0,0 +1,53 @@
+#
+# Copyright 2005 Red Hat, Inc.
+#
+# 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 Red Hat not be used in
+# advertising or publicity pertaining to distribution of the software without
+# specific, written prior permission. Red Hat makes no
+# representations about the suitability of this software for any purpose. It
+# is provided "as is" without express or implied warranty.
+#
+# RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+# EVENT SHALL RED HAT 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.
+
+include $(top_srcdir)/cpprules.in
+
+xinitrcdir = $(XINITDIR)
+
+xinitrc_PROGRAMS = launchd_startx
+
+AM_CPPFLAGS = -I$(srcdir)/.. -DXINITDIR=\"$(xinitrcdir)\" -DBINDIR=\"$(bindir)\"
+
+dist_launchd_startx_SOURCES = \
+ $(srcdir)/../console_redirect.c \
+ launchd_startx.c
+
+CPP_FILES_FLAGS = \
+ -D__xinitrcdir__="$(xinitrcdir)" \
+ -D__bindir__="$(bindir)" \
+ -DBUNDLE_ID_PREFIX="$(bundleidprefix)"
+
+if LAUNCHAGENT_XSERVER
+CPP_FILES_FLAGS += -DLAUNCHAGENT_XSERVER_PATH="$(launchagentxserver)"
+endif
+
+$(bundleidprefix).startx.plist.cpp: startx.plist.cpp
+ cp $< $@
+
+launchagents_PRE = $(bundleidprefix).startx.plist.cpp
+launchagents_DATA = $(launchagents_PRE:plist.cpp=plist)
+
+EXTRA_DIST = startx.plist.cpp
+
+CLEANFILES = \
+ $(launchagents_DATA) \
+ $(bundleidprefix).startx.plist.cpp
diff --git a/launchd/user_startx/Makefile.in b/launchd/user_startx/Makefile.in
new file mode 100644
index 0000000..c4935b7
--- /dev/null
+++ b/launchd/user_startx/Makefile.in
@@ -0,0 +1,573 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+#
+# Copyright 2005 Red Hat, Inc.
+#
+# 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 Red Hat not be used in
+# advertising or publicity pertaining to distribution of the software without
+# specific, written prior permission. Red Hat makes no
+# representations about the suitability of this software for any purpose. It
+# is provided "as is" without express or implied warranty.
+#
+# RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+# EVENT SHALL RED HAT 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.
+
+# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
+# to cpp, because that trick does not work on all ANSI C preprocessors.
+# Delete line numbers from the cpp output (-P is not portable, I guess).
+# Allow XCOMM to be preceded by whitespace and provide a means of generating
+# output lines with trailing backslashes.
+# Allow XHASH to always be substituted, even in cases where XCOMM isn't.
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/cpprules.in
+xinitrc_PROGRAMS = launchd_startx$(EXEEXT)
+@LAUNCHAGENT_XSERVER_TRUE@am__append_1 = -DLAUNCHAGENT_XSERVER_PATH="$(launchagentxserver)"
+subdir = launchd/user_startx
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(xinitrcdir)" \
+ "$(DESTDIR)$(launchagentsdir)"
+xinitrcPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(xinitrc_PROGRAMS)
+dist_launchd_startx_OBJECTS = console_redirect.$(OBJEXT) \
+ launchd_startx.$(OBJEXT)
+launchd_startx_OBJECTS = $(dist_launchd_startx_OBJECTS)
+launchd_startx_LDADD = $(LDADD)
+DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(dist_launchd_startx_SOURCES)
+DIST_SOURCES = $(dist_launchd_startx_SOURCES)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+launchagentsDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(launchagents_DATA)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_CFLAGS = @BASE_CFLAGS@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CHANGELOG_CMD = @CHANGELOG_CMD@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CWARNFLAGS = @CWARNFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_CMD = @INSTALL_CMD@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAN_SUBSTS = @MAN_SUBSTS@
+MCOOKIE = @MCOOKIE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SCOMAN = @SCOMAN@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHELL_CMD = @SHELL_CMD@
+STARTX_COOKIE_FLAGS = @STARTX_COOKIE_FLAGS@
+STRICT_CFLAGS = @STRICT_CFLAGS@
+STRIP = @STRIP@
+TWM = @TWM@
+VERSION = @VERSION@
+XAUTH = @XAUTH@
+XCLOCK = @XCLOCK@
+XCONFIGFILE = @XCONFIGFILE@
+XCONFIGFILEMAN = @XCONFIGFILEMAN@
+XINIT = @XINIT@
+XINITDIR = @XINITDIR@
+XINIT_CFLAGS = @XINIT_CFLAGS@
+XINIT_LIBS = @XINIT_LIBS@
+XMODMAP = @XMODMAP@
+XORG_MAN_PAGE = @XORG_MAN_PAGE@
+XRDB = @XRDB@
+XSERVER = @XSERVER@
+XSERVERNAME = @XSERVERNAME@
+XTERM = @XTERM@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+bundleidprefix = @bundleidprefix@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+launchagentxserver = @launchagentxserver@
+launchdaemonsdir = @launchdaemonsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \
+ -e '/^\#line *[0-9][0-9]* *.*$$/d' \
+ -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \
+ -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
+ -e '/^[ ]*XHASH/s/XHASH/\#/' \
+ -e '/XSLASHGLOB/s/XSLASHGLOB/\/\*/' \
+ -e '/\@\@$$/s/\@\@$$/\\/'
+
+SUFFIXES = .cpp
+xinitrcdir = $(XINITDIR)
+AM_CPPFLAGS = -I$(srcdir)/.. -DXINITDIR=\"$(xinitrcdir)\" -DBINDIR=\"$(bindir)\"
+dist_launchd_startx_SOURCES = \
+ $(srcdir)/../console_redirect.c \
+ launchd_startx.c
+
+CPP_FILES_FLAGS = -D__xinitrcdir__="$(xinitrcdir)" \
+ -D__bindir__="$(bindir)" \
+ -DBUNDLE_ID_PREFIX="$(bundleidprefix)" $(am__append_1)
+launchagents_PRE = $(bundleidprefix).startx.plist.cpp
+launchagents_DATA = $(launchagents_PRE:plist.cpp=plist)
+EXTRA_DIST = startx.plist.cpp
+CLEANFILES = \
+ $(launchagents_DATA) \
+ $(bundleidprefix).startx.plist.cpp
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .c .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/cpprules.in $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign launchd/user_startx/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign launchd/user_startx/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-xinitrcPROGRAMS: $(xinitrc_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(xinitrcdir)" || $(MKDIR_P) "$(DESTDIR)$(xinitrcdir)"
+ @list='$(xinitrc_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(xinitrcPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(xinitrcdir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(xinitrcPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(xinitrcdir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-xinitrcPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(xinitrc_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(xinitrcdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(xinitrcdir)/$$f"; \
+ done
+
+clean-xinitrcPROGRAMS:
+ -test -z "$(xinitrc_PROGRAMS)" || rm -f $(xinitrc_PROGRAMS)
+launchd_startx$(EXEEXT): $(launchd_startx_OBJECTS) $(launchd_startx_DEPENDENCIES)
+ @rm -f launchd_startx$(EXEEXT)
+ $(LINK) $(launchd_startx_OBJECTS) $(launchd_startx_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/console_redirect.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/launchd_startx.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+console_redirect.o: $(srcdir)/../console_redirect.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT console_redirect.o -MD -MP -MF $(DEPDIR)/console_redirect.Tpo -c -o console_redirect.o `test -f '$(srcdir)/../console_redirect.c' || echo '$(srcdir)/'`$(srcdir)/../console_redirect.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/console_redirect.Tpo $(DEPDIR)/console_redirect.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../console_redirect.c' object='console_redirect.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o console_redirect.o `test -f '$(srcdir)/../console_redirect.c' || echo '$(srcdir)/'`$(srcdir)/../console_redirect.c
+
+console_redirect.obj: $(srcdir)/../console_redirect.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT console_redirect.obj -MD -MP -MF $(DEPDIR)/console_redirect.Tpo -c -o console_redirect.obj `if test -f '$(srcdir)/../console_redirect.c'; then $(CYGPATH_W) '$(srcdir)/../console_redirect.c'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/../console_redirect.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/console_redirect.Tpo $(DEPDIR)/console_redirect.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../console_redirect.c' object='console_redirect.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o console_redirect.obj `if test -f '$(srcdir)/../console_redirect.c'; then $(CYGPATH_W) '$(srcdir)/../console_redirect.c'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/../console_redirect.c'; fi`
+install-launchagentsDATA: $(launchagents_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(launchagentsdir)" || $(MKDIR_P) "$(DESTDIR)$(launchagentsdir)"
+ @list='$(launchagents_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(launchagentsDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(launchagentsdir)/$$f'"; \
+ $(launchagentsDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(launchagentsdir)/$$f"; \
+ done
+
+uninstall-launchagentsDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(launchagents_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(launchagentsdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(launchagentsdir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS) $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(xinitrcdir)" "$(DESTDIR)$(launchagentsdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-xinitrcPROGRAMS mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-launchagentsDATA install-xinitrcPROGRAMS
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-launchagentsDATA uninstall-xinitrcPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-xinitrcPROGRAMS ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-launchagentsDATA install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip install-xinitrcPROGRAMS installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-launchagentsDATA \
+ uninstall-xinitrcPROGRAMS
+
+
+.cpp:
+ $(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@
+
+$(bundleidprefix).startx.plist.cpp: startx.plist.cpp
+ cp $< $@
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/launchd/user_startx/launchd_startx.c b/launchd/user_startx/launchd_startx.c
new file mode 100644
index 0000000..f83cd61
--- /dev/null
+++ b/launchd/user_startx/launchd_startx.c
@@ -0,0 +1,84 @@
+/* Copyright (c) 2011 Apple Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * 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 ABOVE LISTED COPYRIGHT
+ * HOLDER(S) 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(s) of the above
+ * copyright holders shall not be used in advertising or otherwise to
+ * promote the sale, use or other dealings in this Software without
+ * prior written authorization.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <asl.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <assert.h>
+#include <sys/wait.h>
+#include <string.h>
+#include <stdlib.h>
+
+/* Using MIN_REQUIRED instead of MAX_ALLOWED logic due to posix_spawn not
+ * being marked with availability macros until 10.7
+ */
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
+#include <spawn.h>
+#else
+#include <errno.h>
+#endif
+
+#include "console_redirect.h"
+
+int main(int argc, char **argv, char **envp) {
+ aslclient aslc;
+ pid_t child;
+ int pstat;
+
+ if(argc < 2 || strcmp(argv[1], "--help") == 0) {
+ fprintf(stderr, "Usage: %s prog [args...]\n", argv[0]);
+ exit(EXIT_FAILURE);
+ }
+
+ aslc = asl_open(BUNDLE_ID_PREFIX".startx", BUNDLE_ID_PREFIX, ASL_OPT_NO_DELAY);
+
+ xi_asl_capture_fd(aslc, NULL, ASL_LEVEL_INFO, STDOUT_FILENO);
+ xi_asl_capture_fd(aslc, NULL, ASL_LEVEL_NOTICE, STDERR_FILENO);
+
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
+ assert(posix_spawnp(&child, argv[1], NULL, NULL, &argv[1], envp) == 0);
+#else
+ switch(child = fork()) {
+ case -1:
+ perror("fork");
+ return errno;
+ case 0:
+ return execvp(argv[1], &argv[1]);
+ default:
+ break;
+ }
+#endif
+
+ wait4(child, &pstat, 0, (struct rusage *)0);
+
+ return pstat;
+}
diff --git a/launchd/user_startx/startx.plist.cpp b/launchd/user_startx/startx.plist.cpp
new file mode 100644
index 0000000..a43025f
--- /dev/null
+++ b/launchd/user_startx/startx.plist.cpp
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>Label</key>
+ <string>BUNDLE_ID_PREFIX.startx</string>
+ <key>ProgramArguments</key>
+ <array>
+ <string>__xinitrcdir__/launchd_startx</string>
+ <string>__bindir__/startx</string>
+#ifdef LAUNCHAGENT_XSERVER_PATH
+ <string>--</string>
+ <string>LAUNCHAGENT_XSERVER_PATH</string>
+#endif
+ </array>
+ <key>Sockets</key>
+ <dict>
+ <key>BUNDLE_ID_PREFIX:0</key>
+ <dict>
+ <key>SecureSocketWithKey</key>
+ <string>DISPLAY</string>
+ </dict>
+ </dict>
+ <key>ServiceIPC</key>
+ <true/>
+ <key>EnableTransactions</key>
+ <true/>
+</dict>
+</plist>