aio_read2/aio_write2: add AIO_OP2_VECTORED

(cherry picked from commit 8dfc788b8480a13f1f945f0a94d8b1e327af5c6f)
This commit is contained in:
Konstantin Belousov 2024-02-03 20:09:36 +02:00
parent e9014ead57
commit e331ce2d60
3 changed files with 7 additions and 2 deletions

View file

@ -37,13 +37,15 @@ aio_read2(struct aiocb *iocb, int flags)
{
int error;
if ((flags & ~(AIO_OP2_FOFFSET)) != 0) {
if ((flags & ~(AIO_OP2_FOFFSET | AIO_OP2_VECTORED)) != 0) {
errno = EINVAL;
return (-1);
}
iocb->aio_lio_opcode = LIO_READ;
if ((flags & AIO_OP2_FOFFSET) != 0)
iocb->aio_lio_opcode |= LIO_FOFFSET;
if ((flags & AIO_OP2_VECTORED) != 0)
iocb->aio_lio_opcode |= LIO_VECTORED;
error = lio_listio(LIO_NOWAIT, &iocb, 1, NULL);
if (error == -1 && errno == EIO) {

View file

@ -37,13 +37,15 @@ aio_write2(struct aiocb *iocb, int flags)
{
int error;
if ((flags & ~(AIO_OP2_FOFFSET)) != 0) {
if ((flags & ~(AIO_OP2_FOFFSET | AIO_OP2_VECTORED)) != 0) {
errno = EINVAL;
return (-1);
}
iocb->aio_lio_opcode = LIO_WRITE;
if ((flags & AIO_OP2_FOFFSET) != 0)
iocb->aio_lio_opcode |= LIO_FOFFSET;
if ((flags & AIO_OP2_VECTORED) != 0)
iocb->aio_lio_opcode |= LIO_VECTORED;
error = lio_listio(LIO_NOWAIT, &iocb, 1, NULL);
if (error == -1 && errno == EIO) {

View file

@ -58,6 +58,7 @@
/* aio_read2/aio_write2 flags */
#if __BSD_VISIBLE
#define AIO_OP2_FOFFSET 0x00000001
#define AIO_OP2_VECTORED 0x00000002
#endif
/*