# define TEST_SYSCALL_INVOKE(sample, pst) \
fstatat(AT_FDCWD, sample, pst, AT_SYMLINK_NOFOLLOW)
# define PRINT_SYSCALL_HEADER(sample) \
- printf("%s(AT_FDCWD, \"%s\", ", TEST_SYSCALL_STR, sample)
-# define PRINT_SYSCALL_FOOTER \
- puts(", AT_SYMLINK_NOFOLLOW) = 0")
+ do { \
+ int saved_errno = errno; \
+ printf("%s(AT_FDCWD, \"%s\", ", TEST_SYSCALL_STR, sample)
+# define PRINT_SYSCALL_FOOTER(rc) \
+ errno = saved_errno; \
+ printf(", AT_SYMLINK_NOFOLLOW) = %s\n", sprintrc(rc)); \
+ } while (0)
# include "xstatx.c"
#define TEST_SYSCALL_INVOKE(sample, pst) \
syscall(TEST_SYSCALL_NR, 0, pst)
#define PRINT_SYSCALL_HEADER(sample) \
- printf("%s(0, ", TEST_SYSCALL_STR)
-#define PRINT_SYSCALL_FOOTER \
- puts(") = 0")
+ do { \
+ int saved_errno = errno; \
+ printf("%s(0, ", TEST_SYSCALL_STR)
+#define PRINT_SYSCALL_FOOTER(rc) \
+ errno = saved_errno; \
+ printf(") = %s\n", sprintrc(rc)); \
+ } while (0)
#define USE_ASM_STAT
#define TEST_SYSCALL_INVOKE(sample, pst) \
syscall(TEST_SYSCALL_NR, sample, pst)
#define PRINT_SYSCALL_HEADER(sample) \
- printf("%s(\"%s\", ", TEST_SYSCALL_STR, sample)
-#define PRINT_SYSCALL_FOOTER \
- puts(") = 0")
+ do { \
+ int saved_errno = errno; \
+ printf("%s(\"%s\", ", TEST_SYSCALL_STR, sample)
+#define PRINT_SYSCALL_FOOTER(rc) \
+ errno = saved_errno; \
+ printf(") = %s\n", sprintrc(rc)); \
+ } while (0)
#define USE_ASM_STAT
# error PRINT_SYSCALL_FOOTER must be defined
# endif
+# include <errno.h>
# include <stdio.h>
# include <stddef.h>
# include <time.h>
return rc;
}
- if (TEST_SYSCALL_INVOKE(sample, st)) {
+ if ((rc = TEST_SYSCALL_INVOKE(sample, st))) {
perror(TEST_SYSCALL_STR);
(void) unlink(sample);
return 77;
PRINT_SYSCALL_HEADER(sample);
print_stat(st);
- PRINT_SYSCALL_FOOTER;
+ PRINT_SYSCALL_FOOTER(rc);
puts("+++ exited with 0 +++");
return 0;