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 |
26 | extern "C" { |
27 | #endif |
28 | extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import)); |
29 | #ifdef __cplusplus |
30 | } |
31 | #endif |
32 | #endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */ |
33 | #endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */ |
34 | #endif /* __has_include */ |
35 | |
36 | /* END MIG_STRNCPY_ZEROFILL CODE */ |
37 | |
38 | #if (__MigKernelSpecificCode) || (_MIG_KERNEL_SPECIFIC_CODE_) |
39 | #include <kern/ipc_mig.h> |
40 | #endif /* __MigKernelSpecificCode */ |
41 | |
42 | #ifdef AUTOTEST |
43 | #ifndef FUNCTION_PTR_T |
44 | #define FUNCTION_PTR_T |
45 | typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); |
46 | typedef struct { |
47 | char *name; |
48 | function_ptr_t function; |
49 | } function_table_entry; |
50 | typedef function_table_entry *function_table_t; |
51 | #endif /* FUNCTION_PTR_T */ |
52 | #endif /* AUTOTEST */ |
53 | |
54 | #ifndef task_access_MSG_COUNT |
55 | #define task_access_MSG_COUNT 2 |
56 | #endif /* task_access_MSG_COUNT */ |
57 | |
58 | #include <mach/std_types.h> |
59 | #include <mach/mig.h> |
60 | #include <mach/mig.h> |
61 | #include <mach/mach_types.h> |
62 | |
63 | #ifdef __BeforeMigUserHeader |
64 | __BeforeMigUserHeader |
65 | #endif /* __BeforeMigUserHeader */ |
66 | |
67 | #include <sys/cdefs.h> |
68 | __BEGIN_DECLS |
69 | |
70 | |
71 | /* Routine check_task_access */ |
72 | #ifdef mig_external |
73 | mig_external |
74 | #else |
75 | extern |
76 | #endif /* mig_external */ |
77 | kern_return_t check_task_access |
78 | ( |
79 | mach_port_t task_access_port, |
80 | int32_t calling_pid, |
81 | uint32_t calling_gid, |
82 | int32_t target_pid |
83 | ); |
84 | |
85 | /* Routine find_code_signature */ |
86 | #ifdef mig_external |
87 | mig_external |
88 | #else |
89 | extern |
90 | #endif /* mig_external */ |
91 | kern_return_t find_code_signature |
92 | ( |
93 | mach_port_t task_access_port, |
94 | int32_t new_pid |
95 | ); |
96 | |
97 | __END_DECLS |
98 | |
99 | /********************** Caution **************************/ |
100 | /* The following data types should be used to calculate */ |
101 | /* maximum message sizes only. The actual message may be */ |
102 | /* smaller, and the position of the arguments within the */ |
103 | /* message layout may vary from what is presented here. */ |
104 | /* For example, if any of the arguments are variable- */ |
105 | /* sized, and less than the maximum is sent, the data */ |
106 | /* will be packed tight in the actual message to reduce */ |
107 | /* the presence of holes. */ |
108 | /********************** Caution **************************/ |
109 | |
110 | /* typedefs for all requests */ |
111 | |
112 | #ifndef __Request__task_access_subsystem__defined |
113 | #define __Request__task_access_subsystem__defined |
114 | |
115 | #ifdef __MigPackStructs |
116 | #pragma pack(4) |
117 | #endif |
118 | typedef struct { |
119 | mach_msg_header_t Head; |
120 | NDR_record_t NDR; |
121 | int32_t calling_pid; |
122 | uint32_t calling_gid; |
123 | int32_t target_pid; |
124 | } __Request__check_task_access_t __attribute__((unused)); |
125 | #ifdef __MigPackStructs |
126 | #pragma pack() |
127 | #endif |
128 | |
129 | #ifdef __MigPackStructs |
130 | #pragma pack(4) |
131 | #endif |
132 | typedef struct { |
133 | mach_msg_header_t Head; |
134 | NDR_record_t NDR; |
135 | int32_t new_pid; |
136 | } __Request__find_code_signature_t __attribute__((unused)); |
137 | #ifdef __MigPackStructs |
138 | #pragma pack() |
139 | #endif |
140 | #endif /* !__Request__task_access_subsystem__defined */ |
141 | |
142 | /* union of all requests */ |
143 | |
144 | #ifndef __RequestUnion__task_access_subsystem__defined |
145 | #define __RequestUnion__task_access_subsystem__defined |
146 | union __RequestUnion__task_access_subsystem { |
147 | __Request__check_task_access_t Request_check_task_access; |
148 | __Request__find_code_signature_t Request_find_code_signature; |
149 | }; |
150 | #endif /* !__RequestUnion__task_access_subsystem__defined */ |
151 | /* typedefs for all replies */ |
152 | |
153 | #ifndef __Reply__task_access_subsystem__defined |
154 | #define __Reply__task_access_subsystem__defined |
155 | |
156 | #ifdef __MigPackStructs |
157 | #pragma pack(4) |
158 | #endif |
159 | typedef struct { |
160 | mach_msg_header_t Head; |
161 | NDR_record_t NDR; |
162 | kern_return_t RetCode; |
163 | } __Reply__check_task_access_t __attribute__((unused)); |
164 | #ifdef __MigPackStructs |
165 | #pragma pack() |
166 | #endif |
167 | |
168 | #ifdef __MigPackStructs |
169 | #pragma pack(4) |
170 | #endif |
171 | typedef struct { |
172 | mach_msg_header_t Head; |
173 | NDR_record_t NDR; |
174 | kern_return_t RetCode; |
175 | } __Reply__find_code_signature_t __attribute__((unused)); |
176 | #ifdef __MigPackStructs |
177 | #pragma pack() |
178 | #endif |
179 | #endif /* !__Reply__task_access_subsystem__defined */ |
180 | |
181 | /* union of all replies */ |
182 | |
183 | #ifndef __ReplyUnion__task_access_subsystem__defined |
184 | #define __ReplyUnion__task_access_subsystem__defined |
185 | union __ReplyUnion__task_access_subsystem { |
186 | __Reply__check_task_access_t Reply_check_task_access; |
187 | __Reply__find_code_signature_t Reply_find_code_signature; |
188 | }; |
189 | #endif /* !__RequestUnion__task_access_subsystem__defined */ |
190 | |
191 | #ifndef subsystem_to_name_map_task_access |
192 | #define subsystem_to_name_map_task_access \ |
193 | { "check_task_access", 27000 },\ |
194 | { "find_code_signature", 27001 } |
195 | #endif |
196 | |
197 | #ifdef __AfterMigUserHeader |
198 | __AfterMigUserHeader |
199 | #endif /* __AfterMigUserHeader */ |
200 | |
201 | #endif /* _task_access_user_ */ |
202 | |