summaryrefslogtreecommitdiff
path: root/tests/oldselect.c
blob: faacdeee0d4110d0b893a00f29c978ccd248d7e8 (plain)
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
/*
 * Copyright (c) 2015-2018 Dmitry V. Levin <ldv@altlinux.org>
 * All rights reserved.
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

#include "tests.h"
#include "scno.h"

#if defined __NR_select && defined __NR__newselect \
 && __NR_select != __NR__newselect \
 && !defined __sparc__

# define TEST_SYSCALL_NR __NR_select
# define TEST_SYSCALL_STR "select"
# define xselect xselect
# include "xselect.c"

static uint32_t *args;

static long
xselect(const kernel_ulong_t nfds,
	const kernel_ulong_t rs,
	const kernel_ulong_t ws,
	const kernel_ulong_t es,
	const kernel_ulong_t tv)
{
	if (!args)
		args = tail_alloc(sizeof(*args) * 5);
	args[0] = nfds;
	args[1] = rs;
	args[2] = ws;
	args[3] = es;
	args[4] = tv;
	long rc = syscall(TEST_SYSCALL_NR, args);
	errstr = sprintrc(rc);
	return rc;
}

#else

SKIP_MAIN_UNDEFINED("__NR_select && __NR__newselect"
		    " && __NR_select != __NR__newselect"
		    " && !defined __sparc__")

#endif