X-Git-Url: https://git.saurik.com/apple/launchd.git/blobdiff_plain/ddbbfbc16a73ae4ed2ebe2c11ac6fb84b944c0dd..dcace88fe6cde929a524daa9e1f1495bf1e24cfe:/launchd/src/vproc_priv.h?ds=sidebyside diff --git a/launchd/src/vproc_priv.h b/launchd/src/vproc_priv.h index b691c22..8893628 100644 --- a/launchd/src/vproc_priv.h +++ b/launchd/src/vproc_priv.h @@ -29,6 +29,7 @@ #include #include #include +#include #ifndef VPROC_HAS_TRANSACTIONS #define VPROC_HAS_TRANSACTIONS @@ -43,6 +44,8 @@ __BEGIN_DECLS /* DO NOT use this. This is a hack for 'loginwindow' */ #define VPROC_MAGIC_TRYKILL_SIGNAL 0x6161706C +typedef void (*_vproc_transaction_callout)(void); + typedef enum { VPROC_GSK_LAST_EXIT_STATUS = 1, VPROC_GSK_GLOBAL_ON_DEMAND, @@ -72,6 +75,14 @@ typedef enum { VPROC_GSK_EMBEDDEDROOTEQUIVALENT, } vproc_gsk_t; +typedef kern_return_t (*vproc_helper_recv_ping_t)(mach_port_t, audit_token_t); + +/* Give to dispatch_mig_server(). */ +boolean_t vprocmgr_helper_server_routine_for_dispatch(mach_msg_header_t *message, mach_msg_header_t *reply); + +/* Give to dispatch_mig_server(). */ +extern size_t vprocmgr_helper_maxmsgsz; + typedef unsigned int vproc_flags_t; /* For _vproc_kickstart_by_label() -- instructs launchd to kickstart the job to stall before exec(2). */ #define VPROCFLAG_STALL_JOB_EXEC 1 << 1 @@ -93,7 +104,6 @@ vproc_err_t _vprocmgr_log_drain(vproc_t vp, pthread_mutex_t *optional_mutex_arou vproc_err_t _vproc_send_signal_by_label(const char *label, int sig); vproc_err_t _vproc_kickstart_by_label(const char *label, pid_t *out_pid, mach_port_t *out_port_name, mach_port_t *out_obsrvr_port, vproc_flags_t flags); -vproc_err_t _vproc_wait_by_label(const char *label, int *out_wstatus); void _vproc_log(int pri, const char *msg, ...) __attribute__((format(printf, 2, 3))); void _vproc_log_error(int pri, const char *msg, ...) __attribute__((format(printf, 2, 3))); @@ -105,21 +115,69 @@ void _vproc_logv(int pri, int err, const char *msg, va_list ap) __attribute__((f #define VPROCMGR_SESSION_STANDARDIO "StandardIO" #define VPROCMGR_SESSION_SYSTEM "System" +#define XPC_DOMAIN_TYPE_SYSTEM "XPCSystem" +#define XPC_DOMAIN_TYPE_PERUSER "XPCPerUser" +#define XPC_DOMAIN_TYPE_PERSESSION "XPCPerSession" +#define XPC_DOMAIN_TYPE_PERAPPLICATION "XPCPerApplication" + vproc_err_t _vprocmgr_move_subset_to_user(uid_t target_user, const char *session_type, uint64_t flags); vproc_err_t _vprocmgr_switch_to_session(const char *target_session, vproc_flags_t flags); vproc_err_t _vprocmgr_detach_from_console(vproc_flags_t flags); -void _vproc_standby_begin(void) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA); -void _vproc_standby_end(void) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA); -size_t _vproc_standby_count(void) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA); -size_t _vproc_standby_timeout(void) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA); - -kern_return_t _vproc_transaction_count_for_pid(pid_t p, int32_t *count, bool *condemned) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA); -bool _vproc_pid_is_managed(pid_t p) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA); -void _vproc_transaction_try_exit(int status) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA); -void _vproc_transaction_begin(void) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA); -void _vproc_transaction_end(void) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA); -size_t _vproc_transaction_count(void) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA); +__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA) +void +_vproc_standby_begin(void); + +__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA) +void +_vproc_standby_end(void); + +__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA) +size_t +_vproc_standby_count(void); + +__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA) +size_t +_vproc_standby_timeout(void); + +__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA) +kern_return_t +_vproc_transaction_count_for_pid(pid_t p, int32_t *count, bool *condemned); + +__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA) +bool +_vproc_pid_is_managed(pid_t p); + +__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA) +void +_vproc_transaction_try_exit(int status); + +__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_5_0) +void +_vproc_transaction_begin(void); + +__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_5_0) +void +_vproc_transaction_end(void); + +__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA) +size_t +_vproc_transaction_count(void); + +int32_t * +_vproc_transaction_ptr(void); + +void +_vproc_transaction_set_callouts(_vproc_transaction_callout gone2zero, _vproc_transaction_callout gonenonzero); + +bool +vprocmgr_helper_check_in(const char *sysname, mach_port_t rp, launch_data_t *events, uint64_t *tokens); + +bool +vprocmgr_helper_event_set_state(const char *sysname, uint64_t token, bool state); + +void +vprocmgr_helper_register(vproc_helper_recv_ping_t callout); #pragma GCC visibility pop