summaryrefslogtreecommitdiff
path: root/access.c
blob: 5c2e6e99ea4aa675d4b4f6287a55a299c12c17f2 (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
/*
 * Copyright (c) 2014-2018 The strace developers.
 * All rights reserved.
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 */

#include "defs.h"

#include <fcntl.h>

#include "xlat/access_flags.h"

static int
decode_access(struct tcb *tcp, int offset)
{
	printpath(tcp, tcp->u_arg[offset]);
	tprints(", ");
	printflags(access_flags, tcp->u_arg[offset + 1], "?_OK");

	return RVAL_DECODED;
}

SYS_FUNC(access)
{
	return decode_access(tcp, 0);
}

SYS_FUNC(faccessat)
{
	print_dirfd(tcp, tcp->u_arg[0]);
	return decode_access(tcp, 1);
}