strace/tests/oldselect-efault.c
Dmitry V. Levin d6c71dd061 Fix preprocessor indentation
Indent the C preprocessor directives to reflect their nesting
using the following script:

$ cppi -l $(git grep -El '^[[:space:]]*#[[:space:]]*(if|ifdef|ifndef|elif|else|endif|define|pragma)[[:space:]]' |grep -v '\.sh$') |while read f; do
	cppi < "$f" > "$f".cppi; mv "$f".cppi "$f"
done
2018-12-30 15:35:21 +00:00

59 lines
1.1 KiB
C

/*
* 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 <asm/unistd.h>
#if defined __NR_select && defined __NR__newselect \
&& __NR_select != __NR__newselect \
&& !defined __sparc__
# include <stdint.h>
# include <stdio.h>
# include <string.h>
# include <unistd.h>
# include <sys/select.h>
static const char *errstr;
static long
xselect(const kernel_ulong_t args)
{
static const kernel_ulong_t dummy = F8ILL_KULONG_MASK | 0xfacefeed;
long rc = syscall(__NR_select, args, dummy, dummy, dummy, dummy, dummy);
errstr = sprintrc(rc);
return rc;
}
int
main(void)
{
unsigned long *const args = tail_alloc(sizeof(*args) * 4);
memset(args, 0, sizeof(*args) * 4);
xselect(0);
# ifndef PATH_TRACING_FD
printf("select(NULL) = %s\n", errstr);
# endif
xselect((uintptr_t) args);
# ifndef PATH_TRACING_FD
printf("select(%p) = %s\n", args, errstr);
# endif
puts("+++ exited with 0 +++");
return 0;
}
#else
SKIP_MAIN_UNDEFINED("__NR_select && __NR__newselect"
" && __NR_select != __NR__newselect"
" && !defined __sparc__")
#endif