summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhunt <hunt>2007-08-22 18:28:31 +0000
committerhunt <hunt>2007-08-22 18:28:31 +0000
commit99ca084c029e7923fe82f9e7c5bb428ca3ad66d5 (patch)
tree6d3193edcbc6ee2c60feda85d2ce812f4b48aba3
parenta89688146eabfed2b72dde1ecbe10c9d71073d3a (diff)
downloadsystemtap-steved-99ca084c029e7923fe82f9e7c5bb428ca3ad66d5.tar.gz
systemtap-steved-99ca084c029e7923fe82f9e7c5bb428ca3ad66d5.tar.xz
systemtap-steved-99ca084c029e7923fe82f9e7c5bb428ca3ad66d5.zip
2007-08-22 Martin Hunt <hunt@redhat.com>
* futimes.c (main): Add utimensat tests.
-rw-r--r--testsuite/systemtap.syscall/futimes.c34
-rw-r--r--testsuite/systemtap.syscall/poll.c1
-rw-r--r--testsuite/systemtap.syscall/readwrite.c1
-rw-r--r--testsuite/systemtap.syscall/select.c1
4 files changed, 34 insertions, 3 deletions
diff --git a/testsuite/systemtap.syscall/futimes.c b/testsuite/systemtap.syscall/futimes.c
index 7a4f4065..4ccb754f 100644
--- a/testsuite/systemtap.syscall/futimes.c
+++ b/testsuite/systemtap.syscall/futimes.c
@@ -1,13 +1,20 @@
-/* COVERAGE: utimes futimes futimesat */
+/* COVERAGE: utimes futimes futimesat utimensat */
#define _GNU_SOURCE
#include <stdio.h>
#include <sys/time.h>
#include <fcntl.h>
+#include <sys/syscall.h>
+
+#ifndef UTIME_NOW
+#define UTIME_NOW ((1l << 30) - 1l)
+#define UTIME_OMIT ((1l << 30) - 2l)
+#endif
int main()
{
int fd;
struct timeval tv[2];
+ struct timespec ts[2];
fd = creat("foobar", 0666);
@@ -21,13 +28,34 @@ int main()
// utimes ("foobar", \[1000000000.001234\]\[2000000000.005678\])
#ifdef SYS_futimesat
futimes(fd, tv);
- // futimesat (-100, "foobar", \[1000000000.001234\]\[2000000000.005678\])
+ // futimesat (AT_FDCWD, "foobar", \[1000000000.001234\]\[2000000000.005678\])
futimesat(7, "foobar", tv);
// futimesat (7, "foobar", \[1000000000.001234\]\[2000000000.005678\])
futimesat(AT_FDCWD, "foobar", tv);
- // futimesat (-100, "foobar", \[1000000000.001234\]\[2000000000.005678\])
+ // futimesat (AT_FDCWD, "foobar", \[1000000000.001234\]\[2000000000.005678\])
#endif /* SYS_futimesat */
+
+#ifdef __NR_utimensat
+ ts[0].tv_sec = 1000000000;
+ ts[0].tv_nsec = 123456789;
+ ts[1].tv_sec = 2000000000;
+ ts[1].tv_nsec = 56780000;
+ syscall(__NR_utimensat, AT_FDCWD, "foobar", ts, 0);
+ // utimensat (AT_FDCWD, "foobar", \[1000000000.123456789\]\[2000000000.056780000\], 0x0)
+
+ ts[0].tv_sec = 0;
+ ts[0].tv_nsec = UTIME_NOW;
+ ts[1].tv_sec = 0;
+ ts[1].tv_nsec = UTIME_OMIT;
+ syscall(__NR_utimensat, AT_FDCWD, "foobar", ts, AT_SYMLINK_NOFOLLOW);
+ // utimensat (AT_FDCWD, "foobar", \[UTIME_NOW\]\[UTIME_OMIT\], AT_SYMLINK_NOFOLLOW)
+
+ syscall(__NR_utimensat, 22, "foobar", ts, 0x42);
+ // utimensat (22, "foobar", \[UTIME_NOW\]\[UTIME_OMIT\], 0x42)
+
+#endif
+
return 0;
}
diff --git a/testsuite/systemtap.syscall/poll.c b/testsuite/systemtap.syscall/poll.c
index 638e3514..591c1f74 100644
--- a/testsuite/systemtap.syscall/poll.c
+++ b/testsuite/systemtap.syscall/poll.c
@@ -3,6 +3,7 @@
#include <sys/epoll.h>
#include <poll.h>
#include <signal.h>
+#include <sys/syscall.h>
int main()
{
diff --git a/testsuite/systemtap.syscall/readwrite.c b/testsuite/systemtap.syscall/readwrite.c
index b0e964b6..aacd68f2 100644
--- a/testsuite/systemtap.syscall/readwrite.c
+++ b/testsuite/systemtap.syscall/readwrite.c
@@ -6,6 +6,7 @@
#include <unistd.h>
#include <linux/unistd.h>
#include <sys/uio.h>
+#include <sys/syscall.h>
#define STRING1 "red"
#define STRING2 "green"
diff --git a/testsuite/systemtap.syscall/select.c b/testsuite/systemtap.syscall/select.c
index d74946c2..6ea13a01 100644
--- a/testsuite/systemtap.syscall/select.c
+++ b/testsuite/systemtap.syscall/select.c
@@ -3,6 +3,7 @@
#include <unistd.h>
#include <sys/select.h>
#include <signal.h>
+#include <sys/syscall.h>
int main()
{