]> granicus.if.org Git - strace/commitdiff
tests: use errno2name()
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 21 Apr 2016 17:49:32 +0000 (17:49 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 21 Apr 2016 18:16:50 +0000 (18:16 +0000)
Automatically change tests/*.c files using the following sed regexp:
sed -i 's/errno == E[[:alnum:]]\+ ? "E[[:alnum:]]\+" : "E[[:alnum:]]\+"/errno2name()/g'

39 files changed:
tests/access.c
tests/copy_file_range.c
tests/creat.c
tests/dup.c
tests/dup2.c
tests/dup3.c
tests/epoll_create.c
tests/epoll_ctl.c
tests/epoll_wait.c
tests/execveat.c
tests/faccessat.c
tests/fchdir.c
tests/fdatasync.c
tests/flock.c
tests/fsync.c
tests/linkat.c
tests/membarrier.c
tests/mkdir.c
tests/mkdirat.c
tests/mknod.c
tests/mlock2.c
tests/mlockall.c
tests/preadv-pwritev.c
tests/pwritev.c
tests/readv.c
tests/rename.c
tests/renameat.c
tests/sched_xetparam.c
tests/sched_xetscheduler.c
tests/setugid.c
tests/shmxt.c
tests/splice.c
tests/symlinkat.c
tests/sync_file_range.c
tests/sync_file_range2.c
tests/tee.c
tests/unlinkat.c
tests/userfaultfd.c
tests/xetpriority.c

index aeb3a791bdfbf47af233504c1853a92b2d36b1e7..402540b20767e5237693134ab784564fd512f002 100644 (file)
@@ -14,11 +14,11 @@ main(void)
 
        long rc = syscall(__NR_access, sample, F_OK);
        printf("access(\"%s\", F_OK) = %ld %s (%m)\n",
-              sample, rc, errno == ENOSYS ? "ENOSYS" : "ENOENT");
+              sample, rc, errno2name());
 
        rc = syscall(__NR_access, sample, R_OK|W_OK|X_OK);
        printf("access(\"%s\", R_OK|W_OK|X_OK) = %ld %s (%m)\n",
-              sample, rc, errno == ENOSYS ? "ENOSYS" : "ENOENT");
+              sample, rc, errno2name());
 
        return 0;
 }
index e90bf6a1b7858e46a5298c9dcd4404a9dbb8ace4..9b304c0711ec5d2c127dd3cb7ec1585d8d91e6da 100644 (file)
@@ -53,7 +53,7 @@ main(void)
                       len, flags) == -1);
        printf("copy_file_range(%d, [%lld], %d, [%lld], %zu, %u) = -1 %s (%m)\n",
               (int) fd_in, *off_in, (int) fd_out, *off_out, len, flags,
-              errno == ENOSYS ? "ENOSYS" : "EBADF");
+              errno2name());
        puts("+++ exited with 0 +++");
        return 0;
 }
index d922dd7c29a57ab75e6ade417c15362aec3928ab..52d9d62d683cbfc0c2231831d6d5bfc3521e9ffe 100644 (file)
@@ -16,7 +16,7 @@ main(void)
        int rc = syscall(__NR_creat, TMP_FILE, S_IRUSR);
        printf("creat(\"%s\", %#o) = %d %s (%m)\n",
               TMP_FILE, S_IRUSR, rc,
-              errno == ENOSYS ? "ENOSYS" : "ETXTBSY");
+              errno2name());
 
        puts("+++ exited with 0 +++");
        return 0;
index 57945aaefe57e6ac1e4ab64081d509b095c6a0d7..6debeb4947ca9cf1650093c34ad2797a4bf47b07 100644 (file)
@@ -10,7 +10,7 @@ main(void)
        int rc = dup(fd);
        printf("dup(%d) = %d %s (%m)\n",
               fd, rc,
-              errno == ENOSYS ? "ENOSYS" : "EBADF");
+              errno2name());
 
        puts("+++ exited with 0 +++");
        return 0;
index 0705af69a0ce33732308f2c4dd631673452e650d..734746fae0df9a554f676c66be5941e8e277cb28 100644 (file)
@@ -15,7 +15,7 @@ main(void)
        int rc = syscall(__NR_dup2, fd_old, fd_new);
        printf("dup2(%d, %d) = %d %s (%m)\n",
               (int) fd_old, (int) fd_new, rc,
-              errno == ENOSYS ? "ENOSYS" : "EBADF");
+              errno2name());
 
        puts("+++ exited with 0 +++");
        return 0;
index b57f05a6b2fd1f401afd8e3781902dc0d970e632..f2c6a31e07e215eb69807979575ae248c2db043c 100644 (file)
@@ -16,7 +16,7 @@ main(void)
        int rc = syscall(__NR_dup3, fd_old, fd_new, O_CLOEXEC);
        printf("dup3(%d, %d, O_CLOEXEC) = %d %s (%m)\n",
               (int) fd_old, (int) fd_new, rc,
-              errno == ENOSYS ? "ENOSYS" : "EBADF");
+              errno2name());
 
        puts("+++ exited with 0 +++");
        return 0;
index 0b9e3a50d1f8817bc03e3a23318667389f30dbee..486b8213b8a45da609f1ab1289d15c57942e5d09 100644 (file)
@@ -12,7 +12,7 @@ main(void)
 {
        int rc = syscall(__NR_epoll_create, -1);
        printf("epoll_create(-1) = %d %s (%m)\n",
-              rc, errno == ENOSYS ? "ENOSYS" : "EINVAL");
+              rc, errno2name());
 
        puts("+++ exited with 0 +++");
        return 0;
index 7237f0f799e1f90bee1a94b3e429320e5abc0ff1..b636a7d45064064b08533f37f91e70f8d60e86f4 100644 (file)
@@ -19,15 +19,15 @@ main(void)
        printf("epoll_ctl(-1, EPOLL_CTL_ADD, -2, {EPOLLIN,"
               " {u32=%u, u64=%" PRIu64 "}}) = %d %s (%m)\n",
               ev->data.u32, ev->data.u64, rc,
-              errno == ENOSYS ? "ENOSYS" : "EBADF");
+              errno2name());
 
        rc = syscall(__NR_epoll_ctl, -3, EPOLL_CTL_DEL, -4, ev);
        printf("epoll_ctl(-3, EPOLL_CTL_DEL, -4, %p) = %d %s (%m)\n",
-              ev, rc, errno == ENOSYS ? "ENOSYS" : "EBADF");
+              ev, rc, errno2name());
 
        rc = syscall(__NR_epoll_ctl, -1L, EPOLL_CTL_MOD, -16L, 0);
        printf("epoll_ctl(-1, EPOLL_CTL_MOD, -16, NULL) = %d %s (%m)\n",
-              rc, errno == ENOSYS ? "ENOSYS" : "EFAULT");
+              rc, errno2name());
 
        puts("+++ exited with 0 +++");
        return 0;
index 98b431f0cf030c123eaa30f8f001b75afad8fe79..be72fc701bdf4ae785869898405faa5728a7ff82 100644 (file)
@@ -15,7 +15,7 @@ main(void)
 
        int rc = syscall(__NR_epoll_wait, -1, ev, 1, -2);
        printf("epoll_wait(-1, %p, 1, -2) = %d %s (%m)\n",
-              ev, rc, errno == ENOSYS ? "ENOSYS" : "EBADF");
+              ev, rc, errno2name());
 
        puts("+++ exited with 0 +++");
        return 0;
index d4ead406f0a517e0f193fbd951a3541ae554fb26..ec0dc768f70776815949cdaa7cc45d962d34014e 100644 (file)
@@ -74,7 +74,7 @@ main(void)
 #ifdef VERBOSE_EXECVEAT
               q_envp[0], q_envp[1], envp[2], envp[3], envp[4],
 #endif
-              errno == ENOSYS ? "ENOSYS" : "ENOENT");
+              errno2name());
 
        tail_argv[ARRAY_SIZE(q_argv)] = NULL;
        tail_envp[ARRAY_SIZE(q_envp)] = NULL;
@@ -91,7 +91,7 @@ main(void)
 #ifdef VERBOSE_EXECVEAT
               q_envp[0], q_envp[1],
 #endif
-              errno == ENOSYS ? "ENOSYS" : "ENOENT");
+              errno2name());
 
        syscall(__NR_execveat, -100, FILENAME, tail_argv + 2, tail_envp + 1, 0x1100);
        printf("execveat(AT_FDCWD, \"%s\", [\"%s\"]"
@@ -105,7 +105,7 @@ main(void)
 #ifdef VERBOSE_EXECVEAT
               q_envp[1],
 #endif
-              errno == ENOSYS ? "ENOSYS" : "ENOENT");
+              errno2name());
 
        char **const empty = tail_alloc(sizeof(*empty));
        char **const efault = empty + 1;
@@ -119,7 +119,7 @@ main(void)
               ", [/* 0 vars */]"
 #endif
               ", AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) = -1 %s (%m)\n",
