]> git.saurik.com Git - apple/launchd.git/blob - launchd/src/libvproc_private.h
launchd-258.18.tar.gz
[apple/launchd.git] / launchd / src / libvproc_private.h
1 #ifndef _VPROC_PRIVATE_H_
2 #define _VPROC_PRIVATE_H_
3 /*
4 * Copyright (c) 2006 Apple Computer, Inc. All rights reserved.
5 *
6 * @APPLE_APACHE_LICENSE_HEADER_START@
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 *
20 * @APPLE_APACHE_LICENSE_HEADER_END@
21 */
22
23 #include <sys/types.h>
24 #include <sys/cdefs.h>
25 #include <sys/syslog.h>
26 #include <sys/time.h>
27 #include <stdbool.h>
28 #include <launch.h>
29
30 __BEGIN_DECLS
31
32 #pragma GCC visibility push(default)
33
34 /* DO NOT use this. This is a hack for launchctl */
35 #define VPROC_MAGIC_UNLOAD_SIGNAL 0x4141504C
36
37 typedef enum {
38 VPROC_GSK_LAST_EXIT_STATUS = 1,
39 VPROC_GSK_GLOBAL_ON_DEMAND,
40 VPROC_GSK_MGR_UID,
41 VPROC_GSK_MGR_PID,
42 VPROC_GSK_IS_MANAGED,
43 VPROC_GSK_BASIC_KEEPALIVE,
44 VPROC_GSK_START_INTERVAL,
45 VPROC_GSK_IDLE_TIMEOUT,
46 VPROC_GSK_EXIT_TIMEOUT,
47 VPROC_GSK_ENVIRONMENT,
48 VPROC_GSK_ALLJOBS,
49 VPROC_GSK_GLOBAL_LOG_MASK,
50 VPROC_GSK_GLOBAL_UMASK,
51 } vproc_gsk_t;
52
53 vproc_err_t vproc_swap_integer(vproc_t vp, vproc_gsk_t key, int64_t *inval, int64_t *outval);
54 vproc_err_t vproc_swap_complex(vproc_t vp, vproc_gsk_t key, launch_data_t inval, launch_data_t *outval);
55
56 vproc_err_t _vproc_get_last_exit_status(int *wstatus);
57 vproc_err_t _vproc_set_global_on_demand(bool val);
58
59 typedef void (*_vprocmgr_log_drain_callback_t)(struct timeval *when, pid_t from_pid, pid_t about_pid, uid_t sender_uid, gid_t sender_gid, int priority, const char *from_name, const char *about_name, const char *session_name, const char *msg);
60
61 vproc_err_t _vprocmgr_log_drain(vproc_t vp, pthread_mutex_t *optional_mutex_around_callback, _vprocmgr_log_drain_callback_t func);
62
63 vproc_err_t _vproc_send_signal_by_label(const char *label, int sig);
64 vproc_err_t _vproc_kickstart_by_label(const char *label, pid_t *out_pid, mach_port_t *out_port_name);
65 vproc_err_t _vproc_wait_by_label(const char *label, int *out_wstatus);
66
67 void _vproc_log(int pri, const char *msg, ...) __attribute__((format(printf, 2, 3)));
68 void _vproc_log_error(int pri, const char *msg, ...) __attribute__((format(printf, 2, 3)));
69
70 #define VPROCMGR_SESSION_LOGINWINDOW "LoginWindow"
71 #define VPROCMGR_SESSION_BACKGROUND "Background"
72 #define VPROCMGR_SESSION_AQUA "Aqua"
73 #define VPROCMGR_SESSION_STANDARDIO "StandardIO"
74 #define VPROCMGR_SESSION_SYSTEM "System"
75
76 vproc_err_t _vprocmgr_move_subset_to_user(uid_t target_user, const char *session_type);
77
78 #pragma GCC visibility pop
79
80 __END_DECLS
81
82 #endif