1#ifndef _task_access_user_
2#define _task_access_user_
3
4/* Module task_access */
5
6#include <string.h>
7#include <mach/ndr.h>
8#include <mach/boolean.h>
9#include <mach/kern_return.h>
10#include <mach/notify.h>
11#include <mach/mach_types.h>
12#include <mach/message.h>
13#include <mach/mig_errors.h>
14#include <mach/port.h>
15
16/* BEGIN MIG_STRNCPY_ZEROFILL CODE */
17
18#if defined(__has_include)
19#if __has_include(<mach/mig_strncpy_zerofill_support.h>)
20#ifndef USING_MIG_STRNCPY_ZEROFILL
21#define USING_MIG_STRNCPY_ZEROFILL
22#endif
23#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
24#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
25#ifdef __cplusplus
26extern "C" {
27#endif
28#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR
29#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable
30#endif
31 extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import));
32#ifdef __cplusplus
33}
34#endif
35#endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */
36#endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */
37#endif /* __has_include */
38
39/* END MIG_STRNCPY_ZEROFILL CODE */
40
41#if (__MigKernelSpecificCode) || (_MIG_KERNEL_SPECIFIC_CODE_)
42#include <kern/ipc_mig.h>
43#endif /* __MigKernelSpecificCode */
44
45#ifdef AUTOTEST
46#ifndef FUNCTION_PTR_T
47#define FUNCTION_PTR_T
48typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
49typedef struct {
50 char * name;
51 function_ptr_t function;
52} function_table_entry;
53typedef function_table_entry *function_table_t;
54#endif /* FUNCTION_PTR_T */
55#endif /* AUTOTEST */
56
57#ifndef task_access_MSG_COUNT
58#define task_access_MSG_COUNT 3
59#endif /* task_access_MSG_COUNT */
60
61#include <Availability.h>
62#include <mach/std_types.h>
63#include <mach/mig.h>
64#include <mach/mig.h>
65#include <mach/mach_types.h>
66
67#ifdef __BeforeMigUserHeader
68__BeforeMigUserHeader
69#endif /* __BeforeMigUserHeader */
70
71#include <sys/cdefs.h>
72__BEGIN_DECLS
73
74
75/* Routine check_task_access */
76#ifdef mig_external
77mig_external
78#else
79extern
80#endif /* mig_external */
81kern_return_t check_task_access
82(
83 mach_port_t task_access_port,
84 int32_t calling_pid,
85 uint32_t calling_gid,
86 int32_t target_pid
87);
88
89/* Routine find_code_signature */
90#ifdef mig_external
91mig_external
92#else
93extern
94#endif /* mig_external */
95kern_return_t find_code_signature
96(
97 mach_port_t task_access_port,
98 int32_t new_pid
99);
100
101/* Routine check_task_access_with_flavor */
102#ifdef mig_external
103mig_external
104#else
105extern
106#endif /* mig_external */
107kern_return_t check_task_access_with_flavor
108(
109 mach_port_t task_access_port,
110 int32_t calling_pid,
111 uint32_t calling_gid,
112 int32_t target_pid,
113 mach_task_flavor_t flavor
114);
115
116__END_DECLS
117
118/********************** Caution **************************/
119/* The following data types should be used to calculate */
120/* maximum message sizes only. The actual message may be */
121/* smaller, and the position of the arguments within the */
122/* message layout may vary from what is presented here. */
123/* For example, if any of the arguments are variable- */
124/* sized, and less than the maximum is sent, the data */
125/* will be packed tight in the actual message to reduce */
126/* the presence of holes. */
127/********************** Caution **************************/
128
129/* typedefs for all requests */
130
131#ifndef __Request__task_access_subsystem__defined
132#define __Request__task_access_subsystem__defined
133
134#ifdef __MigPackStructs
135#pragma pack(push, 4)
136#endif
137 typedef struct {
138 mach_msg_header_t Head;
139 NDR_record_t NDR;
140 int32_t calling_pid;
141 uint32_t calling_gid;
142 int32_t target_pid;
143 } __Request__check_task_access_t __attribute__((unused));
144#ifdef __MigPackStructs
145#pragma pack(pop)
146#endif
147
148#ifdef __MigPackStructs
149#pragma pack(push, 4)
150#endif
151 typedef struct {
152 mach_msg_header_t Head;
153 NDR_record_t NDR;
154 int32_t new_pid;
155 } __Request__find_code_signature_t __attribute__((unused));
156#ifdef __MigPackStructs
157#pragma pack(pop)
158#endif
159
160#ifdef __MigPackStructs
161#pragma pack(push, 4)
162#endif
163 typedef struct {
164 mach_msg_header_t Head;
165 NDR_record_t NDR;
166 int32_t calling_pid;
167 uint32_t calling_gid;
168 int32_t target_pid;
169 mach_task_flavor_t flavor;
170 } __Request__check_task_access_with_flavor_t __attribute__((unused));
171#ifdef __MigPackStructs
172#pragma pack(pop)
173#endif
174#endif /* !__Request__task_access_subsystem__defined */
175
176/* union of all requests */
177
178#ifndef __RequestUnion__task_access_subsystem__defined
179#define __RequestUnion__task_access_subsystem__defined
180union __RequestUnion__task_access_subsystem {
181 __Request__check_task_access_t Request_check_task_access;
182 __Request__find_code_signature_t Request_find_code_signature;
183 __Request__check_task_access_with_flavor_t Request_check_task_access_with_flavor;
184};
185#endif /* !__RequestUnion__task_access_subsystem__defined */
186/* typedefs for all replies */
187
188#ifndef __Reply__task_access_subsystem__defined
189#define __Reply__task_access_subsystem__defined
190
191#ifdef __MigPackStructs
192#pragma pack(push, 4)
193#endif
194 typedef struct {
195 mach_msg_header_t Head;
196 NDR_record_t NDR;
197 kern_return_t RetCode;
198 } __Reply__check_task_access_t __attribute__((unused));
199#ifdef __MigPackStructs
200#pragma pack(pop)
201#endif
202
203#ifdef __MigPackStructs
204#pragma pack(push, 4)
205#endif
206 typedef struct {
207 mach_msg_header_t Head;
208 NDR_record_t NDR;
209 kern_return_t RetCode;
210 } __Reply__find_code_signature_t __attribute__((unused));
211#ifdef __MigPackStructs
212#pragma pack(pop)
213#endif
214
215#ifdef __MigPackStructs
216#pragma pack(push, 4)
217#endif
218 typedef struct {
219 mach_msg_header_t Head;
220 NDR_record_t NDR;
221 kern_return_t RetCode;
222 } __Reply__check_task_access_with_flavor_t __attribute__((unused));
223#ifdef __MigPackStructs
224#pragma pack(pop)
225#endif
226#endif /* !__Reply__task_access_subsystem__defined */
227
228/* union of all replies */
229
230#ifndef __ReplyUnion__task_access_subsystem__defined
231#define __ReplyUnion__task_access_subsystem__defined
232union __ReplyUnion__task_access_subsystem {
233 __Reply__check_task_access_t Reply_check_task_access;
234 __Reply__find_code_signature_t Reply_find_code_signature;
235 __Reply__check_task_access_with_flavor_t Reply_check_task_access_with_flavor;
236};
237#endif /* !__RequestUnion__task_access_subsystem__defined */
238
239#ifndef subsystem_to_name_map_task_access
240#define subsystem_to_name_map_task_access \
241 { "check_task_access", 27000 },\
242 { "find_code_signature", 27001 },\
243 { "check_task_access_with_flavor", 27002 }
244#endif
245
246#ifdef __AfterMigUserHeader
247__AfterMigUserHeader
248#endif /* __AfterMigUserHeader */
249
250#endif /* _task_access_user_ */
251