-              Q_FILENAME, errno == ENOSYS ? "ENOSYS" : "ENOENT");
+              Q_FILENAME, errno2name());
 
        char str_a[] = "012345678901234567890123456789012";
        char str_b[] = "_abcdefghijklmnopqrstuvwxyz()[]{}";
@@ -150,7 +150,7 @@ main(void)
        printf("], [/* %u vars */", DEFAULT_STRLEN + 1);
 #endif
        printf("], AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) = -1 %s (%m)\n",
-              errno == ENOSYS ? "ENOSYS" : "ENOENT");
+              errno2name());
 
        syscall(__NR_execveat, -100, FILENAME, a + 1, b + 1, 0x1100);
        printf("execveat(AT_FDCWD, \"%s\", [\"%s\"", Q_FILENAME, a[1]);
@@ -164,17 +164,17 @@ main(void)
        printf("], [/* %d vars */", DEFAULT_STRLEN);
 #endif
        printf("], AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) = -1 %s (%m)\n",
-              errno == ENOSYS ? "ENOSYS" : "ENOENT");
+              errno2name());
 
        syscall(__NR_execveat, -100, FILENAME, NULL, efault, 0x1100);
        printf("execveat(AT_FDCWD, \"%s\", NULL, %p"
               ", AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) = -1 %s (%m)\n",
-              Q_FILENAME, efault, errno == ENOSYS ? "ENOSYS" : "ENOENT");
+              Q_FILENAME, efault, errno2name());
 
        syscall(__NR_execveat, -100, FILENAME, efault, NULL, 0x1100);
        printf("execveat(AT_FDCWD, \"%s\", %p, NULL"
               ", AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) = -1 %s (%m)\n",
-              Q_FILENAME, efault, errno == ENOSYS ? "ENOSYS" : "ENOENT");
+              Q_FILENAME, efault, errno2name());
 
        puts("+++ exited with 0 +++");
        return 0;
