Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 197b65c

Browse files
committed
core.sys.posix.aio: Add OSX bindings
1 parent 1768238 commit 197b65c

File tree

1 file changed

+55
-4
lines changed

1 file changed

+55
-4
lines changed

src/core/sys/posix/aio.d

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,19 @@ version (CRuntime_Glibc)
6363
}
6464
}
6565
}
66+
else version (OSX)
67+
{
68+
struct aiocb
69+
{
70+
int aio_filedes;
71+
off_t aio_offset;
72+
void* aio_buf;
73+
size_t aio_nbytes;
74+
int reqprio;
75+
sigevent aio_sigevent;
76+
int aio_lio_opcode;
77+
}
78+
}
6679
else version (FreeBSD)
6780
{
6881
struct __aiocb_private
@@ -127,11 +140,32 @@ else
127140
static assert(false, "Unsupported platform");
128141

129142
/* Return values of cancelation function. */
130-
enum
143+
version (CRuntime_Glibc)
144+
{
145+
enum
146+
{
147+
AIO_CANCELED,
148+
AIO_NOTCANCELED,
149+
AIO_ALLDONE
150+
}
151+
}
152+
else version (OSX)
153+
{
154+
enum
155+
{
156+
AIO_ALLDONE = 0x1,
157+
AIO_CANCELED = 0x2,
158+
AIO_NOTCANCELED = 0x4,
159+
}
160+
}
161+
else version (BSD_Posix)
131162
{
132-
AIO_CANCELED,
133-
AIO_NOTCANCELED,
134-
AIO_ALLDONE
163+
enum
164+
{
165+
AIO_CANCELED,
166+
AIO_NOTCANCELED,
167+
AIO_ALLDONE
168+
}
135169
}
136170

137171
/* Operation codes for `aio_lio_opcode'. */
@@ -144,6 +178,15 @@ version (CRuntime_Glibc)
144178
LIO_NOP
145179
}
146180
}
181+
else version (OSX)
182+
{
183+
enum
184+
{
185+
LIO_NOP = 0x0,
186+
LIO_READ = 0x1,
187+
LIO_WRITE = 0x2,
188+
}
189+
}
147190
else version (BSD_Posix)
148191
{
149192
enum
@@ -163,6 +206,14 @@ version (CRuntime_Glibc)
163206
LIO_NOWAIT
164207
}
165208
}
209+
else version (OSX)
210+
{
211+
enum
212+
{
213+
LIO_NOWAIT = 0x1,
214+
LIO_WAIT = 0x2,
215+
}
216+
}
166217
else version (BSD_Posix)
167218
{
168219
enum

0 commit comments

Comments
 (0)