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.
This commit is contained in:
Дмитрий Левин 2014-12-06 03:53:16 +00:00
parent d590f3cdd8
commit 304cd81e46
3 changed files with 31 additions and 27 deletions

View File

@ -17,6 +17,7 @@ AM_CPPFLAGS = -I$(srcdir)/$(OS)/$(ARCH) -I$(srcdir)/$(OS) -I$(builddir)/$(OS)
include xlat/Makemodule.am
strace_SOURCES = \
access.c \
aio.c \
bjm.c \
block.c \

30
access.c Normal file
View File

@ -0,0 +1,30 @@
#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);
}

27
file.c
View File

@ -329,33 +329,6 @@ sys_creat(struct tcb *tcp)
return RVAL_FD;
}
#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);
}
/* several stats */
#if defined(SPARC) || defined(SPARC64)