index 39c006a5d159f5ff4097d4eb5ee92a04595b1b0f..1a8da4f89393ad63d3eceb8995a0ace44b022378 100644 (file)
@@ -16,7 +16,7 @@ main(void)
        int rc = syscall(__NR_faccessat, fd, sample, F_OK);
        printf("faccessat(%d, \"%s\", F_OK) = %d %s (%m)\n",
               (int) fd, sample, rc,
-              errno == ENOSYS ? "ENOSYS" : "EBADF");
+              errno2name());
 
        puts("+++ exited with 0 +++");
        return 0;
index c9153a20ef05eb8a9deadc2f5233fa0cff056a0f..40511173d1af04fb99412bc7e780adc6a9f3a658 100644 (file)
@@ -14,7 +14,7 @@ main(void)
 
        long rc = syscall(__NR_fchdir, fd);
        printf("fchdir(%d) = %ld %s (%m)\n",
-              (int) fd, rc, errno == ENOSYS ? "ENOSYS" : "EBADF");
+              (int) fd, rc, errno2name());
 
        puts("+++ exited with 0 +++");
        return 0;
index 382f47da1459d9da6b4be4920ec43830f06c0bb2..1923b5000c3f4bb1498d743c925170e062369a83 100644 (file)
@@ -14,7 +14,7 @@ main(void)
        int rc = syscall(__NR_fdatasync, fd);
        printf("fdatasync(%d) = %d %s (%m)\n",
               (int) fd, rc,
-              errno == ENOSYS ? "ENOSYS" : "EBADF");
+              errno2name());
 
        puts("+++ exited with 0 +++");
        return 0;
