2007-07-23 Ulrich Drepper <drepper@redhat.com>

* defs.h: Add new parameter to printtv_bitness prototype.
	(printttv): Pass zero for the new parameter.
	(printtv_special): New macro.
	* desc.c (decode_select): Pass zero for the new parameter of
	printtv_bitness.
	* file.c (utimensatflags): New macro.
	(sys_osf_utimes): Pass zero for the new parameter of
	printtv_bitness.
	(sys_utimes): Likewise.
	(sys_futimesat): Likewise.
	(decode_utimes): Add new parameter.  Pass it to the
	printtv_bitness calls.  Fix printing of time values.
	(sys_utimensat): New function.
	* time.c (UTIME_NOW, UTIME_OMIT): Define if not already
	happened.
	(printtv_bitness): Add new parameter.  Print special UTIME_*
	values as strings if set.
	(sys_osf_gettimeofday): Pass zero for the new parameter of
	printtv_bitness.
	(sys_osf_settimeofday): Likewise.
	* linux/syscall.h: Declare sys_utimensat.
	* linux/syscallent.h: Add utimensat entry.
	* linux/x86_64/syscallent.h: Likewise.
This commit is contained in:
Roland McGrath 2007-07-24 01:57:11 +00:00
parent b912ffe5cc
commit 6afc5659ac
7 changed files with 65 additions and 18 deletions

6
defs.h
View File

@ -453,7 +453,7 @@ extern void printnum P((struct tcb *, long, char *));
extern void printnum_int P((struct tcb *, long, char *));
extern void printpath P((struct tcb *, long));
extern void printpathn P((struct tcb *, long, int));
extern void printtv_bitness P((struct tcb *, long, enum bitness_t));
extern void printtv_bitness P((struct tcb *, long, enum bitness_t, int));
extern void sprinttv P((struct tcb *, long, enum bitness_t, char *));
#ifdef HAVE_SIGINFO_T
extern void printsiginfo P((siginfo_t *, int));
@ -519,7 +519,9 @@ extern int proc_open P((struct tcb *tcp, int attaching));
umoven((pid), (addr), sizeof *(objp), (char *) (objp))
#define printtv(tcp, addr) \
printtv_bitness((tcp), (addr), BITNESS_CURRENT)
printtv_bitness((tcp), (addr), BITNESS_CURRENT, 0)
#define printtv_special(tcp, addr) \
printtv_bitness((tcp), (addr), BITNESS_CURRENT, 1)
#ifdef __STDC__
#ifdef __GNUC__

2
desc.c
View File

@ -476,7 +476,7 @@ decode_select(struct tcb *tcp, long *args, enum bitness_t bitness)
}
free(fds);
tprintf(", ");
printtv_bitness(tcp, args[4], bitness);
printtv_bitness(tcp, args[4], bitness, 0);
}
else
{

34
file.c
View File

@ -1184,6 +1184,7 @@ static const struct xlat fstatatflags[] = {
{ AT_SYMLINK_NOFOLLOW, "AT_SYMLINK_NOFOLLOW" },
{ 0, NULL },
};
#define utimensatflags fstatatflags
int
sys_newfstatat(struct tcb *tcp)
@ -2087,19 +2088,30 @@ struct tcb *tcp;
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
tprintf(", ");
printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32);
printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0);
}
return 0;
}
#endif
static int
decode_utimes(struct tcb *tcp, int offset)
decode_utimes(struct tcb *tcp, int offset, int special)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[offset]);
tprintf(", ");
printtv(tcp, tcp->u_arg[offset + 1]);
if (tcp->u_arg[offset + 1] == 0)
tprintf("NULL");
else {
tprintf("{");
printtv_bitness(tcp, tcp->u_arg[offset + 1],
BITNESS_CURRENT, special);
tprintf(", ");
printtv_bitness(tcp, tcp->u_arg[offset + 1]
+ sizeof (struct timeval),
BITNESS_CURRENT, special);
tprintf("}");
}
}
return 0;
}
@ -2107,7 +2119,7 @@ decode_utimes(struct tcb *tcp, int offset)
int
sys_utimes(struct tcb *tcp)
{
return decode_utimes(tcp, 0);
return decode_utimes(tcp, 0, 0);
}
#ifdef LINUX
@ -2116,7 +2128,19 @@ sys_futimesat(struct tcb *tcp)
{
if (entering(tcp))
print_dirfd(tcp->u_arg[0]);
return decode_utimes(tcp, 1);
return decode_utimes(tcp, 1, 0);
}
int
sys_utimensat(struct tcb *tcp)
{
if (entering(tcp)) {
print_dirfd(tcp->u_arg[0]);
decode_utimes(tcp, 1, 1);
tprintf(", ");
printflags(utimensatflags, tcp->u_arg[3], "AT_???");
}
return 0;
}
#endif

