|
Packit |
6c4009 |
/* Copyright (C) 1997-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
This file is part of the GNU C Library.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit |
6c4009 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License as published by the Free Software Foundation; either
|
|
Packit |
6c4009 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit |
6c4009 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6c4009 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
6c4009 |
Lesser General Public License for more details.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License along with the GNU C Library; if not, see
|
|
Packit |
6c4009 |
<http://www.gnu.org/licenses/>. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifndef _AIO_MISC_H
|
|
Packit |
6c4009 |
#define _AIO_MISC_H 1
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <aio.h>
|
|
Packit |
6c4009 |
#include <pthread.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Extend the operation enum. */
|
|
Packit |
6c4009 |
enum
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
LIO_DSYNC = LIO_NOP + 1,
|
|
Packit |
6c4009 |
LIO_SYNC,
|
|
Packit |
6c4009 |
LIO_READ64 = LIO_READ | 128,
|
|
Packit |
6c4009 |
LIO_WRITE64 = LIO_WRITE | 128
|
|
Packit |
6c4009 |
};
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Union of the two request types. */
|
|
Packit |
6c4009 |
typedef union
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
struct aiocb aiocb;
|
|
Packit |
6c4009 |
struct aiocb64 aiocb64;
|
|
Packit |
6c4009 |
} aiocb_union;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Used to synchronize. */
|
|
Packit |
6c4009 |
struct waitlist
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
struct waitlist *next;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* The next two fields is used in synchronous `lio_listio' operations. */
|
|
Packit |
6c4009 |
#ifndef DONT_NEED_AIO_MISC_COND
|
|
Packit |
6c4009 |
pthread_cond_t *cond;
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
int *result;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
volatile unsigned int *counterp;
|
|
Packit |
6c4009 |
/* The next field is used in asynchronous `lio_listio' operations. */
|
|
Packit |
6c4009 |
struct sigevent *sigevp;
|
|
Packit |
6c4009 |
};
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Status of a request. */
|
|
Packit |
6c4009 |
enum
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
no,
|
|
Packit |
6c4009 |
queued,
|
|
Packit |
6c4009 |
yes,
|
|
Packit |
6c4009 |
allocated,
|
|
Packit |
6c4009 |
done
|
|
Packit |
6c4009 |
};
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Used to queue requests.. */
|
|
Packit |
6c4009 |
struct requestlist
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
int running;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
struct requestlist *last_fd;
|
|
Packit |
6c4009 |
struct requestlist *next_fd;
|
|
Packit |
6c4009 |
struct requestlist *next_prio;
|
|
Packit |
6c4009 |
struct requestlist *next_run;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Pointer to the actual data. */
|
|
Packit |
6c4009 |
aiocb_union *aiocbp;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* List of waiting processes. */
|
|
Packit |
6c4009 |
struct waitlist *waiting;
|
|
Packit |
6c4009 |
};
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Lock for global I/O list of requests. */
|
|
Packit |
6c4009 |
extern pthread_mutex_t __aio_requests_mutex attribute_hidden;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Enqueue request. */
|
|
Packit |
6c4009 |
extern struct requestlist *__aio_enqueue_request (aiocb_union *aiocbp,
|
|
Packit |
6c4009 |
int operation)
|
|
Packit |
6c4009 |
attribute_hidden;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Find request entry for given AIO control block. */
|
|
Packit |
6c4009 |
extern struct requestlist *__aio_find_req (aiocb_union *elem) attribute_hidden;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Find request entry for given file descriptor. */
|
|
Packit |
6c4009 |
extern struct requestlist *__aio_find_req_fd (int fildes) attribute_hidden;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Remove request from the list. */
|
|
Packit |
6c4009 |
extern void __aio_remove_request (struct requestlist *last,
|
|
Packit |
6c4009 |
struct requestlist *req, int all)
|
|
Packit |
6c4009 |
attribute_hidden;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Release the entry for the request. */
|
|
Packit |
6c4009 |
extern void __aio_free_request (struct requestlist *req) attribute_hidden;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Notify initiator of request and tell this everybody listening. */
|
|
Packit |
6c4009 |
extern void __aio_notify (struct requestlist *req) attribute_hidden;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Notify initiator of request. */
|
|
Packit |
6c4009 |
extern int __aio_notify_only (struct sigevent *sigev) attribute_hidden;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Send the signal. */
|
|
Packit |
6c4009 |
extern int __aio_sigqueue (int sig, const union sigval val, pid_t caller_pid)
|
|
Packit |
6c4009 |
attribute_hidden;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#endif /* aio_misc.h */
|