8 /* backward compat in case it's not defined */
10 #define O_TMPFILE (020000000|O_DIRECTORY)
15 * Check if the kernel support O_TMPFILE.
19 main(int argc, char *argv[])
25 fprintf(stderr, "Usage: %s dir\n", argv[0]);
28 if (stat(argv[1], &buf) < 0) {
32 if (!S_ISDIR(buf.st_mode)) {
33 fprintf(stderr, "\"%s\" is not a directory\n", argv[1]);
37 fd = open(argv[1], O_TMPFILE | O_WRONLY, 0666);
39 if (errno == EISDIR) {
41 "The kernel doesn't support O_TMPFILE\n");
43 } else if (errno == EOPNOTSUPP) {
45 "The filesystem doesn't support O_TMPFILE\n");