public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* RFC: remove <sys/sysmacros.h> from <sys/types.h>
@ 2015-11-13 14:21 Zack Weinberg
  2015-11-13 14:29 ` Zack Weinberg
                   ` (4 more replies)
  0 siblings, 5 replies; 30+ messages in thread
From: Zack Weinberg @ 2015-11-13 14:21 UTC (permalink / raw)
  To: GNU C Library

sys/sysmacros.h defines three macros - major, minor, makedev - that
are likely to collide with user symbols.  That would be fine, since
it's off by itself, but sys/types.h includes sys/sysmacros.h under
__USE_BSD, which means anyone who defines _BSD_SOURCE or _GNU_SOURCE
and includes sys/types.h gets the macros.  Moreover, under _GNU_SOURCE
stdlib.h includes sys/types.h, and g++ defines _GNU_SOURCE by default
(this is agreed to be suboptimal, but apparently libstdc++'s headers
need it).  This all adds up to what might not technically be a
conformance violation but sure *looks* like it from the end-user
perspective.

At least two bug reports have been filed on this behavior:
https://sourceware.org/bugzilla/show_bug.cgi?id=19239 and
https://bugzilla.redhat.com/show_bug.cgi?id=130601 .

These macros are potentially relevant to anything that wants to take
apart an st_dev value in detail, but I have not personally encountered
a piece of software that needs them in many years.  Since sys/types.h
does not provide these macros on SysV-derived systems, I would expect
that portable software that needs them is prepared to include
sys/sysmacros.h itself.

Therefore, I propose we remove the inclusion of sys/sysmacros.h from
sys/types.h.  It's risky enough that I think it's worth doing a distro
rebuild with that change to find out what, if anything, breaks - who
do I talk to to make that happen?

zw

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

* Re: RFC: remove <sys/sysmacros.h> from <sys/types.h>
  2015-11-13 14:21 RFC: remove <sys/sysmacros.h> from <sys/types.h> Zack Weinberg
@ 2015-11-13 14:29 ` Zack Weinberg
  2015-11-13 14:45 ` Dmitry V. Levin
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 30+ messages in thread
From: Zack Weinberg @ 2015-11-13 14:29 UTC (permalink / raw)
  To: GNU C Library

On Fri, Nov 13, 2015 at 9:21 AM, Zack Weinberg <zackw@panix.com> wrote:
> sys/sysmacros.h defines three macros - major, minor, makedev - that
> are likely to collide with user symbols.  That would be fine, since
> it's off by itself, but sys/types.h includes sys/sysmacros.h under
> __USE_BSD, which means anyone who defines _BSD_SOURCE or _GNU_SOURCE
> and includes sys/types.h gets the macros.

Note: as far as I can tell sys/types.h is the only glibc-installed
header that directly includes sys/sysmacros.h.

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

* Re: RFC: remove <sys/sysmacros.h> from <sys/types.h>
  2015-11-13 14:21 RFC: remove <sys/sysmacros.h> from <sys/types.h> Zack Weinberg
  2015-11-13 14:29 ` Zack Weinberg
@ 2015-11-13 14:45 ` Dmitry V. Levin
  2015-11-13 15:59   ` Paul Eggert
  2015-11-13 23:43 ` Roland McGrath
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 30+ messages in thread
From: Dmitry V. Levin @ 2015-11-13 14:45 UTC (permalink / raw)
  To: GNU C Library

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

On Fri, Nov 13, 2015 at 09:21:46AM -0500, Zack Weinberg wrote:
> sys/sysmacros.h defines three macros - major, minor, makedev - that
> are likely to collide with user symbols.  That would be fine, since
> it's off by itself, but sys/types.h includes sys/sysmacros.h under
> __USE_BSD, which means anyone who defines _BSD_SOURCE or _GNU_SOURCE
> and includes sys/types.h gets the macros.  Moreover, under _GNU_SOURCE
> stdlib.h includes sys/types.h, and g++ defines _GNU_SOURCE by default
> (this is agreed to be suboptimal, but apparently libstdc++'s headers
> need it).  This all adds up to what might not technically be a
> conformance violation but sure *looks* like it from the end-user
> perspective.
> 
> At least two bug reports have been filed on this behavior:
> https://sourceware.org/bugzilla/show_bug.cgi?id=19239 and
> https://bugzilla.redhat.com/show_bug.cgi?id=130601 .
> 
> These macros are potentially relevant to anything that wants to take
> apart an st_dev value in detail, but I have not personally encountered
> a piece of software that needs them in many years.

These macros are still widely used.
See e.g. ls(1) and stat(1) from coreutils.

> Since sys/types.h
> does not provide these macros on SysV-derived systems, I would expect
> that portable software that needs them is prepared to include
> sys/sysmacros.h itself.

Portable software already uses autoconf AC_HEADER_MAJOR macro or analogs.


-- 
ldv

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

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

* Re: RFC: remove <sys/sysmacros.h> from <sys/types.h>
  2015-11-13 14:45 ` Dmitry V. Levin
@ 2015-11-13 15:59   ` Paul Eggert
  0 siblings, 0 replies; 30+ messages in thread
From: Paul Eggert @ 2015-11-13 15:59 UTC (permalink / raw)
  To: GNU C Library

On 11/13/2015 06:45 AM, Dmitry V. Levin wrote:
> >Since sys/types.h
> >does not provide these macros on SysV-derived systems, I would expect
> >that portable software that needs them is prepared to include
> >sys/sysmacros.h itself.
> Portable software already uses autoconf AC_HEADER_MAJOR macro or analogs.

Yes, since coreutils uses AC_HEADER_MAJOR already, programs like 'ls' 
and 'stat' would be unaffected by the proposed change: ./configure would 
discover that sys/types.h no longer define 'major', 'minor' and 
'makedev', and coreutils/src/system.h would therefore include 
<sys/sysmacros.h>.

It's clear these three macros don't belong in <sys/types.h>, but it's 
also clear there will be a conversion hassle for programs that are not 
as portable as coreutils etc. Can we deprecate these symbols without 
removing them, and then remove them a few years from now? That might be 
the wiser course.

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

* Re: RFC: remove <sys/sysmacros.h> from <sys/types.h>
  2015-11-13 14:21 RFC: remove <sys/sysmacros.h> from <sys/types.h> Zack Weinberg
  2015-11-13 14:29 ` Zack Weinberg
  2015-11-13 14:45 ` Dmitry V. Levin
@ 2015-11-13 23:43 ` Roland McGrath
  2015-11-14  9:18   ` Andreas Schwab
  2015-11-14 20:19 ` Carlos O'Donell
  2015-11-19  4:13 ` RFC: deprecate sys/sysmacros.h inclusion from sys/types.h Zack Weinberg
  4 siblings, 1 reply; 30+ messages in thread
From: Roland McGrath @ 2015-11-13 23:43 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: GNU C Library

Having <sys/types.h> define these macros is part of the original BSD API
that was the baseline for glibc long long ago.  What do the modern BSDs
do about this issue?

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

* Re: RFC: remove <sys/sysmacros.h> from <sys/types.h>
  2015-11-13 23:43 ` Roland McGrath
@ 2015-11-14  9:18   ` Andreas Schwab
  2015-11-14 20:41     ` Zack Weinberg
  0 siblings, 1 reply; 30+ messages in thread
From: Andreas Schwab @ 2015-11-14  9:18 UTC (permalink / raw)
  To: Roland McGrath; +Cc: Zack Weinberg, GNU C Library

Roland McGrath <roland@hack.frob.com> writes:

> Having <sys/types.h> define these macros is part of the original BSD API
> that was the baseline for glibc long long ago.  What do the modern BSDs
> do about this issue?

Nothing, they have the same problem.

https://svnweb.freebsd.org/base/head/sys/sys/types.h?view=markup#l356

(__BSD_VISIBLE is the equivalent of __USE_BSD.)

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: RFC: remove <sys/sysmacros.h> from <sys/types.h>
  2015-11-13 14:21 RFC: remove <sys/sysmacros.h> from <sys/types.h> Zack Weinberg
                   ` (2 preceding siblings ...)
  2015-11-13 23:43 ` Roland McGrath
@ 2015-11-14 20:19 ` Carlos O'Donell
  2015-11-19  4:13 ` RFC: deprecate sys/sysmacros.h inclusion from sys/types.h Zack Weinberg
  4 siblings, 0 replies; 30+ messages in thread
From: Carlos O'Donell @ 2015-11-14 20:19 UTC (permalink / raw)
  To: Zack Weinberg, GNU C Library

On 11/13/2015 09:21 AM, Zack Weinberg wrote:
> Therefore, I propose we remove the inclusion of sys/sysmacros.h from
> sys/types.h.  It's risky enough that I think it's worth doing a distro
> rebuild with that change to find out what, if anything, breaks - who
> do I talk to to make that happen?

You reach out to the distribution maintainers to get help testing:

https://sourceware.org/glibc/wiki/MAINTAINERS#Distribution_Maintainers

We do this semi-regularly in Fedora Rawhide (which tracks glibc master)
in order to test new condition variable implementations, the new Unicode 8
support etc.

We could carry such a patch for a cycle in Rawhide and see what happens.
We are still building bootstrap infrastructure [1] which would be faster
to give you an answer. In Rawhide it will take months to churn through
the repo and developers might patch around it (even if I post about it
to Fedora Devel).

At present I have no opinion on what we should be doing here.

If you can make a conformance violation out of the present situation then
I'm happy to see a fix go in, *but* we better have a documented answer
in our release notes for users that need to fix packages, like we did
when we moved to _DEFAULT_SOURCE [2].

Cheers,
Carlos.

[1] http://fedora-bootstrap.osop.rhcloud.com/
[2] https://sourceware.org/glibc/wiki/Release/2.20#Packaging_Changes

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

* Re: RFC: remove <sys/sysmacros.h> from <sys/types.h>
  2015-11-14  9:18   ` Andreas Schwab
