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