|
|
ce426f |
Do not expose O_TMPFILE in a public header.
|
|
|
ce426f |
|
|
|
ce426f |
Adjust tst-open-tmpfile so that it exits with 0 in case of missing
|
|
|
ce426f |
kernel support.
|
|
|
ce426f |
|
|
|
ce426f |
Index: b/io/tst-open-tmpfile.c
|
|
|
ce426f |
===================================================================
|
|
|
ce426f |
--- a/io/tst-open-tmpfile.c
|
|
|
ce426f |
+++ b/io/tst-open-tmpfile.c
|
|
|
ce426f |
@@ -33,7 +33,6 @@ static int do_test (void);
|
|
|
ce426f |
#define TEST_FUNCTION do_test ()
|
|
|
ce426f |
#include "../test-skeleton.c"
|
|
|
ce426f |
|
|
|
ce426f |
-#ifdef O_TMPFILE
|
|
|
ce426f |
typedef int (*wrapper_func) (const char *, int, mode_t);
|
|
|
ce426f |
|
|
|
ce426f |
/* Error-checking wrapper for the open function, compatible with the
|
|
|
ce426f |
@@ -157,7 +156,7 @@ static void
|
|
|
ce426f |
check_wrapper_flags_mode (const char *op, wrapper_func wrapper,
|
|
|
ce426f |
const char *path, int flags, mode_t mode)
|
|
|
ce426f |
{
|
|
|
ce426f |
- int fd = wrapper (path, flags | O_TMPFILE, mode);
|
|
|
ce426f |
+ int fd = wrapper (path, flags | __O_TMPFILE, mode);
|
|
|
ce426f |
struct stat64 st;
|
|
|
ce426f |
if (fstat64 (fd, &st) != 0)
|
|
|
ce426f |
{
|
|
|
ce426f |
@@ -257,20 +256,20 @@ check_wrapper (const char *op, wrapper_f
|
|
|
ce426f |
}
|
|
|
ce426f |
|
|
|
ce426f |
/* Verify that the directory at PATH supports O_TMPFILE. Exit with
|
|
|
ce426f |
- status 77 (unsupported) if the kernel does not support O_TMPFILE.
|
|
|
ce426f |
- Even with kernel support, not all file systems O_TMPFILE, so return
|
|
|
ce426f |
- true if the directory supports O_TMPFILE, false if not. */
|
|
|
ce426f |
+ status 0 if the kernel does not support O_TMPFILE. Even with
|
|
|
ce426f |
+ kernel support, not all file systems O_TMPFILE, so return true if
|
|
|
ce426f |
+ the directory supports O_TMPFILE, false if not. */
|
|
|
ce426f |
static bool
|
|
|
ce426f |
probe_path (const char *path)
|
|
|
ce426f |
{
|
|
|
ce426f |
- int fd = openat (AT_FDCWD, path, O_TMPFILE | O_RDWR, 0);
|
|
|
ce426f |
+ int fd = openat (AT_FDCWD, path, __O_TMPFILE | O_RDWR, 0);
|
|
|
ce426f |
if (fd < 0)
|
|
|
ce426f |
{
|
|
|
ce426f |
if (errno == EISDIR)
|
|
|
ce426f |
/* The system does not support O_TMPFILE. */
|
|
|
ce426f |
{
|
|
|
ce426f |
printf ("info: kernel does not support O_TMPFILE\n");
|
|
|
ce426f |
- exit (77);
|
|
|
ce426f |
+ exit (0);
|
|
|
ce426f |
}
|
|
|
ce426f |
if (errno == EOPNOTSUPP)
|
|
|
ce426f |
{
|
|
|
ce426f |
@@ -291,29 +290,14 @@ do_test (void)
|
|
|
ce426f |
const char *paths[] = { ".", "/dev/shm", "/tmp",
|
|
|
ce426f |
getenv ("TEST_TMPFILE_PATH"),
|
|
|
ce426f |
NULL };
|
|
|
ce426f |
- bool supported = false;
|
|
|
ce426f |
for (int i = 0; paths[i] != NULL; ++i)
|
|
|
ce426f |
if (probe_path (paths[i]))
|
|
|
ce426f |
{
|
|
|
ce426f |
- supported = true;
|
|
|
ce426f |
check_wrapper ("open", wrap_open, paths[i]);
|
|
|
ce426f |
check_wrapper ("openat", wrap_openat, paths[i]);
|
|
|
ce426f |
check_wrapper ("open64", wrap_open64, paths[i]);
|
|
|
ce426f |
check_wrapper ("openat64", wrap_openat64, paths[i]);
|
|
|
ce426f |
}
|
|
|
ce426f |
|
|
|
ce426f |
- if (!supported)
|
|
|
ce426f |
- return 77;
|
|
|
ce426f |
-
|
|
|
ce426f |
return 0;
|
|
|
ce426f |
}
|
|
|
ce426f |
-
|
|
|
ce426f |
-#else /* !O_TMPFILE */
|
|
|
ce426f |
-
|
|
|
ce426f |
-static int
|
|
|
ce426f |
-do_test (void)
|
|
|
ce426f |
-{
|
|
|
ce426f |
- return 77;
|
|
|
ce426f |
-}
|
|
|
ce426f |
-
|
|
|
ce426f |
-#endif /* O_TMPFILE */
|
|
|
ce426f |
Index: b/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
|
|
|
ce426f |
===================================================================
|
|
|
ce426f |
--- a/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
|
|
|
ce426f |
+++ b/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
|
|
|
ce426f |
@@ -131,7 +131,6 @@
|
|
|
ce426f |
# define O_DIRECT __O_DIRECT /* Direct disk access. */
|
|
|
ce426f |
# define O_NOATIME __O_NOATIME /* Do not set atime. */
|
|
|
ce426f |
# define O_PATH __O_PATH /* Resolve pathname but do not open file. */
|
|
|
ce426f |
-# define O_TMPFILE __O_TMPFILE /* Atomically create nameless file. */
|
|
|
ce426f |
#endif
|
|
|
ce426f |
|
|
|
ce426f |
/* For now, Linux has no separate synchronicitiy options for read
|