Update headers for Linux 3.15

Message ID Pine.LNX.4.64.1406171551320.23412@digraph.polyomino.org.uk
State Committed
Headers

Commit Message

Joseph Myers June 17, 2014, 3:53 p.m. UTC
  This patch updates glibc headers for changes / new definitions in
Linux 3.15.  In the course of my review I noticed that
IPV6_PMTUDISC_INTERFACE was absent from glibc despite the inclusion of
IP_PMTUDISC_INTERFACE; I added it along with IP_PMTUDISC_OMIT and
IPV6_PMTUDISC_OMIT.  I did not add FALLOC_FL_NO_HIDE_STALE given the
kernel header comment that it is reserved.

Review of this patch should probably include the question of whether
the definitions added are indeed all wanted in glibc's headers, and
whether anything else from 3.15 requires glibc changes (although the
latter should not need to block the patch).

Deliberately omitted from this patch:

* MicroBlaze kernel-features.h changes for new syscalls (untested
  patch to be sent separately).

* ARM HWCAP2 - since proper support should include dl-procinfo changes
  (like the powerpc dl-procinfo), not just bits/hwcap.h, this is
  probably best done by someone with access to hardware on which the
  new bits are set.

* MIPS sigcontext - as I noted in
  <https://sourceware.org/ml/libc-alpha/2014-06/msg00411.html>, I
  think the changes are fundamentally flawed and should best be
  reverted until a more compatible solution can be produced (and then
  any glibc changes would best be done with access to MSA hardware).

* F_OFD_* (patch has already been posted
  <https://sourceware.org/ml/libc-alpha/2014-06/msg00126.html> but may
  need review).

* IFF_ECHO for net/if.h (previous values IFF_LOWER_UP and IFF_DORMANT
  also omitted and I'm presuming the omission of values that don't fit
  in the "short" flags field is deliberate).

* renameat2 - this relates to the general question of when glibc
  should provide bindings to Linux kernel syscalls, which requires
  someone to take the lead on producing an analysis with reference to
  the various previous threads on this subject, seeking consensus on
  principles for when to provide such bindings, and then adding
  bindings for whatever syscalls meet the principles but don't
  currently have them.

Tested x86_64.

2014-06-17  Joseph Myers  <joseph@codesourcery.com>

	* sysdeps/unix/sysv/linux/bits/fcntl-linux.h [__USE_GNU]
	(FALLOC_FL_COLLAPSE_RANGE): New macro.
	[__USE_GNU] (FALLOC_FL_ZERO_RANGE): Likewise.
	* sysdeps/unix/sysv/linux/bits/in.h (IP_PMTUDISC_OMIT): Likewise.
	(IPV6_PMTUDISC_INTERFACE): Likewise.
	(IPV6_PMTUDISC_OMIT): Likewise.
  

Comments

Roland McGrath June 17, 2014, 11:44 p.m. UTC | #1
> * renameat2 - this relates to the general question of when glibc
>   should provide bindings to Linux kernel syscalls, which requires
>   someone to take the lead on producing an analysis with reference to
>   the various previous threads on this subject, seeking consensus on
>   principles for when to provide such bindings, and then adding
>   bindings for whatever syscalls meet the principles but don't
>   currently have them.

A new kernel feature like this can be addressed in two ways.  What
you've described is one of them.  The other is to decide that the
feature is worthy of being a first-class part of the GNU API, and
add support for it specifically in libc (including an ENOSYS stub
that non-Linux configurations will use until and unless the feature
is implemented elsewhere).  Off hand I am not particularly inclined
to argue for such treatment for renameat2.  But the general point
stands for how to contemplate such issues as they arise.


Thanks,
Roland
  
Joseph Myers June 23, 2014, 11:57 a.m. UTC | #2
Ping.  This patch 
<https://sourceware.org/ml/libc-alpha/2014-06/msg00413.html> is pending 
review.
  
Will Newton June 23, 2014, 2:43 p.m. UTC | #3
On 17 June 2014 16:53, Joseph S. Myers <joseph@codesourcery.com> wrote:
> This patch updates glibc headers for changes / new definitions in
> Linux 3.15.  In the course of my review I noticed that
> IPV6_PMTUDISC_INTERFACE was absent from glibc despite the inclusion of
> IP_PMTUDISC_INTERFACE; I added it along with IP_PMTUDISC_OMIT and
> IPV6_PMTUDISC_OMIT.  I did not add FALLOC_FL_NO_HIDE_STALE given the
> kernel header comment that it is reserved.
>
> Review of this patch should probably include the question of whether
> the definitions added are indeed all wanted in glibc's headers, and
> whether anything else from 3.15 requires glibc changes (although the
> latter should not need to block the patch).
>
> Deliberately omitted from this patch:
>
> * MicroBlaze kernel-features.h changes for new syscalls (untested
>   patch to be sent separately).
>
> * ARM HWCAP2 - since proper support should include dl-procinfo changes
>   (like the powerpc dl-procinfo), not just bits/hwcap.h, this is
>   probably best done by someone with access to hardware on which the
>   new bits are set.

QEMU implements all of these extensions AFAIK.

