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