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