posix-next API 0.1.0
Out-of-tree Zephyr POSIX module
Loading...
Searching...
No Matches
aio.h
Go to the documentation of this file.
1/*
2 * Copyright 2024 Tenstorrent AI ULC
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
20#ifndef ZEPHYR_INCLUDE_ZEPHYR_POSIX_AIO_H_
21#define ZEPHYR_INCLUDE_ZEPHYR_POSIX_AIO_H_
22
23/* size_t must be defined by the libc stddef.h */
24#include <stddef.h>
25#include <stdint.h>
26#include <signal.h>
27
28#include <zephyr/toolchain.h>
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#if !defined(_OFF_T_DECLARED) && !defined(__off_t_defined)
36typedef long off_t;
37#define _OFF_T_DECLARED
38#define __off_t_defined
39#endif
40
41#ifndef __SIZE_TYPE__
42#define __SIZE_TYPE__ unsigned long
43#endif
44
45#if !defined(_SSIZE_T_DECLARED) && !defined(__ssize_t_defined)
47#define unsigned signed /* parasoft-suppress MISRAC2012-RULE_20_4-a MISRAC2012-RULE_20_4-b */
48typedef __SIZE_TYPE__ ssize_t;
49#undef unsigned
50#define _SSIZE_T_DECLARED
51#define __ssize_t_defined
52#endif
53
54/* time_t must be defined by the libc time.h */
55#include <time.h>
56
57#if __STDC_VERSION__ >= 201112L
58/* struct timespec must be defined in the libc time.h */
59#else
60#if !defined(_TIMESPEC_DECLARED) && !defined(__timespec_defined)
62struct timespec {
63 time_t tv_sec;
64 long tv_nsec;
65};
66#define _TIMESPEC_DECLARED
67#define __timespec_defined
68#endif
69#endif
70
72struct aiocb {
75 volatile void *aio_buf;
76 size_t aio_nbytes;
78#if defined(_POSIX_REALTIME_SIGNALS) || defined(__DOXYGEN__)
80#endif
82};
83
84#if _POSIX_C_SOURCE >= 200112L
85
94int aio_cancel(int fildes, struct aiocb *aiocbp);
95
103int aio_error(const struct aiocb *aiocbp);
104
113int aio_fsync(int filedes, struct aiocb *aiocbp);
114
122int aio_read(struct aiocb *aiocbp);
123
135ssize_t aio_return(struct aiocb *aiocbp);
136
146int aio_suspend(const struct aiocb *const list[], int nent, const struct timespec *timeout);
147
155int aio_write(struct aiocb *aiocbp);
156
167int lio_listio(int mode, struct aiocb *const ZRESTRICT list[], int nent,
168 struct sigevent *ZRESTRICT sig);
169
170#endif /* _POSIX_C_SOURCE >= 200112L */
171
172
173#ifdef __cplusplus
174}
175#endif
176
177#endif /* ZEPHYR_INCLUDE_ZEPHYR_POSIX_AIO_H_ */
int aio_write(struct aiocb *aiocbp)
Enqueue an asynchronous write operation.
ssize_t aio_return(struct aiocb *aiocbp)
Retrieve the return status of a completed asynchronous I/O request.
int aio_read(struct aiocb *aiocbp)
Enqueue an asynchronous read operation.
int aio_error(const struct aiocb *aiocbp)
Retrieve the error status of an asynchronous I/O request.
int lio_listio(int mode, struct aiocb *const ZRESTRICT list[], int nent, struct sigevent *ZRESTRICT sig)
Initiate a list of asynchronous I/O requests.
int aio_fsync(int filedes, struct aiocb *aiocbp)
Asynchronously synchronise a file's data and metadata to storage.
int aio_suspend(const struct aiocb *const list[], int nent, const struct timespec *timeout)
Wait for one or more asynchronous I/O requests to complete.
int aio_cancel(int fildes, struct aiocb *aiocbp)
Cancel an outstanding asynchronous I/O request.
long off_t
File offset type.
Definition aio.h:36
Asynchronous I/O control block.
Definition aio.h:72
off_t aio_offset
File offset for the operation.
Definition aio.h:74
volatile void * aio_buf
Data buffer for read or write.
Definition aio.h:75
size_t aio_nbytes
Number of bytes to transfer.
Definition aio.h:76
struct sigevent aio_sigevent
Notification method on completion.
Definition aio.h:79
int aio_reqprio
Request priority offset.
Definition aio.h:77
int aio_lio_opcode
Operation code for lio_listio() (LIO_READ, LIO_WRITE, LIO_NOP).
Definition aio.h:81
int aio_fildes
File descriptor.
Definition aio.h:73
Structure describing how to notify about an asynchronous event.
Time value with nanosecond resolution.
Definition aio.h:62
long tv_nsec
Nanoseconds [0, 999999999].
Definition aio.h:64
time_t tv_sec
Seconds.
Definition aio.h:63
POSIX time-of-day types and functions (<sys/time.h>)