summaryrefslogtreecommitdiff
path: root/include/aio.h
blob: 8481d9cf8edbcfcc73e1db3b3fb95ef1ba2cf598 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#ifndef __AIO_H
#define __AIO_H

#define __BITS_SIGEVENT_H_
#include <bits/sigevent.h>
#undef __BITS_SIGEVENT_H_

#define __BITS_TIMESPEC_H_
#include <bits/timespec.h>
#undef __BITS_TIMESPEC_H_

/** A return value indicating that all requested operations have been canceled.
 */
#define AIO_CANCELED 0

/**
 * A return value indicating that some of the requested operations
 * could not be canceled since they are in progress.
 */
#define AIO_NOTCANCELED 1

/**
 * A return value indicating that none of the requested operations
 * could be canceled since they are already complete.
 */
#define AIO_ALLDONE 2

/** A lio_listio() element operation option requesting a read. */
#define LIO_READ 0

/**
 * A lio_listio() synchronization operation indicating that the calling
 * thread is to suspend until the lio_listio() operation is complete.
 */
#define LIO_WRITE 1

/**
 * A lio_listio() element operation option indicating
 * that no transfer is requested.
 */
#define LIO_NOP 2

/**
 * A lio_listio() synchronization operation indicating that the calling
 * thread is to suspend until the lio_listio() operation is complete.
 */
#define LIO_WAIT 0

/**
 * A lio_listio() synchronization operation indicating that the calling thread
 * is to continue execution while the lio_listio() operation is being performed,
 * and no notification is given when the operation is complete.
 */
#define LIO_NOWAIT 1

typedef __INT64_TYPE__ off_t;
typedef __SIZE_TYPE__ size_t;
typedef __INT64_TYPE__ ssize_t;

struct aiocb {
	int aio_fildes;		      /**< File descriptor. */
	off_t aio_offset;	      /**< File offset. */
	volatile void *aio_buf;	      /**< Location of buffer. */
	size_t aio_nbytes;	      /**< Length of transfer. */
	int aio_reqprio;	      /**< Request priority offset. */
	struct sigevent aio_sigevent; /**< Signal number and value. */
	int aio_lio_opcode;	      /**< Operation to be performed. */
};

int aio_cancel(int, struct aiocb *);
int aio_error(const struct aiocb *);
int aio_fsync(int, struct aiocb *);
int aio_read(struct aiocb *);
ssize_t aio_return(struct aiocb *);
int aio_suspend(const struct aiocb *const[], int, const struct timespec *);
int aio_write(struct aiocb *);
int lio_listio(int, struct aiocb *restrict const[restrict], int,
	       struct sigevent *restrict);

#endif