1
0
forked from 0ad/0ad
0ad/source/lib/posix/aio.h
janwas 067cfcee88 no message
This was SVN commit r13.
2003-11-04 18:30:08 +00:00

64 lines
2.1 KiB
C
Executable File

// POSIX asynchronous I/O
//
// Copyright (c) 2003 Jan Wassenberg
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// Contact info:
// Jan.Wassenberg@stud.uni-karlsruhe.de
// http://www.stud.uni-karlsruhe.de/~urkt/
// included by posix.h
// Note: for maximum efficiency, transfer buffers, offsets, and lengths
// should be sector aligned (otherwise, buffer is copied).
struct aiocb
{
int aio_fildes; // File descriptor.
off_t aio_offset; // File offset.
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.
};
enum
{
// aio_cancel return
AIO_ALLDONE, // None of the requested operations could be canceled since they are already complete.
AIO_CANCELED, // All requested operations have been canceled.
AIO_NOTCANCELED, // Some of the requested operations could not be canceled since they are in progress.
// lio_listio mode
LIO_WAIT, // wait until all I/O is complete
LIO_NOWAIT,
// lio_listio ops
LIO_NOP,
LIO_READ,
LIO_WRITE
};
extern int aio_cancel(int, struct aiocb*);
extern int aio_error(const struct aiocb*);
extern int aio_fsync(int, struct aiocb*);
extern int aio_read(struct aiocb*);
extern ssize_t aio_return(struct aiocb*);
extern int aio_suspend(const struct aiocb* const[], int, const struct timespec*);
extern int aio_write(struct aiocb*);
extern int lio_listio(int, struct aiocb* const[], int, struct sigevent*);
extern int aio_close(int fd);
extern int aio_open(const char* fn, int mode, int fd);