strace/access.c
Dmitry V. Levin 304cd81e46 file.c: move access and faccessat parsers to a separate file
* access.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_access, sys_faccessat and related code to access.c.
2014-12-11 21:40:17 +00:00

31 lines
474 B
C

#include "defs.h"
#include <fcntl.h>
#include "xlat/access_flags.h"
static int
decode_access(struct tcb *tcp, int offset)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[offset]);
tprints(", ");
printflags(access_flags, tcp->u_arg[offset + 1], "?_OK");
}
return 0;
}
int
sys_access(struct tcb *tcp)
{
return decode_access(tcp, 0);
}
int
sys_faccessat(struct tcb *tcp)
{
if (entering(tcp))
print_dirfd(tcp, tcp->u_arg[0]);
return decode_access(tcp, 1);
}