]> git.saurik.com Git - apple/launchd.git/blame_incremental - liblaunch/vproc_internal.h
launchd-842.92.1.tar.gz
[apple/launchd.git] / liblaunch / vproc_internal.h
... / ...
CommitLineData
1/*
2 * Copyright (c) 2006-2007 Apple Inc. All rights reserved.
3 *
4 * @APPLE_APACHE_LICENSE_HEADER_START@
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 * @APPLE_APACHE_LICENSE_HEADER_END@
19 */
20
21#ifndef __VPROC_INTERNAL_H__
22#define __VPROC_INTERNAL_H__
23
24#include <mach/mach.h>
25#include <sys/queue.h>
26#include <sys/time.h>
27#include <stdarg.h>
28#include <sys/syscall.h>
29#include <bsm/audit.h>
30#include "launch.h"
31#include "bootstrap_priv.h"
32#include "vproc.h"
33
34typedef char * _internal_string_t;
35typedef char * logmsg_t;
36typedef pid_t * pid_array_t;
37typedef mach_port_t vproc_mig_t;
38
39#if defined(job_MSG_COUNT) || defined (xpc_domain_MSG_COUNT)
40/* HACK */
41#include "core.h"
42#endif
43
44#define VPROC_ERR_TRY_PER_USER 1099
45
46#pragma GCC visibility push(default)
47
48vproc_err_t _vprocmgr_init(const char *session_type);
49vproc_err_t _vproc_post_fork_ping(void);
50
51#if !TARGET_OS_EMBEDDED
52#define _audit_session_self(v) (mach_port_t)syscall(SYS_audit_session_self)
53#define _audit_session_join(s) (au_asid_t)syscall(SYS_audit_session_join, session)
54#else
55#define _audit_session_self(v) MACH_PORT_NULL
56#define _audit_session_join(s) 0
57#endif
58
59#define __LAUNCH_MACH_PORT_CONTEXT_T_DEFINED__ 0
60
61#define SPAWN_HAS_PATH 0x0001
62#define SPAWN_HAS_WDIR 0x0002
63#define SPAWN_HAS_UMASK 0x0004
64#define SPAWN_WANTS_WAIT4DEBUGGER 0x0008
65
66kern_return_t
67_vproc_grab_subset(mach_port_t bp, mach_port_t *reqport, mach_port_t *rcvright, launch_data_t *outval,
68 mach_port_array_t *ports, mach_msg_type_number_t *portCnt);
69
70kern_return_t _vprocmgr_getsocket(name_t);
71
72struct logmsg_s {
73 union {
74 STAILQ_ENTRY(logmsg_s) sqe;
75 uint64_t __pad;
76 };
77 int64_t when;
78 pid_t from_pid;
79 pid_t about_pid;
80 uid_t sender_uid;
81 gid_t sender_gid;
82 int err_num;
83 int pri;
84 union {
85 const char *from_name;
86 uint64_t from_name_offset;
87 };
88 union {
89 const char *about_name;
90 uint64_t about_name_offset;
91 };
92 union {
93 const char *session_name;
94 uint64_t session_name_offset;
95 };
96 union {
97 const char *msg;
98 uint64_t msg_offset;
99 };
100 uint64_t obj_sz;
101 char data[0];
102};
103
104
105vproc_err_t _vprocmgr_log_forward(mach_port_t mp, void *data, size_t len);
106
107kern_return_t
108bootstrap_info(mach_port_t bp,
109 name_array_t *service_names,
110 mach_msg_type_number_t *service_namesCnt,
111 name_array_t *service_jobs,
112 mach_msg_type_number_t *service_jobsCnt,
113 bootstrap_status_array_t *service_active,
114 mach_msg_type_number_t *service_activeCnt,
115 uint64_t flags);
116
117#pragma GCC visibility pop
118
119#endif /* __VPROC_INTERNAL_H__ */