فهرست منبع

add O_PATH/O_SEARCH support to fcntl.h

I'm not 100% sure that Linux's O_PATH meets the POSIX requirements for
O_SEARCH, but it seems very close if not perfect. and old kernels
ignore it, so O_SEARCH will still work as desired as long as the
caller has read permissions to the directory.
Rich Felker 12 سال پیش
والد
کامیت
b238b37a0f
5فایلهای تغییر یافته به همراه9 افزوده شده و 1 حذف شده
  1. 2 0
      arch/arm/bits/fcntl.h
  2. 2 0
      arch/i386/bits/fcntl.h
  3. 2 0
      arch/mips/bits/fcntl.h
  4. 2 0
      arch/x86_64/bits/fcntl.h
  5. 1 1
      include/fcntl.h

+ 2 - 0
arch/arm/bits/fcntl.h

@@ -10,12 +10,14 @@
 #define O_DIRECTORY  040000
 #define O_NOFOLLOW  0100000
 #define O_CLOEXEC  02000000
+#define O_SEARCH  010000000
 
 #define O_ASYNC      020000
 #define O_DIRECT    0200000
 #define O_LARGEFILE 0400000
 #define O_NOATIME  01000000
 #define O_NDELAY O_NONBLOCK
+#define O_PATH    010000000
 
 #define F_DUPFD  0
 #define F_GETFD  1

+ 2 - 0
arch/i386/bits/fcntl.h

@@ -10,12 +10,14 @@
 #define O_DIRECTORY 0200000
 #define O_NOFOLLOW  0400000
 #define O_CLOEXEC  02000000
+#define O_SEARCH  010000000
 
 #define O_ASYNC      020000
 #define O_DIRECT     040000
 #define O_LARGEFILE 0100000
 #define O_NOATIME  01000000
 #define O_NDELAY O_NONBLOCK
+#define O_PATH    010000000
 
 #define F_DUPFD  0
 #define F_GETFD  1

+ 2 - 0
arch/mips/bits/fcntl.h

@@ -14,6 +14,8 @@
 #define O_NOFOLLOW  0400000
 #define O_NOATIME  01000000
 #define O_CLOEXEC  02000000
+#define O_PATH    010000000
+#define O_SEARCH  010000000
 
 #define O_NDELAY O_NONBLOCK
 

+ 2 - 0
arch/x86_64/bits/fcntl.h

@@ -10,12 +10,14 @@
 #define O_DIRECTORY 0200000
 #define O_NOFOLLOW  0400000
 #define O_CLOEXEC  02000000
+#define O_SEARCH  010000000
 
 #define O_ASYNC      020000
 #define O_DIRECT     040000
 #define O_LARGEFILE       0
 #define O_NOATIME  01000000
 #define O_NDELAY O_NONBLOCK
+#define O_PATH    010000000
 
 #define F_DUPFD  0
 #define F_GETFD  1

+ 1 - 1
include/fcntl.h

@@ -37,7 +37,7 @@ int openat(int, const char *, int, ...);
 int posix_fadvise(int, off_t, off_t, int);
 int posix_fallocate(int, off_t, off_t);
 
-#define O_ACCMODE 03
+#define O_ACCMODE (O_RDWR|O_SEARCH)
 #define O_RDONLY  00
 #define O_WRONLY  01
 #define O_RDWR    02