]> git.saurik.com Git - apple/libdispatch.git/blob - src/shims/linux_stubs.h
libdispatch-913.30.4.tar.gz
[apple/libdispatch.git] / src / shims / linux_stubs.h
1 /*
2 * This source file is part of the Swift.org open source project
3 *
4 * Copyright (c) 2015 Apple Inc. and the Swift project authors
5 *
6 * Licensed under Apache License v2.0 with Runtime Library Exception
7 *
8 * See http://swift.org/LICENSE.txt for license information
9 * See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10 *
11 */
12
13 // forward declarations for functions we are stubbing out
14 // in the intial linux port.
15
16 #ifndef __DISPATCH__STUBS__INTERNAL
17 #define __DISPATCH__STUBS__INTERNAL
18
19 #ifndef TAILQ_FOREACH_SAFE
20 #define TAILQ_FOREACH_SAFE(var, head, field, temp) \
21 for ((var) = TAILQ_FIRST((head)); \
22 (var) && ((temp) = TAILQ_NEXT((var), field), 1); (var) = (temp))
23 #endif
24
25 #if DISPATCH_DEBUG
26 #ifndef TRASHIT
27 #define TRASHIT(x) do { (x) = (void *)-1; } while (0)
28 #endif
29 #endif
30
31 /*
32 * Stub out defines for some mach types and related macros
33 */
34
35 typedef uint32_t mach_port_t;
36
37 #define MACH_PORT_NULL (0)
38 #define MACH_PORT_DEAD (-1)
39
40 typedef uint32_t mach_error_t;
41
42 typedef uint32_t mach_msg_return_t;
43
44 typedef uint32_t mach_msg_bits_t;
45
46 typedef void *dispatch_mach_msg_t;
47
48 typedef uint64_t firehose_activity_id_t;
49
50 typedef void *mach_msg_header_t;
51
52 // Print a warning when an unported code path executes.
53 #define LINUX_PORT_ERROR() do { \
54 printf("LINUX_PORT_ERROR_CALLED %s:%d: %s\n",\
55 __FILE__,__LINE__,__FUNCTION__); } while (0)
56
57 /*
58 * Stub out defines for other missing types
59 */
60
61 // SIZE_T_MAX should not be hardcoded like this here.
62 #ifndef SIZE_T_MAX
63 #define SIZE_T_MAX (~(size_t)0)
64 #endif
65
66 #endif