> * MIPS sigcontext - as I noted in
>   <https://sourceware.org/ml/libc-alpha/2014-06/msg00411.html>, I
>   think the changes are fundamentally flawed and should best be
>   reverted until a more compatible solution can be produced (and then
>   any glibc changes would best be done with access to MSA hardware).
>
> * F_OFD_* (patch has already been posted
>   <https://sourceware.org/ml/libc-alpha/2014-06/msg00126.html> but may
>   need review).
>
> * IFF_ECHO for net/if.h (previous values IFF_LOWER_UP and IFF_DORMANT
>   also omitted and I'm presuming the omission of values that don't fit
>   in the "short" flags field is deliberate).
>
> * renameat2 - this relates to the general question of when glibc
>   should provide bindings to Linux kernel syscalls, which requires
>   someone to take the lead on producing an analysis with reference to
>   the various previous threads on this subject, seeking consensus on
>   principles for when to provide such bindings, and then adding
>   bindings for whatever syscalls meet the principles but don't
>   currently have them.
>
> Tested x86_64.
>
> 2014-06-17  Joseph Myers  <joseph@codesourcery.com>
>
>         * sysdeps/unix/sysv/linux/bits/fcntl-linux.h [__USE_GNU]
>         (FALLOC_FL_COLLAPSE_RANGE): New macro.
>         [__USE_GNU] (FALLOC_FL_ZERO_RANGE): Likewise.
>         * sysdeps/unix/sysv/linux/bits/in.h (IP_PMTUDISC_OMIT): Likewise.
>         (IPV6_PMTUDISC_INTERFACE): Likewise.
>         (IPV6_PMTUDISC_OMIT): Likewise.

These all look like reasonable additions to me.

> diff --git a/sysdeps/unix/sysv/linux/bits/fcntl-linux.h b/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
> index 915eb3e..527eb5c 100644
> --- a/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
> +++ b/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
> @@ -305,6 +305,11 @@ struct f_owner_ex
>                                              even if offset + len is
>                                              greater than file size.  */
>  # define FALLOC_FL_PUNCH_HOLE          2 /* Create a hole in the file.  */
> +# define FALLOC_FL_COLLAPSE_RANGE      8 /* Remove a range of a file
> +                                            without leaving a
> +                                            hole.  */
> +# define FALLOC_FL_ZERO_RANGE          16 /* Convert a range of a
> +                                             file to zeros.  */
>
>
>  /* File handle structure.  */
> diff --git a/sysdeps/unix/sysv/linux/bits/in.h b/sysdeps/unix/sysv/linux/bits/in.h
> index f5b02dd..1331e1b 100644
> --- a/sysdeps/unix/sysv/linux/bits/in.h
> +++ b/sysdeps/unix/sysv/linux/bits/in.h
> @@ -101,6 +101,8 @@
>     Also incoming ICMP frag_needed notifications will be ignored on
>     this socket to prevent accepting spoofed ones.  */
>  #define IP_PMTUDISC_INTERFACE           4
> +/* Like IP_PMTUDISC_INTERFACE but allow packets to be fragmented.  */
> +#define IP_PMTUDISC_OMIT               5
>
>  #define IP_MULTICAST_IF                        32
>  #define IP_MULTICAST_TTL               33
> @@ -214,6 +216,8 @@ struct in_pktinfo
>  #define IPV6_PMTUDISC_WANT     1       /* Use per route hints.  */
>  #define IPV6_PMTUDISC_DO       2       /* Always DF.  */
>  #define IPV6_PMTUDISC_PROBE    3       /* Ignore dst pmtu.  */
> +#define IPV6_PMTUDISC_INTERFACE        4       /* See IP_PMTUDISC_INTERFACE.  */
> +#define IPV6_PMTUDISC_OMIT     5       /* See IP_PMTUDISC_OMIT.  */
>
>  /* Socket level values for IPv6.  */
>  #define SOL_IPV6        41
>
> --
> Joseph S. Myers
> joseph@codesourcery.com
  

Patch

diff --git a/sysdeps/unix/sysv/linux/bits/fcntl-linux.h b/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
index 915eb3e..527eb5c 100644
--- a/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
+++ b/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
@@ -305,6 +305,11 @@  struct f_owner_ex
 					     even if offset + len is
 					     greater than file size.  */
 # define FALLOC_FL_PUNCH_HOLE		2 /* Create a hole in the file.  */
+# define FALLOC_FL_COLLAPSE_RANGE	8 /* Remove a range of a file
+					     without leaving a
+					     hole.  */
+# define FALLOC_FL_ZERO_RANGE		16 /* Convert a range of a
+					      file to zeros.  */
 
 
 /* File handle structure.  */
diff --git a/sysdeps/unix/sysv/linux/bits/in.h b/sysdeps/unix/sysv/linux/bits/in.h
index f5b02dd..1331e1b 100644
--- a/sysdeps/unix/sysv/linux/bits/in.h
+++ b/sysdeps/unix/sysv/linux/bits/in.h
@@ -101,6 +101,8 @@ 
    Also incoming ICMP frag_needed notifications will be ignored on
    this socket to prevent accepting spoofed ones.  */
 #define IP_PMTUDISC_INTERFACE           4
+/* Like IP_PMTUDISC_INTERFACE but allow packets to be fragmented.  */
+#define IP_PMTUDISC_OMIT		5
 
 #define IP_MULTICAST_IF			32
 #define IP_MULTICAST_TTL 		33
@@ -214,6 +216,8 @@  struct in_pktinfo
 #define IPV6_PMTUDISC_WANT	1	/* Use per route hints.  */
 #define IPV6_PMTUDISC_DO	2	/* Always DF.  */
 #define IPV6_PMTUDISC_PROBE	3	/* Ignore dst pmtu.  */
+#define IPV6_PMTUDISC_INTERFACE	4	/* See IP_PMTUDISC_INTERFACE.  */
+#define IPV6_PMTUDISC_OMIT	5	/* See IP_PMTUDISC_OMIT.  */
 
 /* Socket level values for IPv6.  */
 #define SOL_IPV6        41