ATF_REQUIRE_ERRNO
#define ATF_CHECK_ERRNO ATF_REQUIRE_ERRNO
ATF_REQUIRE_ERRNO(ENAMETOOLONG, chroot(buf) == -1);
ATF_REQUIRE_ERRNO(EFAULT, chroot((void *)-1) == -1);
ATF_REQUIRE_ERRNO(ENOENT, chroot("/a/b/c/d/e/f/g/h/i/j") == -1);
ATF_REQUIRE_ERRNO(EBADF, fchroot(-1) == -1);
ATF_REQUIRE_ERRNO(ENOTDIR, fchroot(fd) == -1);
ATF_REQUIRE_ERRNO(EBADF, dup2(-1, -1) == -1);
ATF_REQUIRE_ERRNO(EBADF, dup2(fd, -1) == -1);
ATF_REQUIRE_ERRNO(EBADF, dup2(-1, fd) == -1);
ATF_REQUIRE_ERRNO(EBADF, dup2(STDERR_FILENO, res.rlim_cur + 1) == -1);
ATF_REQUIRE_ERRNO(EINVAL, dup3(-1, -1, O_CLOEXEC) == -1);
ATF_REQUIRE_ERRNO(EBADF, dup3(-1, -1, O_CLOEXEC) == -1);
ATF_REQUIRE_ERRNO(EBADF, dup3(fd, -1, O_CLOEXEC) == -1);
ATF_REQUIRE_ERRNO(EBADF, dup3(-1, fd, O_CLOEXEC) == -1);
ATF_REQUIRE_ERRNO(EINVAL, dup3(fd, 1, O_NOFOLLOW) == -1);
ATF_REQUIRE_ERRNO(EBADF, dup3(STDERR_FILENO,
ATF_REQUIRE_ERRNO(EBADF, dup(-1) == -1);
ATF_REQUIRE_ERRNO(EINVAL, getitimer(-1, &it) == -1);
ATF_REQUIRE_ERRNO(EINVAL, getitimer(INT_MAX, &it) == -1);
ATF_REQUIRE_ERRNO(EFAULT, getitimer(ITIMER_REAL, (void *)-1) == -1);
ATF_REQUIRE_ERRNO(EINVAL, setitimer(-1, &it, &ot) == -1);
ATF_REQUIRE_ERRNO(EINVAL, setitimer(INT_MAX, &it, &ot) == -1);
ATF_REQUIRE_ERRNO(EFAULT, setitimer(ITIMER_REAL,(void*)-1, &ot) == -1);
ATF_REQUIRE_ERRNO(EFAULT, gettimeofday((void *)-1, NULL) != 0);
ATF_REQUIRE_ERRNO(EOPNOTSUPP, true);
ATF_REQUIRE_ERRNO(EEXIST, link(path, pathl) == -1);
ATF_REQUIRE_ERRNO(ENAMETOOLONG, link(buf, "xxx") == -1);
ATF_REQUIRE_ERRNO(ENOENT, link(path, "/d/c/b/a") == -1);
ATF_REQUIRE_ERRNO(ENOENT, link("/a/b/c/d", path) == -1);
ATF_REQUIRE_ERRNO(ENOENT, link("/a/b/c/d", "/d/c/b/a") == -1);
ATF_REQUIRE_ERRNO(EFAULT, link(path, (const char *)-1) == -1);
ATF_REQUIRE_ERRNO(EFAULT, link((const char *)-1, "xxx") == -1);
ATF_REQUIRE_ERRNO(EACCES,
ATF_REQUIRE_ERRNO(ENOTSOCK, listen(fdc, 1) == -1);
ATF_REQUIRE_ERRNO(EINVAL, listen(fdb, 1) == -1);
ATF_REQUIRE_ERRNO(EBADF, connect(fdb,
ATF_REQUIRE_ERRNO(EEXIST, mkdir("/etc", 0500) == -1);
ATF_REQUIRE_ERRNO(EFAULT, mkdir((void *)-1, 0500) == -1);
ATF_REQUIRE_ERRNO(ENAMETOOLONG, mkdir(buf, 0500) == -1);
ATF_REQUIRE_ERRNO(ENOENT, mkdir("/a/b/c/d/e/f/g/h/i/j/k", 0500) == -1);
ATF_REQUIRE_ERRNO(EACCES, mkdir("/usr/__nonexistent__", 0500) == -1);
ATF_REQUIRE_ERRNO(EFAULT, mkfifo((char *)-1, 0600) == -1);
ATF_REQUIRE_ERRNO(EEXIST, mkfifo("/etc/passwd", 0600) == -1);
ATF_REQUIRE_ERRNO(EEXIST, mkfifo(path, 0600) == -1);
ATF_REQUIRE_ERRNO(ENAMETOOLONG, mkfifo(buf, 0600) == -1);
ATF_REQUIRE_ERRNO(ENOENT, mkfifo("/a/b/c/d/e/f/g", 0600) == -1);
ATF_REQUIRE_ERRNO(ENXIO, open(path, O_WRONLY | O_NONBLOCK) == -1);
ATF_REQUIRE_ERRNO(EACCES, mkfifo("/root/fifo", 0600) == -1);
ATF_REQUIRE_ERRNO(EFTYPE, chmod(path, 1777) == -1);
ATF_REQUIRE_ERRNO(EEXIST, mknod(path, S_IFCHR, 0) == -1);
ATF_REQUIRE_ERRNO(EPERM, mknod(path, S_IFCHR, 0) == -1);
ATF_REQUIRE_ERRNO(EPERM, mknod(path, S_IFBLK, 0) == -1);
ATF_REQUIRE_ERRNO(EINVAL, mknod(path, S_IFCHR, -1) == -1);
ATF_REQUIRE_ERRNO(ENAMETOOLONG, mknod(buf, S_IFCHR, 0) == -1);
ATF_REQUIRE_ERRNO(EFAULT, mknod((char *)-1, S_IFCHR, 0) == -1);
ATF_REQUIRE_ERRNO(ENOENT, mknod("/a/b/c/d/e/f/g", S_IFCHR, 0) == -1);
ATF_REQUIRE_ERRNO(EEXIST,
ATF_REQUIRE_ERRNO(ENOMEM, mlock(NULL, page) == -1);
ATF_REQUIRE_ERRNO(ENOMEM, mlock((char *)0, page) == -1);
ATF_REQUIRE_ERRNO(EINVAL, mlock((char *)-1, page) == -1);
ATF_REQUIRE_ERRNO(ENOMEM, mlock((char *)-1, page) == -1);
ATF_REQUIRE_ERRNO(ENOMEM, munlock(NULL, page) == -1);
ATF_REQUIRE_ERRNO(ENOMEM, munlock((char *)0, page) == -1);
ATF_REQUIRE_ERRNO(EINVAL, munlock((char *)-1, page) == -1);
ATF_REQUIRE_ERRNO(ENOMEM, munlock((char *)-1, page) == -1);
ATF_REQUIRE_ERRNO(ENOMEM, munlock(buf, page) == -1);
ATF_REQUIRE_ERRNO(ENOMEM, mlock(invalid_ptr, page) == -1);
ATF_REQUIRE_ERRNO(ENOMEM, munlock(invalid_ptr, page) == -1);
ATF_REQUIRE_ERRNO(EINVAL, msgctl(id, INT_MAX, &msgds) == -1);
ATF_REQUIRE_ERRNO(EFAULT, msgctl(id, IPC_STAT, (void *)-1) == -1);
ATF_REQUIRE_ERRNO(EINVAL, msgctl(-1, cmd[i], &msgds) == -1);
ATF_REQUIRE_ERRNO(ENOMSG, msgrcv(id, &msg,
ATF_REQUIRE_ERRNO(EFAULT, msgrcv(id, (void *)-1,
ATF_REQUIRE_ERRNO(EINVAL, msgrcv(-1, &msg,
ATF_REQUIRE_ERRNO(EINVAL, msgrcv(-1, &msg,
ATF_REQUIRE_ERRNO(E2BIG, msgrcv(id, &r,
ATF_REQUIRE_ERRNO(EFAULT, msgsnd(id, (void *)-1,
ATF_REQUIRE_ERRNO(EINVAL, msgsnd(-1, &msg,
ATF_REQUIRE_ERRNO(EINVAL, msgsnd(-1, &msg,
ATF_REQUIRE_ERRNO(EINVAL, msgsnd(id, &msg,
ATF_REQUIRE_ERRNO(EINVAL, pipe2(fd, O_ASYNC) == -1);
ATF_REQUIRE_ERRNO(EFAULT, poll((struct pollfd *)-1, 1, -1) == -1);
ATF_REQUIRE_ERRNO(EINVAL, poll(&pfd, 1, -2) == -1);
ATF_REQUIRE_ERRNO(EFAULT, POLLTS((void *)-1, 1, &timeout, NULL) == -1);
ATF_REQUIRE_ERRNO(EINVAL, POLLTS(&pfd, 1, &timeout, NULL) == -1);
ATF_REQUIRE_ERRNO(EPERM, ptrace(PT_ATTACH, 1, NULL, 0) == -1);
ATF_REQUIRE_ERRNO(EINVAL, ptrace(PT_ATTACH, getpid(), NULL, 0) == -1);
ATF_REQUIRE_ERRNO(EINVAL,
ATF_REQUIRE_ERRNO(EPERM,
ATF_REQUIRE_ERRNO(EBUSY, ptrace(PT_TRACE_ME, 0, NULL, 0) == -1);
ATF_REQUIRE_ERRNO(EPERM, ptrace(PT_ATTACH, 0, NULL, 0) == -1);
ATF_REQUIRE_ERRNO(EPERM, ptrace(PT_ATTACH, 1, NULL, 0) == -1);
ATF_REQUIRE_ERRNO(EFAULT, revoke((char *)-1) == -1);
ATF_REQUIRE_ERRNO(ENAMETOOLONG, revoke(buf) == -1);
ATF_REQUIRE_ERRNO(ENOTTY, revoke("/etc/passwd") == -1);
ATF_REQUIRE_ERRNO(EPERM, revoke("/etc/passwd") == -1);
ATF_REQUIRE_ERRNO(ENOENT, revoke("/etc/xxx/yyy") == -1);
ATF_REQUIRE_ERRNO(EBADF, fstat(-1, &st) == -1);
ATF_REQUIRE_ERRNO(ENAMETOOLONG, stat(buf, &st) == -1);
ATF_REQUIRE_ERRNO(ENAMETOOLONG, lstat(buf, &st) == -1);
ATF_REQUIRE_ERRNO(EFAULT, stat((void *)-1, &st) == -1);
ATF_REQUIRE_ERRNO(EFAULT, lstat((void *)-1, &st) == -1);
ATF_REQUIRE_ERRNO(EFAULT, stat("/etc/passwd", (void *)-1) == -1);
ATF_REQUIRE_ERRNO(EFAULT, lstat("/etc/passwd", (void *)-1) == -1);
ATF_REQUIRE_ERRNO(ENOENT, stat("/a/b/c/d/e/f/g/h/i/j/k", &st) == -1);
ATF_REQUIRE_ERRNO(ENOENT, lstat("/a/b/c/d/e/f/g/h/i/j/k", &st) == -1);
ATF_REQUIRE_ERRNO(EINPROGRESS,
ATF_REQUIRE_ERRNO(EBADF, ftruncate(-1, 999) == -1);
ATF_REQUIRE_ERRNO(EINVAL, ftruncate(fd, 999) == -1);
ATF_REQUIRE_ERRNO(EFAULT, truncate((void *)-1, 999) == -1);
ATF_REQUIRE_ERRNO(EISDIR, truncate("/tmp", 999) == -1);
ATF_REQUIRE_ERRNO(ENOENT, truncate("/a/b/c/d/e/f/g", 999) == -1);
ATF_REQUIRE_ERRNO(EACCES, truncate(buf, 999) == -1);
ATF_REQUIRE_ERRNO(ENOENT, open(path, O_RDONLY) == -1);
ATF_REQUIRE_ERRNO(EACCES, unlink("/root/.profile") == -1);
ATF_REQUIRE_ERRNO(ENOENT, open(path, O_RDONLY) == -1);
ATF_REQUIRE_ERRNO(ENAMETOOLONG, unlink(buf) == -1);
ATF_REQUIRE_ERRNO(ENOENT, unlink("/a/b/c/d/e/f/g/h/i/j/k/l/m") == -1);
ATF_REQUIRE_ERRNO(ECHILD,
* ATF_REQUIRE_ERRNO(ECHILD,
ATF_REQUIRE_ERRNO(ECHILD,
ATF_REQUIRE_ERRNO(ECHILD,
ATF_REQUIRE_ERRNO(ECHILD,
ATF_REQUIRE_ERRNO(ECHILD,
ATF_REQUIRE_ERRNO(ECHILD,
ATF_REQUIRE_ERRNO(ECHILD, wait(NULL) == -1);
ATF_REQUIRE_ERRNO(ECHILD, waitpid(WAIT_ANY, NULL, TWAIT_OPTION) == -1);
ATF_REQUIRE_ERRNO(ECHILD,
ATF_REQUIRE_ERRNO(ECHILD, wait3(NULL, TWAIT_OPTION, NULL) == -1);
ATF_REQUIRE_ERRNO(EBADF, write(-1, wbuf, sizeof(wbuf)) == -1);
ATF_REQUIRE_ERRNO(0, write(fd, wbuf, 3) == 3);
ATF_REQUIRE_ERRNO(EINVAL, write(fd, wbuf, SIZE_MAX) == -1);
ATF_REQUIRE_ERRNO(EFAULT, write(fd, (void *)-1, 1) == -1);
#define ATF_CHECK_ERRNO ATF_REQUIRE_ERRNO