[Glibc-bsd-commits] r2497 - trunk/glibc-ports/kfreebsd/bits

Aurelien Jarno aurel32 at alioth.debian.org
Tue May 5 16:18:08 UTC 2009


Author: aurel32
Date: 2009-05-05 16:18:08 +0000 (Tue, 05 May 2009)
New Revision: 2497

Modified:
   trunk/glibc-ports/kfreebsd/bits/fcntl.h
Log:
Update bits/fcntl.h from Linux version

Partly solve libgphoto2 FTBFS


Modified: trunk/glibc-ports/kfreebsd/bits/fcntl.h
===================================================================
--- trunk/glibc-ports/kfreebsd/bits/fcntl.h	2009-05-05 09:04:39 UTC (rev 2496)
+++ trunk/glibc-ports/kfreebsd/bits/fcntl.h	2009-05-05 16:18:08 UTC (rev 2497)
@@ -18,52 +18,56 @@
    02111-1307 USA.  */
 
 #ifndef	_FCNTL_H
-#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
 #endif
 
 #include <sys/types.h>
+#include <bits/wordsize.h>
+#ifdef __USE_GNU
+# include <bits/uio.h>
+#endif
 
-/* File access modes for `open' and `fcntl'.  */
-#define	O_RDONLY	0	/* Open read-only.  */
-#define	O_WRONLY	1	/* Open write-only.  */
-#define	O_RDWR		2	/* Open read/write.  */
 
+/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
+   located on an ext2 file system */
+#define O_ACCMODE	   0003
+#define O_RDONLY	     00
+#define O_WRONLY	     01
+#define O_RDWR		     02
+#define O_CREAT		  01000	/* not fcntl */
+#define O_EXCL		  04000	/* not fcntl */
+#define O_NOCTTY	0100000	/* not fcntl */
+#define O_TRUNC		  02000	/* not fcntl */
+#define O_APPEND	    010
+#define O_NONBLOCK	     04
+#define O_NDELAY	O_NONBLOCK
+#define O_SYNC		   0200
+#define O_FSYNC		 O_SYNC
+#define O_ASYNC		   0100
 
-/* Bits OR'd into the second argument to open.  */
-#define	O_CREAT		0x0200	/* Create file if it doesn't exist.  */
-#define	O_EXCL		0x0800	/* Fail if file already exists.  */
-#define	O_TRUNC		0x0400	/* Truncate file to zero length.  */
-#define	O_NOCTTY	0x8000	/* Don't assign a controlling terminal.  */
-#ifdef	__USE_MISC
-#define	O_ASYNC		0x0040	/* Send SIGIO to owner when data is ready.  */
-#define	O_FSYNC		0x0080	/* Synchronous writes.  */
-#define	O_SYNC		O_FSYNC
-#define	O_SHLOCK	0x0010	/* Open with shared file lock.  */
-#define	O_EXLOCK	0x0020	/* Open with shared exclusive lock.  */
-#define O_NOFOLLOW	0x0100	/* Don't follow symlinks.  */
-#define	O_DIRECT    0x00010000  /* Attempt to bypass buffer cache */
+#ifdef __USE_GNU
+# define O_DIRECT	0200000	/* Direct disk access.	*/
+enum { O_DIRECTORY = 0 };	/* Must be a directory.	 */
+enum { O_NOATIME = 0};          /* Do not set atime.  */
+# define O_NOFOLLOW	   0400	/* Do not follow links.	 */
 #endif
 
-enum { O_DIRECTORY = 0 };
-
-/* File status flags for `open' and `fcntl'.  */
-#define	O_APPEND	0x0008	/* Writes append to the file.  */
-#define	O_NONBLOCK	0x0004	/* Non-blocking I/O.  */
-
 #ifdef __USE_BSD
-#define	O_NDELAY	O_NONBLOCK
+#define O_SHLOCK	    020 /* Open with shared file lock.  */
+#define O_EXLOCK	    040 /* Open with shared exclusive lock.  */
 #endif
 
-/* Since 'off_t' is 64-bit, O_LARGEFILE is a no-op.  */
-#define O_LARGEFILE	0
-
-/* FreeBSD doesn't have smaller grained synchronicity control than per file.
-   fdatasync() is equivalent to fsync(), so we define O_DSYNC == O_SYNC.  */
+/* For now FreeBSD has synchronisity options for data and read operations.
+   We define the symbols here but let them do the same as O_SYNC since
+   this is a superset.	*/
 #if defined __USE_POSIX199309 || defined __USE_UNIX98
 # define O_DSYNC	O_SYNC	/* Synchronize data.  */
-# define O_RSYNC	O_SYNC	/* Synchronize read operations.  */
+# define O_RSYNC	O_SYNC	/* Synchronize read operations.	 */
 #endif
 
+/* Since 'off_t' is 64-bit, O_LARGEFILE is a no-op.  */
+#define O_LARGEFILE	0
+
 #ifdef __USE_BSD
 /* Bits in the file status flags returned by F_GETFL.
    These are all the O_* flags, plus FREAD and FWRITE, which are
@@ -71,52 +75,50 @@
    given to `open'.  */
 #define FREAD		1
 #define	FWRITE		2
