]> git.saurik.com Git - apple/launchd.git/blame - liblaunch/vproc_internal.h
launchd-842.92.1.tar.gz
[apple/launchd.git] / liblaunch / vproc_internal.h
CommitLineData
5b0a4722
A
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
eabd1701
A
21#ifndef __VPROC_INTERNAL_H__
22#define __VPROC_INTERNAL_H__
23
5b0a4722
A
24#include <mach/mach.h>
25#include <sys/queue.h>
26#include <sys/time.h>
27#include <stdarg.h>
ddbbfbc1
A
28#include <sys/syscall.h>
29#include <bsm/audit.h>
ef398931 30#include "launch.h"
dcace88f 31#include "bootstrap_priv.h"
ef398931 32#include "vproc.h"
5b0a4722
A
33
34typedef char * _internal_string_t;
35typedef char * logmsg_t;
36typedef pid_t * pid_array_t;
37typedef mach_port_t vproc_mig_t;
ddbbfbc1 38
eabd1701 39#if defined(job_MSG_COUNT) || defined (xpc_domain_MSG_COUNT)
5b0a4722 40/* HACK */
eabd1701 41#include "core.h"
5b0a4722
A
42#endif
43
eabd1701 44#define VPROC_ERR_TRY_PER_USER 1099
5b0a4722
A
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
ddbbfbc1 51#if !TARGET_OS_EMBEDDED
eabd1701
A
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)
ddbbfbc1 54#else
eabd1701
A
55#define _audit_session_self(v) MACH_PORT_NULL
56#define _audit_session_join(s) 0
ddbbfbc1
A
57#endif
58
eabd1701 59#define __LAUNCH_MACH_PORT_CONTEXT_T_DEFINED__ 0
eabd1701
A
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
5b0a4722
A
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
5b0a4722 72struct logmsg_s {
ddbbfbc1
A
73 union {
74 STAILQ_ENTRY(logmsg_s) sqe;
75 uint64_t __pad;
76 };
77 int64_t when;
5b0a4722
A
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;
ddbbfbc1
A
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;
5b0a4722
A
101 char data[0];
102};
103
104
5b0a4722
A
105vproc_err_t _vprocmgr_log_forward(mach_port_t mp, void *data, size_t len);
106
5b0a4722 107kern_return_t
ddbbfbc1
A
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);
5b0a4722
A
116
117#pragma GCC visibility pop
118
eabd1701 119#endif /* __VPROC_INTERNAL_H__ */