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

Commit 64cb6b4

Browse files
authored
Merge pull request #2074 from Darredevil/aio
add aio.d for linux x64 merged-on-behalf-of: Iain Buclaw <ibuclaw@gdcproject.org>
2 parents e977d8f + 53ba9b1 commit 64cb6b4

File tree

4 files changed

+81
-0
lines changed

4 files changed

+81
-0
lines changed

mak/COPY

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ COPY=\
153153
$(IMPDIR)\core\sys\osx\sys\mman.d \
154154
\
155155
$(IMPDIR)\core\sys\posix\arpa\inet.d \
156+
$(IMPDIR)\core\sys\posix\aio.d \
156157
$(IMPDIR)\core\sys\posix\config.d \
157158
$(IMPDIR)\core\sys\posix\dirent.d \
158159
$(IMPDIR)\core\sys\posix\dlfcn.d \

src/core/sys/posix/aio.d

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/**
2+
* D header file to interface with the
3+
* $(HTTP pubs.opengroup.org/onlinepubs/9699919799/basedefs/aio.h.html, Posix AIO API).
4+
*
5+
* Copyright: Copyright D Language Foundation 2018.
6+
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
7+
* Authors: $(HTTPS github.com/darredevil, Alexandru Razvan Caciulescu)
8+
*/
9+
module core.sys.posix.aio;
10+
11+
private import core.sys.posix.signal;
12+
13+
version (Posix):
14+
15+
extern (C):
16+
@system:
17+
@nogc:
18+
nothrow:
19+
20+
version (CRuntime_Glibc)
21+
{
22+
version (X86_64)
23+
{
24+
struct aiocb
25+
{
26+
int aio_fildes;
27+
int aio_lio_opcode;
28+
int aio_reqprio;
29+
void *aio_buf; //volatile
30+
size_t aio_nbytes;
31+
sigevent aio_sigevent;
32+
33+
ubyte[24] internal_members_padding;
34+
off_t aio_offset;
35+
ubyte[32] __glibc_reserved;
36+
}
37+
}
38+
else
39+
static assert(0);
40+
}
41+
else
42+
static assert(false, "Unsupported platform");
43+
44+
/* Return values of cancelation function. */
45+
enum
46+
{
47+
AIO_CANCELED,
48+
AIO_NOTCANCELED,
49+
AIO_ALLDONE
50+
};
51+
52+
/* Operation codes for `aio_lio_opcode'. */
53+
enum
54+
{
55+
LIO_READ,
56+
LIO_WRITE,
57+
LIO_NOP
58+
};
59+
60+
/* Synchronization options for `lio_listio' function. */
61+
enum
62+
{
63+
LIO_WAIT,
64+
LIO_NOWAIT
65+
};
66+
67+
int aio_read(aiocb *aiocbp);
68+
int aio_write(aiocb *aiocbp);
69+
int aio_fsync(int op, aiocb *aiocbp);
70+
int aio_error(const(aiocb)* aiocbp);
71+
ssize_t aio_return(const(aiocb)* aiocbp);
72+
int aio_suspend(const(aiocb*)* aiocb_list, int nitems, const(timespec)* timeout);
73+
int aio_cancel(int fd, aiocb *aiocbp);
74+
int lio_listio(int mode, const(aiocb*)* aiocb_list, int nitems, sigevent *sevp);

win32.mak

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,9 @@ $(IMPDIR)\core\sys\osx\sys\mman.d : src\core\sys\osx\sys\mman.d
617617
$(IMPDIR)\core\sys\posix\arpa\inet.d : src\core\sys\posix\arpa\inet.d
618618
copy $** $@
619619

620+
$(IMPDIR)\core\sys\posix\aio.d : src\core\sys\posix\aio.d
621+
copy $** $@
622+
620623
$(IMPDIR)\core\sys\posix\config.d : src\core\sys\posix\config.d
621624
copy $** $@
622625

win64.mak

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,9 @@ $(IMPDIR)\core\sys\osx\sys\mman.d : src\core\sys\osx\sys\mman.d
628628
$(IMPDIR)\core\sys\posix\arpa\inet.d : src\core\sys\posix\arpa\inet.d
629629
copy $** $@
630630

631+
$(IMPDIR)\core\sys\posix\aio.d : src\core\sys\posix\aio.d
632+
copy $** $@
633+
631634
$(IMPDIR)\core\sys\posix\config.d : src\core\sys\posix\config.d
632635
copy $** $@
633636

0 commit comments

Comments
 (0)