Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/openlaunchd
Path: blob/master/liblaunch/vproc_internal.h
374 views
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
#if HAS_MACH
25
#include <mach/mach.h>
26
#endif
27
#include <sys/queue.h>
28
#include <sys/time.h>
29
#include <stdarg.h>
30
#include <sys/syscall.h>
31
#include <bsm/audit.h>
32
#include "launch.h"
33
#ifdef __APPLE__
34
#include "bootstrap_priv.h"
35
#endif
36
#include "vproc.h"
37
38
typedef char * _internal_string_t;
39
typedef char * logmsg_t;
40
typedef pid_t * pid_array_t;
41
#if HAS_MACH
42
typedef mach_port_t vproc_mig_t;
43
#else
44
#warning "PORT: vproc_mig_t ifdef'd out, used in job_types.defs"
45
#endif
46
47
#if defined(job_MSG_COUNT) || defined (xpc_domain_MSG_COUNT)
48
/* HACK */
49
#include "core.h"
50
#endif
51
52
#define VPROC_ERR_TRY_PER_USER 1099
53
54
#pragma GCC visibility push(default)
55
56
vproc_err_t _vprocmgr_init(const char *session_type);
57
vproc_err_t _vproc_post_fork_ping(void);
58
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
67
#define __LAUNCH_MACH_PORT_CONTEXT_T_DEFINED__ 0
68
69
#define SPAWN_HAS_PATH 0x0001
70
#define SPAWN_HAS_WDIR 0x0002
71
#define SPAWN_HAS_UMASK 0x0004
72
#define SPAWN_WANTS_WAIT4DEBUGGER 0x0008
73
74
#ifdef __APPLE__
75
kern_return_t
76
_vproc_grab_subset(mach_port_t bp, mach_port_t *reqport, mach_port_t *rcvright, launch_data_t *outval,
77
mach_port_array_t *ports, mach_msg_type_number_t *portCnt);
78
79
kern_return_t _vprocmgr_getsocket(name_t);
80
#else
81
#warning "PORT: _vproc_grab_subset() What is this for?"
82
#endif
83
84
struct logmsg_s {
85
union {
86
STAILQ_ENTRY(logmsg_s) sqe;
87
uint64_t __pad;
88
};
89
int64_t when;
90
pid_t from_pid;
91
pid_t about_pid;
92
uid_t sender_uid;
93
gid_t sender_gid;
94
int err_num;
95
int pri;
96
union {
97
const char *from_name;
98
uint64_t from_name_offset;
99
};
100
union {
101
const char *about_name;
102
uint64_t about_name_offset;
103
};
104
union {
105
const char *session_name;
106
uint64_t session_name_offset;
107
};
108
union {
109
const char *msg;
110
uint64_t msg_offset;
111
};
112
uint64_t obj_sz;
113
char data[0];
114
};
115
116
117
#ifdef __APPLE__
118
vproc_err_t _vprocmgr_log_forward(mach_port_t mp, void *data, size_t len);
119
120
kern_return_t
121
bootstrap_info(mach_port_t bp,
122
name_array_t *service_names,
123
mach_msg_type_number_t *service_namesCnt,
124
name_array_t *service_jobs,
125
mach_msg_type_number_t *service_jobsCnt,
126
bootstrap_status_array_t *service_active,
127
mach_msg_type_number_t *service_activeCnt,
128
uint64_t flags);
129
#else
130
#warning "PORT: bootstrap_info(): is this only for bootstrap servics?"
131
#endif
132
133
#pragma GCC visibility pop
134
135
#endif /* __VPROC_INTERNAL_H__ */
136
137