@ 2015-11-14 20:41     ` Zack Weinberg
  2015-11-14 21:59       ` Rich Felker
  0 siblings, 1 reply; 30+ messages in thread
From: Zack Weinberg @ 2015-11-14 20:41 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Roland McGrath, GNU C Library

On Sat, Nov 14, 2015 at 4:18 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Roland McGrath <roland@hack.frob.com> writes:
>
>> What do the modern BSDs do about this issue?
>
> Nothing, they have the same problem.
>
> https://svnweb.freebsd.org/base/head/sys/sys/types.h?view=markup#l356
>
> (__BSD_VISIBLE is the equivalent of __USE_BSD.)

However, if I'm reading these headers correctly, FreeBSD does *not*
include sys/types.h in stdlib.h.  (It does include sys/_types.h but I
think that's their equivalent of bits/types.h - nothing but __names.)
Perhaps that is a lower-risk change for us.  I am going to talk to the
people who do Debian archive rebuilds about trying both possibilities.

(If we still had it, this might be an appropriate thing to put under
__FAVOR_BSD, but I see it's gone, and it doesn't seem important enough
to resurrect it for.)

zw

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

* Re: RFC: remove <sys/sysmacros.h> from <sys/types.h>
  2015-11-14 20:41     ` Zack Weinberg
@ 2015-11-14 21:59       ` Rich Felker
  2015-11-14 22:19         ` Andreas Schwab
  0 siblings, 1 reply; 30+ messages in thread
From: Rich Felker @ 2015-11-14 21:59 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: Andreas Schwab, Roland McGrath, GNU C Library

On Sat, Nov 14, 2015 at 03:41:08PM -0500, Zack Weinberg wrote:
> On Sat, Nov 14, 2015 at 4:18 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> > Roland McGrath <roland@hack.frob.com> writes:
> >
> >> What do the modern BSDs do about this issue?
> >
> > Nothing, they have the same problem.
> >
> > https://svnweb.freebsd.org/base/head/sys/sys/types.h?view=markup#l356
> >
> > (__BSD_VISIBLE is the equivalent of __USE_BSD.)
> 
> However, if I'm reading these headers correctly, FreeBSD does *not*
> include sys/types.h in stdlib.h.  (It does include sys/_types.h but I

Exactly. While I would like to get rid of _all_ implicit inclusion of
sys/sysmacros.h, I think it's the _interaction_ of these two implicit
inclusions (stdlib->sys/types and sys/types->sys/sysmacros) that's
extremely problematic. Modern software has little if any reason to
include sys/types.h anyway, but basically everything has to include
stdlib.h, and having stdlib indirectly define major() and minor() is
almost as embarassing as MSVC's defining of min() and max(). One way
or another this really needs to be fixed.

One way to fix this would be to make stdlib.h include a new header,
sys/real_types.h or something (or the FreeBSD name, sys/_types.h), and
have sys/types.h just be:

#include <sys/real_types.h>
#if ...
#include <sys/sysmacros.h>
#endif

But again I would just prefer getting rid of all implicit inclusion of
sysmacros.h.

Rich

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

* Re: RFC: remove <sys/sysmacros.h> from <sys/types.h>
  2015-11-14 21:59       ` Rich Felker
@ 2015-11-14 22:19         ` Andreas Schwab
  2015-11-21  0:19           ` Roland McGrath
  0 siblings, 1 reply; 30+ messages in thread
From: Andreas Schwab @ 2015-11-14 22:19 UTC (permalink / raw)
  To: Rich Felker; +Cc: Zack Weinberg, Roland McGrath, GNU C Library

Rich Felker <dalias@libc.org> writes:

> One way to fix this would be to make stdlib.h include a new header,
> sys/real_types.h or something (or the FreeBSD name, sys/_types.h), and
> have sys/types.h just be:

stdlib.h only includes sys/types.h for int32_t, which is also available
through stdint.h.  We could add support for __need_int32_t if necessary.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* RFC: deprecate sys/sysmacros.h inclusion from sys/types.h
@ 2015-11-19  4:13 ` Zack Weinberg
  2015-12-07 14:03   ` Zack Weinberg
                     ` (3 more replies)
  0 siblings, 4 replies; 30+ messages in thread
From: Zack Weinberg @ 2015-11-19  4:13 UTC (permalink / raw)
  To: GNU C Library

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

Andreas may still be running whole-distro rebuild tests, but enough
results came back that I feel fairly confident saying that option B
(remove the #include <sys/types.h> from stdlib.h) is a non-starter.
There are too many (sloppily coded, yes) programs that include stdlib.h
and expect it to expose all the POSIX foo_t types.  That leaves us with
option A (remove the #include <sys/sysmacros.h> from sys/types.h) and
even that is going to break stuff.  So we need a deprecation period.

The attached, lightly tested, patch sets up that deprecation period.
From an application's perspective, it works like this:

* If you include <sys/sysmacros.h> directly, you get major(), minor(),
and makedev() macros and everything works as it did before, regardless
of whether you also include <sys/types.h> and in what order.

* If you define _SYS_TYPES_NO_SYSMACROS before including any headers,
then <sys/types.h> does not include <sys/sysmacros.h> at all.

* If you include <sys/types.h>, you don't include <sys/sysmacros.h>, and
you don't define _SYS_TYPES_NO_SYSMACROS, then you still get major(),
minor(), and makedev() macros, but they trigger a deprecation warning if
you *use* them.  This warning contains a lengthy explanation of what is
about to change and suggests either including <sys/sysmacros.h> or
defining _SYS_TYPES_NO_SYSMACROS, depending on whether you actually
wanted the dev_t manipulators.

The implementation of all that is regrettably messy, but it works.  I
also took the opportunity to genericize some of the code involved;
sys/sysmacros.h and makedev.c both now live in misc/ instead of
sysdeps/, and there's a new 'bits' header that encapsulates the only
thing that varies between Linux and non-, which is the actual encoding
of a dev_t.  (I'd appreciate extra-careful review of the arithmetic in
the new bits headers; I'm not sure it was ever 100% correct, I may have
messed it up, and there don't seem to be any tests.)

I deliberately didn't say "in the next release" in the deprecation
message, because we might want to give this more than one cycle to bake.

zw



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Deprecate-inclusion-of-sys-sysmacros.h-by-sys-types..patch --]
[-- Type: text/x-patch; name="0001-Deprecate-inclusion-of-sys-sysmacros.h-by-sys-types..patch", Size: 20991 bytes --]

 include/sys/sysmacros.h                  |  3 +
 misc/Makefile                            |  5 +-
 misc/makedev.c                           | 40 ++++++++++++++
 misc/sys/cdefs.h                         | 21 ++++++-
 misc/sys/sysmacros.h                     | 95 ++++++++++++++++++++++++++++++++
 posix/Makefile                           |  2 +-
 posix/sys/types.h                        | 13 ++++-
 sysdeps/generic/bits/sysmacros.h         | 30 ++++++++++
 sysdeps/generic/sys/sysmacros.h          | 30 ----------
 sysdeps/unix/sysv/linux/Makefile         |  2 +-
 sysdeps/unix/sysv/linux/bits/sysmacros.h | 39 +++++++++++++
 sysdeps/unix/sysv/linux/makedev.c        | 40 --------------
 sysdeps/unix/sysv/linux/sys/sysmacros.h  | 65 ----------------------
 13 files changed, 243 insertions(+), 142 deletions(-)
 create mode 100644 include/sys/sysmacros.h
 create mode 100644 misc/makedev.c
 create mode 100644 misc/sys/sysmacros.h
 create mode 100644 sysdeps/generic/bits/sysmacros.h
 delete mode 100644 sysdeps/generic/sys/sysmacros.h
 create mode 100644 sysdeps/unix/sysv/linux/bits/sysmacros.h
 delete mode 100644 sysdeps/unix/sysv/linux/makedev.c
 delete mode 100644 sysdeps/unix/sysv/linux/sys/sysmacros.h

diff --git a/include/sys/sysmacros.h b/include/sys/sysmacros.h
new file mode 100644
index 0000000..a986710
--- /dev/null
+++ b/include/sys/sysmacros.h
@@ -0,0 +1,3 @@
+#ifndef _SYS_SYSMACROS_H
+#include <misc/sys/sysmacros.h>
+#endif
diff --git a/misc/Makefile b/misc/Makefile
index 2f5edf6..14b16ff 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -34,7 +34,8 @@ headers	:= sys/uio.h bits/uio.h sys/ioctl.h bits/ioctls.h bits/ioctl-types.h \
 	   regexp.h bits/select.h bits/mman.h sys/xattr.h \
 	   syslog.h sys/syslog.h \
 	   bits/syslog.h bits/syslog-ldbl.h bits/syslog-path.h bits/error.h \
-	   bits/select2.h bits/hwcap.h sys/auxv.h
+	   bits/select2.h bits/hwcap.h sys/auxv.h \
+	   sys/sysmacros.h bits/sysmacros.h
 
 routines := brk sbrk sstk ioctl \
 	    readv writev preadv preadv64 pwritev pwritev64 \
@@ -67,7 +68,7 @@ routines := brk sbrk sstk ioctl \
 	    getloadavg getclktck \
 	    fgetxattr flistxattr fremovexattr fsetxattr getxattr \
 	    listxattr lgetxattr llistxattr lremovexattr lsetxattr \
-	    removexattr setxattr getauxval ifunc-impl-list
+	    removexattr setxattr getauxval ifunc-impl-list makedev
 
 generated += tst-error1.mtrace tst-error1-mem.out
 
diff --git a/misc/makedev.c b/misc/makedev.c
new file mode 100644
index 0000000..d17deec
--- /dev/null
+++ b/misc/makedev.c
@@ -0,0 +1,40 @@
+/* Definitions of functions to access `dev_t' values.
+   Copyright (C) 2003-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <features.h>
+#undef __USE_EXTERN_INLINES
+#include <sys/sysmacros.h>
+#include <sys/types.h>
+
+unsigned int
+gnu_dev_major (dev_t dev)
+{
+  return __dev_major (dev);
+}
+
+unsigned int
+gnu_dev_minor (dev_t dev)
+{
+  return __dev_minor (dev);
+}
+
+dev_t
+gnu_dev_makedev (unsigned int major, unsigned int minor)
+{
+  return __dev_makedev (major, minor);
+}
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 99e94cc..e613a64 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -77,6 +77,15 @@
 
 #endif	/* GCC.  */
 
+/* Compilers that are not clang may object to
+       #if defined __clang__ && __has_extension(...)
+   even though they do not need to evaluate the right-hand side of the &&. */
+#ifdef __clang__
+# define __clang_has_extension__(ext) __has_extension(ext)
+#else
+# define __clang_has_extension__(ext) 0
+#endif
+
 /* These two macros are not used in glibc anymore.  They are kept here
    only because some other projects expect the macros to be defined.  */
 #define __P(args)	args
@@ -249,13 +258,23 @@
 # define __attribute_noinline__ /* Ignore */
 #endif
 
-/* gcc allows marking deprecated functions.  */
+/* gcc has supported marking deprecated functions since 3.2, but the
+   ability to specify a message was only added in 4.5.  clang claims
+   to be gcc 4.2, but may support messages anyway.  */
 #if __GNUC_PREREQ (3,2)
 # define __attribute_deprecated__ __attribute__ ((__deprecated__))
 #else
 # define __attribute_deprecated__ /* Ignore */
 #endif
 
+#if __GNUC_PREREQ (4,5) || \
+    __clang_has_extension__ (__attribute_deprecated_with_message__)
+# define __attribute_deprecated_msg__(msg) \
+         __attribute__ ((__deprecated__ (msg)))
+#else
+# define __attribute_deprecated_msg__(msg) __attribute_deprecated__
+#endif
+
 /* At some point during the gcc 2.8 development the `format_arg' attribute
    for functions was introduced.  We don't want to use it unconditionally
    (although this would be possible) since it generates warnings.
diff --git a/misc/sys/sysmacros.h b/misc/sys/sysmacros.h
new file mode 100644
index 0000000..15f0692
--- /dev/null
+++ b/misc/sys/sysmacros.h
@@ -0,0 +1,95 @@
+/* Definitions of macros to access `dev_t' values.
+   Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _SYS_SYSMACROS_H
+
+#ifndef _DEPRECATED_INCLUSION_OF_SYS_SYSMACROS_H
+# define _SYS_SYSMACROS_H	1
+#endif
+
+/* If <sys/sysmacros.h> is included after <sys/types.h>, these macros
+   will already be defined, and we need to redefine them without the
+   deprecation warnings.  (If they are included in the opposite order,
+   the outer #ifndef will suppress this entire file and the macros
+   will be usable without warnings.)  */
+#undef major
+#undef minor
+#undef makedev
+
+#ifndef _SYS_SYSMACROS_H_INNER
+#define _SYS_SYSMACROS_H_INNER 1
+
+#include <features.h>
+#include <bits/types.h>
+#include <bits/sysmacros.h>
+
+#define __INCLUSION_DEPRECATION_MSG(symbol)                                  \
+  "\n  The macro `" #symbol "' is defined by <sys/sysmacros.h>."             \
+  "\n  For compatibility with BSD, it is currently defined by <sys/types.h>" \
+  "\n  as well, but we plan to remove this soon.  To use `" #symbol "',"     \
+  "\n  include <sys/sysmacros.h> directly.  If you did not intend to use"    \
+  "\n  a system-defined macro `" #symbol "', you can suppress it by "        \
+  "\n  defining the macro _SYS_TYPES_NO_SYSMACROS (with any value) before "  \
+  "\n  including any system headers."
+
+#define __SYSMACRO_DECL(rtype, name, proto) \
+  extern rtype gnu_dev_##name proto __THROW __attribute_const__; \
+  extern rtype __REDIRECT_NTH (gnu_dev_##name##_from_sys_types, proto, \
+                               gnu_dev_##name) \
+       __attribute_const__ \
+       __attribute_deprecated_msg__ (__INCLUSION_DEPRECATION_MSG (name)); \
+
+#ifdef __USE_EXTERN_INLINES
+#define __SYSMACRO_IMPL(rtype, name, proto, expr) \
+  __SYSMACRO_DECL(rtype, name, proto) \
+  __extension__ __extern_inline __attribute_const__ rtype \
+  __NTH (gnu_dev_##name proto) { return expr; } \
+  __extension__ __extern_inline __attribute_const__ rtype \
+  __NTH (gnu_dev_##name##_from_sys_types proto) { return expr; }
+#else
+#define __SYSMACRO_IMPL(rtype, name, proto, expr) \
+  __SYSMACRO_DECL(rtype, name, proto)
+#endif
+
+__BEGIN_DECLS
+
+__SYSMACRO_IMPL(unsigned int, major, (__dev_t __dev), __dev_major (__dev))
+__SYSMACRO_IMPL(unsigned int, minor, (__dev_t __dev), __dev_minor (__dev))
+__SYSMACRO_IMPL(__dev_t, makedev,
+                (unsigned int __major, unsigned int __minor),
+                __dev_makedev (__major, __minor))
+
+__END_DECLS
+
+#undef __SYSMACRO_IMPL
+#undef __SYSMACRO_DECL
+#undef __INCLUSION_DEPRECATION_MESSAGE
+
+#endif /* _SYS_SYSMACROS_H_INNER */
+
+#ifdef _DEPRECATED_INCLUSION_OF_SYS_SYSMACROS_H
+#define major(dev) gnu_dev_major_from_sys_types (dev)
+#define minor(dev) gnu_dev_minor_from_sys_types (dev)
+#define makedev(maj, min) gnu_dev_makedev_from_sys_types (maj, min)
+#else
+#define major(dev) gnu_dev_major (dev)
+#define minor(dev) gnu_dev_minor (dev)
+#define makedev(maj, min) gnu_dev_makedev (maj, min)
+#endif
+
+#endif /* sys/sysmacros.h */
diff --git a/posix/Makefile b/posix/Makefile
index aeb9890..e2835c3 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -29,7 +29,7 @@ headers	:= sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.h	      \
 	   bits/local_lim.h tar.h bits/utsname.h bits/confname.h	      \
 	   bits/waitflags.h bits/waitstatus.h sys/unistd.h sched.h	      \
 	   bits/sched.h re_comp.h wait.h bits/environments.h cpio.h	      \
-	   sys/sysmacros.h spawn.h bits/unistd.h
+	   spawn.h bits/unistd.h
 
 routines :=								      \
 	uname								      \
diff --git a/posix/sys/types.h b/posix/sys/types.h
index bf30873..74eb558 100644
--- a/posix/sys/types.h
+++ b/posix/sys/types.h
@@ -218,8 +218,17 @@ typedef int register_t __attribute__ ((__mode__ (__word__)));
 /* It also defines `fd_set' and the FD_* macros for `select'.  */
 # include <sys/select.h>
 
-/* BSD defines these symbols, so we follow.  */
-# include <sys/sysmacros.h>
+/* BSD defines `major', `minor', and `makedev' in this header.
+   However, these symbols are likely to collide with user code, so we
+   are going to remove them in an upcoming release.  Code that needs
+   these macros should include <sys/sysmacros.h> directly.  Code that
+   does not need these macros may define _SYS_TYPES_NO_SYSMACROS to
+   insulate itself from them.  */
+# ifndef _SYS_TYPES_NO_SYSMACROS
+#  define _DEPRECATED_INCLUSION_OF_SYS_SYSMACROS_H
+#  include <sys/sysmacros.h>
+#  undef _DEPRECATED_INCLUSION_OF_SYS_SYSMACROS_H
+# endif /* No sysmacros.  */
 #endif /* Use misc.  */
 
 
diff --git a/sysdeps/generic/bits/sysmacros.h b/sysdeps/generic/bits/sysmacros.h
new file mode 100644
index 0000000..1022d48
--- /dev/null
+++ b/sysdeps/generic/bits/sysmacros.h
@@ -0,0 +1,30 @@
+/* Definitions of macros to access `dev_t' values.
+   Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _BITS_SYSMACROS_H
+#define _BITS_SYSMACROS_H	1
+
+#ifndef _SYS_SYSMACROS_H_INNER
+# error "Never include <bits/sysmacros.h> directly; use <sys/sysmacros.h> instead."
+#endif
+
+#define __dev_major(dev) ((dev) >> 8) & 0xff))
+#define __dev_minor(dev) ((dev)       & 0xff))
+#define __dev_makedev(major, minor) (((major) << 8) | (minor & 0xff))
+
+#endif /* bits/sysmacros.h */
diff --git a/sysdeps/generic/sys/sysmacros.h b/sysdeps/generic/sys/sysmacros.h
deleted file mode 100644
index 06e5d70..0000000
--- a/sysdeps/generic/sys/sysmacros.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Definitions of macros to access `dev_t' values.
-   Copyright (C) 1996-2015 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#ifndef _SYS_SYSMACROS_H
-#define _SYS_SYSMACROS_H	1
-
-/* For compatibility we provide alternative names.
-
-   The problem here is that compilers other than GCC probably don't
-   have the `long long' type and so `dev_t' is actually an array.  */
-#define major(dev) ((int)(((unsigned int) (dev) >> 8) & 0xff))
-#define minor(dev) ((int)((dev) & 0xff))
-#define makedev(major, minor) (((major) << 8) | (minor))
-
-#endif /* sys/sysmacros.h */
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index d6cc529..551c4ee 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -15,7 +15,7 @@ ifeq ($(subdir),misc)
 include $(firstword $(wildcard $(sysdirs:=/sysctl.mk)))
 
 sysdep_routines += clone llseek umount umount2 readahead \
-		   setfsuid setfsgid makedev epoll_pwait signalfd \
+		   setfsuid setfsgid epoll_pwait signalfd \
 		   eventfd eventfd_read eventfd_write prlimit
 
 CFLAGS-gethostid.c = -fexceptions
diff --git a/sysdeps/unix/sysv/linux/bits/sysmacros.h b/sysdeps/unix/sysv/linux/bits/sysmacros.h
new file mode 100644
index 0000000..da37e28
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/bits/sysmacros.h
@@ -0,0 +1,39 @@
+/* Definitions of macros to access `dev_t' values.
+   Copyright (C) 1996-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _BITS_SYSMACROS_H
+#define _BITS_SYSMACROS_H	1
+
+#ifndef _SYS_SYSMACROS_H_INNER
+# error "Never include <bits/sysmacros.h> directly; use <sys/sysmacros.h> instead."
+#endif
+
+/* dev_t in glibc is a 64-bit quantity, encoded as MMMM Mmmm mmmM MMmm,
+   where M is a hex digit of the major number and m is a hex digit of
+   the minor number.  Linux-the-kernel only uses the low 32 bits.  */
+
+#define __dev_major(dev) \
+  ((((dev) >> 8) & 0xfff) | (((unsigned int) ((dev) >> 32)) & ~0xfff))
+#define __dev_minor(dev) \
+  (((dev) & 0xff) | (((unsigned int) ((dev) >> 12) & ~0xff)))
+#define __dev_makedev(major, minor) \
+  (((minor) & 0xff) | (((major) & 0xfff) << 8) \
+   | (((__dev_t) ((minor) & ~0xff)) << 12) \
+   | (((__dev_t) ((major) & ~0xff)) << 32))
+
+#endif /* bits/sysmacros.h */
diff --git a/sysdeps/unix/sysv/linux/makedev.c b/sysdeps/unix/sysv/linux/makedev.c
deleted file mode 100644
index bd9666f..0000000
--- a/sysdeps/unix/sysv/linux/makedev.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Definitions of functions to access `dev_t' values.
-   Copyright (C) 2003-2015 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <endian.h>
-#include <sys/sysmacros.h>
-
-unsigned int
-gnu_dev_major (unsigned long long int dev)
-{
-  return ((dev >> 8) & 0xfff) | ((unsigned int) (dev >> 32) & ~0xfff);
-}
-
-unsigned int
-gnu_dev_minor (unsigned long long int dev)
-{
-  return (dev & 0xff) | ((unsigned int) (dev >> 12) & ~0xff);
-}
-
-unsigned long long int
-gnu_dev_makedev (unsigned int major, unsigned int minor)
-{
-  return ((minor & 0xff) | ((major & 0xfff) << 8)
-	  | (((unsigned long long int) (minor & ~0xff)) << 12)
-	  | (((unsigned long long int) (major & ~0xfff)) << 32));
-}
diff --git a/sysdeps/unix/sysv/linux/sys/sysmacros.h b/sysdeps/unix/sysv/linux/sys/sysmacros.h
deleted file mode 100644
index a4fbd47..0000000
--- a/sysdeps/unix/sysv/linux/sys/sysmacros.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Definitions of macros to access `dev_t' values.
-   Copyright (C) 1996-2015 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#ifndef _SYS_SYSMACROS_H
-#define _SYS_SYSMACROS_H	1
-
-#include <features.h>
-
-__BEGIN_DECLS
-
-__extension__
-extern unsigned int gnu_dev_major (unsigned long long int __dev)
-     __THROW __attribute_const__;
-__extension__
-extern unsigned int gnu_dev_minor (unsigned long long int __dev)
-     __THROW __attribute_const__;
-__extension__
-extern unsigned long long int gnu_dev_makedev (unsigned int __major,
-					       unsigned int __minor)
-     __THROW __attribute_const__;
-
-#ifdef __USE_EXTERN_INLINES
-__extension__ __extern_inline __attribute_const__ unsigned int
-__NTH (gnu_dev_major (unsigned long long int __dev))
-{
-  return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff);
-}
-
-__extension__ __extern_inline __attribute_const__ unsigned int
-__NTH (gnu_dev_minor (unsigned long long int __dev))
-{
-  return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff);
-}
-
-__extension__ __extern_inline __attribute_const__ unsigned long long int
-__NTH (gnu_dev_makedev (unsigned int __major, unsigned int __minor))
-{
-  return ((__minor & 0xff) | ((__major & 0xfff) << 8)
-	  | (((unsigned long long int) (__minor & ~0xff)) << 12)
-	  | (((unsigned long long int) (__major & ~0xfff)) << 32));
-}
-#endif
-__END_DECLS
-
-/* Access the functions with their traditional names.  */
-#define major(dev) gnu_dev_major (dev)
-#define minor(dev) gnu_dev_minor (dev)
-#define makedev(maj, min) gnu_dev_makedev (maj, min)
-
-#endif /* sys/sysmacros.h */
-- 
2.6.2


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

* Re: RFC: remove <sys/sysmacros.h> from <sys/types.h>
  2015-11-14 22:19         ` Andreas Schwab
@ 2015-11-21  0:19           ` Roland McGrath
  2015-11-21  0:56             ` Zack Weinberg
  0 siblings, 1 reply; 30+ messages in thread
From: Roland McGrath @ 2015-11-21  0:19 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Rich Felker, Zack Weinberg, GNU C Library

> stdlib.h only includes sys/types.h for int32_t, which is also available
> through stdint.h.  We could add support for __need_int32_t if necessary.

Making stdlib.h include stdint.h instead of sys/types.h seems sensible to me.
It was never an explicit intent that stdlib.h would get you sys/sysmacros.h,
while it was for sys/types.h.

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

* Re: RFC: remove <sys/sysmacros.h> from <sys/types.h>
  2015-11-21  0:19           ` Roland McGrath
@ 2015-11-21  0:56             ` Zack Weinberg
  0 siblings, 0 replies; 30+ messages in thread
From: Zack Weinberg @ 2015-11-21  0:56 UTC (permalink / raw)
  To: Roland McGrath; +Cc: Andreas Schwab, Rich Felker, GNU C Library

On Fri, Nov 20, 2015 at 7:19 PM, Roland McGrath <roland@hack.frob.com> wrote:
>> stdlib.h only includes sys/types.h for int32_t, which is also available
>> through stdint.h.  We could add support for __need_int32_t if necessary.
>
> Making stdlib.h include stdint.h instead of sys/types.h seems sensible to me.
> It was never an explicit intent that stdlib.h would get you sys/sysmacros.h,
> while it was for sys/types.h.

Unfortunately - see the other threads about this - there seem to be a
significant number of programs written (sloppily, yes) on the
assumption that stdlib.h *does* include sys/types.h.  If you look at
the patches I posted about a day ago, to see how much of a mess it was
just to generate deprecation warnings for *three* declarations
accessed the wrong way, and then imagine extending that to everything
from sys/types.h ... I'm not a fan.

zw

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

* Re: RFC: deprecate sys/sysmacros.h inclusion from sys/types.h
  2015-11-19  4:13 ` RFC: deprecate sys/sysmacros.h inclusion from sys/types.h Zack Weinberg
@ 2015-12-07 14:03   ` Zack Weinberg
  2015-12-21 20:31     ` Zack Weinberg
  2015-12-29 20:42   ` Mike Frysinger
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 30+ messages in thread
From: Zack Weinberg @ 2015-12-07 14:03 UTC (permalink / raw)
  To: GNU C Library

On 11/18/2015 11:13 PM, Zack Weinberg wrote:
> Andreas may still be running whole-distro rebuild tests, but enough
> results came back that I feel fairly confident saying that option B
> (remove the #include <sys/types.h> from stdlib.h) is a non-starter.
> There are too many (sloppily coded, yes) programs that include stdlib.h
> and expect it to expose all the POSIX foo_t types.  That leaves us with
> option A (remove the #include <sys/sysmacros.h> from sys/types.h) and
> even that is going to break stuff.  So we need a deprecation period.
> 
> The attached, lightly tested, patch sets up that deprecation period.

Ping.  The patch at
<https://sourceware.org/ml/libc-alpha/2015-11/msg00452.html> is awaiting
review.

zw

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

* Re: RFC: deprecate sys/sysmacros.h inclusion from sys/types.h
  2015-12-07 14:03   ` Zack Weinberg
@ 2015-12-21 20:31     ` Zack Weinberg
  2016-01-11 15:16       ` Zack Weinberg
  0 siblings, 1 reply; 30+ messages in thread
From: Zack Weinberg @ 2015-12-21 20:31 UTC (permalink / raw)
  To: GNU C Library

On Mon, Dec 7, 2015 at 9:03 AM, Zack Weinberg <zackw@panix.com> wrote:
> On 11/18/2015 11:13 PM, Zack Weinberg wrote:
>> Andreas may still be running whole-distro rebuild tests, but enough
>> results came back that I feel fairly confident saying that option B
>> (remove the #include <sys/types.h> from stdlib.h) is a non-starter.
>> There are too many (sloppily coded, yes) programs that include stdlib.h
>> and expect it to expose all the POSIX foo_t types.  That leaves us with
>> option A (remove the #include <sys/sysmacros.h> from sys/types.h) and
>> even that is going to break stuff.  So we need a deprecation period.
>>
>> The attached, lightly tested, patch sets up that deprecation period.
>
> Ping.  The patch at
> <https://sourceware.org/ml/libc-alpha/2015-11/msg00452.html> is awaiting
> review.

Ping.

zw

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

* Re: RFC: deprecate sys/sysmacros.h inclusion from sys/types.h
  2015-11-19  4:13 ` RFC: deprecate sys/sysmacros.h inclusion from sys/types.h Zack Weinberg
  2015-12-07 14:03   ` Zack Weinberg
@ 2015-12-29 20:42   ` Mike Frysinger
  2015-12-29 21:56     ` Zack Weinberg
  2016-04-20 17:37   ` Mike Frysinger
  2016-04-21 19:31   ` Roland McGrath
  3 siblings, 1 reply; 30+ messages in thread
From: Mike Frysinger @ 2015-12-29 20:42 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: GNU C Library

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

On 18 Nov 2015 23:13, Zack Weinberg wrote:
> Andreas may still be running whole-distro rebuild tests, but enough
> results came back that I feel fairly confident saying that option B
> (remove the #include <sys/types.h> from stdlib.h) is a non-starter.
> There are too many (sloppily coded, yes) programs that include stdlib.h
> and expect it to expose all the POSIX foo_t types.  That leaves us with
> option A (remove the #include <sys/sysmacros.h> from sys/types.h) and
> even that is going to break stuff.  So we need a deprecation period.

i'm just going to drop it in Gentoo and let people fix the build failures
-mike

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

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

* Re: RFC: deprecate sys/sysmacros.h inclusion from sys/types.h
  2015-12-29 20:42   ` Mike Frysinger
@ 2015-12-29 21:56     ` Zack Weinberg
  2015-12-29 22:45       ` Mike Frysinger
  0 siblings, 1 reply; 30+ messages in thread
From: Zack Weinberg @ 2015-12-29 21:56 UTC (permalink / raw)
  To: GNU C Library

On Tue, Dec 29, 2015 at 12:42 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> On 18 Nov 2015 23:13, Zack Weinberg wrote:
>> Andreas may still be running whole-distro rebuild tests, but enough
>> results came back that I feel fairly confident saying that option B
>> (remove the #include <sys/types.h> from stdlib.h) is a non-starter.
>> There are too many (sloppily coded, yes) programs that include stdlib.h
>> and expect it to expose all the POSIX foo_t types.  That leaves us with
>> option A (remove the #include <sys/sysmacros.h> from sys/types.h) and
>> even that is going to break stuff.  So we need a deprecation period.
>
> i'm just going to drop it in Gentoo and let people fix the build failures

Well, if you're going to do that, option B might be better (or both!)
but I don't see it as a viable approach for upstream...

zw

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

* Re: RFC: deprecate sys/sysmacros.h inclusion from sys/types.h
  2015-12-29 21:56     ` Zack Weinberg
@ 2015-12-29 22:45       ` Mike Frysinger
  2016-02-19 20:56         ` Mike Frysinger
  0 siblings, 1 reply; 30+ messages in thread
From: Mike Frysinger @ 2015-12-29 22:45 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: GNU C Library

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

On 29 Dec 2015 13:56, Zack Weinberg wrote:
> On Tue, Dec 29, 2015 at 12:42 PM, Mike Frysinger wrote:
> > On 18 Nov 2015 23:13, Zack Weinberg wrote:
> >> Andreas may still be running whole-distro rebuild tests, but enough
> >> results came back that I feel fairly confident saying that option B
> >> (remove the #include <sys/types.h> from stdlib.h) is a non-starter.
> >> There are too many (sloppily coded, yes) programs that include stdlib.h
> >> and expect it to expose all the POSIX foo_t types.  That leaves us with
> >> option A (remove the #include <sys/sysmacros.h> from sys/types.h) and
> >> even that is going to break stuff.  So we need a deprecation period.
> >
> > i'm just going to drop it in Gentoo and let people fix the build failures
> 
> Well, if you're going to do that, option B might be better (or both!)
> but I don't see it as a viable approach for upstream...

one at a time :).  the impact of sysmacros.h is significantly lower than
the impact of sys/types.h.  although people have been building Gentoo
against other C libs, so we are prob better protected against that.
-mike

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

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

* Re: RFC: deprecate sys/sysmacros.h inclusion from sys/types.h
  2015-12-21 20:31     ` Zack Weinberg
@ 2016-01-11 15:16       ` Zack Weinberg
  2016-01-11 15:27         ` Carlos O'Donell
  0 siblings, 1 reply; 30+ messages in thread
From: Zack Weinberg @ 2016-01-11 15:16 UTC (permalink / raw)
  To: GNU C Library, adhemerval.zanella

On 12/21/2015 03:31 PM, Zack Weinberg wrote:
> On Mon, Dec 7, 2015 at 9:03 AM, Zack Weinberg <zackw@panix.com> wrote:
>> On 11/18/2015 11:13 PM, Zack Weinberg wrote:
>>> Andreas may still be running whole-distro rebuild tests, but enough
>>> results came back that I feel fairly confident saying that option B
>>> (remove the #include <sys/types.h> from stdlib.h) is a non-starter.
>>> There are too many (sloppily coded, yes) programs that include stdlib.h
>>> and expect it to expose all the POSIX foo_t types.  That leaves us with
>>> option A (remove the #include <sys/sysmacros.h> from sys/types.h) and
>>> even that is going to break stuff.  So we need a deprecation period.
>>>
>>> The attached, lightly tested, patch sets up that deprecation period.
>>
>> Ping.  The patch at
>> <https://sourceware.org/ml/libc-alpha/2015-11/msg00452.html> is awaiting
>> review.
> 
> Ping.

Ping.

My hacking time is very limited right now. With the freeze looming, I
would appreciate a definitive yes-or-no answer to whether this is wanted
in the next release (possibly with some concrete list of changes) so I
know whether I need to find time in the near future.

zw

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

* Re: RFC: deprecate sys/sysmacros.h inclusion from sys/types.h
  2016-01-11 15:16       ` Zack Weinberg
@ 2016-01-11 15:27         ` Carlos O'Donell
  2016-01-11 18:02           ` Zack Weinberg
  0 siblings, 1 reply; 30+ messages in thread
From: Carlos O'Donell @ 2016-01-11 15:27 UTC (permalink / raw)
  To: Zack Weinberg, GNU C Library, adhemerval.zanella

On 01/11/2016 10:16 AM, Zack Weinberg wrote:
> On 12/21/2015 03:31 PM, Zack Weinberg wrote:
>> On Mon, Dec 7, 2015 at 9:03 AM, Zack Weinberg <zackw@panix.com> wrote:
>>> On 11/18/2015 11:13 PM, Zack Weinberg wrote:
>>>> Andreas may still be running whole-distro rebuild tests, but enough
>>>> results came back that I feel fairly confident saying that option B
>>>> (remove the #include <sys/types.h> from stdlib.h) is a non-starter.
>>>> There are too many (sloppily coded, yes) programs that include stdlib.h
>>>> and expect it to expose all the POSIX foo_t types.  That leaves us with
>>>> option A (remove the #include <sys/sysmacros.h> from sys/types.h) and
>>>> even that is going to break stuff.  So we need a deprecation period.
>>>>
>>>> The attached, lightly tested, patch sets up that deprecation period.
>>>
>>> Ping.  The patch at
>>> <https://sourceware.org/ml/libc-alpha/2015-11/msg00452.html> is awaiting
>>> review.
>>
>> Ping.
> 
> Ping.
> 
> My hacking time is very limited right now. With the freeze looming, I
> would appreciate a definitive yes-or-no answer to whether this is wanted
> in the next release (possibly with some concrete list of changes) so I
> know whether I need to find time in the near future.

I would like this to go into 2.24.

The reason I say this is that we're very close to a Fedora release and
I would like time to put the deprecation code into Rawhide to get the
developers to cleanup their code there.

For example, 2.23 would go out without these patches, then after we reopen
for 2.24 (Feb), we put the patches in, then we get 6 months of cleanup in
Rawhide, and 2.24 goes out the door with the deprecation macros.
Then 2.25 has the changes made in complete.

Thoughts?

I appreciate the consideration you'd be giving to the Fedora distribution
schedule.

Cheers,
Carlos.

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

* Re: RFC: deprecate sys/sysmacros.h inclusion from sys/types.h
  2016-01-11 15:27         ` Carlos O'Donell
@ 2016-01-11 18:02           ` Zack Weinberg
  2016-01-11 20:50             ` Carlos O'Donell
  0 siblings, 1 reply; 30+ messages in thread
From: Zack Weinberg @ 2016-01-11 18:02 UTC (permalink / raw)
  To: Carlos O'Donell; +Cc: GNU C Library, Adhemerval Zanella

On Mon, Jan 11, 2016 at 10:27 AM, Carlos O'Donell <carlos@redhat.com> wrote:
>
> I would like this to go into 2.24.
>
> The reason I say this is that we're very close to a Fedora release and
> I would like time to put the deprecation code into Rawhide to get the
> developers to cleanup their code there.

I'm happy to have this go in on whatever schedule is most convenient
for the community at large.  Perhaps we should check whether your
proposed schedule is also good for other distributions?

(also, still waiting for any feedback at all on the content of the changes ;-)

zw

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

* Re: RFC: deprecate sys/sysmacros.h inclusion from sys/types.h
  2016-01-11 18:02           ` Zack Weinberg
@ 2016-01-11 20:50             ` Carlos O'Donell
  0 siblings, 0 replies; 30+ messages in thread
From: Carlos O'Donell @ 2016-01-11 20:50 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: GNU C Library, Adhemerval Zanella

On 01/11/2016 01:02 PM, Zack Weinberg wrote:
> On Mon, Jan 11, 2016 at 10:27 AM, Carlos O'Donell <carlos@redhat.com> wrote:
>>
>> I would like this to go into 2.24.
>>
>> The reason I say this is that we're very close to a Fedora release and
>> I would like time to put the deprecation code into Rawhide to get the
>> developers to cleanup their code there.
> 
> I'm happy to have this go in on whatever schedule is most convenient
> for the community at large.  Perhaps we should check whether your
> proposed schedule is also good for other distributions?
> 
> (also, still waiting for any feedback at all on the content of the changes ;-)

I'm buying myself time to review :}

The other distributions are listed on MAINTAINERS and their respective
glibc developers should follow this list, even orthogonally, and if we
make this change it will go into the release-specific wiki page documenting
distribution changes (like we did for DEFAULT_SOURCE and your other change).
So they should have visibility just before the release.

Cheers,
Carlos.

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

* Re: RFC: deprecate sys/sysmacros.h inclusion from sys/types.h
  2015-12-29 22:45       ` Mike Frysinger
@ 2016-02-19 20:56         ` Mike Frysinger
  0 siblings, 0 replies; 30+ messages in thread
From: Mike Frysinger @ 2016-02-19 20:56 UTC (permalink / raw)
  To: Zack Weinberg, GNU C Library

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

On 29 Dec 2015 17:45, Mike Frysinger wrote:
> On 29 Dec 2015 13:56, Zack Weinberg wrote:
> > On Tue, Dec 29, 2015 at 12:42 PM, Mike Frysinger wrote:
> > > On 18 Nov 2015 23:13, Zack Weinberg wrote:
> > >> Andreas may still be running whole-distro rebuild tests, but enough
> > >> results came back that I feel fairly confident saying that option B
> > >> (remove the #include <sys/types.h> from stdlib.h) is a non-starter.
> > >> There are too many (sloppily coded, yes) programs that include stdlib.h
> > >> and expect it to expose all the POSIX foo_t types.  That leaves us with
> > >> option A (remove the #include <sys/sysmacros.h> from sys/types.h) and
> > >> even that is going to break stuff.  So we need a deprecation period.
> > >
> > > i'm just going to drop it in Gentoo and let people fix the build failures
> > 
> > Well, if you're going to do that, option B might be better (or both!)
> > but I don't see it as a viable approach for upstream...
> 
> one at a time :).  the impact of sysmacros.h is significantly lower than
> the impact of sys/types.h.  although people have been building Gentoo
> against other C libs, so we are prob better protected against that.

i've deployed this in Gentoo now, but only to limited testers.
i'll open it up when glibc-2.22 goes stable in like ~30 days.
-mike

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

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

* Re: RFC: deprecate sys/sysmacros.h inclusion from sys/types.h
  2015-11-19  4:13 ` RFC: deprecate sys/sysmacros.h inclusion from sys/types.h Zack Weinberg
  2015-12-07 14:03   ` Zack Weinberg
  2015-12-29 20:42   ` Mike Frysinger
@ 2016-04-20 17:37   ` Mike Frysinger
  2016-04-20 17:58     ` Zack Weinberg
  2016-04-21 19:31   ` Roland McGrath
  3 siblings, 1 reply; 30+ messages in thread
From: Mike Frysinger @ 2016-04-20 17:37 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: GNU C Library

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

On 18 Nov 2015 23:13, Zack Weinberg wrote:
> Andreas may still be running whole-distro rebuild tests, but enough
> results came back that I feel fairly confident saying that option B
> (remove the #include <sys/types.h> from stdlib.h) is a non-starter.
> There are too many (sloppily coded, yes) programs that include stdlib.h
> and expect it to expose all the POSIX foo_t types.  That leaves us with
> option A (remove the #include <sys/sysmacros.h> from sys/types.h) and
> even that is going to break stuff.  So we need a deprecation period.
> 
> The attached, lightly tested, patch sets up that deprecation period.
> From an application's perspective, it works like this:
> 
> * If you include <sys/sysmacros.h> directly, you get major(), minor(),
> and makedev() macros and everything works as it did before, regardless
> of whether you also include <sys/types.h> and in what order.
> 
> * If you define _SYS_TYPES_NO_SYSMACROS before including any headers,
> then <sys/types.h> does not include <sys/sysmacros.h> at all.
> 
> * If you include <sys/types.h>, you don't include <sys/sysmacros.h>, and
> you don't define _SYS_TYPES_NO_SYSMACROS, then you still get major(),
> minor(), and makedev() macros, but they trigger a deprecation warning if
> you *use* them.  This warning contains a lengthy explanation of what is
> about to change and suggests either including <sys/sysmacros.h> or
> defining _SYS_TYPES_NO_SYSMACROS, depending on whether you actually
> wanted the dev_t manipulators.
> 
> The implementation of all that is regrettably messy, but it works.  I
> also took the opportunity to genericize some of the code involved;
> sys/sysmacros.h and makedev.c both now live in misc/ instead of
> sysdeps/, and there's a new 'bits' header that encapsulates the only
> thing that varies between Linux and non-, which is the actual encoding
> of a dev_t.  (I'd appreciate extra-careful review of the arithmetic in
> the new bits headers; I'm not sure it was ever 100% correct, I may have
> messed it up, and there don't seem to be any tests.)
> 
> I deliberately didn't say "in the next release" in the deprecation
> message, because we might want to give this more than one cycle to bake.

shall we move forward with this ?  i've been sending patches to upstreams
and they've been taking them.
-mike

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

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

* Re: RFC: deprecate sys/sysmacros.h inclusion from sys/types.h
  2016-04-20 17:37   ` Mike Frysinger
@ 2016-04-20 17:58     ` Zack Weinberg
  2016-04-20 18:11       ` Mike Frysinger
  0 siblings, 1 reply; 30+ messages in thread
From: Zack Weinberg @ 2016-04-20 17:58 UTC (permalink / raw)
  To: GNU C Library, Carlos O'Donell, Mike Frysinger

On Wed, Apr 20, 2016 at 1:36 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> On 18 Nov 2015 23:13, Zack Weinberg wrote:
>>
>> The attached, lightly tested, patch sets up that deprecation period.
>
> shall we move forward with this ?  i've been sending patches to upstreams
> and they've been taking them.

I'm going to be on vacation the last two weeks in May, and I've got a
lot on my plate between now and then.  I can probably find time to
revise the patch *once* before June, but it would be ideal to get a
comprehensive list of changes you want me to make ASAP.

zw

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

* Re: RFC: deprecate sys/sysmacros.h inclusion from sys/types.h
  2016-04-20 17:58     ` Zack Weinberg
@ 2016-04-20 18:11       ` Mike Frysinger
  0 siblings, 0 replies; 30+ messages in thread
From: Mike Frysinger @ 2016-04-20 18:11 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: GNU C Library, Carlos O'Donell

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

On 20 Apr 2016 13:58, Zack Weinberg wrote:
> On Wed, Apr 20, 2016 at 1:36 PM, Mike Frysinger wrote:
> > On 18 Nov 2015 23:13, Zack Weinberg wrote:
> >> The attached, lightly tested, patch sets up that deprecation period.
> >
> > shall we move forward with this ?  i've been sending patches to upstreams
> > and they've been taking them.
> 
> I'm going to be on vacation the last two weeks in May, and I've got a
> lot on my plate between now and then.  I can probably find time to
> revise the patch *once* before June, but it would be ideal to get a
> comprehensive list of changes you want me to make ASAP.

assuming it works as advertised, i didn't see anything wrong with this
version as-is.  Carlos said he wanted to take a peek though ...
-mike

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

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

* Re: RFC: deprecate sys/sysmacros.h inclusion from sys/types.h
  2015-11-19  4:13 ` RFC: deprecate sys/sysmacros.h inclusion from sys/types.h Zack Weinberg
                     ` (2 preceding siblings ...)
  2016-04-20 17:37   ` Mike Frysinger
@ 2016-04-21 19:31   ` Roland McGrath
  2016-04-21 21:00     ` Zack Weinberg
  3 siblings, 1 reply; 30+ messages in thread
From: Roland McGrath @ 2016-04-21 19:31 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: GNU C Library

This patch has no ChangeLog entries.

Please drop the clang-related changes to sys/cdefs.h in this patch.
Adding __attribute_deprecated_msg__ here is OK, but other changes to
sys/cdefs.h belong in a separate change.

> --- /dev/null
> +++ b/include/sys/sysmacros.h
> @@ -0,0 +1,3 @@
> +#ifndef _SYS_SYSMACROS_H
> +#include <misc/sys/sysmacros.h>
> +#endif

No #ifndef here.  include/ files should be nothing but direct
wrappers when that works, as it should here.

> --- /dev/null
> +++ b/misc/makedev.c

Moving this file to OS-independent place means you also need to add
the functions to misc/Versions.  Since they didn't exist before on
non-Linux configurations, misc/Versions should list them under
GLIBC_2.24.  The existing sysdeps/unix/sysv/linux/Versions entries
will give them the old symbol version in Linux configurations.

> --- /dev/null
> +++ b/misc/sys/sysmacros.h

Throughout this file you should indent nested preprocessor
directives, e.g.:

#ifdef foo
# define bar ...
#endif


> +#define __INCLUSION_DEPRECATION_MSG(symbol)                                  \

Use a name that starts with "__SYSMACROS_".

> +  "\n  The macro `" #symbol "' is defined by <sys/sysmacros.h>."             \
> +  "\n  For compatibility with BSD, it is currently defined by <sys/types.h>" \
> +  "\n  as well, but we plan to remove this soon.  To use `" #symbol "',"     \
> +  "\n  include <sys/sysmacros.h> directly.  If you did not intend to use"    \
> +  "\n  a system-defined macro `" #symbol "', you can suppress it by "        \
> +  "\n  defining the macro _SYS_TYPES_NO_SYSMACROS (with any value) before "  \
> +  "\n  including any system headers."

Say "historical compatibility" rather than "compatibility with BSD".

I'm not convinced that we should support the _SYS_TYPES_NO_SYSMACROS
macro at all.  If we advise applications to define that, then it will
litter random sources for years to come.  But it serves only a brief
transitional purpose.  And IMHO there is really no need for that
option at all.  Things will continue to work as they did today with
no warnings for applications that were not using these symbols.

> +#ifdef __USE_EXTERN_INLINES
> +#define __SYSMACRO_IMPL(rtype, name, proto, expr) \

An example of unintended preprocessor directives.

> +  __SYSMACRO_DECL(rtype, name, proto) \

Space before paren here.

> +__SYSMACRO_IMPL(unsigned int, major, (__dev_t __dev), __dev_major (__dev))
> +__SYSMACRO_IMPL(unsigned int, minor, (__dev_t __dev), __dev_minor (__dev))
> +__SYSMACRO_IMPL(__dev_t, makedev,
> +                (unsigned int __major, unsigned int __minor),
> +                __dev_makedev (__major, __minor))

Space before parens here.

Also, make all these macros __SYSMACROS_* instead of _SYSMACRO_* (so
the prefix matches the name of the header file).

> +#ifdef _DEPRECATED_INCLUSION_OF_SYS_SYSMACROS_H
> +#define major(dev) gnu_dev_major_from_sys_types (dev)
> +#define minor(dev) gnu_dev_minor_from_sys_types (dev)
> +#define makedev(maj, min) gnu_dev_makedev_from_sys_types (maj, min)

I think these compat wrapper functions should have __ names.


Thanks,
Roland

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

* Re: RFC: deprecate sys/sysmacros.h inclusion from sys/types.h
  2016-04-21 19:31   ` Roland McGrath
@ 2016-04-21 21:00     ` Zack Weinberg
  2016-04-21 21:11       ` Roland McGrath
  0 siblings, 1 reply; 30+ messages in thread
From: Zack Weinberg @ 2016-04-21 21:00 UTC (permalink / raw)
  To: Roland McGrath; +Cc: GNU C Library

Thanks for the review. I will make revisions this weekend.

On Thu, Apr 21, 2016 at 3:31 PM, Roland McGrath <roland@hack.frob.com> wrote:
> This patch has no ChangeLog entries.

I'll add those after all revisions are complete.

> Please drop the clang-related changes to sys/cdefs.h in this patch.
> Adding __attribute_deprecated_msg__ here is OK, but other changes to
> sys/cdefs.h belong in a separate change.

OK, I'll split it.

>> --- /dev/null
>> +++ b/include/sys/sysmacros.h
>> @@ -0,0 +1,3 @@
>> +#ifndef _SYS_SYSMACROS_H
>> +#include <misc/sys/sysmacros.h>
>> +#endif
>
> No #ifndef here.  include/ files should be nothing but direct
> wrappers when that works, as it should here.

OK.

>> --- /dev/null
>> +++ b/misc/makedev.c
>
> Moving this file to OS-independent place means you also need to add
> the functions to misc/Versions.  Since they didn't exist before on
> non-Linux configurations, misc/Versions should list them under
> GLIBC_2.24.  The existing sysdeps/unix/sysv/linux/Versions entries
> will give them the old symbol version in Linux configurations.

OK.

>> --- /dev/null
>> +++ b/misc/sys/sysmacros.h
>
> Throughout this file you should indent nested preprocessor
> directives, e.g.:
>
> #ifdef foo
> # define bar ...
> #endif

OK.

>> +#define __INCLUSION_DEPRECATION_MSG(symbol)                                  \
>
> Use a name that starts with "__SYSMACROS_".

OK.

>> +  "\n  For compatibility with BSD, it is currently defined by <sys/types.h>" \
>> +  "\n  as well, but we plan to remove this soon.  To use `" #symbol "',"     \
>> +  "\n  include <sys/sysmacros.h> directly.  If you did not intend to use"    \
>> +  "\n  a system-defined macro `" #symbol "', you can suppress it by "        \
>> +  "\n  defining the macro _SYS_TYPES_NO_SYSMACROS (with any value) before "  \
>> +  "\n  including any system headers."
>
> Say "historical compatibility" rather than "compatibility with BSD".

OK.

> I'm not convinced that we should support the _SYS_TYPES_NO_SYSMACROS
> macro at all.  If we advise applications to define that, then it will
> litter random sources for years to come.  But it serves only a brief
> transitional purpose.  And IMHO there is really no need for that
> option at all.  Things will continue to work as they did today with
> no warnings for applications that were not using these symbols.

Hmm, good point.  The macro was for programs that *are* being broken
because they didn't expect sys/types.h to define major/minor/makedev,
and advising such programs to #undef those symbols is better advice,
since that will work on *BSDs that still define them there.

>> +#ifdef __USE_EXTERN_INLINES
>> +#define __SYSMACRO_IMPL(rtype, name, proto, expr) \
>
> An example of unintended preprocessor directives.

I assume you meant unindented.

>> +  __SYSMACRO_DECL(rtype, name, proto) \
>
> Space before paren here.

Doh.  (I've been working mostly on programs where the preferred style
is different, lately.)

>> +__SYSMACRO_IMPL(unsigned int, major, (__dev_t __dev), __dev_major (__dev))
>> +__SYSMACRO_IMPL(unsigned int, minor, (__dev_t __dev), __dev_minor (__dev))
>> +__SYSMACRO_IMPL(__dev_t, makedev,
>> +                (unsigned int __major, unsigned int __minor),
>> +                __dev_makedev (__major, __minor))
>
> Space before parens here.
>
> Also, make all these macros __SYSMACROS_* instead of _SYSMACRO_* (so
> the prefix matches the name of the header file).

I think singular is more appropriate because it expands to the
implementation of *one* sysmacro.

>> +#ifdef _DEPRECATED_INCLUSION_OF_SYS_SYSMACROS_H
>> +#define major(dev) gnu_dev_major_from_sys_types (dev)
>> +#define minor(dev) gnu_dev_minor_from_sys_types (dev)
>> +#define makedev(maj, min) gnu_dev_makedev_from_sys_types (maj, min)
>
> I think these compat wrapper functions should have __ names.

OK.

zw

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

* Re: RFC: deprecate sys/sysmacros.h inclusion from sys/types.h
  2016-04-21 21:00     ` Zack Weinberg
@ 2016-04-21 21:11       ` Roland McGrath
  0 siblings, 0 replies; 30+ messages in thread
From: Roland McGrath @ 2016-04-21 21:11 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: GNU C Library

> Hmm, good point.  The macro was for programs that *are* being broken
> because they didn't expect sys/types.h to define major/minor/makedev,
> and advising such programs to #undef those symbols is better advice,
> since that will work on *BSDs that still define them there.

Yes, that is harmless now and will be harmless in the future and does not
look like gratuitous cruft in the same way.

> >> +#ifdef __USE_EXTERN_INLINES
> >> +#define __SYSMACRO_IMPL(rtype, name, proto, expr) \
> >
> > An example of unintended preprocessor directives.
> 
> I assume you meant unindented.

Indeed.  Typing is hard.

> > Also, make all these macros __SYSMACROS_* instead of _SYSMACRO_* (so
> > the prefix matches the name of the header file).
> 
> I think singular is more appropriate because it expands to the
> implementation of *one* sysmacro.

"sysmacro" is not a thing.  "sysmacros" is the name of the file, and hence
the moniker for its private namespace.

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

* Re: RFC: remove <sys/sysmacros.h> from <sys/types.h>
@ 2017-10-21 12:10 Andreas K. Huettel
  0 siblings, 0 replies; 30+ messages in thread
From: Andreas K. Huettel @ 2017-10-21 12:10 UTC (permalink / raw)
  To: GLIBC Devel

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

Zac Weinberg wrote on Fri, 13 Nov 2015:
https://sourceware.org/ml/libc-alpha/2015-11/msg00253.html
>
> Therefore, I propose we remove the inclusion of sys/sysmacros.h from
> sys/types.h.  It's risky enough that I think it's worth doing a distro
> rebuild with that change to find out what, if anything, breaks - who
> do I talk to to make that happen?

Are there any specific plans still to make this happen? 
As far as I can see the include is still in master.

FYI, 

Mike Frysinger wrote on Tue, 29 Dec 2015:
> i'm just going to drop it in Gentoo and let people fix the build failures
> -mike

^ this was reverted by our QA team less than a day later because of 
introducing Gentoo-wide user visible breakage. We kept the patch in later 
glibc versions though, in particular Gentoo testing 2.24 and 2.25.

Now that we want to stabilize 2.25, we're down to 18 (known) build failures 
within our stable package set. 

-- 
Andreas K. Hüttel
dilfridge@gentoo.org
Gentoo Linux developer (council, perl, libreoffice)

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 981 bytes --]

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

end of thread, other threads:[~2017-10-21 12:10 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-13 14:21 RFC: remove <sys/sysmacros.h> from <sys/types.h> Zack Weinberg
2015-11-13 14:29 ` Zack Weinberg
2015-11-13 14:45 ` Dmitry V. Levin
2015-11-13 15:59   ` Paul Eggert
2015-11-13 23:43 ` Roland McGrath
2015-11-14  9:18   ` Andreas Schwab
2015-11-14 20:41     ` Zack Weinberg
2015-11-14 21:59       ` Rich Felker
2015-11-14 22:19         ` Andreas Schwab
2015-11-21  0:19           ` Roland McGrath
2015-11-21  0:56             ` Zack Weinberg
2015-11-14 20:19 ` Carlos O'Donell
2015-11-19  4:13 ` RFC: deprecate sys/sysmacros.h inclusion from sys/types.h Zack Weinberg
2015-12-07 14:03   ` Zack Weinberg
2015-12-21 20:31     ` Zack Weinberg
2016-01-11 15:16       ` Zack Weinberg
2016-01-11 15:27         ` Carlos O'Donell
2016-01-11 18:02           ` Zack Weinberg
2016-01-11 20:50             ` Carlos O'Donell
2015-12-29 20:42   ` Mike Frysinger
2015-12-29 21:56     ` Zack Weinberg
2015-12-29 22:45       ` Mike Frysinger
2016-02-19 20:56         ` Mike Frysinger
2016-04-20 17:37   ` Mike Frysinger
2016-04-20 17:58     ` Zack Weinberg
2016-04-20 18:11       ` Mike Frysinger
2016-04-21 19:31   ` Roland McGrath
2016-04-21 21:00     ` Zack Weinberg
2016-04-21 21:11       ` Roland McGrath
2017-10-21 12:10 RFC: remove <sys/sysmacros.h> from <sys/types.h> Andreas K. Huettel

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).