]> git.saurik.com Git - apple/launchd.git/blame - launchd/src/vproc_internal.h
launchd-329.3.tar.gz
[apple/launchd.git] / launchd / src / vproc_internal.h
CommitLineData
5b0a4722
A
1#ifndef _VPROC_INTERNAL_H_
2#define _VPROC_INTERNAL_H_
3/*
4 * Copyright (c) 2006-2007 Apple 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 <mach/mach.h>
24#include <sys/queue.h>
25#include <sys/time.h>
26#include <stdarg.h>
ddbbfbc1
A
27#include <sys/syscall.h>
28#include <bsm/audit.h>
ef398931
A
29#include "launch.h"
30#include "bootstrap.h"
31#include "vproc.h"
5b0a4722
A
32
33typedef char * _internal_string_t;
34typedef char * logmsg_t;
35typedef pid_t * pid_array_t;
36typedef mach_port_t vproc_mig_t;
37
ddbbfbc1
A
38#define VPROC_SHMEM_EXITING 0x1
39
40struct vproc_shmem_s {
41 int32_t vp_shmem_transaction_cnt;
42 int32_t vp_shmem_standby_cnt;
43 uint32_t vp_shmem_standby_timeout;
44 int32_t vp_shmem_flags;
45};
46
5b0a4722
A
47#ifdef protocol_vproc_MSG_COUNT
48/* HACK */
49#include "launchd_core_logic.h"
50#endif
51
52#define VPROC_ERR_TRY_PER_USER 1099
53
54#pragma GCC visibility push(default)
55
56vproc_err_t _vprocmgr_init(const char *session_type);
57vproc_err_t _vproc_post_fork_ping(void);
58
ddbbfbc1
A
59#if !TARGET_OS_EMBEDDED
60 #define _audit_session_self(v) (mach_port_t)syscall(SYS_audit_session_self)
61 #define _audit_session_join(s) (au_asid_t)syscall(SYS_audit_session_join, session)
62#else
63 #define _audit_session_self(v) MACH_PORT_NULL
64 #define _audit_session_join(s) 0
65#endif
66
5b0a4722
A
67#define SPAWN_HAS_PATH 0x0001
68#define SPAWN_HAS_WDIR 0x0002
69#define SPAWN_HAS_UMASK 0x0004
70#define SPAWN_WANTS_WAIT4DEBUGGER 0x0008
71
72kern_return_t
73_vproc_grab_subset(mach_port_t bp, mach_port_t *reqport, mach_port_t *rcvright, launch_data_t *outval,
74 mach_port_array_t *ports, mach_msg_type_number_t *portCnt);
75
76kern_return_t _vprocmgr_getsocket(name_t);
77
5b0a4722 78struct logmsg_s {
ddbbfbc1
A
79 union {
80 STAILQ_ENTRY(logmsg_s) sqe;
81 uint64_t __pad;
82 };
83 int64_t when;
5b0a4722
A
84 pid_t from_pid;
85 pid_t about_pid;
86 uid_t sender_uid;
87 gid_t sender_gid;
88 int err_num;
89 int pri;
ddbbfbc1
A
90 union {
91 const char *from_name;
92 uint64_t from_name_offset;
93 };
94 union {
95 const char *about_name;
96 uint64_t about_name_offset;
97 };
98 union {
99 const char *session_name;
100 uint64_t session_name_offset;
101 };
102 union {
103 const char *msg;
104 uint64_t msg_offset;
105 };
106 uint64_t obj_sz;
5b0a4722
A
107 char data[0];
108};
109
110
5b0a4722
A
111vproc_err_t _vprocmgr_log_forward(mach_port_t mp, void *data, size_t len);
112
113
114kern_return_t
ddbbfbc1
A
115bootstrap_info(mach_port_t bp,
116 name_array_t *service_names,
117 mach_msg_type_number_t *service_namesCnt,
118 name_array_t *service_jobs,
119 mach_msg_type_number_t *service_jobsCnt,
120 bootstrap_status_array_t *service_active,
121 mach_msg_type_number_t *service_activeCnt,
122 uint64_t flags);
5b0a4722
A
123
124#pragma GCC visibility pop
125
126#endif