| 1 | #ifndef _clock_server_ |
| 2 | #define _clock_server_ |
| 3 | |
| 4 | /* Module clock */ |
| 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 clock_MSG_COUNT |
| 52 | #define clock_MSG_COUNT 3 |
| 53 | #endif /* clock_MSG_COUNT */ |
| 54 | |
| 55 | #include <mach/std_types.h> |
| 56 | #include <mach/mig.h> |
| 57 | #include <ipc/ipc_voucher.h> |
| 58 | #include <kern/ipc_kobject.h> |
| 59 | #include <kern/ipc_tt.h> |
| 60 | #include <kern/ipc_host.h> |
| 61 | #include <kern/ipc_sync.h> |
| 62 | #include <kern/ledger.h> |
| 63 | #include <kern/processor.h> |
| 64 | #include <kern/sync_lock.h> |
| 65 | #include <kern/sync_sema.h> |
| 66 | #include <vm/memory_object.h> |
| 67 | #include <vm/vm_map.h> |
| 68 | #include <kern/ipc_mig.h> |
| 69 | #include <mach/mig.h> |
| 70 | #include <mach/mach_types.h> |
| 71 | #include <mach/mach_types.h> |
| 72 | |
| 73 | #ifdef __BeforeMigServerHeader |
| 74 | __BeforeMigServerHeader |
| 75 | #endif /* __BeforeMigServerHeader */ |
| 76 | |
| 77 | |
| 78 | /* Routine clock_get_time */ |
| 79 | #ifdef mig_external |
| 80 | mig_external |
| 81 | #else |
| 82 | extern |
| 83 | #endif /* mig_external */ |
| 84 | kern_return_t clock_get_time |
| 85 | ( |
| 86 | clock_serv_t clock_serv, |
| 87 | mach_timespec_t *cur_time |
| 88 | ); |
| 89 | |
| 90 | /* Routine clock_get_attributes */ |
| 91 | #ifdef mig_external |
| 92 | mig_external |
| 93 | #else |
| 94 | extern |
| 95 | #endif /* mig_external */ |
| 96 | kern_return_t clock_get_attributes |
| 97 | ( |
| 98 | clock_serv_t clock_serv, |
| 99 | clock_flavor_t flavor, |
| 100 | clock_attr_t clock_attr, |
| 101 | mach_msg_type_number_t *clock_attrCnt |
| 102 | ); |
| 103 | |
| 104 | /* Routine clock_alarm */ |
| 105 | #ifdef mig_external |
| 106 | mig_external |
| 107 | #else |
| 108 | extern |
| 109 | #endif /* mig_external */ |
| 110 | kern_return_t clock_alarm |
| 111 | ( |
| 112 | clock_serv_t clock_serv, |
| 113 | alarm_type_t alarm_type, |
| 114 | mach_timespec_t alarm_time, |
| 115 | clock_reply_t alarm_port, |
| 116 | mach_msg_type_name_t alarm_portPoly |
| 117 | ); |
| 118 | |
| 119 | #ifdef mig_external |
| 120 | mig_external |
| 121 | #else |
| 122 | extern |
| 123 | #endif /* mig_external */ |
| 124 | boolean_t clock_server( |
| 125 | mach_msg_header_t *InHeadP, |
| 126 | mach_msg_header_t *OutHeadP); |
| 127 | |
| 128 | #ifdef mig_external |
| 129 | mig_external |
| 130 | #else |
| 131 | extern |
| 132 | #endif /* mig_external */ |
| 133 | mig_routine_t clock_server_routine( |
| 134 | mach_msg_header_t *InHeadP); |
| 135 | |
| 136 | |
| 137 | /* Description of this subsystem, for use in direct RPC */ |
| 138 | extern const struct clock_subsystem { |
| 139 | mig_server_routine_t server; /* Server routine */ |
| 140 | mach_msg_id_t start; /* Min routine number */ |
| 141 | mach_msg_id_t end; /* Max routine number + 1 */ |
| 142 | unsigned int maxsize; /* Max msg size */ |
| 143 | vm_address_t reserved; /* Reserved */ |
| 144 | struct routine_descriptor /*Array of routine descriptors */ |
| 145 | routine[3]; |
| 146 | } clock_subsystem; |
| 147 | |
| 148 | /* typedefs for all requests */ |
| 149 | |
| 150 | #ifndef __Request__clock_subsystem__defined |
| 151 | #define __Request__clock_subsystem__defined |
| 152 | |
| 153 | #ifdef __MigPackStructs |
| 154 | #pragma pack(4) |
| 155 | #endif |
| 156 | typedef struct { |
| 157 | mach_msg_header_t Head; |
| 158 | } __Request__clock_get_time_t __attribute__((unused)); |
| 159 | #ifdef __MigPackStructs |
| 160 | #pragma pack() |
| 161 | #endif |
| 162 | |
| 163 | #ifdef __MigPackStructs |
| 164 | #pragma pack(4) |
| 165 | #endif |
| 166 | typedef struct { |
| 167 | mach_msg_header_t Head; |
| 168 | NDR_record_t NDR; |
| 169 | clock_flavor_t flavor; |
| 170 | mach_msg_type_number_t clock_attrCnt; |
| 171 | } __Request__clock_get_attributes_t __attribute__((unused)); |
| 172 | #ifdef __MigPackStructs |
| 173 | #pragma pack() |
| 174 | #endif |
| 175 | |
| 176 | #ifdef __MigPackStructs |
| 177 | #pragma pack(4) |
| 178 | #endif |
| 179 | typedef struct { |
| 180 | mach_msg_header_t Head; |
| 181 | /* start of the kernel processed data */ |
| 182 | mach_msg_body_t msgh_body; |
| 183 | mach_msg_port_descriptor_t alarm_port; |
| 184 | /* end of the kernel processed data */ |
| 185 | NDR_record_t NDR; |
| 186 | alarm_type_t alarm_type; |
| 187 | mach_timespec_t alarm_time; |
| 188 | } __Request__clock_alarm_t __attribute__((unused)); |
| 189 | #ifdef __MigPackStructs |
| 190 | #pragma pack() |
| 191 | #endif |
| 192 | #endif /* !__Request__clock_subsystem__defined */ |
| 193 | |
| 194 | |
| 195 | /* union of all requests */ |
| 196 | |
| 197 | #ifndef __RequestUnion__clock_subsystem__defined |
| 198 | #define __RequestUnion__clock_subsystem__defined |
| 199 | union __RequestUnion__clock_subsystem { |
| 200 | __Request__clock_get_time_t Request_clock_get_time; |
| 201 | __Request__clock_get_attributes_t Request_clock_get_attributes; |
| 202 | __Request__clock_alarm_t Request_clock_alarm; |
| 203 | }; |
| 204 | #endif /* __RequestUnion__clock_subsystem__defined */ |
| 205 | /* typedefs for all replies */ |
| 206 | |
| 207 | #ifndef __Reply__clock_subsystem__defined |
| 208 | #define __Reply__clock_subsystem__defined |
| 209 | |
| 210 | #ifdef __MigPackStructs |
| 211 | #pragma pack(4) |
| 212 | #endif |
| 213 | typedef struct { |
| 214 | mach_msg_header_t Head; |
| 215 | NDR_record_t NDR; |
| 216 | kern_return_t RetCode; |
| 217 | mach_timespec_t cur_time; |
| 218 | } __Reply__clock_get_time_t __attribute__((unused)); |
| 219 | #ifdef __MigPackStructs |
| 220 | #pragma pack() |
| 221 | #endif |
| 222 | |
| 223 | #ifdef __MigPackStructs |
| 224 | #pragma pack(4) |
| 225 | #endif |
| 226 | typedef struct { |
| 227 | mach_msg_header_t Head; |
| 228 | NDR_record_t NDR; |
| 229 | kern_return_t RetCode; |
| 230 | mach_msg_type_number_t clock_attrCnt; |
| 231 | int clock_attr[1]; |
| 232 | } __Reply__clock_get_attributes_t __attribute__((unused)); |
| 233 | #ifdef __MigPackStructs |
| 234 | #pragma pack() |
| 235 | #endif |
| 236 | |
| 237 | #ifdef __MigPackStructs |
| 238 | #pragma pack(4) |
| 239 | #endif |
| 240 | typedef struct { |
| 241 | mach_msg_header_t Head; |
| 242 | NDR_record_t NDR; |
| 243 | kern_return_t RetCode; |
| 244 | } __Reply__clock_alarm_t __attribute__((unused)); |
| 245 | #ifdef __MigPackStructs |
| 246 | #pragma pack() |
| 247 | #endif |
| 248 | #endif /* !__Reply__clock_subsystem__defined */ |
| 249 | |
| 250 | |
| 251 | /* union of all replies */ |
| 252 | |
| 253 | #ifndef __ReplyUnion__clock_subsystem__defined |
| 254 | #define __ReplyUnion__clock_subsystem__defined |
| 255 | union __ReplyUnion__clock_subsystem { |
| 256 | __Reply__clock_get_time_t Reply_clock_get_time; |
| 257 | __Reply__clock_get_attributes_t Reply_clock_get_attributes; |
| 258 | __Reply__clock_alarm_t Reply_clock_alarm; |
| 259 | }; |
| 260 | #endif /* __RequestUnion__clock_subsystem__defined */ |
| 261 | |
| 262 | #ifndef subsystem_to_name_map_clock |
| 263 | #define subsystem_to_name_map_clock \ |
| 264 | { "clock_get_time", 1000 },\ |
| 265 | { "clock_get_attributes", 1001 },\ |
| 266 | { "clock_alarm", 1002 } |
| 267 | #endif |
| 268 | |
| 269 | #ifdef __AfterMigServerHeader |
| 270 | __AfterMigServerHeader |
| 271 | #endif /* __AfterMigServerHeader */ |
| 272 | |
| 273 | #endif /* _clock_server_ */ |
| 274 | |