blob: c74039558e3a7684749d436311831ed96fb3cfae [file] [log] [blame]
Elliott Hughesed398002017-06-21 14:41:24 -07001#include <errno.h>
2#include <fcntl.h>
3#include <stdio.h>
4
5#define BAD_FD 42
6
7int main() {
8 int x;
9
10 (void)posix_fadvise(x, 1, 2, POSIX_FADV_NORMAL);
11 (void)posix_fadvise(BAD_FD, x, 2, POSIX_FADV_NORMAL);
12 (void)posix_fadvise(BAD_FD, 1, x, POSIX_FADV_NORMAL);
13 (void)posix_fadvise(BAD_FD, 1, 2, x);
14
15 x = posix_fadvise(BAD_FD, 1, 2, POSIX_FADV_NORMAL);
16
17 if (x != EBADF)
18 fprintf(stderr, "Unexpected return value: %d\n", x);
19
20 return 0;
21}