| 1 | #ifndef	_notify_server_ | 
|---|
| 2 | #define	_notify_server_ | 
|---|
| 3 |  | 
|---|
| 4 | /* Module notify */ | 
|---|
| 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	notify_MSG_COUNT | 
|---|
| 52 | #define	notify_MSG_COUNT	9 | 
|---|
| 53 | #endif	/* notify_MSG_COUNT */ | 
|---|
| 54 |  | 
|---|
| 55 | #include <mach/std_types.h> | 
|---|
| 56 | #include <mach/mig.h> | 
|---|
| 57 |  | 
|---|
| 58 | #ifdef __BeforeMigServerHeader | 
|---|
| 59 | __BeforeMigServerHeader | 
|---|
| 60 | #endif /* __BeforeMigServerHeader */ | 
|---|
| 61 |  | 
|---|
| 62 |  | 
|---|
| 63 | /* SimpleRoutine mach_notify_port_deleted */ | 
|---|
| 64 | #ifdef	mig_external | 
|---|
| 65 | mig_external | 
|---|
| 66 | #else | 
|---|
| 67 | extern | 
|---|
| 68 | #endif	/* mig_external */ | 
|---|
| 69 | kern_return_t do_mach_notify_port_deleted | 
|---|
| 70 | ( | 
|---|
| 71 | mach_port_t notify, | 
|---|
| 72 | mach_port_name_t name | 
|---|
| 73 | ); | 
|---|
| 74 |  | 
|---|
| 75 | /* SimpleRoutine mach_notify_port_destroyed */ | 
|---|
| 76 | #ifdef	mig_external | 
|---|
| 77 | mig_external | 
|---|
| 78 | #else | 
|---|
| 79 | extern | 
|---|
| 80 | #endif	/* mig_external */ | 
|---|
| 81 | kern_return_t do_mach_notify_port_destroyed | 
|---|
| 82 | ( | 
|---|
| 83 | mach_port_t notify, | 
|---|
| 84 | mach_port_t rights | 
|---|
| 85 | ); | 
|---|
| 86 |  | 
|---|
| 87 | /* SimpleRoutine mach_notify_no_senders */ | 
|---|
| 88 | #ifdef	mig_external | 
|---|
| 89 | mig_external | 
|---|
| 90 | #else | 
|---|
| 91 | extern | 
|---|
| 92 | #endif	/* mig_external */ | 
|---|
| 93 | kern_return_t do_mach_notify_no_senders | 
|---|
| 94 | ( | 
|---|
| 95 | mach_port_t notify, | 
|---|
| 96 | mach_port_mscount_t mscount | 
|---|
| 97 | ); | 
|---|
| 98 |  | 
|---|
| 99 | /* SimpleRoutine mach_notify_send_once */ | 
|---|
| 100 | #ifdef	mig_external | 
|---|
| 101 | mig_external | 
|---|
| 102 | #else | 
|---|
| 103 | extern | 
|---|
| 104 | #endif	/* mig_external */ | 
|---|
| 105 | kern_return_t do_mach_notify_send_once | 
|---|
| 106 | ( | 
|---|
| 107 | mach_port_t notify | 
|---|
| 108 | ); | 
|---|
| 109 |  | 
|---|
| 110 | /* SimpleRoutine mach_notify_dead_name */ | 
|---|
| 111 | #ifdef	mig_external | 
|---|
| 112 | mig_external | 
|---|
| 113 | #else | 
|---|
| 114 | extern | 
|---|
| 115 | #endif	/* mig_external */ | 
|---|
| 116 | kern_return_t do_mach_notify_dead_name | 
|---|
| 117 | ( | 
|---|
| 118 | mach_port_t notify, | 
|---|
| 119 | mach_port_name_t name | 
|---|
| 120 | ); | 
|---|
| 121 |  | 
|---|
| 122 | #ifdef	mig_external | 
|---|
| 123 | mig_external | 
|---|
| 124 | #else | 
|---|
| 125 | extern | 
|---|
| 126 | #endif	/* mig_external */ | 
|---|
| 127 | boolean_t notify_server( | 
|---|
| 128 | mach_msg_header_t *InHeadP, | 
|---|
| 129 | mach_msg_header_t *OutHeadP); | 
|---|
| 130 |  | 
|---|
| 131 | #ifdef	mig_external | 
|---|
| 132 | mig_external | 
|---|
| 133 | #else | 
|---|
| 134 | extern | 
|---|
| 135 | #endif	/* mig_external */ | 
|---|
| 136 | mig_routine_t notify_server_routine( | 
|---|
| 137 | mach_msg_header_t *InHeadP); | 
|---|
| 138 |  | 
|---|
| 139 |  | 
|---|
| 140 | /* Description of this subsystem, for use in direct RPC */ | 
|---|
| 141 | extern const struct do_notify_subsystem { | 
|---|
| 142 | mig_server_routine_t	server;	/* Server routine */ | 
|---|
| 143 | mach_msg_id_t	start;	/* Min routine number */ | 
|---|
| 144 | mach_msg_id_t	end;	/* Max routine number + 1 */ | 
|---|
| 145 | unsigned int	maxsize;	/* Max msg size */ | 
|---|
| 146 | vm_address_t	reserved;	/* Reserved */ | 
|---|
| 147 | struct routine_descriptor	/*Array of routine descriptors */ | 
|---|
| 148 | routine[9]; | 
|---|
| 149 | } do_notify_subsystem; | 
|---|
| 150 |  | 
|---|
| 151 | /* typedefs for all requests */ | 
|---|
| 152 |  | 
|---|
| 153 | #ifndef __Request__notify_subsystem__defined | 
|---|
| 154 | #define __Request__notify_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 | mach_port_name_t name; | 
|---|
| 163 | } __Request__mach_notify_port_deleted_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 | /* start of the kernel processed data */ | 
|---|
| 174 | mach_msg_body_t msgh_body; | 
|---|
| 175 | mach_msg_port_descriptor_t rights; | 
|---|
| 176 | /* end of the kernel processed data */ | 
|---|
| 177 | } __Request__mach_notify_port_destroyed_t __attribute__((unused)); | 
|---|
| 178 | #ifdef  __MigPackStructs | 
|---|
| 179 | #pragma pack() | 
|---|
| 180 | #endif | 
|---|
| 181 |  | 
|---|
| 182 | #ifdef  __MigPackStructs | 
|---|
| 183 | #pragma pack(4) | 
|---|
| 184 | #endif | 
|---|
| 185 | typedef struct { | 
|---|
| 186 | mach_msg_header_t Head; | 
|---|
| 187 | NDR_record_t NDR; | 
|---|
| 188 | mach_port_mscount_t mscount; | 
|---|
| 189 | } __Request__mach_notify_no_senders_t __attribute__((unused)); | 
|---|
| 190 | #ifdef  __MigPackStructs | 
|---|
| 191 | #pragma pack() | 
|---|
| 192 | #endif | 
|---|
| 193 |  | 
|---|
| 194 | #ifdef  __MigPackStructs | 
|---|
| 195 | #pragma pack(4) | 
|---|
| 196 | #endif | 
|---|
| 197 | typedef struct { | 
|---|
| 198 | mach_msg_header_t Head; | 
|---|
| 199 | } __Request__mach_notify_send_once_t __attribute__((unused)); | 
|---|
| 200 | #ifdef  __MigPackStructs | 
|---|
| 201 | #pragma pack() | 
|---|
| 202 | #endif | 
|---|
| 203 |  | 
|---|
| 204 | #ifdef  __MigPackStructs | 
|---|
| 205 | #pragma pack(4) | 
|---|
| 206 | #endif | 
|---|
| 207 | typedef struct { | 
|---|
| 208 | mach_msg_header_t Head; | 
|---|
| 209 | NDR_record_t NDR; | 
|---|
| 210 | mach_port_name_t name; | 
|---|
| 211 | } __Request__mach_notify_dead_name_t __attribute__((unused)); | 
|---|
| 212 | #ifdef  __MigPackStructs | 
|---|
| 213 | #pragma pack() | 
|---|
| 214 | #endif | 
|---|
| 215 | #endif /* !__Request__notify_subsystem__defined */ | 
|---|
| 216 |  | 
|---|
| 217 |  | 
|---|
| 218 | /* union of all requests */ | 
|---|
| 219 |  | 
|---|
| 220 | #ifndef __RequestUnion__do_notify_subsystem__defined | 
|---|
| 221 | #define __RequestUnion__do_notify_subsystem__defined | 
|---|
| 222 | union __RequestUnion__do_notify_subsystem { | 
|---|
| 223 | __Request__mach_notify_port_deleted_t Request_mach_notify_port_deleted; | 
|---|
| 224 | __Request__mach_notify_port_destroyed_t Request_mach_notify_port_destroyed; | 
|---|
| 225 | __Request__mach_notify_no_senders_t Request_mach_notify_no_senders; | 
|---|
| 226 | __Request__mach_notify_send_once_t Request_mach_notify_send_once; | 
|---|
| 227 | __Request__mach_notify_dead_name_t Request_mach_notify_dead_name; | 
|---|
| 228 | }; | 
|---|
| 229 | #endif /* __RequestUnion__do_notify_subsystem__defined */ | 
|---|
| 230 | /* typedefs for all replies */ | 
|---|
| 231 |  | 
|---|
| 232 | #ifndef __Reply__notify_subsystem__defined | 
|---|
| 233 | #define __Reply__notify_subsystem__defined | 
|---|
| 234 |  | 
|---|
| 235 | #ifdef  __MigPackStructs | 
|---|
| 236 | #pragma pack(4) | 
|---|
| 237 | #endif | 
|---|
| 238 | typedef struct { | 
|---|
| 239 | mach_msg_header_t Head; | 
|---|
| 240 | NDR_record_t NDR; | 
|---|
| 241 | kern_return_t RetCode; | 
|---|
| 242 | } __Reply__mach_notify_port_deleted_t __attribute__((unused)); | 
|---|
| 243 | #ifdef  __MigPackStructs | 
|---|
| 244 | #pragma pack() | 
|---|
| 245 | #endif | 
|---|
| 246 |  | 
|---|
| 247 | #ifdef  __MigPackStructs | 
|---|
| 248 | #pragma pack(4) | 
|---|
| 249 | #endif | 
|---|
| 250 | typedef struct { | 
|---|
| 251 | mach_msg_header_t Head; | 
|---|
| 252 | NDR_record_t NDR; | 
|---|
| 253 | kern_return_t RetCode; | 
|---|
| 254 | } __Reply__mach_notify_port_destroyed_t __attribute__((unused)); | 
|---|
| 255 | #ifdef  __MigPackStructs | 
|---|
| 256 | #pragma pack() | 
|---|
| 257 | #endif | 
|---|
| 258 |  | 
|---|
| 259 | #ifdef  __MigPackStructs | 
|---|
| 260 | #pragma pack(4) | 
|---|
| 261 | #endif | 
|---|
| 262 | typedef struct { | 
|---|
| 263 | mach_msg_header_t Head; | 
|---|
| 264 | NDR_record_t NDR; | 
|---|
| 265 | kern_return_t RetCode; | 
|---|
| 266 | } __Reply__mach_notify_no_senders_t __attribute__((unused)); | 
|---|
| 267 | #ifdef  __MigPackStructs | 
|---|
| 268 | #pragma pack() | 
|---|
| 269 | #endif | 
|---|
| 270 |  | 
|---|
| 271 | #ifdef  __MigPackStructs | 
|---|
| 272 | #pragma pack(4) | 
|---|
| 273 | #endif | 
|---|
| 274 | typedef struct { | 
|---|
| 275 | mach_msg_header_t Head; | 
|---|
| 276 | NDR_record_t NDR; | 
|---|
| 277 | kern_return_t RetCode; | 
|---|
| 278 | } __Reply__mach_notify_send_once_t __attribute__((unused)); | 
|---|
| 279 | #ifdef  __MigPackStructs | 
|---|
| 280 | #pragma pack() | 
|---|
| 281 | #endif | 
|---|
| 282 |  | 
|---|
| 283 | #ifdef  __MigPackStructs | 
|---|
| 284 | #pragma pack(4) | 
|---|
| 285 | #endif | 
|---|
| 286 | typedef struct { | 
|---|
| 287 | mach_msg_header_t Head; | 
|---|
| 288 | NDR_record_t NDR; | 
|---|
| 289 | kern_return_t RetCode; | 
|---|
| 290 | } __Reply__mach_notify_dead_name_t __attribute__((unused)); | 
|---|
| 291 | #ifdef  __MigPackStructs | 
|---|
| 292 | #pragma pack() | 
|---|
| 293 | #endif | 
|---|
| 294 | #endif /* !__Reply__notify_subsystem__defined */ | 
|---|
| 295 |  | 
|---|
| 296 |  | 
|---|
| 297 | /* union of all replies */ | 
|---|
| 298 |  | 
|---|
| 299 | #ifndef __ReplyUnion__do_notify_subsystem__defined | 
|---|
| 300 | #define __ReplyUnion__do_notify_subsystem__defined | 
|---|
| 301 | union __ReplyUnion__do_notify_subsystem { | 
|---|
| 302 | __Reply__mach_notify_port_deleted_t Reply_mach_notify_port_deleted; | 
|---|
| 303 | __Reply__mach_notify_port_destroyed_t Reply_mach_notify_port_destroyed; | 
|---|
| 304 | __Reply__mach_notify_no_senders_t Reply_mach_notify_no_senders; | 
|---|
| 305 | __Reply__mach_notify_send_once_t Reply_mach_notify_send_once; | 
|---|
| 306 | __Reply__mach_notify_dead_name_t Reply_mach_notify_dead_name; | 
|---|
| 307 | }; | 
|---|
| 308 | #endif /* __RequestUnion__do_notify_subsystem__defined */ | 
|---|
| 309 |  | 
|---|
| 310 | #ifndef subsystem_to_name_map_notify | 
|---|
| 311 | #define subsystem_to_name_map_notify \ | 
|---|
| 312 | { "mach_notify_port_deleted", 65 },\ | 
|---|
| 313 | { "mach_notify_port_destroyed", 69 },\ | 
|---|
| 314 | { "mach_notify_no_senders", 70 },\ | 
|---|
| 315 | { "mach_notify_send_once", 71 },\ | 
|---|
| 316 | { "mach_notify_dead_name", 72 } | 
|---|
| 317 | #endif | 
|---|
| 318 |  | 
|---|
| 319 | #ifdef __AfterMigServerHeader | 
|---|
| 320 | __AfterMigServerHeader | 
|---|
| 321 | #endif /* __AfterMigServerHeader */ | 
|---|
| 322 |  | 
|---|
| 323 | #endif	 /* _notify_server_ */ | 
|---|
| 324 |  | 
|---|