glibc/include/sys
Zack Weinberg 63eb8df85a Minimize sysdeps code involved in defining major/minor/makedev.
Presently sys/sysmacros.h is entirely defined in sysdeps.  This would
mean that the deprecation logic coming up in the next patch would have
to be written twice (in generic/ and unix/sysv/linux/).  To avoid that,
hoist all but the unavoidably system-dependent logic to misc/, leaving a
bits/ header behind.  This also promotes the Linux-specific encoding of
dev_t, which accommodates 32-bit major and minor numbers in a 64-bit dev_t,
to generic, as glibc's dev_t is always 64 bits wide.

The former Linux implementation used inline functions to avoid evaluating
arguments more than once.  After this change, all platforms use inline
functions, which means that three new symbols are added to the generic ABI.
(These symbols are in the user namespace, which is how they have always
been on Linux.  They begin with "gnu_dev_", so collisions with user code
are pretty unlikely.)

New ports henceforth need only provide a bits/sysmacros.h defining
internal macros __SYSMACROS_{DECLARE,DEFINE}_{MAJOR,MINOR,MAKEDEV}.
This is only necessary if the kernel encoding is incompatible with
the now-generic encoding (for instance, it would be necessary for
FreeBSD).

While I was at it, I added a basic round-trip test for these functions.

	* sysdeps/generic/sys/sysmacros.h: Delete file.
	* sysdeps/unix/sysv/linux/makedev.c: Delete file.
	* sysdeps/unix/sysv/linux/sys/sysmacros.h: Move file ...
	* bits/sysmacros.h: ... here; this encoding is now the generic
	encoding.  Now defines only the following macros:
	__SYSMACROS_DECLARE_MAJOR, __SYSMACROS_DEFINE_MAJOR,
	__SYSMACROS_DECLARE_MINOR, __SYSMACROS_DEFINE_MINOR,
	__SYSMACROS_DECLARE_MAKEDEV, __SYSMACROS_DEFINE_MAKEDEV.

	* misc/sys/sysmacros.h, misc/makedev.c: New files that use
	bits/sysmacros.h and the above new macros to generate the
	public implementations of major, minor, and makedev.
	* misc/tst-makedev.c: New test.
	* include/sys/sysmacros.h: New wrapper.

	* misc/Makefile (headers): Add sys/sysmacros.h, bits/sysmacros.h.
	(routines): Add makedev.
	(tests): Add tst-makedev.
	* misc/Versions [GLIBC_2.25]: Add gnu_dev_major, gnu_dev_minor,
	gnu_dev_makedev.
	* posix/Makefile (headers): Remove sys/sysmacros.h.
	* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Remove makedev.

	* sysdeps/arm/nacl/libc.abilist: Add GLIBC_2.25,
	gnu_dev_major, gnu_dev_makedev, gnu_dev_minor.
	* sysdeps/unix/sysv/linux/aarch64/libc.abilist
	* sysdeps/unix/sysv/linux/alpha/libc.abilist
	* sysdeps/unix/sysv/linux/arm/libc.abilist
	* sysdeps/unix/sysv/linux/hppa/libc.abilist
	* sysdeps/unix/sysv/linux/i386/libc.abilist
	* sysdeps/unix/sysv/linux/ia64/libc.abilist
	* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
	* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
	* sysdeps/unix/sysv/linux/microblaze/libc.abilist
	* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
	* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
	* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
	* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
	* sysdeps/unix/sysv/linux/nios2/libc.abilist
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
	* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
	* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
	* sysdeps/unix/sysv/linux/sh/libc.abilist
	* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
	* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist
	* sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist
	* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
	* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist:
	Add GLIBC_2.25.
2016-08-03 15:23:04 -04:00
..
auxv.h Add sys/auxv.h wrapper to include/sys/ 2016-03-08 21:20:43 +01:00
bitypes.h
cdefs.h sys/cdefs.h: export __attribute_alloc_size__ 2013-02-18 17:18:57 -05:00
dir.h
epoll.h Use include/sys/epoll.h to provide libc_hidden_proto for epoll_pwait(). 2012-01-28 12:00:12 -05:00
errno.h * include/sys/errno.h: New file. 2002-08-11 22:06:06 +00:00
fcntl.h
file.h
gmon_out.h
gmon.h Update. 2002-03-13 09:38:59 +00:00
ioctl.h
ipc.h
mman.h Mark ld.so internal mmap functions hidden in ld.so 2016-01-06 11:28:56 -08:00
msg.h First steps to get conformtest fully working 2012-02-25 23:18:39 -05:00
param.h Split sys/param.h out into common file and sysdeps bits/param.h file. 2012-08-17 09:55:17 -07:00
poll.h Add first fixes for conformtest for POSIX2008 2012-02-26 21:32:56 -05:00
prctl.h Update. 2003-01-28 05:59:24 +00:00
profil.h New file, adds an internal prototype. 2001-04-06 15:22:21 +00:00
queue.h
resource.h Fix nice getpriority, setpriority namespace (bug 18553). 2015-06-17 20:22:39 +00:00
select.h First steps to get conformtest fully working 2012-02-25 23:18:39 -05:00
sem.h
sendfile.h [BZ #1920] 2005-11-24 18:16:42 +00:00
shm.h
signal.h
socket.h Assume that SOCK_CLOEXEC is available and works 2015-10-17 12:02:37 +02:00
stat.h Mark ld.so internel __fxstatat64 hidden 2015-10-19 12:01:48 -07:00
statfs.h Remove pre-ISO C support 2012-01-07 23:57:22 -05:00
statvfs.h First steps to get conformtest fully working 2012-02-25 23:18:39 -05:00
sysctl.h * sunrpc/xcrypt.c (passwd2des_internal): Renamed fom passwd2des. 2002-09-17 10:58:17 +00:00
sysinfo.h [BZ #1535] 2006-01-08 09:39:29 +00:00
syslog.h Test _ISOMAC in include/sys/syslog.h. 2012-11-02 15:41:37 +00:00
sysmacros.h Minimize sysdeps code involved in defining major/minor/makedev. 2016-08-03 15:23:04 -04:00
termios.h
time.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
timeb.h
times.h First steps to get conformtest fully working 2012-02-25 23:18:39 -05:00
types.h
uio.h Remove __libc_readv and __libc_writev function names. 2014-10-30 20:56:34 +00:00
un.h
unistd.h
utsname.h Mark ld.so internel __uname hidden 2015-10-15 14:33:40 -07:00
vlimit.h
vtimes.h
wait.h Remove union wait [BZ #19613] 2016-04-14 08:54:57 +02:00
xattr.h 2005-12-29 Roland McGrath <roland@frob.com> 2005-12-29 10:38:08 +00:00