update to xinit 1.1.1

This commit is contained in:
matthieu 2009-05-03 13:17:37 +00:00
parent 8bb5fd8a8f
commit 033e24f23d
15 changed files with 4944 additions and 3786 deletions

View File

@ -1,3 +1,125 @@
commit 46d641fdd020d07a9b4bd0364cf126643342a7e3
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Wed Dec 17 15:19:38 2008 -0800
xinit 1.1.1
commit c340932db548d1a3d4fc5bbc682b7730e5b2cf4a
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Wed Dec 17 13:00:23 2008 -0800
Apple: Allow defaults option that maps to a -dpi server command line in startx
commit 89c1675d128da3477cac6858c4249b839ec68346
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Sat Dec 13 00:14:54 2008 -0800
OSX: Don't use login/bash -c hack anymore for org.x.startx LaunchAgent
commit 13accec7614960965470f17894bc9212842ea6d7
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Tue Dec 9 21:15:13 2008 -0800
OSX: More prefix fixes
commit e06ebf63e2c91e590fc1091e5ea2e49bab835526
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Wed Dec 3 11:19:48 2008 -0800
OSX: Fixed bad prefix
commit 4ee72a6f1fc5d045adb71260107ca605ec68a84a
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Tue Dec 2 20:56:11 2008 -0800
OSX Tiger: Fix discovery of mach port
commit ca9cb9750d2dd480240a37cdbd94fdba0a34da4c
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Tue Dec 2 20:31:10 2008 -0800
Apple: Honor X11_PREFS_DOMAIN if it's set (1.4.2-apple26 and later)
commit 754efe651165ea7dd034f6b0ce75ef785deab826
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Fri Nov 28 23:23:14 2008 -0800
OSX Tiger: Hopefully the last fix for Tiger users...
commit f04db53e71c681379ec49494c9ab727bc5269b30
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Fri Nov 28 11:20:25 2008 -0800
OSX Tiger: More compilation fixes...
commit ed6dc88f5cbaaad08a282c44ae333a938f6f4216
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Thu Nov 27 00:47:31 2008 -0800
OSX: Create privleged_startx on Tiger
Launchd in Tiger doesn't support OnDemand loading, so this is
a KeepAlive idle daemon on Tiger.
commit 9f761b5a8512a8ad8b1475a3684e1a23d953916f
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Sat Nov 22 10:52:35 2008 -0800
Apple: Use AvailabilityMacros.h for Tiger compatability
commit 0c0b73812efe75496e154730787402538a268bac
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Thu Aug 28 19:10:59 2008 -0700
Apple: Make VPATH builds work on darwin
Patch from Peter O'Gorman <peter@pogma.com>
commit 0753882b89a451c9bdd053c2915a80fbcdbb0b77
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Tue Aug 5 14:58:48 2008 -0700
Apple: sleep() to avoid innocent error message spew
commit 79871c9b9daa1fad1b84af8f7eb54fced7526b2e
Author: Alan Coopersmith <alan.coopersmith@sun.com>
Date: Tue Aug 5 14:11:24 2008 -0700
Fix build of startx & xinitrc with Solaris make
For some reason, having the dependencies explictly listed
causes it to ignore the suffix implicit rule for .cpp.
commit 9cc39e441b8741b4b0b878d00e09f0366ff36146
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Mon Aug 4 14:40:49 2008 -0700
Support the instant-off API in SnowLeopard.
commit 7d41013b0e295ec0444c2f9099679bb6018c812f
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Wed Jul 2 16:36:24 2008 -0700
Apple: Using eval to protect people who have spaces in their home path.
commit 9632367abd03108f3636b05e9f2fd92f5c28dabe
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Sun Jun 29 18:24:13 2008 -0700
startx.cpp: Made some things a little more friendly for people who have spaces in pathnames.
commit c5bd51b3a31b3b290dec9f978779a56161308bb4
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Sun Jun 29 17:50:44 2008 -0700
Apple: privleged_startx: Increase the timeout so slower machines don't get a stray process warning in their system log.
commit a5a8ea7c8452908c2c4c9c822f5b4f7382c03630
Author: Adam Jackson <ajax@redhat.com>
Date: Thu Jun 12 15:27:11 2008 -0400
xinit 1.1.0
commit 44e2ee01b456deb2630d21786d19ee2734d2f40a
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
Date: Wed May 28 12:01:35 2008 -0700