index cd25185c312aac87810c7030602a6cc975b8b431..feb6cae3a0c413787ba7d7d11d939cc4fbbe62ac 100644 (file)
@@ -15,7 +15,7 @@ main(void)
        int rc = syscall(__NR_flock, fd, LOCK_SH);
        printf("flock(%d, LOCK_SH) = %d %s (%m)\n",
               (int) fd, rc,
-              errno == ENOSYS ? "ENOSYS" : "EBADF");
+              errno2name());
 
        puts("+++ exited with 0 +++");
        return 0;
index 774420eef7079867983b87881fad0bd4b4bccc48..3dcf101ee24f5840fcd8293dae2225a779d9c277 100644 (file)
@@ -14,7 +14,7 @@ main(void)
        int rc = syscall(__NR_fsync, fd);
        printf("fsync(%d) = %d %s (%m)\n",
               (int) fd, rc,
-              errno == ENOSYS ? "ENOSYS" : "EBADF");
+              errno2name());
 
        puts("+++ exited with 0 +++");
        return 0;
index 1577f0dd8e928aa01706b42195b0ce99d238906f..e1dd21761decbc23574adfd85fb46391090ae95a 100644 (file)
@@ -18,14 +18,14 @@ main(void)
        int rc = syscall(__NR_linkat, fd_old, sample_1, fd_new, sample_2, 0);
        printf("linkat(%d, \"%s\", %d, \"%s\", 0) = %d %s (%m)\n",
               (int) fd_old, sample_1, (int) fd_new, sample_2, rc,
-              errno == ENOSYS ? "ENOSYS" : "EBADF");
+              errno2name());
 
        rc = syscall(__NR_linkat, -100, sample_1, -100, sample_2, -1L);
        printf("linkat(%s, \"%s\", %s, \"%s\", %s) = %d %s (%m)\n",
               "AT_FDCWD", sample_1, "AT_FDCWD", sample_2,
               "AT_SYMLINK_NOFOLLOW|AT_REMOVEDIR|AT_SYMLINK_FOLLOW"
               "|AT_NO_AUTOMOUNT|AT_EMPTY_PATH|0xffffe0ff",
-              rc, errno == ENOSYS ? "ENOSYS" : "EINVAL");
+              rc, errno2name());
 
        puts("+++ exited with 0 +++");
        return 0;
