public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Re: [PATCH mtd-utils] include sys/sysmacros.h for major/minor/makedev
       [not found] <1460860245-14895-1-git-send-email-vapier@gentoo.org>
@ 2016-04-18 16:39 ` Brian Norris
  2016-04-18 16:49   ` Mike Frysinger
  0 siblings, 1 reply; 6+ messages in thread
From: Brian Norris @ 2016-04-18 16:39 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: linux-mtd, Michael Kerrisk, linux-man, libc-alpha

+ man-page and glibc folks

On Sat, Apr 16, 2016 at 10:30:45PM -0400, Mike Frysinger wrote:
> These functions have always been defined in sys/sysmacros.h under
> Linux C libraries.  For some, including sys/types.h implicitly
> includes that as well, but glibc wants to deprecate that, and some
> others already have.  Include the header explicitly for the funcs.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>

Patch looks fine to me, thanks. Pushed to mtd-utils.git.

But I don't see this change documented anywhere. (Helpfully, I do see
the change from your other patch -- _BSD_SOURCE -> _DEFAULT_SOURCE --
documented though!) Should the man-pages project be updated? I see the
latest makedev(5) still recommends #include <sys/types.h>.

Brian

> ---
>  include/common.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/common.h b/include/common.h
> index fb0ca83..8cb3142 100644
> --- a/include/common.h
> +++ b/include/common.h
> @@ -28,6 +28,7 @@
>  #include <errno.h>
>  #include <features.h>
>  #include <inttypes.h>
> +#include <sys/sysmacros.h>
>  #include "version.h"
>  
>  #ifndef PROGRAM_NAME
> -- 
> 2.7.4
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH mtd-utils] include sys/sysmacros.h for major/minor/makedev
  2016-04-18 16:39 ` [PATCH mtd-utils] include sys/sysmacros.h for major/minor/makedev Brian Norris
@ 2016-04-18 16:49   ` Mike Frysinger
  2016-04-19  5:52     ` [PATCH] makedev(3): point people at sys/sysmacros.h Mike Frysinger
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2016-04-18 16:49 UTC (permalink / raw)
  To: Brian Norris; +Cc: linux-mtd, Michael Kerrisk, linux-man, libc-alpha

[-- Attachment #1: Type: text/plain, Size: 920 bytes --]

On 18 Apr 2016 09:39, Brian Norris wrote:
> On Sat, Apr 16, 2016 at 10:30:45PM -0400, Mike Frysinger wrote:
> > These functions have always been defined in sys/sysmacros.h under
> > Linux C libraries.  For some, including sys/types.h implicitly
> > includes that as well, but glibc wants to deprecate that, and some
> > others already have.  Include the header explicitly for the funcs.
> > 
> > Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> 
> Patch looks fine to me, thanks. Pushed to mtd-utils.git.
> 
> But I don't see this change documented anywhere. (Helpfully, I do see
> the change from your other patch -- _BSD_SOURCE -> _DEFAULT_SOURCE --
> documented though!) Should the man-pages project be updated? I see the
> latest makedev(5) still recommends #include <sys/types.h>.

glibc hasn't moved forward (yet).  we should update the man pages now
though to mention sys/sysmacros.h.
-mike

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] makedev(3): point people at sys/sysmacros.h
  2016-04-18 16:49   ` Mike Frysinger
@ 2016-04-19  5:52     ` Mike Frysinger
  2016-04-20 11:31       ` Michael Kerrisk (man-pages)
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2016-04-19  5:52 UTC (permalink / raw)
  To: Michael Kerrisk; +Cc: linux-mtd, libc-alpha, linux-man

Defining these functions via sys/types.h violates POSIX namespace
requirements, so we want to disentangle it from that header.  Since
glibc has basically always used this header, update the docs to have
people include that instead.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 man3/makedev.3 | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/man3/makedev.3 b/man3/makedev.3
index f91f4b5..3d26d15 100644
--- a/man3/makedev.3
+++ b/man3/makedev.3
@@ -28,23 +28,13 @@
 makedev, major, minor \- manage a device number
 .SH SYNOPSIS
 .nf
-.B #include <sys/types.h>
+.B #include <sys/sysmacros.h>
 
 .BI "dev_t makedev(unsigned int " maj ", unsigned int " min );
 
 .BI "unsigned int major(dev_t " dev );
 .BI "unsigned int minor(dev_t " dev );
 .fi
-.sp
-.BR makedev (),
-.BR major (),
-.BR minor ():
-.nf
-    Since glibc 2.19:
-        _DEFAULT_SOURCE
-    In glibc up to and including 2.19:
-        _BSD_SOURCE
-.fi
 .SH DESCRIPTION
 A device ID consists of two parts:
 a major ID, identifying the class of the device,
@@ -90,7 +80,9 @@ and
 .BR minor ()
 functions are not specified in POSIX.1,
 but are present on many other systems.
-.\" The BSDs, HP-UX, Solaris, AIX, Irix
+.\" The BSDs, HP-UX, Solaris, AIX, Irix.
+.\" The header location is inconsistent:
+.\" Could be sys/mkdev.h, sys/sysmacros.h, or sys/types.h.
 .SH NOTES
 These interfaces are defined as macros.
 Since glibc 2.3.3,