View File

@ -69,9 +69,6 @@ endif
DIST_SUBDIRS = privileged_startx
xinitrc: xinitrc.cpp Makefile
startx: startx.cpp Makefile
xinitrc_DATA = xinitrc
CLEANFILES = xinitrc startx $(appman_DATA) $(launchagents_DATA)

View File

@ -161,6 +161,7 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
FILE_MAN_DIR = @FILE_MAN_DIR@
FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@ -198,6 +199,8 @@ SHELL = @SHELL@
SHELL_CMD = @SHELL_CMD@
STARTX_COOKIE_FLAGS = @STARTX_COOKIE_FLAGS@
STRIP = @STRIP@
TIGER_LAUNCHD_FALSE = @TIGER_LAUNCHD_FALSE@
TIGER_LAUNCHD_TRUE = @TIGER_LAUNCHD_TRUE@
TWM = @TWM@
VERSION = @VERSION@
WM = @WM@
@ -212,8 +215,6 @@ XRDB = @XRDB@
XSERVER = @XSERVER@
XTERM = @XTERM@
ac_ct_CC = @ac_ct_CC@
ac_ct_STRIP = @ac_ct_STRIP@
ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
@ -228,12 +229,16 @@ build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
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@
@ -241,12 +246,15 @@ launchagentsdir = @launchagentsdir@
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@
sysconfdir = @sysconfdir@
@ -898,9 +906,6 @@ uninstall-info: uninstall-info-recursive
.man.$(APP_MAN_SUFFIX):
$(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@
xinitrc: xinitrc.cpp Makefile
startx: startx.cpp Makefile
.PHONY: ChangeLog
ChangeLog:

57
app/xinit/aclocal.m4 vendored
View File

@ -1023,6 +1023,7 @@ AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
dnl xorg-macros.m4. Generated from xorg-macros.m4.in:xorgversion.m4 by configure.
dnl
dnl Copyright 2005-2006 Sun Microsystems, Inc. All rights reserved.
dnl
@ -1070,7 +1071,7 @@ AC_DEFUN([XORG_MACROS_VERSION],[
XORG_MACROS_needed_major=`echo $XORG_MACROS_needed_version | sed 's/\..*$//'`
XORG_MACROS_needed_minor=`echo $XORG_MACROS_needed_version | sed -e 's/^[0-9]*\.//' -e 's/\..*$//'`]
AC_MSG_CHECKING([if xorg-macros used to generate configure is at least ${XORG_MACROS_needed_major}.${XORG_MACROS_needed_minor}])
[XORG_MACROS_version=1.1.6
[XORG_MACROS_version=1.2.1
XORG_MACROS_major=`echo $XORG_MACROS_version | sed 's/\..*$//'`
XORG_MACROS_minor=`echo $XORG_MACROS_version | sed -e 's/^[0-9]*\.//' -e 's/\..*$//'`]
if test $XORG_MACROS_major -ne $XORG_MACROS_needed_major ; then
@ -1104,6 +1105,10 @@ else
if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
RAWCPPFLAGS=-undef
AC_MSG_RESULT([yes])
# under Cygwin unix is still defined even with -undef
elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
RAWCPPFLAGS="-undef -ansi"
AC_MSG_RESULT([yes, with -ansi])
else
AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef. I don't know what to do.])
fi
@ -1216,7 +1221,9 @@ AC_SUBST([ADMIN_MAN_DIR])
# Whether or not the necessary tools and files are found can be checked
# with the AM_CONDITIONAL "BUILD_LINUXDOC"
AC_DEFUN([XORG_CHECK_LINUXDOC],[
XORG_SGML_PATH=$prefix/share/sgml
if test x$XORG_SGML_PATH = x ; then
XORG_SGML_PATH=$prefix/share/sgml
fi
HAVE_DEFS_ENT=
if test x"$cross_compiling" = x"yes" ; then
@ -1272,7 +1279,9 @@ AC_SUBST(MAKE_HTML)
# indicates whether the necessary tools and files are found and, if set,
# $(MAKE_XXX) blah.sgml will produce blah.xxx.
AC_DEFUN([XORG_CHECK_DOCBOOK],[
XORG_SGML_PATH=$prefix/share/sgml
if test x$XORG_SGML_PATH = x ; then
XORG_SGML_PATH=$prefix/share/sgml
fi
HAVE_DEFS_ENT=
BUILDTXTDOC=no
BUILDPDFDOC=no
@ -1449,6 +1458,31 @@ AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
]) # XORG_LINT_LIBRARY
# XORG_CWARNFLAGS
# ---------------
# Minimum version: 1.2.0
#
# Defines CWARNFLAGS to enable C compiler warnings.
#
AC_DEFUN([XORG_CWARNFLAGS], [
AC_REQUIRE([AC_PROG_CC])
if test "x$GCC" = xyes ; then
CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
-Wbad-function-cast"
case `gcc -dumpversion` in
3.4.* | 4.*)
CWARNFLAGS+=" -Wold-style-definition -Wdeclaration-after-statement"
;;
esac
else
AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
if test "x$SUNCC" = "xyes"; then
CWARNFLAGS="-v"
fi
fi
AC_SUBST(CWARNFLAGS)
]) # XORG_CWARNFLAGS
dnl Copyright 2005 Red Hat, Inc
dnl
dnl Permission to use, copy, modify, distribute, and sell this software and its
@ -1511,3 +1545,20 @@ AC_DEFUN([XORG_RELEASE_VERSION],[
[Patch version of this package])
])
# XORG_CHANGELOG()
# ----------------
# Minimum version: 1.2.0
#
# Defines the variable CHANGELOG_CMD as the command to generate
# ChangeLog from git.
#
# Arrange that distcleancheck ignores ChangeLog left over by distclean.
#
AC_DEFUN([XORG_CHANGELOG], [
CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > .changelog.tmp && \
mv .changelog.tmp ChangeLog) || (rm -f .changelog.tmp; touch ChangeLog; \
echo 'git directory not found: installing possibly empty changelog.' >&2)"
AC_SUBST([CHANGELOG_CMD])
AC_SUBST([distcleancheck_listfiles], ['find . -type f ! -name ChangeLog -print'])
]) # XORG_CHANGELOG

8246
app/xinit/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,7 @@ dnl
dnl Process this file with autoconf to create configure.
AC_PREREQ([2.57])
AC_INIT(xinit,[1.1.0], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],xinit)
AC_INIT(xinit,[1.1.1], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],xinit)
AM_INIT_AUTOMAKE([dist-bzip2])
AM_MAINTAINER_MODE
@ -114,18 +114,17 @@ AC_ARG_WITH(launchdaemons-dir, AS_HELP_STRING([--with-launchdaemons-dir=PATH],
if test "x$LAUNCHD" = "xauto"; then
unset LAUNCHD
case $host_os in
darwin8*)
LAUNCHD=no
;;
*)
AC_CHECK_PROG(LAUNCHD, [launchd], [yes], [no])
;;
esac
AC_CHECK_PROG(LAUNCHD, [launchd], [yes], [no])
fi
TIGER_LAUNCHD=no
if test "x$LAUNCHD" = "xyes" ; then
AC_DEFINE(HAVE_LAUNCHD, 1, [launchd support available])
case $host_os in
darwin8*)
TIGER_LAUNCHD=yes
;;
esac
else
launchagentsdir=""
launchdaemonsdir=""
@ -133,6 +132,7 @@ fi
AC_SUBST([launchagentsdir])
AC_SUBST([launchdaemonsdir])
AM_CONDITIONAL(LAUNCHD, [test "x$LAUNCHD" = "xyes"])
AM_CONDITIONAL(TIGER_LAUNCHD, [test "x$TIGER_LAUNCHD" = "xyes"])
# Checks for pkg-config packages
PKG_CHECK_MODULES(XINIT, x11)