index 6aa6c9e494a7e92e42b4e12442eedf6845d8ccb7..7364d0fd10437c6cd3563d216ab86ee216c17b5f 100644 (file)
@@ -40,7 +40,7 @@ main(void)
 {
        assert(syscall(__NR_membarrier, 3, 255) == -1);
        printf("membarrier(0x3 /* MEMBARRIER_CMD_??? */, 255) = -1 %s (%m)\n",
-              errno == ENOSYS ? "ENOSYS" : "EINVAL");
+              errno2name());
        if (errno != ENOSYS) {
                /* the test needs to be updated? */
                assert(syscall(__NR_membarrier, 0, 0) == 1);
index 0a810c14f2e8654be0f5548d46d6a78b05044589..2ff449475a0ed187c895d89ef1196294c570cfd5 100644 (file)
@@ -14,7 +14,7 @@ main(void)
 
        long rc = syscall(__NR_mkdir, sample, 0600);
        printf("mkdir(\"%s\", 0600) = %ld %s (%m)\n",
-              sample, rc, errno == ENOSYS ? "ENOSYS" : "EEXIST");
+              sample, rc, errno2name());
 
        puts("+++ exited with 0 +++");
        return 0;
index 03f85c2dd41ab8279c82e30266dd32818db8bce1..dd3a1661b523c77f1ca6420cbd82f0c2d3a46cf2 100644 (file)
@@ -16,7 +16,7 @@ main(void)
        int rc = syscall(__NR_mkdirat, fd, sample, 0600);
        printf("mkdirat(%d, \"%s\", 0600) = %d %s (%m)\n",
               (int) fd, sample, rc,
-              errno == ENOSYS ? "ENOSYS" : "EBADF");
+              errno2name());
 
        puts("+++ exited with 0 +++");
        return 0;
index 48367fed3392f3b64b9aff14232cc60d93eebe65..198e556b3212f5638a8348dff2ce1c8ac83b70c3 100644 (file)
@@ -23,14 +23,14 @@ main(void)
        int rc = syscall(__NR_mknod, TMP_FILE, S_IFREG|0600, 0);
        printf("mknod(\"%s\", S_IFREG|0600) = %d %s (%m)\n",
               TMP_FILE, rc,
-              errno == ENOSYS ? "ENOSYS" : "EEXIST");
+              errno2name());
 
        const unsigned long dev =
                (unsigned long) 0xdeadbeef00000000 | makedev(1, 7);
        rc = syscall(__NR_mknod, TMP_FILE, S_IFCHR | 0400, dev);
        printf("mknod(\"%s\", S_IFCHR|0400, makedev(1, 7)) = %d %s (%m)\n",
               TMP_FILE, rc,
-              errno == ENOSYS ? "ENOSYS" : "EEXIST");
+              errno2name());
 
        puts("+++ exited with 0 +++");
        return 0;
index 4e850fdbfd67dc8d2753f7ec229a35b95c553442..b8f4f48736599a567a77f040d7d4ad2d8b90e88f 100644 (file)
@@ -40,7 +40,7 @@ main(void)
 {
        assert(syscall(__NR_mlock2, 0xdeadbeef, 0xdefaced, 0xffff) == -1);
        printf("mlock2(0xdeadbeef, 233811181, MLOCK_ONFAULT|0xfffe)"
-              " = -1 %s (%m)\n", errno == ENOSYS ? "ENOSYS" : "EINVAL");
+              " = -1 %s (%m)\n", errno2name());
        puts("+++ exited with 0 +++");
        return 0;
 }
index 97cfdcfc442fd861aeef2c79115509fd94162b81..2a27ce450033f17b42dc789278370029febd1a20 100644 (file)
@@ -42,7 +42,7 @@ main(void)
                puts("mlockall(MCL_CURRENT) = 0");
        } else {
                printf("mlockall(MCL_CURRENT) = -1 %s (%m)\n",
-                      errno == ENOMEM ? "ENOMEM" : "EPERM");
+                      errno2name());
        }
 
        puts("+++ exited with 0 +++");