-
-/* Traditional BSD names the O_* bits.  */
-#define FASYNC		O_ASYNC
-#define FCREAT		O_CREAT
-#define FEXCL		O_EXCL
-#define FTRUNC		O_TRUNC
-#define FNOCTTY		O_NOCTTY
-#define FFSYNC		O_FSYNC
-#define FSYNC		O_SYNC
-#define FAPPEND		O_APPEND
-#define FNONBLOCK	O_NONBLOCK
-#define FNDELAY		O_NDELAY
 #endif
 
-/* Mask for file access modes.  This is system-dependent in case
-   some system ever wants to define some other flavor of access.  */
-#define	O_ACCMODE	(O_RDONLY|O_WRONLY|O_RDWR)
+/* Values for the second argument to `fcntl'.  */
+#define F_DUPFD		0	/* Duplicate file descriptor.  */
+#define F_GETFD		1	/* Get file descriptor flags.  */
+#define F_SETFD		2	/* Set file descriptor flags.  */
+#define F_GETFL		3	/* Get file status flags.  */
+#define F_SETFL		4	/* Set file status flags.  */
+#define F_GETLK		7	/* Get record locking info.  */
+#define F_SETLK		8	/* Set record locking info (non-blocking).  */
+#define F_SETLKW	9	/* Set record locking info (blocking).	*/
+/* Not necessary, we always have 64-bit offsets.  */
+#define F_GETLK64	7	/* Get record locking info.  */
+#define F_SETLK64	8	/* Set record locking info (non-blocking).  */
+#define F_SETLKW64	9	/* Set record locking info (blocking).	*/
 
-/* Values for the second argument to `fcntl'.  */
-#define	F_DUPFD	  	0	/* Duplicate file descriptor.  */
-#define	F_GETFD		1	/* Get file descriptor flags.  */
-#define	F_SETFD		2	/* Set file descriptor flags.  */
-#define	F_GETFL		3	/* Get file status flags.  */
-#define	F_SETFL		4	/* Set file status flags.  */
-#ifdef __USE_BSD
-#define	F_GETOWN	5	/* Get owner (receiver of SIGIO).  */
-#define	F_SETOWN	6	/* Set owner (receiver of SIGIO).  */
+#if defined __USE_BSD || defined __USE_UNIX98
+# define F_SETOWN	5	/* Get owner of socket (receiver of SIGIO).  */
+# define F_GETOWN	6	/* Set owner of socket (receiver of SIGIO).  */
 #endif
-#define	F_GETLK		7	/* Get record locking info.  */
-#define	F_SETLK		8	/* Set record locking info (non-blocking).  */
-#define	F_SETLKW	9	/* Set record locking info (blocking).  */
 
-/* File descriptor flags used with F_GETFD and F_SETFD.  */
-#define	FD_CLOEXEC	1	/* Close on exec.  */
+/* For F_[GET|SET]FD.  */
+#define FD_CLOEXEC	1	/* actually anything with low bit set goes */
 
+/* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
+#define F_RDLCK		1	/* Read lock.  */
+#define F_WRLCK		3	/* Write lock.	*/
+#define F_UNLCK		2	/* Remove lock.	 */
 
-#include <bits/types.h>
+#ifdef __USE_BSD
+/* Operations for bsd flock(), also used by the kernel implementation.	*/
+# define LOCK_SH	1	/* shared lock */
+# define LOCK_EX	2	/* exclusive lock */
+# define LOCK_NB	4	/* or'd with one of the above to prevent
+				   blocking */
+# define LOCK_UN	8	/* remove lock */
+#endif
 
-/* The structure describing an advisory lock.  This is the type of the third
-   argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests.  */
 struct flock
   {
     __off_t l_start;	/* Offset where the lock begins.  */
     __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
     __pid_t l_pid;	/* Process holding the lock.  */
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
     short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
   };
 
@@ -126,20 +128,24 @@
     __off64_t l_start;	/* Offset where the lock begins.  */
     __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
     __pid_t l_pid;	/* Process holding the lock.  */
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
     short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
   };
 #endif
 
-/* Values for the `l_type' field of a `struct flock'.  */
-#define	F_RDLCK	1	/* Read lock.  */
-#define	F_WRLCK	3	/* Write lock.  */
-#define	F_UNLCK	2	/* Remove lock.  */
+/* Define some more compatibility macros to be backward compatible with
+   BSD systems which did not managed to hide these kernel macros.  */
+#ifdef	__USE_BSD
+# define FAPPEND	O_APPEND
+# define FFSYNC		O_FSYNC
+# define FASYNC		O_ASYNC
+# define FNONBLOCK	O_NONBLOCK
+# define FNDELAY	O_NDELAY
 
-#ifdef __USE_BSD
-/* Operations for flock().  */
-# define LOCK_SH 1	/* shared lock */
-# define LOCK_EX 2	/* exclusive lock */
-# define LOCK_NB 4	/* or'd with one of the above to prevent blocking */
-# define LOCK_UN 8	/* remove lock */
-#endif
+#define FCREAT		O_CREAT
+#define FEXCL		O_EXCL
+#define FTRUNC		O_TRUNC
+#define FNOCTTY		O_NOCTTY
+#define FSYNC		O_SYNC
+#endif /* Use BSD.  */
+




More information about the Glibc-bsd-commits mailing list