View File

@ -6,9 +6,6 @@
<string>org.x.startx</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>--login</string>
<string>-c</string>
<string>__bindir__/startx</string>
</array>
<key>Sockets</key>
@ -21,5 +18,7 @@
</dict>
<key>ServiceIPC</key>
<true/>
<key>EnableTransactions</key>
<true/>
</dict>
</plist>

View File

@ -27,9 +27,9 @@ 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 &
BINDIR/font_cache -s &
elif [ -x BINDIR/font_cache.sh ] ; then
BINDIR/font_cache.sh -s &
elif [ -x /usr/X11/bin/fc-cache ] ; then
elif [ -x BINDIR/fc-cache ] ; then
BINDIR/fc-cache &
fi

View File

@ -34,9 +34,12 @@ xinitrc_PROGRAMS = privileged_startx
privstartx_SCRIPTS = 10-tmpdirs 20-font_cache
AM_CPPFLAGS = -DXINITDIR=\"$(xinitrcdir)\" -DSCRIPTDIR=\"$(privstartxdir)\" -DBINDIR=\"$(bindir)\"
CPP_FILES_FLAGS = -DXINITDIR="$(xinitrcdir)" -DSCRIPTDIR="$(privstartxdir)" -DBINDIR="$(bindir)"
if TIGER_LAUNCHD
CPP_FILES_FLAGS += -DTIGER_LAUNCHD
endif
dist_privileged_startx_SOURCES = \
server.c \
client.c \
@ -70,5 +73,5 @@ EXTRA_DIST = \
privileged_startx.defs \
privileged_startx_types.h
$(BUILT_SOURCES): privileged_startx.defs
mig -sheader privileged_startxServer.h privileged_startx.defs
$(BUILT_SOURCES): $(srcdir)/privileged_startx.defs
mig -sheader privileged_startxServer.h $(srcdir)/privileged_startx.defs

