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

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

#ifdef __NR__llseek

# include <stdio.h>
# include <unistd.h>

int
main(void)
{
	const unsigned long high = 0xfacefeed;
	const unsigned long low = 0xdeadbeef;
	const long long offset = 0xfacefeeddeadbeefLL;
	unsigned long long result;

	long rc = syscall(__NR__llseek, -1, high, low, &result, SEEK_SET);
	printf("_llseek(-1, %lld, %p, SEEK_SET) = %ld %s (%m)\n",
	       offset, &result, rc, errno2name());

	puts("+++ exited with 0 +++");
	return 0;
}

#else

SKIP_MAIN_UNDEFINED("__NR__llseek")

#endif