This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] libc-compat.h for <bits/fcntl-linux.h>


Hello everyone,
  I've been doing some kernel hacking and added some new flags to the
Linux kernel. I want to use these flags in userland without having to in
an additional header (<asm-generic/fcntl.h>) and even then, there are
conflicts, because almost everything is already defined.

  As such, I filed a feature request (20050) and was informed about
about the process to have compatibility.

  I've attached a patch that shouldn't break anything. Incidentally,
everything in the Linux Kernel matches what is done by glibc.

  If I need to provide any more information, then please let me know.

Regards,
Eric Neblock
Only in ./glibc-2.23_other/: build
diff -crB ./glibc-2.23/ChangeLog ./glibc-2.23_other/ChangeLog
*** ./glibc-2.23/ChangeLog	2016-05-08 14:02:17.451792443 -0500
--- ./glibc-2.23_other/ChangeLog	2016-02-18 11:54:00.000000000 -0600
***************
*** 1,7 ****
- 2016-05-08  Eric Neblock <ceneblock@member.fsf.org>
- 
- 	* <bits/fcntl-linux.h>: Modified for kernel compability
- 
  2016-02-18  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
  
  	* version.h (RELEASE): Set to "stable".
--- 1,3 ----
Only in ./glibc-2.23: .gitattributes
Only in ./glibc-2.23: .gitignore
Only in ./glibc-2.23/po: be.mo
Only in ./glibc-2.23/po: bg.mo
Only in ./glibc-2.23/po: ca.mo
Only in ./glibc-2.23/po: cs.mo
Only in ./glibc-2.23/po: da.mo
Only in ./glibc-2.23/po: de.mo
Only in ./glibc-2.23/po: el.mo
Only in ./glibc-2.23/po: en_GB.mo
Only in ./glibc-2.23/po: eo.mo
Only in ./glibc-2.23/po: es.mo
Only in ./glibc-2.23/po: fi.mo
Only in ./glibc-2.23/po: fr.mo
Only in ./glibc-2.23/po: gl.mo
Only in ./glibc-2.23/po: hr.mo
Only in ./glibc-2.23/po: hu.mo
Only in ./glibc-2.23/po: ia.mo
Only in ./glibc-2.23/po: id.mo
Only in ./glibc-2.23/po: it.mo
Only in ./glibc-2.23/po: ja.mo
Only in ./glibc-2.23/po: ko.mo
Only in ./glibc-2.23/po: lt.mo
Only in ./glibc-2.23/po: nb.mo
Only in ./glibc-2.23/po: nl.mo
Only in ./glibc-2.23/po: pl.mo
Only in ./glibc-2.23/po: pt_BR.mo
Only in ./glibc-2.23/po: ru.mo
Only in ./glibc-2.23/po: rw.mo
Only in ./glibc-2.23/po: sk.mo
Only in ./glibc-2.23/po: sl.mo
Only in ./glibc-2.23/po: sv.mo
Only in ./glibc-2.23/po: tr.mo
Only in ./glibc-2.23/po: uk.mo
Only in ./glibc-2.23/po: vi.mo
Only in ./glibc-2.23/po: zh_CN.mo
Only in ./glibc-2.23/po: zh_TW.mo
diff -crB ./glibc-2.23/sysdeps/unix/sysv/linux/bits/fcntl-linux.h ./glibc-2.23_other/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
*** ./glibc-2.23/sysdeps/unix/sysv/linux/bits/fcntl-linux.h	2016-05-06 12:52:41.087503794 -0500
--- ./glibc-2.23_other/sysdeps/unix/sysv/linux/bits/fcntl-linux.h	2016-02-18 11:54:00.000000000 -0600
***************
*** 38,53 ****
  # include <bits/uio.h>
  #endif
  
- /* If the user has added in the kernel header, then we use those definations */
- #ifndef __UAPI_DEF_FCNTL_H
- #define __BITS_FCNTL_LINUX_H 1
  /* open/fcntl.  */
  #define O_ACCMODE	   0003
  #define O_RDONLY	     00
  #define O_WRONLY	     01
  #define O_RDWR		     02
- #endif
- 
  #ifndef O_CREAT
  # define O_CREAT	   0100	/* Not fcntl.  */
  #endif
--- 38,48 ----
***************
*** 134,145 ****
     last reference to the the file description against which they were acquired
     is put. */
  #ifdef __USE_GNU
- #ifndef __UAPI_DEF_FCNTL
  # define F_OFD_GETLK	36
  # define F_OFD_SETLK	37
  # define F_OFD_SETLKW	38
! #endif /* __UAPI_DEF_FCNTL */
! #endif /* __USE_GNU */
  
  #ifdef __USE_LARGEFILE64
  # define O_LARGEFILE __O_LARGEFILE
--- 129,138 ----
     last reference to the the file description against which they were acquired
     is put. */
  #ifdef __USE_GNU
  # define F_OFD_GETLK	36
  # define F_OFD_SETLK	37
  # define F_OFD_SETLKW	38