View File

@ -102,6 +102,7 @@ int sys_waitid(), sys_fadvise64(), sys_fadvise64_64();
int sys_mbind(), sys_get_mempolicy(), sys_set_mempolicy(), sys_move_pages();
int sys_arch_prctl();
int sys_io_setup(), sys_io_submit(), sys_io_cancel(), sys_io_getevents(), sys_io_destroy();
int sys_utimensat();
/* sys_socketcall subcalls */

View File

@ -350,7 +350,7 @@
{ 6, 0, sys_move_pages, "move_pages" }, /* 317 */
{ 5, 0, printargs, "SYS_318" }, /* 318 */
{ 5, 0, printargs, "SYS_319" }, /* 319 */
{ 5, 0, printargs, "SYS_320" }, /* 320 */
{ 4, TD|TF, sys_utimensat, "utimensat" }, /* 320 */
{ 5, 0, printargs, "SYS_321" }, /* 321 */
{ 5, 0, printargs, "SYS_322" }, /* 322 */
{ 5, 0, printargs, "SYS_323" }, /* 323 */

View File

@ -278,3 +278,4 @@
{ 4, TD, printargs, "tee" }, /* 277 */
{ 4, TD, printargs, "vmsplice" }, /* 278 */
{ 6, 0, sys_move_pages, "move_pages" }, /* 279 */
{ 4, TD|TF, sys_utimensat, "utimensat" }, /* 280 */

37
time.c
View File

@ -36,6 +36,13 @@
#include <sys/timex.h>
#include <linux/ioctl.h>
#include <linux/rtc.h>
#ifndef UTIME_NOW
#define UTIME_NOW ((1l << 30) - 1l)
#endif
#ifndef UTIME_OMIT
#define UTIME_OMIT ((1l << 30) - 2l)
#endif
#endif /* LINUX */
struct timeval32
@ -57,7 +64,7 @@ tprint_timeval(struct tcb *tcp, const struct timeval *tv)
}
void
printtv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness)
printtv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness, int special)
{
if (addr == 0)
tprintf("NULL");
@ -75,14 +82,26 @@ printtv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness)
{
struct timeval32 tv;
if ((rc = umove(tcp, addr, &tv)) >= 0)
tprint_timeval32(tcp, &tv);
if ((rc = umove(tcp, addr, &tv)) >= 0) {
if (special && tv.tv_usec == UTIME_NOW)
tprintf("UTIME_NOW");
else if (special && tv.tv_usec == UTIME_OMIT)
tprintf("UTIME_OMIT");
else
tprint_timeval32(tcp, &tv);
}
} else
{
struct timeval tv;
if ((rc = umove(tcp, addr, &tv)) >= 0)
tprint_timeval(tcp, &tv);
if ((rc = umove(tcp, addr, &tv)) >= 0) {
if (special && tv.tv_usec == UTIME_NOW)
tprintf("UTIME_NOW");
else if (special && tv.tv_usec == UTIME_OMIT)
tprintf("UTIME_OMIT");
else
tprint_timeval(tcp, &tv);
}
}
if (rc < 0)
@ -180,10 +199,10 @@ struct tcb *tcp;
tcp->u_arg[0], tcp->u_arg[1]);
return 0;
}
printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32);
printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32, 0);
#ifndef SVR4
tprintf(", ");
printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32);
printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0);
#endif /* !SVR4 */
}
return 0;
@ -210,10 +229,10 @@ sys_osf_settimeofday(tcp)
struct tcb *tcp;
{
if (entering(tcp)) {
printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32);
printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32, 0);
#ifndef SVR4
tprintf(", ");
printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32);
printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0);
#endif /* !SVR4 */
}
return 0;