aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/libaio/src/io_pgetevents.c
blob: e6b061468897ebacf9b339266ffe35e8908361e9 (plain) (blame)
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
/*
   libaio Linux async I/O interface
   Copyright 2018 Christoph Hellwig.

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library 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
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with this library; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 */
#include <libaio.h>
#include <errno.h>
#include <stdlib.h>
#include <time.h>
#include <signal.h>
#include "syscall.h"
#include "aio_ring.h"

#ifdef __NR_io_pgetevents
io_syscall6(int, __io_pgetevents, io_pgetevents, io_context_t, ctx, long,
		min_nr, long, nr, struct io_event *, events,
		struct timespec *, timeout, void *, sigmask);

int io_pgetevents(io_context_t ctx, long min_nr, long nr,
		struct io_event *events, struct timespec *timeout,
		sigset_t *sigmask)
{
	struct {
		unsigned long ss;
		unsigned long ss_len;
	} data;

	if (aio_ring_is_empty(ctx, timeout))
		return 0;

	data.ss = (unsigned long)sigmask;
	data.ss_len = _NSIG / 8;
	return __io_pgetevents(ctx, min_nr, nr, events, timeout, &data);
}
#else
int io_pgetevents(io_context_t ctx, long min_nr, long nr,
		struct io_event *events, struct timespec *timeout,
		sigset_t *sigmask)

{
	return -ENOSYS;
}
#endif /* __NR_io_pgetevents */