index 8ceae3500ecdb72496c07b2f6111e8200b21a746..9f4fb4c2870a5c76bbef6df942cb0786e7261886 100644 (file)
@@ -70,13 +70,13 @@ main(void)
        if (rc != -1)
                perror_msg_and_fail("pwritev: expected -1, returned %ld", rc);
        tprintf("pwritev(1, %p, 42, 0) = -1 %s (%m)\n",
-               efault, errno == EINVAL ? "EINVAL" : "EFAULT");
+               efault, errno2name());
 
        rc = preadv(0, efault, 42, 0);
        if (rc != -1)
                perror_msg_and_fail("preadv: expected -1, returned %ld", rc);
        tprintf("preadv(0, %p, 42, 0) = -1 %s (%m)\n",
-               efault, errno == EINVAL ? "EINVAL" : "EFAULT");
+               efault, errno2name());
 
        static const char r0_c[] = "01234567";
        const char *r0_d = hexdump_strdup(r0_c);
@@ -108,7 +108,7 @@ main(void)
                                    rc);
        tprintf("pwritev(1, [{\"%s\", %u}, %p], 2, 0) = -1 %s (%m)\n",
                w2_c, LENGTH_OF(w2_c), w_iov + ARRAY_SIZE(w_iov_),
-               errno == EINVAL ? "EINVAL" : "EFAULT");
+               errno2name());
 
        const unsigned int w_len =
                LENGTH_OF(w0_c) + LENGTH_OF(w1_c) + LENGTH_OF(w2_c);
index 0c8afcbda35b25cf219d39b489980f111521f650..b0ecfe64765a46f16764d0bfb731965e054e3e0a 100644 (file)
@@ -118,7 +118,7 @@ main(void)
                print_iovec(iov + i, n, LEN - i);
                printf(", %u, %lld) = -1 %s (%m)\n",
                       n, (long long) offset + LEN + i,
-                      errno == EINVAL ? "EINVAL" : "EFAULT");
+                      errno2name());
        }
 
        iov->iov_base = iov + LEN * 2;
index a8af872998302949da8ef5fe0e69ac1a9441a1ee..08aea7af49238d7b6501ecc31f2fe7da586e91cc 100644 (file)
@@ -62,11 +62,11 @@ main(void)
 
        assert(writev(1, efault, 42) == -1);
        tprintf("writev(1, %p, 42) = -1 %s (%m)\n",
-               efault, errno == EINVAL ? "EINVAL" : "EFAULT");
+               efault, errno2name());
 
        assert(readv(0, efault, 42) == -1);
        tprintf("readv(0, %p, 42) = -1 %s (%m)\n",
-               efault, errno == EINVAL ? "EINVAL" : "EFAULT");
+               efault, errno2name());
 
        static const char r0_c[] = "01234567";
        const char *r0_d = hexdump_strdup(r0_c);
@@ -93,7 +93,7 @@ main(void)
        assert(writev(1, w_iov + ARRAY_SIZE(w_iov_) - 1, 2) == -1);
        tprintf("writev(1, [{\"%s\", %u}, %p], 2) = -1 %s (%m)\n",
                w2_c, LENGTH_OF(w2_c), w_iov + ARRAY_SIZE(w_iov_),
-               errno == EINVAL ? "EINVAL" : "EFAULT");
+               errno2name());
 
        const unsigned int w_len =
                LENGTH_OF(w0_c) + LENGTH_OF(w1_c) + LENGTH_OF(w2_c);
index 2fb88d64bd16af90f8fb1716b4d1e49104e813ad..a4469fc4b700827efe665fb303d4c79fb0da42c8 100644 (file)
@@ -16,7 +16,7 @@ main(void)
        int rc = syscall(__NR_rename, OLD_FILE, NEW_FILE);
        printf("rename(\"%s\", \"%s\") = %d %s (%m)\n",
               OLD_FILE, NEW_FILE, rc,
-              errno == ENOSYS ? "ENOSYS" : "ENOENT");
+              errno2name());
 
        puts("+++ exited with 0 +++");
        return 0;
