file.c: move truncate, truncate64, ftruncate, and ftruncate64 parsers to a separate file

* truncate.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_truncate, sys_truncate64, sys_ftruncate, sys_ftruncate64):
Move to truncate.c.
This commit is contained in:
Дмитрий Левин 2014-12-06 03:53:16 +00:00
parent 9b2f674adb
commit 6934182f16
3 changed files with 42 additions and 40 deletions

View File

@ -76,6 +76,7 @@ strace_SOURCES = \
sysmips.c \
term.c \
time.c \
truncate.c \
umount.c \
util.c \
utime.c \

40
file.c
View File

@ -464,46 +464,6 @@ sys_readahead(struct tcb *tcp)
return 0;
}
int
sys_truncate(struct tcb *tcp)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
tprintf(", %lu", tcp->u_arg[1]);
}
return 0;
}
int
sys_truncate64(struct tcb *tcp)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
printllval(tcp, ", %llu", 1);
}
return 0;
}
int
sys_ftruncate(struct tcb *tcp)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprintf(", %lu", tcp->u_arg[1]);
}
return 0;
}
int
sys_ftruncate64(struct tcb *tcp)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
printllval(tcp, ", %llu", 1);
}
return 0;
}
/* several stats */
#if defined(SPARC) || defined(SPARC64)

41
truncate.c Normal file
View File

@ -0,0 +1,41 @@
#include "defs.h"
int
sys_truncate(struct tcb *tcp)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
tprintf(", %lu", tcp->u_arg[1]);
}
return 0;
}
int
sys_truncate64(struct tcb *tcp)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
printllval(tcp, ", %llu", 1);
}
return 0;
}
int
sys_ftruncate(struct tcb *tcp)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprintf(", %lu", tcp->u_arg[1]);
}
return 0;
}
int
sys_ftruncate64(struct tcb *tcp)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
printllval(tcp, ", %llu", 1);
}
return 0;
}