! #endif
  
  #ifdef __USE_LARGEFILE64
  # define O_LARGEFILE __O_LARGEFILE
***************
*** 170,183 ****
  # endif
  #endif
  
- #ifndef __UAPI_DEF_FCNTL_H
  /* 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.  */
- #endif
  
  #ifndef __F_SETOWN
  # define __F_SETOWN	8
--- 163,174 ----
***************
*** 185,195 ****
  #endif
  
  #if defined __USE_UNIX98 || defined __USE_XOPEN2K8
- #ifndef __UAPI_DEF_FCNTL_H
  # define F_SETOWN	__F_SETOWN /* Get owner (process receiving SIGIO).  */
  # define F_GETOWN	__F_GETOWN /* Set owner (process receiving SIGIO).  */
! #endif /* __UAPI_DEF_FCNTL_H */
! #endif /* __USE_UNIX98 || __USE_XOPEN2K8 */
  
  #ifndef __F_SETSIG
  # define __F_SETSIG	10	/* Set number of signal to be sent.  */
--- 176,184 ----
  #endif
  
  #if defined __USE_UNIX98 || defined __USE_XOPEN2K8
  # define F_SETOWN	__F_SETOWN /* Get owner (process receiving SIGIO).  */
  # define F_GETOWN	__F_GETOWN /* Set owner (process receiving SIGIO).  */
! #endif
  
  #ifndef __F_SETSIG
  # define __F_SETSIG	10	/* Set number of signal to be sent.  */
***************
*** 201,213 ****
  #endif
  
  #ifdef __USE_GNU
- #ifndef __UAPI_DEF_FCNTL_H
  # define F_SETSIG	__F_SETSIG	/* Set number of signal to be sent.  */
  # define F_GETSIG	__F_GETSIG	/* Get number of signal to be sent.  */
  # define F_SETOWN_EX	__F_SETOWN_EX	/* Get owner (thread receiving SIGIO).  */
  # define F_GETOWN_EX	__F_GETOWN_EX	/* Set owner (thread receiving SIGIO).  */
! #endif /* __UAPI_DEF_FCNTL_H */
! #endif /* __USE_GNU */
  
  #ifdef __USE_GNU
  # define F_SETLEASE	1024	/* Set a lease.	 */
--- 190,200 ----
  #endif
  
  #ifdef __USE_GNU
  # define F_SETSIG	__F_SETSIG	/* Set number of signal to be sent.  */
  # define F_GETSIG	__F_GETSIG	/* Get number of signal to be sent.  */
  # define F_SETOWN_EX	__F_SETOWN_EX	/* Get owner (thread receiving SIGIO).  */
  # define F_GETOWN_EX	__F_GETOWN_EX	/* Set owner (thread receiving SIGIO).  */
! #endif
  
  #ifdef __USE_GNU
  # define F_SETLEASE	1024	/* Set a lease.	 */
***************
*** 221,230 ****
  				   close-on-exit set.  */
  #endif
  
- #ifndef __UAPI_DEF_FCNTL_H
  /* For F_[GET|SET]FD.  */
  #define FD_CLOEXEC	1	/* Actually anything with low bit set goes */
- #endif
  
  #ifndef F_RDLCK
  /* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
--- 208,215 ----
***************
*** 240,246 ****
  # define F_SHLCK		8	/* or 4 */
  #endif
  
- #ifndef __UAPI_DEF_FCNTL_H
  #ifdef __USE_MISC
  /* Operations for BSD flock, also used by the kernel implementation.  */
  # define LOCK_SH	1	/* Shared lock.  */
--- 225,230 ----
***************
*** 248,262 ****
  # define LOCK_NB	4	/* Or'd with one of the above to prevent
  				   blocking.  */
  # define LOCK_UN	8	/* Remove lock.  */
! #endif /* __USE_MISC */
  
  #ifdef __USE_GNU
  # define LOCK_MAND	32	/* This is a mandatory flock:	*/
  # define LOCK_READ	64	/* ... which allows concurrent read operations.	 */
  # define LOCK_WRITE	128	/* ... which allows concurrent write operations.  */
  # define LOCK_RW	192	/* ... Which allows concurrent read & write operations.	 */
! #endif /* __USE_MISC */
! #endif /* __UAPI_DEF_FCNTL_H */
  
  #ifdef __USE_GNU
  /* Types of directory notifications that may be requested with F_NOTIFY.  */
--- 232,245 ----
  # define LOCK_NB	4	/* Or'd with one of the above to prevent
  				   blocking.  */
  # define LOCK_UN	8	/* Remove lock.  */
! #endif
  
  #ifdef __USE_GNU
  # define LOCK_MAND	32	/* This is a mandatory flock:	*/
  # define LOCK_READ	64	/* ... which allows concurrent read operations.	 */
  # define LOCK_WRITE	128	/* ... which allows concurrent write operations.  */
  # define LOCK_RW	192	/* ... Which allows concurrent read & write operations.	 */
! #endif
  
  #ifdef __USE_GNU
  /* Types of directory notifications that may be requested with F_NOTIFY.  */

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]