|
20 | 20 | #define __OS_LINUX_BASE__ |
21 | 21 |
|
22 | 22 | // #include <sys/event.h> |
| 23 | +#include <sys/user.h> |
23 | 24 |
|
24 | 25 | // marker for hacks we have made to make progress |
25 | 26 | #define __LINUX_PORT_HDD__ 1 |
@@ -76,34 +77,41 @@ struct voucher_offsets_s { |
76 | 77 | }; |
77 | 78 |
|
78 | 79 |
|
| 80 | +// Print a warning when an unported code path executes. |
| 81 | +#define LINUX_PORT_ERROR() do { printf("LINUX_PORT_ERROR_CALLED %s:%d: %s\n",__FILE__,__LINE__,__FUNCTION__); } while (0) |
| 82 | + |
79 | 83 | /* |
80 | 84 | * Stub out defines for other missing types |
81 | 85 | */ |
82 | 86 |
|
83 | | -// Pulled from OS X man page for kevent |
84 | | -struct kevent64_s { |
85 | | - uint64_t ident; /* identifier for this event */ |
86 | | - int16_t filter; /* filter for event */ |
87 | | - uint16_t flags; /* general flags */ |
88 | | - uint32_t fflags; /* filter-specific flags */ |
89 | | - int64_t data; /* filter-specific data */ |
90 | | - uint64_t udata; /* opaque user data identifier */ |
91 | | - uint64_t ext[2]; /* filter-specific extensions */ |
92 | | -}; |
93 | | - |
| 87 | +#if __linux__ |
| 88 | +// we fall back to use kevent |
| 89 | +#define kevent64_s kevent |
| 90 | +#define kevent64(kq,cl,nc,el,ne,f,to) kevent(kq,cl,nc,el,ne,to) |
| 91 | +#endif |
94 | 92 |
|
95 | | -// PAGE_SIZE and SIZE_T_MAX should not be hardcoded like this here. |
96 | | -#define PAGE_SIZE (4096) |
| 93 | +// SIZE_T_MAX should not be hardcoded like this here. |
97 | 94 | #define SIZE_T_MAX (0x7fffffff) |
98 | 95 |
|
99 | 96 | // Define to 0 the NOTE_ values that are not present on Linux. |
100 | 97 | // Revisit this...would it be better to ifdef out the uses instead?? |
101 | | -#define NOTE_VM_PRESSURE 0 |
102 | | -#define NOTE_ABSOLUTE 0 |
103 | | -#define NOTE_NSECONDS 0 |
104 | | -#define NOTE_LEEWAY 0 |
105 | | -#define NOTE_CRITICAL 0 |
106 | | -#define NOTE_BACKGROUND 0 |
| 98 | + |
| 99 | +// The following values are passed as part of the EVFILT_TIMER requests |
| 100 | + |
| 101 | +#define IGNORE_KEVENT64_EXT /* will force the kevent64_s.ext[] to not be used -> leeway ignored */ |
| 102 | + |
| 103 | +#define NOTE_SECONDS 0x01 |
| 104 | +#define NOTE_USECONDS 0x02 |
| 105 | +#define NOTE_NSECONDS 0x04 |
| 106 | +#define NOTE_ABSOLUTE 0x08 |
| 107 | +#define NOTE_CRITICAL 0x10 |
| 108 | +#define NOTE_BACKGROUND 0x20 |
| 109 | +#define NOTE_LEEWAY 0x40 |
| 110 | + |
| 111 | +// need to catch the following usage if it happens .. |
| 112 | +// we simply return '0' as a value probably not correct |
| 113 | + |
| 114 | +#define NOTE_VM_PRESSURE ({LINUX_PORT_ERROR(); 0;}) |
107 | 115 |
|
108 | 116 | /* |
109 | 117 | * Stub out misc linking and compilation attributes |
@@ -135,8 +143,5 @@ struct kevent64_s { |
135 | 143 | #define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(a,b,c,d,msg) // |
136 | 144 |
|
137 | 145 |
|
138 | | -// Print a warning when an unported code path executes. |
139 | | -#define LINUX_PORT_ERROR() do { printf("LINUX_PORT_ERROR_CALLED %s:%d: %s\n",__FILE__,__LINE__,__FUNCTION__); } while (0) |
140 | | - |
141 | 146 |
|
142 | 147 | #endif /* __OS_LINUX_BASE__ */ |
0 commit comments