Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Jan 2016 19:47:52 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r294033 - stable/10/usr.bin/truss
Message-ID:  <201601141947.u0EJlqCW023981@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Thu Jan 14 19:47:52 2016
New Revision: 294033
URL: https://svnweb.freebsd.org/changeset/base/294033

Log:
  Now that futimens() and utimensat() have been merged, add decoding for
  those system calls that was left out of the previous merge of r286381 in
  r290052.

Modified:
  stable/10/usr.bin/truss/syscall.h
  stable/10/usr.bin/truss/syscalls.c

Modified: stable/10/usr.bin/truss/syscall.h
==============================================================================
--- stable/10/usr.bin/truss/syscall.h	Thu Jan 14 19:33:13 2016	(r294032)
+++ stable/10/usr.bin/truss/syscall.h	Thu Jan 14 19:47:52 2016	(r294033)
@@ -43,7 +43,7 @@ enum Argtype { None = 1, Hex, Octal, Int
 	Umtx, Sigset, Sigprocmask, StatFs, Kevent, Sockdomain, Socktype, Open,
 	Fcntlflag, Rusage, BinString, Shutdown, Resource, Rlimit, Timeval2,
 	Pathconf, Rforkflags, ExitStatus, Waitoptions, Idtype, Procctl,
-	LinuxSockArgs, Umtxop, Atfd, Atflags, Accessmode, Long,
+	LinuxSockArgs, Umtxop, Atfd, Atflags, Timespec2, Accessmode, Long,
 	Sysarch, ExecArgs, ExecEnv, PipeFds, QuadHex };
 
 #define	ARG_MASK	0xff

Modified: stable/10/usr.bin/truss/syscalls.c
==============================================================================
--- stable/10/usr.bin/truss/syscalls.c	Thu Jan 14 19:33:13 2016	(r294032)
+++ stable/10/usr.bin/truss/syscalls.c	Thu Jan 14 19:47:52 2016	(r294033)
@@ -162,6 +162,8 @@ static struct syscall decoded_syscalls[]
 	  .args = { { Int, 0 }, { StatFs | OUT, 1 } } },
 	{ .name = "ftruncate", .ret_type = 1, .nargs = 2,
 	  .args = { { Int | IN, 0 }, { QuadHex | IN, 1 + QUAD_ALIGN } } },
+	{ .name = "futimens", .ret_type = 1, .nargs = 2,
+	  .args = { { Int, 0 }, { Timespec2 | IN, 1 } } },
 	{ .name = "futimes", .ret_type = 1, .nargs = 2,
 	  .args = { { Int, 0 }, { Timeval2 | IN, 1 } } },
 	{ .name = "futimesat", .ret_type = 1, .nargs = 3,
@@ -341,6 +343,9 @@ static struct syscall decoded_syscalls[]
 	  .args = { { Atfd, 0 }, { Name, 1 }, { Atflags, 2 } } },
 	{ .name = "unmount", .ret_type = 1, .nargs = 2,
 	  .args = { { Name, 0 }, { Int, 1 } } },
+	{ .name = "utimensat", .ret_type = 1, .nargs = 4,
+	  .args = { { Atfd, 0 }, { Name | IN, 1 }, { Timespec2 | IN, 2 },
+		    { Atflags, 3 } } },
 	{ .name = "utimes", .ret_type = 1, .nargs = 2,
 	  .args = { { Name | IN, 0 }, { Timeval2 | IN, 1 } } },
 	{ .name = "wait4", .ret_type = 1, .nargs = 4,
@@ -1083,6 +1088,37 @@ print_arg(struct syscall_args *sc, unsig
 			fprintf(fp, "0x%lx", args[sc->offset]);
 		break;
 	}
+	case Timespec2: {
+		struct timespec ts[2];
+		const char *sep;
+		unsigned int i;
+
+		if (get_struct(pid, (void *)args[sc->offset], &ts, sizeof(ts))
+		    != -1) {
+			fputs("{ ", fp);
+			sep = "";
+			for (i = 0; i < nitems(ts); i++) {
+				fputs(sep, fp);
+				sep = ", ";
+				switch (ts[i].tv_nsec) {
+				case UTIME_NOW:
+					fprintf(fp, "UTIME_NOW");
+					break;
+				case UTIME_OMIT:
+					fprintf(fp, "UTIME_OMIT");
+					break;
+				default:
+					fprintf(fp, "%jd.%09ld",
+					    (intmax_t)ts[i].tv_sec,
+					    ts[i].tv_nsec);
+					break;
+				}
+			}
+			fputs(" }", fp);
+		} else
+			fprintf(fp, "0x%lx", args[sc->offset]);
+		break;
+	}
 	case Timeval: {
 		struct timeval tv;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601141947.u0EJlqCW023981>