#define _GNU_SOURCE #include #include #include #include #include #include #include int main() { int retval, fd; if (mkfifo("fifo", 0666) < 0) { printf("create fifo error\n"); return 1; } fd = open("fifo", O_RDWR); if (fd < 0) { printf("open fifo error\n"); remove("fifo"); return 1; } retval = posix_fadvise(fd, 0, 0, POSIX_FADV_NORMAL); if (retval) { printf("Expected fail - The fd argument is associated with a pipe or FIFO.\n"); if (retval != ESPIPE) printf("Unexpected ERRNO %d (Expected %d)\n", retval, ESPIPE); } else printf("Unexpected success - The fd argument is associated with a pipe or FIFO.\n"); close(fd); remove("fifo"); if (retval) return 0; return 1; }