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