-- 
2.7.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] makedev(3): point people at sys/sysmacros.h
  2016-04-19  5:52     ` [PATCH] makedev(3): point people at sys/sysmacros.h Mike Frysinger
@ 2016-04-20 11:31       ` Michael Kerrisk (man-pages)
  2016-04-20 11:48         ` Zack Weinberg
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Kerrisk (man-pages) @ 2016-04-20 11:31 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: mtk.manpages, linux-mtd, libc-alpha, linux-man


Hi Mike,

I don't object to the patch, but...

On 04/19/2016 06:52 AM, Mike Frysinger wrote:
> Defining these functions via sys/types.h violates POSIX namespace
> requirements, 

What do the previous lines mean? Violate namespace requirements how?

Cheers,

Michael


> so we want to disentangle it from that header.  Since
> glibc has basically always used this header, update the docs to have
> people include that instead.
>
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
>  man3/makedev.3 | 16 ++++------------
>  1 file changed, 4 insertions(+), 12 deletions(-)
> 
> diff --git a/man3/makedev.3 b/man3/makedev.3
> index f91f4b5..3d26d15 100644
> --- a/man3/makedev.3
> +++ b/man3/makedev.3
> @@ -28,23 +28,13 @@
>  makedev, major, minor \- manage a device number
>  .SH SYNOPSIS
>  .nf
> -.B #include <sys/types.h>
> +.B #include <sys/sysmacros.h>
>  
>  .BI "dev_t makedev(unsigned int " maj ", unsigned int " min );
>  
>  .BI "unsigned int major(dev_t " dev );
>  .BI "unsigned int minor(dev_t " dev );
>  .fi
> -.sp
> -.BR makedev (),
> -.BR major (),
> -.BR minor ():
> -.nf
> -    Since glibc 2.19:
> -        _DEFAULT_SOURCE
> -    In glibc up to and including 2.19:
> -        _BSD_SOURCE
> -.fi
>  .SH DESCRIPTION
>  A device ID consists of two parts:
>  a major ID, identifying the class of the device,
> @@ -90,7 +80,9 @@ and
>  .BR minor ()
>  functions are not specified in POSIX.1,
>  but are present on many other systems.
> -.\" The BSDs, HP-UX, Solaris, AIX, Irix
> +.\" The BSDs, HP-UX, Solaris, AIX, Irix.
> +.\" The header location is inconsistent:
> +.\" Could be sys/mkdev.h, sys/sysmacros.h, or sys/types.h.
>  .SH NOTES
>  These interfaces are defined as macros.
>  Since glibc 2.3.3,
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] makedev(3): point people at sys/sysmacros.h
  2016-04-20 11:31       ` Michael Kerrisk (man-pages)
@ 2016-04-20 11:48         ` Zack Weinberg
  2016-04-20 12:39           ` Michael Kerrisk (man-pages)
  0 siblings, 1 reply; 6+ messages in thread
From: Zack Weinberg @ 2016-04-20 11:48 UTC (permalink / raw)
  To: Michael Kerrisk (man-pages)
  Cc: Mike Frysinger, linux-mtd, GNU C Library, linux-man

On Wed, Apr 20, 2016 at 7:31 AM, Michael Kerrisk (man-pages)
<mtk.manpages@gmail.com> wrote:
> On 04/19/2016 06:52 AM, Mike Frysinger wrote:
>> Defining these functions via sys/types.h violates POSIX namespace
>> requirements,
>
> What do the previous lines mean? Violate namespace requirements how?

I think it's technically not true that they violate POSIX namespace
requirements, since they're only defined in the non-conforming modes.

The reason I originally proposed the change is that libstdc++
force-enables _GNU_SOURCE, which means people writing in C++ _can't_
avoid these nonstandard macros by using a strict conformance mode.

zw

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] makedev(3): point people at sys/sysmacros.h
  2016-04-20 11:48         ` Zack Weinberg
@ 2016-04-20 12:39           ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Kerrisk (man-pages) @ 2016-04-20 12:39 UTC (permalink / raw)
  To: Zack Weinberg
  Cc: mtk.manpages, Mike Frysinger, linux-mtd, GNU C Library, linux-man

On 04/20/2016 01:47 PM, Zack Weinberg wrote:
> On Wed, Apr 20, 2016 at 7:31 AM, Michael Kerrisk (man-pages)
> <mtk.manpages@gmail.com> wrote:
>> On 04/19/2016 06:52 AM, Mike Frysinger wrote:
>>> Defining these functions via sys/types.h violates POSIX namespace
>>> requirements,
>>
>> What do the previous lines mean? Violate namespace requirements how?
> 
> I think it's technically not true that they violate POSIX namespace
> requirements, since they're only defined in the non-conforming modes.
> 
> The reason I originally proposed the change is that libstdc++
> force-enables _GNU_SOURCE, which means people writing in C++ _can't_
> avoid these nonstandard macros by using a strict conformance mode.

Thanks for the explanation, Zack. I applied Mike's patch.

Cheers,

Michael


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-04-20 12:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1460860245-14895-1-git-send-email-vapier@gentoo.org>
2016-04-18 16:39 ` [PATCH mtd-utils] include sys/sysmacros.h for major/minor/makedev Brian Norris
2016-04-18 16:49   ` Mike Frysinger
2016-04-19  5:52     ` [PATCH] makedev(3): point people at sys/sysmacros.h Mike Frysinger
2016-04-20 11:31       ` Michael Kerrisk (man-pages)
2016-04-20 11:48         ` Zack Weinberg
2016-04-20 12:39           ` Michael Kerrisk (man-pages)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).