index f17e9b01b3d3a4e6f18009ed752db3c7738d4b86..c7745b996359565ebcbe5963d5ac93ba77595081 100644 (file)
@@ -18,7 +18,7 @@ main(void)
        int rc = syscall(__NR_renameat, fd_old, OLD_FILE, fd_new, NEW_FILE);
        printf("renameat(%d, \"%s\", %d, \"%s\") = %d %s (%m)\n",
               (int) fd_old, OLD_FILE, (int) fd_new, NEW_FILE, rc,
-              errno == ENOSYS ? "ENOSYS" : "EBADF");
+              errno2name());
 
        puts("+++ exited with 0 +++");
        return 0;
index d968a2c5c37a2b791f0b1e878970e109090c8c74..d075a35e15461e574a337f922d0682f45583681c 100644 (file)
@@ -20,7 +20,7 @@ main(void)
        rc = syscall(__NR_sched_setparam, 0, param);
        printf("sched_setparam(0, [%d]) = %d %s (%m)\n",
               param->sched_priority, rc,
-              errno == EPERM ? "EPERM" : "EINVAL");
+              errno2name());
 
        puts("+++ exited with 0 +++");
        return 0;
index dbf3c1f6286cb69e6552148a02ea572ced45e25d..db638e68964b78332fcefa7a2f7c37d779a13700 100644 (file)
@@ -51,7 +51,7 @@ main(void)
        rc = syscall(__NR_sched_setscheduler, 0, SCHED_FIFO, param);
        printf("sched_setscheduler(0, SCHED_FIFO, [%d]) = %d %s (%m)\n",
               param->sched_priority, rc,
-              errno == EPERM ? "EPERM" : "EINVAL");
+              errno2name());
 
        puts("+++ exited with 0 +++");
        return 0;
index 0578f69b6331d8e7db9997dacab33632daf2a56e..46e6e99517f466c2434fd5b40b11f0a50ad72881 100644 (file)
@@ -88,7 +88,7 @@ main(void)
                errno = saved_errno;
                if (expected)
                        printf(") = -1 %s (%m)\n",
-                              errno == EPERM ? "EPERM" : "EINVAL");
+                              errno2name());
                else
                        printf(") = 0\n");
        }
index c6e1652ffddfacaa4230a4d9fbc2c7604733ac2b..9662b9dade6c1fd5cd84317bd597eff37a70205e 100644 (file)
@@ -29,7 +29,7 @@ main(void)
 
        shmat(id, NULL, SHM_REMAP);
        printf("%s(%d, NULL, SHM_REMAP) = -1 %s (%m)\n",
-              SHMAT, id, errno == ENOSYS ? "ENOSYS" : "EINVAL");
+              SHMAT, id, errno2name());
 
        void *shmaddr = shmat(id, NULL, SHM_RDONLY);
        if (shmaddr == (void *)(-1))
index ac24b2a71548c93119f8f8cfa425b2b558060e7b..81b5c9b904f54af6dd30078df164efdb39c546d4 100644 (file)
@@ -54,7 +54,7 @@ main(void)
        printf("splice(%d, [%lld], %d, [%lld], %zu, %s) = -1 %s (%m)\n",
               (int) fd_in, *off_in, (int) fd_out, *off_out, len,
               "SPLICE_F_MOVE|SPLICE_F_NONBLOCK|SPLICE_F_MORE|SPLICE_F_GIFT",
-              errno == ENOSYS ? "ENOSYS" : "EBADF");
+              errno2name());
        puts("+++ exited with 0 +++");
        return 0;
 }
index 37d055aa9e775cc0ddb7195e54d7951857fbd23e..aada5e5041d63abb997ed7961c6eda3116cafe97 100644 (file)
@@ -16,7 +16,7 @@ main(void)
        long rc = syscall(__NR_symlinkat, oldpath, fd, newpath);
        printf("symlinkat(\"%s\", %d, \"%s\") = %ld %s (%m)\n",
               oldpath, (int) fd, newpath, rc,
-              errno == ENOSYS ? "ENOSYS" : "EBADF");
+              errno2name());
 
        puts("+++ exited with 0 +++");
        return 0;
