CLEANFILES = protocol_vproc.h protocol_vprocServer.c protocol_vprocUser.c protocol_vprocServer.h \
launchd_internal.h launchd_internalServer.h launchd_internalServer.c launchd_internalUser.c \
- notifyServer.c notifyServer.h job_replyUser.c job_reply.h __version.c
+ notifyServer.c notifyServer.h job_replyUser.c job_reply.h __version.c mach_excServer.c mach_excServer.h
protocol_vproc.h protocol_vprocServer.c protocol_vprocUser.c protocol_vprocServer.h: $(srcdir)/protocol_job.defs
mig $(MIGFLAGS) -sheader protocol_vprocServer.h $(srcdir)/protocol_job.defs
launchd_CFLAGS = -mdynamic-no-pic $(AM_CFLAGS) -Wno-unused-parameter
launchd_LDFLAGS = -lbsm
-launchd_SOURCES = launchd.c launchd_core_logic.c launchd_unix_ipc.c protocol_vprocServer.c notifyServer.c launchd_internalUser.c launchd_internalServer.c job_replyUser.c launchd_runtime.c launchd_runtime_kill.c
+launchd_SOURCES = launchd.c launchd_core_logic.c launchd_unix_ipc.c protocol_vprocServer.c notifyServer.c launchd_internalUser.c launchd_internalServer.c job_replyUser.c launchd_runtime.c launchd_runtime_kill.c mach_excServer.c
-launchd_runtime.c:: notifyServer.h launchd_internal.h
+launchd_runtime.c:: notifyServer.h launchd_internal.h mach_excServer.h
launchd_core_logic.c:: protocol_vproc.h job_reply.h protocol_vprocServer.h
launchproxy_LDFLAGS = -weak_framework Security
notifyServer.c notifyServer.h: /usr/include/mach/notify.defs
mig $(MIGFLAGS) -header /dev/null -user /dev/null -sheader notifyServer.h /usr/include/mach/notify.defs
+mach_excServer.c mach_excServer.h: /usr/include/mach/mach_exc.defs
+ mig $(MIGFLAGS) -header /dev/null -user /dev/null -sheader mach_excServer.h /usr/include/mach/mach_exc.defs
+
job_replyUser.c job_reply.h: $(srcdir)/protocol_job_reply.defs
mig $(MIGFLAGS) -sheader /dev/null -server /dev/null $(srcdir)/protocol_job_reply.defs
am__launchd_SOURCES_DIST = launchd.c launchd_core_logic.c \
launchd_unix_ipc.c protocol_vprocServer.c notifyServer.c \
launchd_internalUser.c launchd_internalServer.c \
- job_replyUser.c launchd_runtime.c launchd_runtime_kill.c
+ job_replyUser.c launchd_runtime.c launchd_runtime_kill.c \
+ mach_excServer.c
@LIBS_ONLY_FALSE@am_launchd_OBJECTS = launchd-launchd.$(OBJEXT) \
@LIBS_ONLY_FALSE@ launchd-launchd_core_logic.$(OBJEXT) \
@LIBS_ONLY_FALSE@ launchd-launchd_unix_ipc.$(OBJEXT) \
@LIBS_ONLY_FALSE@ launchd-launchd_internalServer.$(OBJEXT) \
@LIBS_ONLY_FALSE@ launchd-job_replyUser.$(OBJEXT) \
@LIBS_ONLY_FALSE@ launchd-launchd_runtime.$(OBJEXT) \
-@LIBS_ONLY_FALSE@ launchd-launchd_runtime_kill.$(OBJEXT)
+@LIBS_ONLY_FALSE@ launchd-launchd_runtime_kill.$(OBJEXT) \
+@LIBS_ONLY_FALSE@ launchd-mach_excServer.$(OBJEXT)
launchd_OBJECTS = $(am_launchd_OBJECTS)
launchd_LDADD = $(LDADD)
launchd_LINK = $(CCLD) $(launchd_CFLAGS) $(CFLAGS) $(launchd_LDFLAGS) \
AM_CFLAGS = -no-cpp-precomp -F/System/Library/PrivateFrameworks -Wall -Wextra -Waggregate-return -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror -D__MigTypeCheck=1 -fvisibility=hidden -Dmig_external=__private_extern__
CLEANFILES = protocol_vproc.h protocol_vprocServer.c protocol_vprocUser.c protocol_vprocServer.h \
launchd_internal.h launchd_internalServer.h launchd_internalServer.c launchd_internalUser.c \
- notifyServer.c notifyServer.h job_replyUser.c job_reply.h __version.c
+ notifyServer.c notifyServer.h job_replyUser.c job_reply.h __version.c mach_excServer.c mach_excServer.h
@LIBS_ONLY_TRUE@noinst_LIBRARIES = liblaunch.a liblaunch_profile.a
@LIBS_ONLY_TRUE@liblaunch_a_CFLAGS = -D__DARWIN_NON_CANCELABLE=1 $(AM_CFLAGS)
@LIBS_ONLY_FALSE@SystemStarter_SOURCES = StartupItems.c IPC.c SystemStarter.c
@LIBS_ONLY_FALSE@launchd_CFLAGS = -mdynamic-no-pic $(AM_CFLAGS) -Wno-unused-parameter
@LIBS_ONLY_FALSE@launchd_LDFLAGS = -lbsm
-@LIBS_ONLY_FALSE@launchd_SOURCES = launchd.c launchd_core_logic.c launchd_unix_ipc.c protocol_vprocServer.c notifyServer.c launchd_internalUser.c launchd_internalServer.c job_replyUser.c launchd_runtime.c launchd_runtime_kill.c
+@LIBS_ONLY_FALSE@launchd_SOURCES = launchd.c launchd_core_logic.c launchd_unix_ipc.c protocol_vprocServer.c notifyServer.c launchd_internalUser.c launchd_internalServer.c job_replyUser.c launchd_runtime.c launchd_runtime_kill.c mach_excServer.c
@LIBS_ONLY_FALSE@launchproxy_LDFLAGS = -weak_framework Security
@LIBS_ONLY_FALSE@man1_MANS = wait4path.1 launchctl.1
@LIBS_ONLY_FALSE@man5_MANS = launchd.plist.5 launchd.conf.5
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/launchd-launchd_runtime.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/launchd-launchd_runtime_kill.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/launchd-launchd_unix_ipc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/launchd-mach_excServer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/launchd-notifyServer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/launchd-protocol_vprocServer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/launchproxy.Po@am__quote@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='launchd_runtime_kill.c' object='launchd-launchd_runtime_kill.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) $(launchd_CFLAGS) $(CFLAGS) -c -o launchd-launchd_runtime_kill.obj `if test -f 'launchd_runtime_kill.c'; then $(CYGPATH_W) 'launchd_runtime_kill.c'; else $(CYGPATH_W) '$(srcdir)/launchd_runtime_kill.c'; fi`
+
+launchd-mach_excServer.o: mach_excServer.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(launchd_CFLAGS) $(CFLAGS) -MT launchd-mach_excServer.o -MD -MP -MF $(DEPDIR)/launchd-mach_excServer.Tpo -c -o launchd-mach_excServer.o `test -f 'mach_excServer.c' || echo '$(srcdir)/'`mach_excServer.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/launchd-mach_excServer.Tpo $(DEPDIR)/launchd-mach_excServer.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mach_excServer.c' object='launchd-mach_excServer.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) $(launchd_CFLAGS) $(CFLAGS) -c -o launchd-mach_excServer.o `test -f 'mach_excServer.c' || echo '$(srcdir)/'`mach_excServer.c
+
+launchd-mach_excServer.obj: mach_excServer.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(launchd_CFLAGS) $(CFLAGS) -MT launchd-mach_excServer.obj -MD -MP -MF $(DEPDIR)/launchd-mach_excServer.Tpo -c -o launchd-mach_excServer.obj `if test -f 'mach_excServer.c'; then $(CYGPATH_W) 'mach_excServer.c'; else $(CYGPATH_W) '$(srcdir)/mach_excServer.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/launchd-mach_excServer.Tpo $(DEPDIR)/launchd-mach_excServer.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mach_excServer.c' object='launchd-mach_excServer.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) $(launchd_CFLAGS) $(CFLAGS) -c -o launchd-mach_excServer.obj `if test -f 'mach_excServer.c'; then $(CYGPATH_W) 'mach_excServer.c'; else $(CYGPATH_W) '$(srcdir)/mach_excServer.c'; fi`
install-man1: $(man1_MANS) $(man_MANS)
@$(NORMAL_INSTALL)
test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
@LIBS_ONLY_TRUE@ cp liblaunch.a $(DESTDIR)/usr/local/lib/system/liblaunch_debug.a
@LIBS_ONLY_TRUE@ cp liblaunch_profile.a $(DESTDIR)/usr/local/lib/system/liblaunch_profile.a
-@LIBS_ONLY_FALSE@launchd_runtime.c:: notifyServer.h launchd_internal.h
+@LIBS_ONLY_FALSE@launchd_runtime.c:: notifyServer.h launchd_internal.h mach_excServer.h
@LIBS_ONLY_FALSE@launchd_core_logic.c:: protocol_vproc.h job_reply.h protocol_vprocServer.h
@LIBS_ONLY_FALSE@notifyServer.c notifyServer.h: /usr/include/mach/notify.defs
@LIBS_ONLY_FALSE@ mig $(MIGFLAGS) -header /dev/null -user /dev/null -sheader notifyServer.h /usr/include/mach/notify.defs
+@LIBS_ONLY_FALSE@mach_excServer.c mach_excServer.h: /usr/include/mach/mach_exc.defs
+@LIBS_ONLY_FALSE@ mig $(MIGFLAGS) -header /dev/null -user /dev/null -sheader mach_excServer.h /usr/include/mach/mach_exc.defs
+
@LIBS_ONLY_FALSE@job_replyUser.c job_reply.h: $(srcdir)/protocol_job_reply.defs
@LIBS_ONLY_FALSE@ mig $(MIGFLAGS) -sheader /dev/null -server /dev/null $(srcdir)/protocol_job_reply.defs
* @APPLE_APACHE_LICENSE_HEADER_END@
*/
-static const char *const __rcs_file_version__ = "$Revision: 23400 $";
+static const char *const __rcs_file_version__ = "$Revision: 23457 $";
#include "liblaunch_public.h"
#include "liblaunch_private.h"
static bool do_single_user_mode2(void);
static void read_launchd_conf(void);
static bool job_disabled_logic(launch_data_t obj);
+static void fix_bogus_file_metadata(void);
typedef enum {
BOOTCACHE_START = 1,
goto out;
}
- fprintf(stderr, "fsck failed! Leaving the root file system read-only...\n");
+ fprintf(stderr, "fsck failed!\n");
+
+ /* someday, we should keep booting read-only, but as of today, other sub-systems cannot handle that scenario */
+ assumes(reboot(RB_HALT) != -1);
return;
out:
*/
assumes(fwexec(remount_tool, true) != -1);
+
+ fix_bogus_file_metadata();
+}
+
+void
+fix_bogus_file_metadata(void)
+{
+ static const struct {
+ const char *path;
+ const uid_t owner;
+ const gid_t group;
+ const mode_t needed_bits;
+ const mode_t bad_bits;
+ } f[] = {
+ { "/sbin/launchd", 0, 0, S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH, S_ISUID|S_ISGID|S_ISVTX|S_IWOTH },
+ { _PATH_TMP, 0, 0, S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO, S_ISUID|S_ISGID },
+ { _PATH_VARTMP, 0, 0, S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO, S_ISUID|S_ISGID },
+ };
+ struct stat sb;
+ size_t i;
+
+ for (i = 0; i < (sizeof(f) / sizeof(f[0])); i++) {
+ mode_t i_needed_bits;
+ mode_t i_bad_bits;
+ bool fix_mode = false;
+ bool fix_id = false;
+
+ if (!assumes(stat(f[i].path, &sb) != -1)) {
+ continue;
+ }
+
+ i_needed_bits = ~sb.st_mode & f[i].needed_bits;
+ i_bad_bits = sb.st_mode & f[i].bad_bits;
+
+ if (i_bad_bits) {
+ fprintf(stderr, "Crucial filesystem check: Removing bogus mode bits 0%o on path: %s\n", i_bad_bits, f[i].path);
+ fix_mode = true;
+ }
+ if (i_needed_bits) {
+ fprintf(stderr, "Crucial filesystem check: Adding missing mode bits 0%o on path: %s\n", i_needed_bits, f[i].path);
+ fix_mode = true;
+ }
+ if (sb.st_uid != f[i].owner) {
+ fprintf(stderr, "Crucial filesystem check: Fixing bogus UID %u on path: %s\n", sb.st_uid, f[i].path);
+ fix_id = true;
+ }
+ if (sb.st_gid != f[i].group) {
+ fprintf(stderr, "Crucial filesystem check: Fixing bogus GID %u on path: %s\n", sb.st_gid, f[i].path);
+ fix_id = true;
+ }
+
+ if (fix_mode) {
+ assumes(chmod(f[i].path, (sb.st_mode & ~i_bad_bits) | i_needed_bits) != -1);
+ }
+ if (fix_id) {
+ assumes(chown(f[i].path, f[i].owner, f[i].group) != -1);
+ }
+ }
}
bool
* @APPLE_APACHE_LICENSE_HEADER_END@
*/
-static const char *const __rcs_file_version__ = "$Revision: 23433 $";
+static const char *const __rcs_file_version__ = "$Revision: 23459 $";
#include "config.h"
#include "launchd_core_logic.h"
char *groupname;
char *stdoutpath;
char *stderrpath;
+ char *alt_exc_handler;
struct machservice *lastlookup;
unsigned int lastlookup_gennum;
char *seatbelt_profile;
currently_ignored:1, forced_peers_to_demand_mode:1, setnice:1, hopefully_exits_last:1, removal_pending:1,
wait4pipe_eof:1, sent_sigkill:1, debug_before_kill:1, weird_bootstrap:1, start_on_mount:1,
per_user:1, hopefully_exits_first:1, deny_unknown_mslookups:1, unload_at_mig_return:1, abandon_pg:1,
- poll_for_vfs_changes:1;
+ poll_for_vfs_changes:1, internal_exc_handler:1;
const char label[0];
};
if (j->stderrpath) {
free(j->stderrpath);
}
+ if (j->alt_exc_handler) {
+ free(j->alt_exc_handler);
+ }
if (j->seatbelt_profile) {
free(j->seatbelt_profile);
}
found_key = true;
}
break;
+ case 'm':
+ case 'M':
+ if (strcasecmp(key, LAUNCH_JOBKEY_MACHEXCEPTIONHANDLER) == 0) {
+ j->internal_exc_handler = value;
+ found_key = true;
+ }
+ break;
case 'i':
case 'I':
if (strcasecmp(key, LAUNCH_JOBKEY_INITGROUPS) == 0) {
char **where2put = NULL;
switch (key[0]) {
+ case 'm':
+ case 'M':
+ if (strcasecmp(key, LAUNCH_JOBKEY_MACHEXCEPTIONHANDLER) == 0) {
+ where2put = &j->alt_exc_handler;
+ }
+ break;
case 'p':
case 'P':
if (strcasecmp(key, LAUNCH_JOBKEY_PROGRAM) == 0) {
job_assumes(j, runtime_close(spair[0]) == 0);
job_assumes(j, runtime_close(spair[1]) == 0);
}
+ if (!j->legacy_mach_job) {
+ job_assumes(j, runtime_close(oepair[0]) != -1);
+ job_assumes(j, runtime_close(oepair[1]) != -1);
+ j->log_redirect_fd = 0;
+ }
break;
case 0:
if (_vproc_post_fork_ping()) {
void
job_setup_exception_port(job_t j, task_t target_task)
{
+ struct machservice *ms;
thread_state_flavor_t f = 0;
+ mach_port_t exc_port = the_exception_server;
- if (!the_exception_server) {
+ if (j->alt_exc_handler) {
+ ms = jobmgr_lookup_service(j->mgr, j->alt_exc_handler, true, 0);
+ if (ms) {
+ exc_port = machservice_port(ms);
+ } else {
+ job_log(j, LOG_WARNING, "Falling back to default Mach exception handler. Could not find: %s", j->alt_exc_handler);
+ }
+ } else if (j->internal_exc_handler) {
+ exc_port = runtime_get_kernel_port();
+ } else if (!exc_port) {
return;
}
#endif
if (target_task) {
- job_assumes(j, task_set_exception_ports(target_task, EXC_MASK_CRASH, the_exception_server,
+ job_assumes(j, task_set_exception_ports(target_task, EXC_MASK_CRASH, exc_port,
EXCEPTION_STATE_IDENTITY | MACH_EXCEPTION_CODES, f) == KERN_SUCCESS);
- } else if (getpid() == 1) {
+ } else if (getpid() == 1 && the_exception_server) {
mach_port_t mhp = mach_host_self();
job_assumes(j, host_set_exception_ports(mhp, EXC_MASK_CRASH, the_exception_server,
EXCEPTION_STATE_IDENTITY | MACH_EXCEPTION_CODES, f) == KERN_SUCCESS);
return BOOTSTRAP_NO_MEMORY;
}
- job_assumes(jr, jr->p);
+ if (!job_assumes(jr, jr->p)) {
+ job_remove(jr);
+ return BOOTSTRAP_NO_MEMORY;
+ }
if (!job_setup_machport(jr)) {
job_remove(jr);
return BOOTSTRAP_NO_MEMORY;
}
- job_log(j, LOG_INFO, "Spawned");
+ job_log(jr, LOG_DEBUG, "Spawned by PID %u: %s", j->p, j->label);
*child_pid = jr->p;
*obsvr_port = jr->j_port;
* @APPLE_APACHE_LICENSE_HEADER_END@
*/
-static const char *const __rcs_file_version__ = "$Revision: 23432 $";
+static const char *const __rcs_file_version__ = "$Revision: 23459 $";
#include "config.h"
#include "launchd_runtime.h"
#include "launchd_internalServer.h"
#include "launchd_internal.h"
#include "notifyServer.h"
+#include "mach_excServer.h"
/* We shouldn't be including these */
#include "launch.h"
static void *kqueue_demand_loop(void *arg);
static void log_kevent_struct(int level, struct kevent *kev, int indx);
+static boolean_t launchd_internal_demux(mach_msg_header_t *Request, mach_msg_header_t *Reply);
static void record_caller_creds(mach_msg_header_t *mh);
static void launchd_runtime2(mach_msg_size_t msg_size, mig_reply_error_t *bufRequest, mig_reply_error_t *bufReply);
static mach_msg_size_t max_msg_size;
};
static sigset_t sigign_set;
+mach_port_t
+runtime_get_kernel_port(void)
+{
+ return launchd_internal_port;
+}
+
void
launchd_runtime_init(void)
{
static char flags_buf[sizeof(MAX_RB_STR)];
char *flags_off = NULL;
- if (flags) while (flags) {
+ if (flags == 0) {
+ return "RB_AUTOBOOT";
+ }
+
+ while (flags) {
if (flags_off) {
*flags_off = '|';
flags_off++;
flags_off += sprintf(flags_off, "0x%x", flags);
flags = 0;
}
- return flags_buf;
- } else {
- return "RB_AUTOBOOT";
}
+
+ return flags_buf;
}
const char *
kern_return_t
launchd_mport_notify_req(mach_port_t name, mach_msg_id_t which)
{
- mach_port_mscount_t msgc = (which == MACH_NOTIFY_NO_SENDERS) ? 1 : 0;
+ mach_port_mscount_t msgc = (which == MACH_NOTIFY_PORT_DESTROYED) ? 0 : 1;
mach_port_t previous, where = (which == MACH_NOTIFY_NO_SENDERS) ? name : launchd_internal_port;
if (which == MACH_NOTIFY_NO_SENDERS) {
{
if (launchd_internal_server_routine(Request)) {
return launchd_internal_server(Request, Reply);
+ } else if (notify_server_routine(Request)) {
+ return notify_server(Request, Reply);
+ } else {
+ return mach_exc_server(Request, Reply);
}
-
- return notify_server(Request, Reply);
}
kern_return_t
{
runtime_busy_cnt--;
}
+
+kern_return_t
+catch_mach_exception_raise(mach_port_t exception_port, mach_port_t thread, mach_port_t task,
+ exception_type_t exception, mach_exception_data_t code, mach_msg_type_number_t codeCnt)
+{
+ runtime_syslog(LOG_NOTICE, "%s(): thread: 0x%x task: 0x%x type: 0x%x code: %p codeCnt: 0x%x",
+ __func__, thread, task, exception, code, codeCnt);
+
+ launchd_assumes(launchd_mport_deallocate(thread) == KERN_SUCCESS);
+ launchd_assumes(launchd_mport_deallocate(task) == KERN_SUCCESS);
+
+ return 0;
+}
+
+kern_return_t
+catch_mach_exception_raise_state(mach_port_t exception_port,
+ exception_type_t exception, const mach_exception_data_t code, mach_msg_type_number_t codeCnt,
+ int *flavor, const thread_state_t old_state, mach_msg_type_number_t old_stateCnt,
+ thread_state_t new_state, mach_msg_type_number_t *new_stateCnt)
+{
+ runtime_syslog(LOG_NOTICE, "%s(): type: 0x%x code: %p codeCnt: 0x%x flavor: %p old_state: %p old_stateCnt: 0x%x new_state: %p new_stateCnt: %p",
+ __func__, exception, code, codeCnt, flavor, old_state, old_stateCnt, new_state, new_stateCnt);
+
+ memcpy(new_state, old_state, old_stateCnt * sizeof(old_state[0]));
+ *new_stateCnt = old_stateCnt;
+
+ return 0;
+}
+
+kern_return_t
+catch_mach_exception_raise_state_identity(mach_port_t exception_port, mach_port_t thread, mach_port_t task,
+ exception_type_t exception, mach_exception_data_t code, mach_msg_type_number_t codeCnt,
+ int *flavor, thread_state_t old_state, mach_msg_type_number_t old_stateCnt,
+ thread_state_t new_state, mach_msg_type_number_t *new_stateCnt)
+{
+ runtime_syslog(LOG_NOTICE, "%s(): thread: 0x%x task: 0x%x type: 0x%x code: %p codeCnt: 0x%x flavor: %p old_state: %p old_stateCnt: 0x%x new_state: %p new_stateCnt: %p",
+ __func__, thread, task, exception, code, codeCnt, flavor, old_state, old_stateCnt, new_state, new_stateCnt);
+
+ memcpy(new_state, old_state, old_stateCnt * sizeof(old_state[0]));
+ *new_stateCnt = old_stateCnt;
+
+ launchd_assumes(launchd_mport_deallocate(thread) == KERN_SUCCESS);
+ launchd_assumes(launchd_mport_deallocate(task) == KERN_SUCCESS);
+
+ return 0;
+}
typedef boolean_t (*mig_callback)(mach_msg_header_t *, mach_msg_header_t *);
typedef void (*timeout_callback)(void);
-boolean_t launchd_internal_demux(mach_msg_header_t *Request, mach_msg_header_t *Reply);
+mach_port_t runtime_get_kernel_port(void);
void runtime_add_ref(void);
void runtime_del_ref(void);
}
}
fcntl(r, F_SETFL, 0);
+ fcntl(r, F_SETFD, 1);
dup2(r, STDIN_FILENO);
if (dupstdout)
dup2(r, STDOUT_FILENO);
#define LAUNCH_JOBKEY_PERJOBMACHSERVICES "PerJobMachServices"
#define LAUNCH_JOBKEY_SERVICEIPC "ServiceIPC"
#define LAUNCH_JOBKEY_BINARYORDERPREFERENCE "BinaryOrderPreference"
+#define LAUNCH_JOBKEY_MACHEXCEPTIONHANDLER "MachExceptionHandler"
#define LAUNCH_JOBKEY_MACH_KUNCSERVER "kUNCServer"
#define LAUNCH_JOBKEY_MACH_EXCEPTIONSERVER "ExceptionServer"