Browse Source

file.c: move utime parser to a separate file

* utime.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_utime): Move to utime.c.
Dmitry V. Levin 5 years ago
parent
commit
fb470f350e
3 changed files with 38 additions and 36 deletions
  1. 1
    0
      Makefile.am
  2. 0
    36
      file.c
  3. 37
    0
      utime.c

+ 1
- 0
Makefile.am View File

@@ -72,6 +72,7 @@ strace_SOURCES =	\
72 72
 	time.c		\
73 73
 	umount.c	\
74 74
 	util.c		\
75
+	utime.c		\
75 76
 	v4l2.c		\
76 77
 	vsprintf.c	\
77 78
 	xattr.c

+ 0
- 36
file.c View File

@@ -1519,39 +1519,3 @@ sys_utimensat(struct tcb *tcp)
1519 1519
 	}
1520 1520
 	return 0;
1521 1521
 }
1522
-
1523
-int
1524
-sys_utime(struct tcb *tcp)
1525
-{
1526
-	union {
1527
-		long utl[2];
1528
-		int uti[2];
1529
-		long paranoia_for_huge_wordsize[4];
1530
-	} u;
1531
-	unsigned wordsize;
1532
-
1533
-	if (entering(tcp)) {
1534
-		printpath(tcp, tcp->u_arg[0]);
1535
-		tprints(", ");
1536
-
1537
-		wordsize = current_wordsize;
1538
-		if (!tcp->u_arg[1])
1539
-			tprints("NULL");
1540
-		else if (!verbose(tcp))
1541
-			tprintf("%#lx", tcp->u_arg[1]);
1542
-		else if (umoven(tcp, tcp->u_arg[1], 2 * wordsize, (char *) &u) < 0)
1543
-			tprints("[?, ?]");
1544
-		else if (wordsize == sizeof u.utl[0]) {
1545
-			tprintf("[%s,", sprinttime(u.utl[0]));
1546
-			tprintf(" %s]", sprinttime(u.utl[1]));
1547
-		}
1548
-		else if (wordsize == sizeof u.uti[0]) {
1549
-			tprintf("[%s,", sprinttime(u.uti[0]));
1550
-			tprintf(" %s]", sprinttime(u.uti[1]));
1551
-		}
1552
-		else
1553
-			tprintf("<decode error: unsupported wordsize %d>",
1554
-				wordsize);
1555
-	}
1556
-	return 0;
1557
-}

+ 37
- 0
utime.c View File

@@ -0,0 +1,37 @@
1
+#include "defs.h"
2
+
3
+int
4
+sys_utime(struct tcb *tcp)
5
+{
6
+	union {
7
+		long utl[2];
8
+		int uti[2];
9
+		long paranoia_for_huge_wordsize[4];
10
+	} u;
11
+	unsigned wordsize;
12
+
13
+	if (entering(tcp)) {
14
+		printpath(tcp, tcp->u_arg[0]);
15
+		tprints(", ");
16
+
17
+		wordsize = current_wordsize;
18
+		if (!tcp->u_arg[1])
19
+			tprints("NULL");
20
+		else if (!verbose(tcp))
21
+			tprintf("%#lx", tcp->u_arg[1]);
22
+		else if (umoven(tcp, tcp->u_arg[1], 2 * wordsize, (char *) &u) < 0)
23
+			tprints("[?, ?]");
24
+		else if (wordsize == sizeof u.utl[0]) {
25
+			tprintf("[%s,", sprinttime(u.utl[0]));
26
+			tprintf(" %s]", sprinttime(u.utl[1]));
27
+		}
28
+		else if (wordsize == sizeof u.uti[0]) {
29
+			tprintf("[%s,", sprinttime(u.uti[0]));
30
+			tprintf(" %s]", sprinttime(u.uti[1]));
31
+		}
32
+		else
33
+			tprintf("<decode error: unsupported wordsize %d>",
34
+				wordsize);
35
+	}
36
+	return 0;
37
+}

Loading…
Cancel
Save