index 2c3848ca33f33942f0860eb85392602bff41ca27..4843a786611d7f4c856d6e1fc31dbc735a2c4351 100644 (file)
@@ -52,7 +52,7 @@ main(void)
               "sync_file_range", fd,
               (long long) offset,
               (long long) nbytes,
-              errno == ENOSYS ? "ENOSYS" : "EINVAL");
+              errno2name());
 
        puts("+++ exited with 0 +++");
        return 0;
index aa38c27be59e46c2ad29b6ff57fbea6a2fd1fadc..bc307a7a7234ffaa87963c241ccdf987758ed0ea 100644 (file)
@@ -52,7 +52,7 @@ main(void)
               "sync_file_range2", fd,
               (long long) offset,
               (long long) nbytes,
-              errno == ENOSYS ? "ENOSYS" : "EINVAL");
+              errno2name());
 
        puts("+++ exited with 0 +++");
        return 0;
index abdf38308af19e05174bcf5648d45512fa2a0244..12493b5f015b2427b34af32cacc46d21fd1f9fec 100644 (file)
@@ -50,7 +50,7 @@ main(void)
        printf("tee(%d, %d, %zu, %s) = -1 %s (%m)\n",
               (int) fd_in, (int) fd_out, len,
               "SPLICE_F_MOVE|SPLICE_F_NONBLOCK|SPLICE_F_MORE|SPLICE_F_GIFT",
-              errno == ENOSYS ? "ENOSYS" : "EBADF");
+              errno2name());
        puts("+++ exited with 0 +++");
        return 0;
 }
index 2a268a28d87e76396068bb196cd99d9962f18e81..8f3cd64c1a1492ef3299e3dc89a0c51781315763 100644 (file)
@@ -16,14 +16,14 @@ main(void)
        int rc = syscall(__NR_unlinkat, fd, sample, 0);
        printf("unlinkat(%d, \"%s\", 0) = %d %s (%m)\n",
               (int) fd, sample, rc,
-              errno == ENOSYS ? "ENOSYS" : "EBADF");
+              errno2name());
 
        rc = syscall(__NR_unlinkat, -100, sample, -1L);
        printf("unlinkat(%s, \"%s\", %s) = %d %s (%m)\n",
               "AT_FDCWD", sample,
               "AT_SYMLINK_NOFOLLOW|AT_REMOVEDIR|AT_SYMLINK_FOLLOW"
               "|AT_NO_AUTOMOUNT|AT_EMPTY_PATH|0xffffe0ff",
-              rc, errno == ENOSYS ? "ENOSYS" : "EINVAL");
+              rc, errno2name());
 
        puts("+++ exited with 0 +++");
        return 0;
index 5dc294bc1457c28d5b516e3512cf15af3d29d85e..a2f5375daf18ed58f1d77248e9ca52fd864b860d 100644 (file)
@@ -41,7 +41,7 @@ main(void)
 {
        assert(syscall(__NR_userfaultfd, 1 | O_NONBLOCK | O_CLOEXEC) == -1);
        printf("userfaultfd(O_NONBLOCK|O_CLOEXEC|0x1) = -1 %s (%m)\n",
-              errno == ENOSYS ? "ENOSYS" : "EINVAL");
+              errno2name());
        puts("+++ exited with 0 +++");
        return 0;
 }
index aefe5e95f5edca4cfa72b3b38a935a96c0e4661a..016387d70e48dddaa45f99ed6c227c9d23b01ce3 100644 (file)
@@ -24,7 +24,7 @@ main(void)
                printf("setpriority(PRIO_PROCESS, %d, 0) = 0\n", pid);
        } else {
                printf("setpriority(PRIO_PROCESS, %d, 0) = -1 %s (%m)\n",
-                      pid, errno == EPERM ? "EPERM" : "EACCES");
+                      pid, errno2name());
        }
 
        puts("+++ exited with 0 +++");