View File

@ -75,6 +75,7 @@ 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 = privileged_startx
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
@ -147,6 +148,7 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
FILE_MAN_DIR = @FILE_MAN_DIR@
FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@ -184,6 +186,8 @@ SHELL = @SHELL@
SHELL_CMD = @SHELL_CMD@
STARTX_COOKIE_FLAGS = @STARTX_COOKIE_FLAGS@
STRIP = @STRIP@
TIGER_LAUNCHD_FALSE = @TIGER_LAUNCHD_FALSE@
TIGER_LAUNCHD_TRUE = @TIGER_LAUNCHD_TRUE@
TWM = @TWM@
VERSION = @VERSION@
WM = @WM@
@ -198,8 +202,6 @@ XRDB = @XRDB@
XSERVER = @XSERVER@
XTERM = @XTERM@
ac_ct_CC = @ac_ct_CC@
ac_ct_STRIP = @ac_ct_STRIP@
ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
@ -214,12 +216,16 @@ build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
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@
@ -227,12 +233,15 @@ launchagentsdir = @launchagentsdir@
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@
sysconfdir = @sysconfdir@
@ -265,7 +274,9 @@ xinitrcdir = $(libdir)/X11/xinit
privstartxdir = $(xinitrcdir)/privileged_startx.d
privstartx_SCRIPTS = 10-tmpdirs 20-font_cache
AM_CPPFLAGS = -DXINITDIR=\"$(xinitrcdir)\" -DSCRIPTDIR=\"$(privstartxdir)\" -DBINDIR=\"$(bindir)\"
CPP_FILES_FLAGS = -DXINITDIR="$(xinitrcdir)" -DSCRIPTDIR="$(privstartxdir)" -DBINDIR="$(bindir)"
CPP_FILES_FLAGS = -DXINITDIR="$(xinitrcdir)" \
-DSCRIPTDIR="$(privstartxdir)" -DBINDIR="$(bindir)" \
$(am__append_1)
dist_privileged_startx_SOURCES = \
server.c \
client.c \
@ -605,8 +616,8 @@ uninstall-am: uninstall-info-am uninstall-launchdaemonsDATA \
10-tmpdirs: 10-tmpdirs.cpp Makefile
20-font_cache: 20-font_cache.cpp Makefile
$(BUILT_SOURCES): privileged_startx.defs
mig -sheader privileged_startxServer.h privileged_startx.defs
$(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:

View File

@ -34,6 +34,8 @@
#include <stdlib.h>
#include <stdbool.h>
#include <AvailabilityMacros.h>
#include "privileged_startx.h"
int client_main(void) {
@ -42,7 +44,11 @@ int client_main(void) {
kr = bootstrap_look_up(bootstrap_port, BOOTSTRAP_NAME, &mp);
if (kr != KERN_SUCCESS) {
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
fprintf(stderr, "bootstrap_look_up(): %s\n", bootstrap_strerror(kr));
#else
fprintf(stderr, "bootstrap_look_up(): %ul\n", (unsigned long)kr);
#endif
exit(EXIT_FAILURE);
}

View File

@ -4,18 +4,25 @@
<dict>
<key>Label</key>
<string>org.x.privileged_startx</string>
<key>MachServices</key>
<dict>
<key>org.x.privileged_startx</key>
<true/>
</dict>
<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>org.x.privileged_startx</key>
<true/>
</dict>
<key>TimeOut</key>
<integer>60</integer>
<integer>120</integer>
<key>EnableTransactions</key>
<true/>
#endif
</dict>
</plist>

View File

@ -40,7 +40,6 @@
#include <sys/time.h>
#include <launch.h>
#include <asl.h>
#include <pthread.h>
#include <errno.h>
#include "privileged_startx.h"
@ -51,6 +50,10 @@ union MaxMsgSize {
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 */
@ -61,6 +64,7 @@ struct idle_globals {
};
struct idle_globals idle_globals;
#endif
#ifndef SCRIPTDIR
#define SCRIPTDIR="/usr/X11/lib/X11/xinit/privileged_startx.d"
@ -69,13 +73,46 @@ struct idle_globals idle_globals;
/* Default script dir */
const char *script_dir = SCRIPTDIR;
static void* idle_thread(void* param __attribute__((unused)));
#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) {
fprintf(stderr, "mach_port_allocate(): %s\n", 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) {
fprintf(stderr, "mach_port_insert_right(): %s\n", mach_error_string(kr));
exit(EXIT_FAILURE);
}
kr = bootstrap_register(bootstrap_port, bname, mp);
if (kr != KERN_SUCCESS) {
fprintf(stderr, "bootstrap_register(): %s\n", 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;
checkin = launch_data_new_string(LAUNCH_KEY_CHECKIN);
@ -85,6 +122,13 @@ int server_main(const char *dir) {
exit(EXIT_FAILURE);
}
if(dir) {
script_dir = dir;
asl_log(NULL, NULL, ASL_LEVEL_DEBUG,
"script directory set: %s", script_dir);
}
#ifdef LAUNCH_JOBKEY_MACHSERVICES
launch_data_t tmv;
tmv = launch_data_dict_lookup(config, LAUNCH_JOBKEY_TIMEOUT);
if (tmv) {
@ -93,12 +137,6 @@ int server_main(const char *dir) {
"idle timeout set: %ld seconds", idle_timeout);
}
if(dir) {
script_dir = dir;
asl_log(NULL, NULL, ASL_LEVEL_DEBUG,
"script directory set: %s", script_dir);
}
launch_data_t svc;
svc = launch_data_dict_lookup(config, LAUNCH_JOBKEY_MACHSERVICES);
if (!svc) {
@ -114,6 +152,10 @@ int server_main(const char *dir) {
}
mp = launch_data_get_machport(svc);
#else
mp = checkin_or_register("org.x.privileged_startx");
#endif
if (mp == MACH_PORT_NULL) {
asl_log(NULL, NULL, ASL_LEVEL_ERR, "NULL mach service: %s",
BOOTSTRAP_NAME);
@ -129,12 +171,14 @@ int server_main(const char *dir) {
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);
@ -161,8 +205,10 @@ kern_return_t do_privileged_startx(mach_port_t test_port __attribute__((unused))
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(path_argv, FTS_PHYSICAL, ftscmp);
@ -222,6 +268,7 @@ kern_return_t do_privileged_startx(mach_port_t test_port __attribute__((unused))
}
kern_return_t do_idle_exit(mach_port_t test_port __attribute__((unused))) {
#ifdef LAUNCH_JOBKEY_MACHSERVICES
struct timeval now;
gettimeofday(&now, NULL);
@ -231,8 +278,12 @@ kern_return_t do_idle_exit(mach_port_t test_port __attribute__((unused))) {
}
return KERN_SUCCESS;
#else
return KERN_FAILURE;
#endif
}
#ifdef LAUNCH_JOBKEY_MACHSERVICES
static void *idle_thread(void* param __attribute__((unused))) {
for(;;) {
struct timeval now;
@ -248,3 +299,4 @@ static void *idle_thread(void* param __attribute__((unused))) {
}
return NULL;
}
#endif

View File

@ -84,27 +84,31 @@ serverargs=""
#ifdef __APPLE__
if [ "x$X11_PREFS_DOMAIN" = x ] ; then
X11_PREFS_DOMAIN="org.x.X11"
fi
XCOMM Initialize defaults (this will cut down on "safe" error messages)
if ! defaults read org.x.X11 cache_fonts >& /dev/null ; then
defaults write org.x.X11 cache_fonts -bool true
if ! defaults read $X11_PREFS_DOMAIN cache_fonts >& /dev/null ; then
defaults write $X11_PREFS_DOMAIN cache_fonts -bool true
fi
if ! defaults read org.x.X11 no_auth >& /dev/null ; then
defaults write org.x.X11 no_auth -bool false
if ! defaults read $X11_PREFS_DOMAIN no_auth >& /dev/null ; then
defaults write $X11_PREFS_DOMAIN no_auth -bool false
fi
if ! defaults read org.x.X11 nolisten_tcp >& /dev/null ; then
defaults write org.x.X11 nolisten_tcp -bool true
if ! defaults read $X11_PREFS_DOMAIN nolisten_tcp >& /dev/null ; then
defaults write $X11_PREFS_DOMAIN nolisten_tcp -bool true
fi
XCOMM First, start caching fonts
if [ x`defaults read org.x.X11 cache_fonts` = x1 ] ; then
if [ -x /usr/X11/bin/font_cache ] ; then
/usr/X11/bin/font_cache &
elif [ -x /usr/X11/bin/font_cache.sh ] ; then
/usr/X11/bin/font_cache.sh &
elif [ -x /usr/X11/bin/fc-cache ] ; then
/usr/X11/bin/fc-cache &
if [ x`defaults read $X11_PREFS_DOMAIN cache_fonts` = x1 ] ; then
if [ -x $bindir/font_cache ] ; then
$bindir/font_cache &
elif [ -x $bindir/font_cache.sh ] ; then
$bindir/font_cache.sh &
elif [ -x $bindir/fc-cache ] ; then
$bindir/fc-cache &
fi
fi
@ -114,16 +118,20 @@ if [ -x XINITDIR/privileged_startx ] ; then
XINITDIR/privileged_startx
fi
if [ x`defaults read org.x.X11 no_auth` = x0 ] ; then
if [ x`defaults read $X11_PREFS_DOMAIN no_auth` = x0 ] ; then
enable_xauth=1
else
enable_xauth=0
fi
if [ x`defaults read org.x.X11 nolisten_tcp` = x1 ] ; then
if [ x`defaults read $X11_PREFS_DOMAIN nolisten_tcp` = x1 ] ; then
defaultserverargs="$defaultserverargs -nolisten tcp"
fi
if defaults read $X11_PREFS_DOMAIN dpi >& /dev/null ; then
defaultserverargs="$defaultserverargs -dpi `defaults read $X11_PREFS_DOMAIN dpi`"
fi
for ((d=0; ; d++)) ; do
[[ -e /tmp/.X$d-lock ]] || break
done
@ -133,19 +141,6 @@ defaultdisplay=":$d"
enable_xauth=1
#endif
if [ -f $userclientrc ]; then
defaultclientargs=$userclientrc
elif [ -f $sysclientrc ]; then
defaultclientargs=$sysclientrc
#if defined(__SCO__) || defined(__UNIXWARE__)
elif [ -f $scouserclientrc ]; then
defaultclientargs=$scouserclientrc
elif [ -f $scosysclientrc ]; then
defaultclientargs=$scosysclientrc
#endif
fi
#if defined(__SCO__) || defined(__UNIXWARE__)
XCOMM SCO -t option: do not start an X server
@ -202,11 +197,23 @@ done
XCOMM process client arguments
if [ x"$client" = x ]; then
client=$defaultclient
XCOMM if no client arguments either, use rc file instead
if [ x"$clientargs" = x ]; then
client="$defaultclientargs"
else
client=$defaultclient
if [ -f "$userclientrc" ]; then
client=$userclientrc
elif [ -f "$sysclientrc" ]; then
client=$sysclientrc
#if defined(__SCO__) || defined(__UNIXWARE__)
elif [ -f "$scouserclientrc" ]; then
client=$scouserclientrc
elif [ -f "$scosysclientrc" ]; then
client=$scosysclientrc
#endif
fi
clientargs=$defaultclientargs
fi
fi
@ -217,9 +224,9 @@ if [ x"$server" = x ]; then
XCOMM if no server arguments or display either, use defaults
if [ x"$serverargs" = x -a x"$display" = x ]; then
XCOMM For compatibility reasons, only use xserverrc if there were no server command line arguments
if [ -f $userserverrc ]; then
if [ -f "$userserverrc" ]; then
server=$userserverrc
elif [ -f $sysserverrc ]; then
elif [ -f "$sysserverrc" ]; then
server=$sysserverrc
fi
@ -268,11 +275,15 @@ if [ x"$enable_xauth" = x1 ] ; then
XCOMM create a file with auth information for the server. ':0' is a dummy.
xserverauthfile=$HOME/.serverauth.$$
trap "rm -f $xserverauthfile" HUP INT QUIT ILL TRAP KILL BUS TERM
xauth -q -f $xserverauthfile << EOF
trap "rm -f '$xserverauthfile'" HUP INT QUIT ILL TRAP KILL BUS TERM
xauth -q -f "$xserverauthfile" << EOF
add :$dummy . $mcookie
EOF
#ifdef __APPLE__
serverargs=${serverargs}" -auth '"${xserverauthfile}"'"
#else
serverargs=${serverargs}" -auth "${xserverauthfile}
#endif
XCOMM now add the same credentials to the client authority file
XCOMM if '$displayname' already exists do not overwrite it as another
@ -287,7 +298,7 @@ EOF
removelist="$displayname $removelist"
else
dummy=$(($dummy+1));
XAUTH -q -f $xserverauthfile << EOF
XAUTH -q -f "$xserverauthfile" << EOF
add :$dummy . $authcookie
EOF
fi
@ -298,10 +309,16 @@ fi
if [ "$REMOTE_SERVER" = "TRUE" ]; then
exec SHELL_CMD ${client}
else
XINIT $client $clientargs -- $server $display $serverargs
XINIT "$client" $clientargs -- "$server" $display $serverargs
fi
#else
XINIT $client $clientargs -- $server $display $serverargs
#ifdef __APPLE__
eval XINIT \"$client\" $clientargs -- \"$server\" $display $serverargs
#else
XINIT "$client" $clientargs -- "$server" $display $serverargs
#endif
#endif
if [ x"$enable_xauth" = x1 ] ; then
@ -309,7 +326,7 @@ if [ x"$enable_xauth" = x1 ] ; then
XAUTH remove $removelist
fi
if [ x"$xserverauthfile" != x ]; then
rm -f $xserverauthfile
rm -f "$xserverauthfile"
fi
fi

View File

@ -1,6 +1,6 @@
/* $Xorg: xinit.c,v 1.5 2001/02/09 02:05:49 xorgcvs Exp $ */
/* $XdotOrg: xc/programs/xinit/xinit.c,v 1.4 2005/10/04 01:27:34 ajax Exp $ */
/* $OpenBSD: xinit.c,v 1.6 2008/06/18 20:31:51 matthieu Exp $ */
/* $OpenBSD: xinit.c,v 1.7 2009/05/03 13:17:37 matthieu Exp $ */
/*
@ -61,6 +61,13 @@ in this Software without prior written authorization from The Open Group.
#include <setjmp.h>
#include <stdarg.h>
#ifdef __APPLE__
#include <AvailabilityMacros.h>
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
#include <vproc.h>
#endif
#endif
#if !defined(SIGCHLD) && defined(SIGCLD)
#define SIGCHLD SIGCLD
#endif
@ -251,6 +258,11 @@ main(int argc, char *argv[], char *envp[])
int client_args_given = 0, server_args_given = 0;
int start_of_client_args, start_of_server_args;
struct sigaction sa;
#ifdef __APPLE__
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
vproc_transaction_t vt;
#endif
#endif
#ifdef __UNIXOS2__
envsave = envp; /* circumvent an EMX problem */
@ -427,6 +439,13 @@ main(int argc, char *argv[], char *envp[])
signal(SIGALRM, sigAlarm);
signal(SIGUSR1, sigUsr1);
#ifdef __APPLE__
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
vt = vproc_transaction_begin(NULL);
#endif
#endif
if (startServer(server) > 0
&& startClient(client) > 0) {
pid = -1;
@ -435,6 +454,13 @@ main(int argc, char *argv[], char *envp[])
)
pid = wait(NULL);
}
#ifdef __APPLE__
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
vproc_transaction_end(NULL, vt);
#endif
#endif
signal(SIGTERM, SIG_IGN);
signal(SIGQUIT, SIG_IGN);
signal(SIGINT, SIG_IGN);
@ -465,15 +491,23 @@ waitforserver(void)
int ncycles = 120; /* # of cycles to wait */
int cycles; /* Wait cycle count */
#ifdef __APPLE__
/* For Apple, we don't get signaled by the server when it's ready, so we just
* want to sleep now since we're going to sleep later anyways and this allows us
* to avoid the awkard, "why is there an error message in the log" questions
* from users.
*/
sleep(2);
#endif
for (cycles = 0; cycles < ncycles; cycles++) {
if ((xd = XOpenDisplay(displayNum))) {
return(TRUE);
}
else {
#define MSG "X server to begin accepting connections"
if (!processTimeout (1, MSG))
if (!processTimeout (1, "X server to begin accepting connections"))
break;
#undef MSG
}
}