Age | Commit message (Collapse) | Author | Files | Lines |
|
As with sys/socket.h and struct sockaddr, most of the files including
netinet/in.h just want struct sockaddr_in or a related type, so
introduce bits/types headers for these. POSIX specifically allows
arpa/inet.h to include netinet/in.h and I think it makes sense to
preserve that. The definition of struct sockaddr_in had a dependence
on the definition of struct sockaddr; to avoid that, bits/sockaddr.h
grows a new macro, __SOCKADDR_DATA_SIZE, which is the declared size of
struct sockaddr.sa_data.
On Linux, some kernel headers (notably linux/in.h and linux/in6.h)
attempt to cooperate with a C library’s headers in defining types such
as struct sockaddr_in. There is a set of macros whose names begin
with __UAPI_DEF_ that indicate that a type has already been defined.
This mechanism doesn’t actually work with the kernel headers as they
are in 5.0, as far as I can tell, but it could be made to work with
straightforward changes, so it makes sense for us to support it to the
extent we can. To do this sensibly I need to introduce a new bits
header called bits/uapi-compat.h, with a trivial definition for
non-Linux. This replaces the existing __USE_KERNEL_IPV6_DEFS macro.
* bits/sockaddr.h (__SOCKADDR_DATA_SIZE): New macro.
* sysdeps/unix/bsd/bits/sockaddr.h: Likewise.
* sysdeps/unix/sysv/linux/m68k/bits/sockaddr.h: Likewise.
* socket/bits/types/struct_sockaddr.h: Use __SOCKADDR_DATA_SIZE as
array length of sa_data.
* bits/in.h: Add multiple inclusion guard.
(__USE_KERNEL_IPV6_DEFS): Don’t define.
* sysdeps/unix/sysv/linux/bits/in.h: Similarly.
(IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP): Define when not
already defined, not conditional on __USE_KERNEL_IPV6_DEFS.
* bits/uapi-compat.h: New file, trivial generic version.
* sysdeps/unix/sysv/linux/bits/uapi-compat.h: New file,
Linux-specific version which recognizes kernel header guard macros
and defines __UAPI_DEF_* macros as appropriate.
* misc/Makefile: Install bits/uapi-compat.h.
* include/bits/types/in_addr_t.h, include/bits/types/in_port_t.h
* include/bits/types/struct_in_addr.h
* include/bits/types/struct_in6_addr.h
* include/bits/types/struct_sockaddr_in.h
* include/bits/types/struct_sockaddr_in6.h:
New wrapper headers.
* inet/bits/types/in_addr_t.h, inet/bits/types/in_port_t.h
* inet/bits/types/struct_in_addr.h
* inet/bits/types/struct_in6_addr.h
* inet/bits/types/struct_sockaddr_in.h
* inet/bits/types/struct_sockaddr_in6.h
New single-type headers, factored out of inet/netinet/in.h.
Add __UAPI_DEF_* conditionals where appropriate, and verify that
all conditionalized definitions agree with the relevant
OS-supplied header. Use __SOCKADDR_DATA_SIZE to set size of sin_zero.
* inet/Makefile: Install the new single-type headers.
* inet/netinet/in.h: Include bits/uapi-compat.h.
Define in_addr_t, in_port_t, struct in_addr, struct in6_addr,
struct sockaddr_in, and struct sockaddr_in6 by including the
above single-type headers, not directly. Replace all
__USE_KERNEL_IPV6_DEFS conditionals with appropriate __UAPI_DEF_*
conditionals. Add appropriate __UAPI_DEF_* conditionals around
the definitions of the IPPROTO_* constants, the IN_CLASS
macros, and struct ip_mreq. Import IN_LOOPBACK macro from
Linux 5.0 linux/in.h and verify all other conditionalized
definitions agree with the relevant linux/ header.
Define IPPORT_RESERVED only if not already defined, and make it a
macro so we can tell.
* inet/netinet/igmp.h, inet/netinet/ip.h, inet/netinet/ip_icmp.h:
Include bits/types/struct_in_addr.h, not netinet/in.h.
* inet/netinet/ip_icmp.h: Hoist all #includes to the top of the file.
* inet/netinet/icmp6.h, inet/netinet/ip6.h
* sysdeps/unix/sysv/linux/net/route.h:
Include bits/types/struct_in6_addr.h, not netinet/in.h.
* sysdeps/mach/hurd/net/route.h: Include bits/types.h and
bits/types/struct_in6_addr.h, not netinet/in.h. Use __uint16_t
and __uint32_t instead of uint16_t and uint32_t.
* resolv/bits/types/res_state.h: Include bits/types/struct_in_addr.h
and bits/types/struct_sockaddr_in.h. Forward declare struct
sockaddr_in6. Don’t include netinet/in.h.
* resolv/netdb.h: Don’t include netinet/in.h. Use socklen_t
instead of __socklen_t. Define IPPORT_RESERVED only if not
already defined, with definition matching netinet/in.h.
When __USE_MISC, include bits/sockaddr.h.
* resolv/resolv.h: Don’t include netinet/in.h.
* inet/tst-getni1.c, inet/tst-getni2.c
* nss/tst-nss-files-hosts-erange.c, nss/tst-nss-files-hosts-getent.c
* nss/tst-nss-files-hosts-multi.c, posix/tst-getaddrinfo2.c
* resolv/tst-bug18665-tcp.c, resolv/tst-resolv-ai_idn-common.c
* resolv/tst-resolv-canonname.c, resolv/tst-resolv-edns.c
* resolv/tst-resolv-network.c, resolv/tst-resolv-nondecimal.c
* resolv/tst-resolv-search.c, support/tst-support-namespace.c:
Include netinet/in.h.
* support/resolv_test.h: Include stdint.h, not sys/cdefs.h.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
Update.
|
|
No standard public header is required to include sys/socket.h,
although some are allowed to. Several public headers need the
definitions of socklen_t, struct sockaddr, and/or struct
sockaddr_storage, but nothing else from sys/socket.h. We already have
a single-type header for socklen_t, so this patch adds single-type
headers for struct sockaddr and struct sockaddr_storage.
The definition of struct sockaddr_storage is subtly different on Linux
than on the Hurd; in order to not need two copies of
bits/types/struct_sockaddr_storage.h, bits/sockaddr.h is now
responsible for defining __ss_aligntype if ‘unsigned long int’ is not
the correct definition.
I also added a single-type header for struct linger, even though only
sys/socket.h is expected to define that, just because all three copies
of bits/socket.h were defining it exactly the same way. There would
also be a case for defining it directly in sys/socket.h but this
seemed tidier.
I did *not* create single-type headers for struct msghdr and struct
cmsghdr, because those and their helper macros are not consistent
among the three copies of bits/socket.h, and, again, only sys/socket.h
is expected to define them.
The large number of .c files that add an `#include <sys/socket.h>`
might make this look like it’s not worth doing. However, after this
change, only half of the files in the glibc source tree that include
netinet/in.h also need to include sys/socket.h, and only a third of
the files that include netdb.h need to include sys/socket.h. Before,
all of the files in both groups were getting sys/socket.h. That seems
like enough justification to me.
While I was at it I noticed that sys/socketvar.h is yet another
backward compatibility header that does nothing but include some other
header (sys/socket.h, in this case) and also doesn’t need to be
system-dependent.
* socket/bits/types/struct_linger.h
* socket/bits/types/struct_sockaddr.h
* socket/bits/types/struct_sockaddr_storage.h:
New single-type headers, factored out of the various bits/socket.h
headers.
* include/bits/types/struct_linger.h
* include/bits/types/struct_sockaddr.h
* include/bits/types/struct_sockaddr_storage.h:
New wrappers.
* socket/Makefile (headers): Add bits/types/struct_linger.h,
bits/types/struct_sockaddr.h, and bits/types/struct_sockaddr_storage.h.
Alphabetize the list.
* bits/socket.h, sysdeps/mach/hurd/bits/socket.h
* sysdeps/unix/sysv/linux/bits/socket.h:
Don’t define struct sockaddr, struct sockaddr_storage,
__ss_aligntype, or struct linger here. Minimize inclusions.
* sysdeps/unix/bsd/bits/sockaddr.h: Define __ss_aligntype here.
* socket/sys/socket.h: Include bits/types/struct_linger.h,
bits/sockaddr.h, bits/types/struct_sockaddr.h, and
bits/types/struct_sockaddr_storage.h. Move inclusion of
bits/socket.h below forward declaration of struct timespec,
and update commentary.
* inet/ifaddrs.h, socket/net/if.h
* sysdeps/mach/hurd/net/if_arp.h
* sysdeps/mach/hurd/net/route.h
* sysdeps/unix/sysv/linux/errqueue.h
* sysdeps/unix/sysv/linux/net/if_arp.h
* sysdeps/unix/sysv/linux/net/route.h:
Include bits/types/struct_sockaddr.h and possibly also bits/types.h,
not sys/socket.h or sys/types.h.
* sysdeps/unix/sysv/linux/errqueue.h:
* sysdeps/unix/sysv/linux/net/route.h:
Use __uint8_t and __uint32_t instead of uint8_t and uint32_t.
* inet/arpa/inet.h: Include bits/types/size_t.h.
* inet/netinet/in.h: Include bits/sockaddr.h,
bits/types/struct_sockaddr.h, and
bits/types/struct_sockaddr_storage.h,
not sys/socket.h. Use __socklen_t instead of socklen_t.
* inet/netinet/tcp.h: Include bits/types.h and
bits/types/struct_sockaddr_storage.h, not sys/socket.h or
bits/stdint-uintn.h. Use __uint8_t, __uint16_t, and __uint32_t
instead of uint8_t, uint16_t and uint32_t.
* inet/protocols/routed.h: Include features.h and
bits/types/struct_sockaddr.h, not sys/socket.h.
* resolv/netdb.h: Include bits/types/socklen_t.h.
* sysdeps/unix/sysv/linux/netatalk/at.h: Don’t include sys/socket.h.
* include/ifaddrs.h: Include stddef.h for size_t.
* include/netdb.h: Use __socklen_t instead of socklen_t.
* inet/check_pf.c, inet/gethstbynm.c, inet/gethstbynm_r.c
* inet/getsourcefilter.c, inet/inet6_opt.c, inet/inet6_option.c
* inet/inet6_rth.c, inet/setsourcefilter.c, inet/test-ifaddrs.c
* inet/test-inet6_opt.c, inet/tst-inet6_rth.c
* inet/tst-inet6_scopeid_pton.c, nis/nss_nis/nis-hosts.c
* nis/nss_nisplus/nisplus-hosts.c, nscd/aicache.c, nscd/cache.c
* nscd/hstcache.c, nscd/initgrcache.c, nscd/netgroupcache.c
* nscd/nscd_gethst_r.c, nscd/servicescache.c, nss/digits_dots.c
* nss/nss_files/files-hosts.c, nss/nss_files/files-network.c
* nss/tst-nss-files-hosts-erange.c, nss/tst-nss-files-hosts-getent.c
* nss/tst-nss-files-hosts-multi.c, posix/tst-getaddrinfo3.c
* resolv/nss_dns/dns-network.c, resolv/resolv_conf.c
* resolv/tst-bug18665-tcp.c, resolv/tst-bug18665.c
* resolv/tst-inet_ntop.c, resolv/tst-inet_pton.c
* resolv/tst-resolv-ai_idn-common.c, resolv/tst-resolv-basic.c
* resolv/tst-resolv-edns.c, resolv/tst-resolv-network.c
* resolv/tst-resolv-nondecimal.c, resolv/tst-resolv-search.c
* resolv/tst-resolv-threads.c, resolv/tst-resolv-trailing.c
* sunrpc/rpc_gethostbyname.c
* support/support_format_address_family.c
* support/support_format_addrinfo.c
* support/support_format_dns_packet.c
* support/support_format_hostent.c, support/support_format_netent.c
* sysdeps/mach/hurd/if_index.c
* sysdeps/unix/sysv/linux/check_native.c: Include sys/socket.h.
* resolv/tst-resolv-binary.c: Include sys/types.h.
* sysdeps/generic/sys/socketvar.h: Move to socket/sys/socketvar.h.
* include/sys/socketvar.h: New wrapper.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
Update.
|
|
Many public headers include sys/types.h and/or stdint.h when they only
need and/or are supposed to define a small number of types from that
header. This patch changes as many of them as practical to include
only the single-type headers for the types they are actually specified
to define, and use the impl-namespace aliases for any types they need
but are not specified to define. In most cases, where a header has
historically used uintN_t types, I changed it to use __uintN_t types;
in a few cases I chose to have it continue to define the complete set
of those types (using <bits/stdint-uintn.h>).
After this patch, the public headers that still include sys/types.h are:
stdlib.h and sys/param.h, where removal would risk breaking far too much;
the inclusion of sys/types.h; regex.h, which is taken verbatim from
gnulib and can't include features.h directly (I'm open to better ideas);
sys/bitypes.h, which is an alternative name for sys/types.h; and
the networking headers, which will be dealt with separately. The headers
that still include stdint.h are: inttypes.h, as required by ISO C;
elf.h and thread_db.h, see discussion of debugger interface headers below;
and, again, the networking headers will be dealt with separately.
While I was at it, I moved headers out of sysdeps where possible: If
we have only a sysdeps/generic/something.h or sysdeps/gnu/something.h,
no other sysdeps variants, it is not really system-dependent and can
be moved to the directory that installs it. If we have both
sysdeps/generic/ and gnu/something.h, the generic version is never
used (since we support only GNUish systems these days) and can be
deleted, and the gnu-version can be moved to the directory that
installs it. If the only copy of a bits header is in the
top-level bits directory, it is not system-dependent.
For utmp.h and utmpx.h, I think we might be able to fold their
respective bits headers into the primary headers and make them not
system-dependent at all. The remaining variation is between
s390*-*-linux* and everything else, and it appears to me that the s390
versions of the bits headers are actually the headers that everyone
should be using. The only difference is that the s390 headers
unconditionally use 64-bit quantities for lastlog.ll_time,
utmp{,x}.ut_tv, and utmp{,x}.ut_session, whereas the generic headers
use either 64- or 32-bit quantities depending on
__WORDSIZE_TIME64_COMPAT32. I could be wrong, but I don’t think it
makes sense for programs with 64-bit and 32-bit time_t to have
different ideas of the layout of a structures that are copied directly
to and from a shared file on disk. But fixing that doesn’t belong in
this patch series.
The conform tests expect utmpx.h to define time_t and suseconds_t.
These are the public names for the types of the fields of struct
timeval, and utmpx.h is required to define struct timeval, so this is
a reasonable expectation even though POSIX doesn't _explicitly_ say
it's also required to define time_t and suseconds_t. utmp.h is not a
standard header but it makes sense for it to be as consistent with
utmpx.h as possible, especially in our implementation where
/var/log/utmp and /var/log/utmpx have the same format.
I thought I was going to need to change all of the arch-specific
bits/epoll.h headers as well as sys/epoll.h, but it turned out not to
be necessary. I still took the opportunity to give them all multiple
inclusion guards.
I suspect we do not need as many copies of bits/fcntl.h and bits/sem.h
as we have, but that’s complicated enough that it deserves its own patchset.
The debugger interface headers are a mess and I only have so much
patience for them. This does the bare minimum required for
thread_db.h, sys/procfs.h, and sys/user.h, which are at least
nominally cross-platform interfaces, to avoid including sys/types.h,
sys/time.h, and/or signal.h. Exposure of sys/ucontext.h is reduced
but not eliminated. Cross-architecture consistency should be improved.
It would be desirable to stop including stdint.h from elf.h and
thread_db.h as well, but that would involve touching dozens more
bits headers and I ran out of patience.
Git does not understand “remove file X and then rename file Y over the
top of it” very well, so the diff looks bigger than it should.
This is another partial fix for Hurd-specific bug 23088. The headers
that are still affected by that bug are aio.h, mqueue.h, regex.h,
signal.h, stdlib.h, and sys/types.h.
* io/ftw.h: Don't include sys/types.h.
* misc/sys/uio.h: Don't include sys/types.h.
Include bits/types.h, bits/types/size_t.h, and bits/types/ssize_t.h.
* posix/spawn.h: Don't include sys/types.h.
Include bits/types.h, bits/types/mode_t.h, and bits/types/pid_t.h.
* rt/aio.h: Don't include sys/types.h.
Include bits/types.h, bits/pthreadtypes.h,
bits/types/size_t.h, and bits/types/ssize_t.h.
* sysdeps/pthread/semaphore.h: Don't include sys/types.h.
* sysdeps/unix/sysv/linux/bits/uio-ext.h: Use __pid_t, not pid_t.
* sysdeps/generic/netinet/in_systm.h: Rename to
inet/netinet/in_systm.h. Include bits/stdint-uintn.h,
not sys/types.h or stdint.h.
* sysdeps/generic/netinet/ip.h: Rename to
inet/netinet/ip.h. Include bits/stdint-uintn.h and
bits/endian.h, not sys/types.h.
* sysdeps/gnu/netinet/tcp.h: Rename to
inet/netinet/tcp.h. Include bits/stdint-uintn.h and
bits/endian.h, not sys/types.h or stdint.h.
* sydeps/gnu/net/if.h: Rename to socket/net/if.h.
Don’t include sys/types.h.
* include/net/if.h: Include socket/net/if.h, rather than
whatever the next net/if.h on the include path is.
* include/netinet/in_systm.h, include/netinet/ip.h
* include/netinet/tcp.h: New trivial wrappers.
* sysdeps/generic/net/if.h: Delete, never used.
* sysdeps/generic/netinet/tcp.h: Delete, never used.
* bits/utmp.h: Delete file.
* sysdeps/gnu/bits/utmp.h: Move to bits/utmp.h.
Add multiple include guard.
Don’t include paths.h, sys/time.h, or sys/types.h.
Don’t use struct timeval.
Use __intN_t for consistency with bits/utmpx.h.
* sysdeps/unix/sysv/linux/s390/bits/utmp.h: Add multiple include guard.
Don’t include paths.h, sys/time.h, sys/types.h, or bits/wordsize.h.
Don’t use struct timeval.
Use __intN_t for consistency with bits/utmpx.h.
Use __time64_t unconditionally for lastlog.ll_time.
Use __int64_t unconditionally for utmp.ut_session.
Adjust indentation and blank lines to match bits/utmp.h.
* sysdeps/gnu/bits/utmpx.h: Move to bits/utmpx.h.
Add multiple include guard.
Don’t include paths.h, sys/time.h, bits/types.h, or bits/wordsize.h.
Don’t define _PATH_UTMPX or _PATH_WTMPX.
Don’t use struct timeval.
Use pid_t for consistency with bits/utmp.h.
* sysdeps/unix/sysv/linux/s390/bits/utmpx.h: Add multiple include guard.
Don’t define _PATH_UTMPX or _PATH_WTMPX.
Don’t include paths.h, sys/time.h, bits/types.h, or bits/wordsize.h.
Don’t define _PATH_UTMPX or _PATH_WTMPX.
Don’t use struct timeval.
Use pid_t for consistency with bits/utmp.h.
Use __int64_t unconditionally for utmpx.ut_session.
* login/utmp.h: Don’t include sys/types.h.
Do include paths.h, bits/types.h, bits/types/pid_t.h,
bits/types/suseconds_t, bits/types/time_t.h, and
bits/types/struct_timeval.h.
Move __BEGIN_DECLS to enclose only prototypes.
* sysdeps/gnu/utmpx.h: Move to login/utmpx.h.
Don’t include sys/time.h. Do include bits/types.h,
bits/types/suseconds_t, bits/types/time_t.h, and
bits/types/struct_timeval.h.
When __USE_GNU, include paths.h and define _PATH_UTMPX and _PATH_WTMPX.
* login/Makefile (headers): Add utmpx.h and bits/utmpx.h.
(routines): Add endutxent, getutmp, getutmpx, getutxent,
getutxid, getutxline, pututxline, setutxent, updwtmpx, and
utmpxname. Reorganize.
* sysdeps/gnu/Makefile: Do not add anything to sysdep_routines
or sysdep_headers when subdir == login.
* sysdeps/gnu/sys/mtio.h: Move to misc/sys/mtio.h.
Don't include sys/types.h.
* sysdeps/gnu/Makefile: Don't add anything to sysdep_headers
for the misc directory.
* misc/Makefile (headers): Add sys/mtio.h.
* include/sys/mtio.h: New wrapper.
* elf/link.h, inet/aliases.h, misc/sys/xattr.h:
Don't include sys/types.h. Include bits/types/size_t.h.
* gmon/sys/gmon.h: Don't include sys/types.h.
* gmon/sys/profil.h: Don't include sys/types.h.
Include bits/types/size_t.h and bits/types/struct_timeval.h.
* io/fts.h: Don't include sys/types.h.
Include bits/types/dev_t.h, bits/types/ino_t.h, bits/types/ino64_t.h,
and bits/types/nlink_t.h.
* io/sys/sendfile.h: Don't include sys/types.h.
Include bits/types.h, bits/types/off_t.h, bits/types/size_t.h,
and bits/types/ssize_t.h.
* stdlib/sys/random.h: Don't include sys/types.h.
Include bits/types/size_t.h and bits/types/ssize_t.h.
* gmon/tst-sprofil.h: Include sys/time.h.
* sysdeps/mach/hurd/sendfile.c: Include sys/types.h.
* sysdeps/unix/sysv/linux/sys/epoll.h: Don’t include stdint.h
or sys/types.h. Do include features.h and bits/types.h.
(union epoll_data, struct epoll_event): Use __uint32_t and
__uint64_t for field types.
* sysdeps/unix/sysv/linux/alpha/bits/epoll.h
* sysdeps/unix/sysv/linux/bits/epoll.h
* sysdeps/unix/sysv/linux/hppa/bits/epoll.h
* sysdeps/unix/sysv/linux/mips/bits/epoll.h
* sysdeps/unix/sysv/linux/sparc/bits/epoll.h
* sysdeps/unix/sysv/linux/x86/bits/epoll.h:
Add multiple inclusion guard.
* sysdeps/unix/sysv/linux/alpha/sys/acct.h: Style fix.
* sysdeps/unix/sysv/linux/sys/acct.h: Include features.h
and bits/stdint-uintn.h. Don't include sys/types.h, stdint.h,
or bits/types/time_t.h.
* sysdeps/unix/sysv/linux/sys/fsuid.h
* sysdeps/unix/sysv/linux/sys/quota.h
Include bits/types.h, not sys/types.h.
* sysdeps/nptl/sys/procfs.h: Include features.h and bits/types.h,
not sys/types.h.
* sysdeps/nptl/thread_db.h: Don’t include sys/types.h.
* sysdeps/nptl/proc_service.h: Include bits/types/pid_t.h and
bits/types/size_t.h.
* sysdeps/unix/sysv/linux/sys/procfs.h: Include bits/types.h and
bits/types/struct_timeval.h, not sys/time.h or sys/types.h.
* sysdeps/unix/sysv/linux/aarch64/bits/procfs.h: Add multiple
inclusion guard. Include bits/types.h. Correct a comment.
* sysdeps/unix/sysv/linux/alpha/bits/procfs-prregset.h:
Add multiple inclusion guard. Include sys/ucontext.h.
* sysdeps/unix/sysv/linux/alpha/bits/procfs.h
* sysdeps/unix/sysv/linux/sparc/bits/procfs.h
Add multiple inclusion guard. Don’t include signal.h or sys/ucontext.h.
* sysdeps/unix/sysv/linux/ia64/bits/procfs.h:
Add multiple inclusion guard. Include sys/ucontext.h, not signal.h.
* sysdeps/unix/sysv/linux/powerpc/bits/procfs.h:
Add multiple inclusion guard. Don’t include signal.h or
sys/ucontext.h. Include bits/wordsize.h and asm/elf.h.
Adjust conditional for whether to provide various fallback
definitions.
* sysdeps/unix/sysv/linux/arm/bits/procfs.h
* sysdeps/unix/sysv/linux/csky/bits/procfs.h
* sysdeps/unix/sysv/linux/hppa/bits/procfs.h
* sysdeps/unix/sysv/linux/m68k/bits/procfs.h
* sysdeps/unix/sysv/linux/microblaze/bits/procfs.h
* sysdeps/unix/sysv/linux/mips/bits/procfs.h
* sysdeps/unix/sysv/linux/nios2/bits/procfs.h
* sysdeps/unix/sysv/linux/riscv/bits/procfs.h
* sysdeps/unix/sysv/linux/s390/bits/procfs.h
* sysdeps/unix/sysv/linux/sh/bits/procfs.h
* sysdeps/unix/sysv/linux/x86/bits/procfs.h:
Add multiple inclusion guard. Improve commentary.
* sysdeps/posix/dl-fileid.h (r_file_id): Use __dev_t and __ino64_t
for field types.
* nss/nss.h
* sysdeps/powerpc/sys/platform/ppc.h
* sysdeps/unix/sysv/linux/sys/eventfd.h
* sysdeps/unix/sysv/linux/sys/fanotify.h
* sysdeps/unix/sysv/linux/sys/inotify.h
* sysdeps/unix/sysv/linux/sys/raw.h
* sysdeps/unix/sysv/linux/sys/signalfd.h:
Include bits/types.h, not stdint.h.
Include features.h where not already doing so.
Use __(u)intN_t types instead of (u)intN_t types in all
declarations.
* sysdeps/unix/sysv/linux/powerpc/bits/powerpc.h:
Use __uint64_t instead of uint64_t.
* nss/tst-nss-test4.c: Include stdint.h.
* bits/fcntl.h: Add multiple include guard. Hoist inclusion of
bits/types.h to top of file.
* sysdeps/mach/hurd/bits/fcntl.h: Add multiple include guard.
Include bits/types.h, not sys/types.h; remove redundant inclusion
of bits/types.h in middle of file.
* bits/sem.h: Add multiple include guard. Include bits/types.h,
not sys/types.h.
* sysdeps/gnu/bits/sem.h: Likewise.
* sysdeps/unix/sysv/linux/bits/sem.h: Likewise.
* sysdeps/unix/sysv/linux/ia64/bits/ipc.h: Likewise.
* sysvipc/sys/sem.h: Include bits/types/pid_t.h and
bits/types/time_t.h.
* resolv/bits/types/res_state.h: Include bits/types.h, not
sys/types.h. Use __uint32_t and __uint16_t, not uint32_t and
uint16_t.
* sysdeps/mach/hurd/bits/socket.h: Include bits/types.h, not
sys/types.h.
* sysdeps/unix/sysv/linux/bits/socket.h: Likewise. Use __pid_t,
__uid_t, and __gid_t, not pid_t, uid_t, and gid_t.
* socket/sys/socket.h: Include bits/types.h, bits/types/ssize_t.h,
and bits/types/socklen_t.h.
* inet/htonl.c, include/htons.c: Include endian.h.
* include/netinet/ether.h: Include bits/types/size_t.h.
* scripts/check-obsolete-constructs.py
(HEADER_ALLOWED_INCLUDES, SYSDEP_ALLOWED_INCLUDES): Update.
* sysdeps/mach/hurd/i386/Makefile: Update list of xfails for
bug 23088.
|
|
Besides the snarl of debugger/ucontext interfaces, these are the only
public headers that include signal.h.
sys/wait.h includes signal.h only for the definition of siginfo_t.
We already have a single-type header for that, so use it. siginfo_t
contains a field whose type is uid_t, but sys/wait.h is not specified
to define uid_t, so, as is already done for pid_t, the conformance
test is modified to expect that field to have type __uid_t instead.
It is not clear what subset of the definitions from signal.h are
actually expected by historical users of sys/param.h; I’ve chosen to
take the comment at face value and cut it down to bits/signum.h, which
supplies _NSIG and all of the SIG* constants. This requires adjusting
every copy of bits/signum.h to permit inclusion by sys/param.h as well
as signal.h.
While I was at it I moved the comment about sys/param.h being obsolete
from sysdeps/mach/hurd/bits/param.h, where it’s not likely to be seen,
to the top-level sys/param.h, and edited it to give more useful advice.
This patch partially fixes Hurd-specific bug 23088; sys/wait.h is now
conformant.
* posix/sys/wait.h: Include bits/types/siginfo_t.h, not signal.h.
* conform/data/sys/wait.h-data: Do not expect a definition of uid_t.
* malloc/tst-mallocfork.c, nptl/tst-fork4.c, nptl/tst-getpid3.c
* nptl/tst-mutex9.c, nptl/tst-rwlock12.c
* resolv/tst-resolv-res_init-skeleton.c
* sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c:
Include signal.h.
* nptl/tst-cancel4.c, rt/tst-mqueue1.c
* support/tst-support_capture_subprocess.c
* sysdeps/unix/sysv/linux/tst-align-clone.c:
Include signal.h. Sort includes.
* misc/sys/param.h: Include bits/signum.h, not signal.h.
Add comment explaining that this header is obsolete, based on
a similar comment in Hurd bits/param.h.
* bits/param.h: Add multiple inclusion guard and defensive #error.
* sysdeps/mach/hurd/bits/param.h: Add multiple inclusion guard.
Remove comment explaining that this header is obsolete (see above).
* sysdeps/mach/i386/bits/mach/param.h: Add multiple inclusion guard.
* sysdeps/unix/sysv/linux/bits/param.h: Add multiple inclusion guard.
* bits/signum-generic.h, bits/signum.h
* sysdeps/unix/bsd/bits/signum.h
* sysdeps/unix/sysv/linux/alpha/bits/signum.h
* sysdeps/unix/sysv/linux/bits/signum.h
* sysdeps/unix/sysv/linux/hppa/bits/signum.h
* sysdeps/unix/sysv/linux/mips/bits/signum.h:
Allow inclusion by sys/param.h as well as signal.h.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
Update.
* sysdeps/mach/hurd/i386/Makefile: Remove XFAILs for sys/wait.h.
|
|
This is supposedly present for BSD compatibility, but the current
generation of BSDs is not consistent about it: FreeBSD does, OpenBSD
doesn’t, NetBSD exposes only fd_set and the FD_* macros. Programs
that need to wait for any of multiple I/O events have several
alternatives to select nowadays, so I think it makes sense to expose
select only to programs that specifically want it.
Only a few places within our own code are affected. A few test
programs need to include sys/select.h explicitly, as does rpc/svc.h.
sysdeps/nptl/thread_db.h needs to declare sigset_t, and
sysdeps/unix/sysv/linux/pselect.c was including sys/poll.h instead of
sys/select.h, which is probably a copy-and-paste error. sys/socket.h
needs to forward-declare struct timespec under __USE_GNU, because
recvmmsg has a struct timespec * argument; I’m open to the possibility
of having it fully declare struct timespec.
I considered taking sys/select.h out of sys/time.h as well, but POSIX
not only explicitly allows this inclusion, it requires sys/time.h to
declare almost everything that sys/select.h declares. It doesn’t seem
worth creating another bits header just to prevent sys/time.h from
declaring pselect, sigset_t, and struct timespec.
Not including sys/select.h from sys/types.h means that sys/types.h
also no longer defines anything from sys/time.h, and a couple of files
were relying on that. (pthread_join_common.c should be using
clock_gettime instead of gettimeofday, but that's out of scope for
this patch series.)
* posix/sys/types.h: Don’t include sys/select.h.
* scripts/check-obsolete-constructs.py: Remove whitelist entry
for sys/types.h -> sys/select.h. Adjust commentary re
sys/time.h -> sys/select.h.
* socket/sys/socket.h: When __USE_GNU, forward-declare struct timespec.
* misc/tst-fdset.c, nptl/tst-cancel4.c, scripts/check-c++-types.sh
* sunrpc/rpc/svc.h: Include sys/select.h.
* sysdeps/nptl/thread_db.h: Include bits/types/sigset_t.h.
* sysdeps/unix/sysv/linux/pselect.c: Include sys/select.h,
not sys/poll.h.
* nptl/pthread_join_common.c, sysdeps/unix/sysv/linux/dl-vdso.h:
Include sys/time.h.
|
|
We rely on the compiler's stddef.h and stdarg.h to define size_t,
ptrdiff_t, wchar_t, NULL, and __gnuc_va_list, and to implement a
convention that allows us to request the definition of a specific one:
for instance
#define __need_size_t
#include <stddef.h>
is expected to define size_t but not any of the other things stddef.h
defines.
This patch hides that convention behind a set of bits/types/ headers,
which allows check-obsolete-constructs.py to verify that none of our
headers include these headers unconditionally. (Both of them define
at least one item in the user namespace that no other header is
supposed to expose.) It will also facilitate coping with compilers
that don’t implement the __need convention. (That scenario is not
hypothetical, see the next patch.)
Only public headers use the new bits headers. Non-public headers and
.c files in our codebase, that were formerly defining __need macros,
now just include stddef.h and/or stdarg.h without any __need macros.
A few files didn’t need to be including stddef.h / stdarg.h at all.
Uses of NULL in public headers that aren’t expected to define NULL
are changed to a bare 0. bits/NULL.h is only used by headers that
are expected to define NULL.
malloc.h and printf.h were, in fact, including stddef.h and/or
stdarg.h unconditionally; they no longer do that. This broke a few of
our test cases, which are fixed by adding appropriate inclusions to
the relevant .c files.
* stdlib/bits/NULL.h
* stdlib/bits/types/__va_list.h
* stdlib/bits/types/ptrdiff_t.h
* stdlib/bits/types/size_t.h
* stdlib/bits/types/va_list.h
* stdlib/bits/types/wchar_t.h:
New headers defining a single type or macro each.
* stdlib/Makefile: Install new headers.
* include/bits/NULL.h
* include/bits/types/__va_list.h
* include/bits/types/ptrdiff_t.h
* include/bits/types/size_t.h
* include/bits/types/va_list.h
* include/bits/types/wchar_t.h:
New wrapper headers.
* malloc/malloc.h: Don’t include stdio.h or stddef.h.
Include bits/NULL.h, bits/types/size_t.h, bits/types/ptrdiff_t.h,
and bits/types/FILE.h.
* stdio-common/printf.h: Don’t include stddef.h or stdarg.h.
Include bits/types/size_t.h, bits/types/wchar_t.h, and
bits/types/__va_list.h. Use __gnuc_va_list instead of va_list
in prototypes.
* libio/bits/types/struct_FILE.h: Include bits/types/size_t.h.
* misc/sys/param.h: Include features.h.
* sysvipc/sys/msg.h: Include bits/msq.h after all bits/types/ headers.
* sysvipc/sys/sem.h: Include bits/sem.h after all bits/types/ headers.
* sysvipc/sys/shm.h: Include bits/shm.h after all bits/types/ headers.
* hurd/hurd/signal.h: Don’t use NULL.
* hurd/hurd/ioctl.h: Don’t include stdarg.h.
* hurd/hurd/userlink.h: Don’t include stddef.h. Don’t use NULL.
* intl/libintl.h: Don’t include stddef.h. Don’t use NULL.
* intl/gettext.c, intl/ngettext.c: Include stddef.h
unconditionally. Don’t define any __need macros first.
Don’t include stdlib.h.
* sysdeps/posix/sigignore.c:, sysdeps/posix/sigset.c:
Don’t include errno.h or string.h.
* malloc/tst-malloc-thread-fail.c: Include stddef.h.
* malloc/tst-malloc_info.c: Include stdio.h.
* stdio-common/tst-vfprintf-user-type.c: Include stdarg.h.
* string/tst-cmp.c: Include stdio.h.
* debug/wcpcpy_chk.c, iconv/loop.c, iconv/skeleton.c
* signal/sighold.c, signal/sigrelse.c, stdio-common/tempname.c
* sysdeps/generic/ldsodefs.h, sysdeps/nptl/libc-lock.h
* sysdeps/nptl/libc-lockP.h, sysdeps/posix/waitid.c
* wcsmbs/wcstol_l.c, wcsmbs/wcstoll_l.c, wcsmbs/wcstoul_l.c
* wcsmbs/wcstoull_l.c, sysdeps/posix/sigignore.c
* sysdeps/posix/sigset.c: Don’t define __need macros before
including stddef.h.
* bits/socket.h, bits/types/stack_t.h, dirent/dirent.h
* dlfcn/dlfcn.h, gmon/sys/profil.h, grp/grp.h, gshadow/gshadow.h
* hurd/hurd/signal.h, hurd/hurd/sigpreempt.h, iconv/gconv.h
* include/set-hooks.h, include/stdio.h, inet/aliases.h
* io/sys/sendfile.h, libio/stdio.h, misc/bits/types/struct_iovec.h
* misc/search.h, misc/sys/mman.h, misc/syslog.h, posix/glob.h
* posix/sched.h, posix/sys/types.h, posix/unistd.h
* posix/wordexp.h, pwd/pwd.h, shadow/shadow.h, signal/signal.h
* socket/sys/socket.h, stdlib/alloca.h, stdlib/monetary.h
* stdlib/stdlib.h, stdlib/sys/random.h, string/string.h
* string/strings.h, sunrpc/rpc/netdb.h
* sysdeps/htl/bits/types/struct___pthread_attr.h
* sysdeps/mach/hurd/bits/socket.h
* sysdeps/unix/sysv/linux/bits/socket.h
* sysdeps/unix/sysv/linux/bits/types/stack_t.h
* sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h
* sysdeps/unix/sysv/linux/mips/bits/types/stack_t.h
* sysdeps/unix/sysv/linux/scsi/sg.h
* sysdeps/unix/sysv/linux/sys/sysctl.h
* sysvipc/sys/msg.h, sysvipc/sys/sem.h, sysvipc/sys/shm.h
* time/time.h, wcsmbs/uchar.h, wcsmbs/wchar.h:
Use bits/types/size_t.h instead of __need_size_t.
* iconv/gconv.h, iconv/iconv.h, libio/libio.h
* stdlib/inttypes.h, stdlib/stdlib.h, wcsmbs/wchar.h:
Use bits/types/wchar_t.h instead of __need_wchar_t.
* libio/stdio.h, locale/locale.h, misc/sys/param.h
* posix/sched.h, posix/unistd.h, stdlib/stdlib.h
* string/string.h, sysdeps/unix/sysv/linux/bits/sigcontext.h
* time/time.h, wcsmbs/wchar.h: Use bits/NULL.h instead of __need_NULL.
* libio/stdio.h, misc/err.h: Use bits/types/__va_list.h instead
of __need___va_list.
* libio/stdio.h: Use bits/types/va_list.h instead of manually
defining va_list.
* hurd/hurd/userlink.h, misc/sys/mman.h, posix/sched.h
* sysdeps/mach/hurd/bits/socket.h
* sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h
* wcsmbs/wchar.h: Reorganize includes; no semantic effect.
* stdlib/stdlib.h: Normalize format of multiple include guard.
* sysdeps/unix/sysv/linux/bits/sigcontext.h: Annotate workarounds
for kernel header bugs.
* sysdeps/unix/sysv/linux/aarch64/sys/user.h
* sysdeps/unix/sysv/linux/arm/sys/user.h
* sysdeps/unix/sysv/linux/m68k/sys/user.h
* sysdeps/unix/sysv/linux/microblaze/sys/user.h
* sysdeps/unix/sysv/linux/nios2/sys/user.h
* sysdeps/unix/sysv/linux/s390/sys/user.h
* sysdeps/unix/sysv/linux/x86/sys/user.h
Include features.h.
* sysdeps/unix/sysv/linux/alpha/sys/user.h
* sysdeps/unix/sysv/linux/ia64/sys/user.h
* sysdeps/unix/sysv/linux/mips/sys/user.h
* sysdeps/unix/sysv/linux/powerpc/sys/user.h
* sysdeps/unix/sysv/linux/sh/sys/user.h
* sysdeps/unix/sysv/linux/sparc/sys/user.h
Include features.h and bits/types/size_t.h, in that order.
Include kernel headers, if any, after those two.
Don’t include stddef.h or sys/types.h.
* scripts/check-obsolete-constructs.py
(UNIVERSAL_ALLOWED_INCLUDES): Remove stddef.h and stdarg.h.
(HEADER_ALLOWED_INCLUDES): Update.
|
|
The convention throughout glibc is that every public header includes
features.h directly, as its first action, and relies on features.h to
include sys/cdefs.h. In a few places, though, it’s been done the
other way around, usually in headers that were copied from a BSD
source (where the convention is exactly the opposite). This patch
makes all installed headers match the glibc convention.
This patch also corrects a bug in glob.h: it may declare size_t
without notifying stddef.h that it has done this, so e.g.
#define _XOPEN_SOURCE 700
#include <glob.h>
#include <stddef.h>
int dummy;
declares size_t twice, which is invalid prior to C2011. I wasn’t able
to persuade gcc 8 to issue an error, even with -std=c89 -Wsystem-headers,
but clang is not so lenient.
* posix/glob.h: Include features.h, not sys/cdefs.h.
When __USE_XOPEN || USE_XOPEN2K8, include stddef.h for size_t;
otherwise, issue an immediate #error if __SIZE_TYPE__ is not
available. Use __gsize_t, not __size_t, as an impl-namespace
alternative name for size_t.
* conform/data/glob.h-data: Adjust to match.
* inet/netinet/igmp.h, mach/lock-intern.h, misc/ar.h
* misc/sys/auxv.h, resolv/resolv.h, socket/sys/un.h
* sunrpc/rpc/auth_des.h, sunrpc/rpc/rpc_msg.h
* sysdeps/generic/memcopy.h, sysdeps/generic/netinet/tcp.h
* sysdeps/htl/pthread.h, sysdeps/mach/hurd/net/ethernet.h
* sysdeps/mach/hurd/net/if_arp.h: Include features.h, not sys/cdefs.h.
* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
Update.
|
|
This doesn't exactly fit the theme but as long as I'm tinkering with
sys/types.h it makes sense to go through and create single-declaration
bits/types/ headers for all of the remaining cases where we have
two or more headers declaring a public type.
The remaining uses of the original __T_defined idiom are:
__error_t_defined in files shared with gnulib, which probably has to
remain as is; ____gwchar_t_defined in inttypes.h, which may not be
necessary anymore and should be addressed separately, and
__ldiv_t_defined and __lldiv_t_defined in stdlib.h, ditto.
Our handling of LFS types is a little inconsistent: some headers
declare both off_t and off64_t (for instance) when
_LARGEFILE64_SOURCE, others will only declare off_t regardless of
_LARGEFILE64_SOURCE. I don't know if this was intentional or not.
I am tempted to centralize responsibility for _LARGEFILE64_SOURCE as
well as _FILE_OFFSET_BITS=64 in bits/types/off_t.h (etc) so that any
header that declares off_t will automatically also declare off64_t
when _LARGEFILE64_SOURCE.
sunrpc/rpc/types.h is special, because it is included in files
compiled by the *build* compiler (cross-rpcgen-objs), and therefore it
cannot unconditionally assume bits/types headers are available. What
I did was have it include the appropriate bits/types headers only if
including sys/types.h did not cause __BIT_TYPES_DEFINED__ to be
defined. This will do the right thing when an installed rpc/types.h
is included by application code compiled without __USE_MISC in effect.
During the build, we rely on the fact that we compile all of our own
code with __USE_MISC in effect. This is fragile, but should be
acceptable for code that's no longer built by default anyway.
scripts/check-obsolete-constructs.py ensures that only sys/types.h and
rpc/types.h include the bits/types/ headers that define obsolete types.
* posix/bits/types/blkcnt64_t.h
* posix/bits/types/blkcnt_t.h
* posix/bits/types/blksize_t.h
* posix/bits/types/dev_t.h
* posix/bits/types/fsblkcnt64_t.h
* posix/bits/types/fsblkcnt_t.h
* posix/bits/types/fsfilcnt64_t.h
* posix/bits/types/fsfilcnt_t.h
* posix/bits/types/fsid_t.h
* posix/bits/types/gid_t.h
* posix/bits/types/id_t.h
* posix/bits/types/ino64_t.h
* posix/bits/types/ino_t.h
* posix/bits/types/intptr_t.h
* posix/bits/types/key_t.h
* posix/bits/types/loff_t.h
* posix/bits/types/mode_t.h
* posix/bits/types/nlink_t.h
* posix/bits/types/off64_t.h
* posix/bits/types/off_t.h
* posix/bits/types/pid_t.h
* posix/bits/types/socklen_t.h
* posix/bits/types/ssize_t.h
* posix/bits/types/suseconds_t.h
* posix/bits/types/uid_t.h
* posix/bits/types/useconds_t.h:
New single-declaration headers for standard types canonically
defined by sys/types.h, sys/socket.h, or inttypes.h but also
exposed by other headers under some circumstances. Code moved
from posix/sys/types.h, socket/sys/socket.h, stdlib/inttypes.h
as appropriate.
* posix/bits/types/uint.h
* posix/bits/types/u_int.h
* posix/bits/types/u_intN_t.h
* posix/bits/types/caddr_t.h
* posix/bits/types/daddr_t.h
* posix/bits/types/loff_t.h
* posix/bits/types/register_t.h:
Similarly, but for obsolete BSD-derived types whose canonical
home is sys/types.h. Some of these headers define more than
one type.
* posix/Makefile (headers): Install the above new headers.
Rewrap the list.
* posix/sys/types.h: All definitions of public types now
accomplished using the above new headers. Consolidate
groups of definitions controlled by the same feature
selection macros.
* inet/arpa/inet.h, bits/socket.h
* sysdeps/mach/hurd/bits/socket.h
* sysdeps/unix/sysv/linux/bits/socket.h:
Use bits/types/socklen_t.h.
* dirent/dirent.h: Use bits/types/ino_t.h and bits/types/ino64_t.h.
* grp/grp.h: Use bits/types/gid_t.h.
* io/fcntl.h: Use bits/types/mode_t.h, bits/types/off_t.h,
bits/types/pid_t.h, and bits/types/off64_t.h.
* io/sys/stat.h: Use bits/types/dev_t.h, bits/types/gid_t.h,
bits/types/ino_t.h, bits/types/mode_t.h, bits/types/nlink_t.h,
bits/types/off_t.h, bits/types/uid_t.h, and bits/types/blkcnt_t.h.
* libio/stdio.h: Use bits/types/off_t.h, bits/types/off64_t.h,
and bits/types/ssize_t.h.
* misc/sys/mman.h: Use bits/types/off_t.h and bits/types/mode_t.h.
* misc/sys/select.h: Use bits/types/suseconds_t.h.
* posix/sched.h: Use bits/types/pid_t.h.
* posix/sys/wait.h: Use bits/types/pid_t.h and bits/types/id_t.h.
* posix/unistd.h: Use bits/types/gid_t.h, bits/types/uid_t.h,
bits/types/off_t.h, bits/types/off64_t.h, bits/types/useconds_t.h,
bits/types/intptr_t.h, and bits/types/socklen_t.h.
* pwd/pwd.h: Use bits/types/gid_t.h and bits/types/uid_t.h.
* resource/sys/resource.h: Use bits/types/id_t.h.
* signal/signal.h: Use bits/types/pid_t.h and bits/types/uid_t.h.
* stdlib/monetary.h: Use bits/types/ssize_t.h.
* sysdeps/gnu/utmpx.h: Use bits/types/pid_t.h.
* sysvipc/sys/ipc.h: Use bits/types/uid_t.h, bits/types/gid_t.h,
bits/types/mode_t.h, and bits/types/key_t.h.
* sysvipc/sys/msg.h: Use bits/types/pid_t.h and bits/types/ssize_t.h.
* sysvipc/sys/shm.h: Use bits/types/pid_t.h.
* termios/termios.h: Use bits/types/pid_t.h.
* time/sys/time.h: Use bits/types/suseconds_t.h.
* time/time.h: Use bits/types/pid_t.h.
* sunrpc/rpc/types.h: Consolidate all #includes at the top of
the file. If __BIT_TYPES_DEFINED__ is not defined after
including sys/types.h, also include bits/types/caddr_t.h,
bits/types/daddr_t.h, bits/types/fsid_t.h, and bits/types/u_int.h.
* scripts/check-obsolete-constructs.py (OBSOLETE_TYPE_HDR_RE_): New.
(ObsoleteIndirectDefinitionsAllowed): New; allows inclusion of
bits/types/ headers that define obsolete typedefs, but not
direct definitions of those types.
(ObsoleteNotAllowed, ObsoletePrivateDefinitionsAllowed)
(ObsoletePublicDefinitionsAllowed): Do not allow inclusion of
bits/types/ headers that define obsolete typedefs.
* include/bits/types/blkcnt64_t.h
* include/bits/types/blkcnt_t.h
* include/bits/types/blksize_t.h
* include/bits/types/caddr_t.h
* include/bits/types/daddr_t.h
* include/bits/types/dev_t.h
* include/bits/types/fsblkcnt64_t.h
* include/bits/types/fsblkcnt_t.h
* include/bits/types/fsfilcnt64_t.h
* include/bits/types/fsfilcnt_t.h
* include/bits/types/fsid_t.h
* include/bits/types/gid_t.h
* include/bits/types/id_t.h
* include/bits/types/ino64_t.h
* include/bits/types/ino_t.h
* include/bits/types/intptr_t.h
* include/bits/types/key_t.h
* include/bits/types/loff_t.h
* include/bits/types/mode_t.h
* include/bits/types/nlink_t.h
* include/bits/types/off64_t.h
* include/bits/types/off_t.h
* include/bits/types/pid_t.h
* include/bits/types/register_t.h
* include/bits/types/socklen_t.h
* include/bits/types/ssize_t.h
* include/bits/types/suseconds_t.h
* include/bits/types/u_char.h
* include/bits/types/u_intN_t.h
* include/bits/types/uchar.h
* include/bits/types/uid_t.h
* include/bits/types/useconds_t.h: New wrappers.
|
|
This makes four linked changes to bits/types.h. First, we use
__(u)?int(16|32|64)_t to define __[SU](16|32|64)_TYPE. In addition
to reducing the amount of ifdeffage, this means __STD_TYPE is no longer
necessary, since gcc -std=c89 will complain about ‘typedef long long foo_t’
but not ‘typedef __int64_t foo_t’, even if the underlying type
of __int64_t is long long.
Second, we eliminate __UQUAD_TYPE and __SQUAD_TYPE from the set of
macros bits/typesizes.h should use to define __FOO_T_TYPE macros,
since they are always the same as __U64_TYPE and __S64_TYPE
respectively.
Third, we remove __u_char, __u_short, __u_int, __u_long, __u_quad_t,
and __quad_t, we add __uintptr_t, and we define __intmax_t and
__uintmax_t as __int64_t and __uint64_t.
Fourth, we reorganize the list of typedefs into groups by the
standard (if any) that defines them, and sort them alphabetically within
each group.
* posix/bits/types.h: Move #error for __WORDSIZE neither 32 nor 64
to first group of conditionals on __WORDSIZE, and make it more
explicit. Update commentary. Define all __foo_t types with
regular ‘typedef’. Reorganize all __foo_t types into the same
groups that sys/types.h uses.
(__u_char, __u_short, __u_int, __u_long, __quad_t, __u_quad_t)
(__UQUAD_TYPE, __SQUAD_TYPE, __STD_TYPE): Don’t define.
(__S16_TYPE): Define unconditionally as __int16_t.
(__U16_TYPE): Define unconditionally as __uint16_t.
(__S32_TYPE): Define unconditionally as __int32_t.
(__U32_TYPE): Define unconditionally as __uint32_t.
(__S64_TYPE): Define unconditionally as __int64_t.
(__U64_TYPE): Define unconditionally as __uint64_t.
(__intmax_t): Define unconditionally as __int64_t.
(__uintmax_t): Define unconditionally as __uint64_t.
(__uintptr_t): New typedef.
* bits/time64.h
* bits/typesizes.h
* sysdeps/mach/hurd/bits/typesizes.h
* sysdeps/unix/sysv/linux/alpha/bits/typesizes.h
* sysdeps/unix/sysv/linux/generic/bits/typesizes.h
* sysdeps/unix/sysv/linux/mips/bits/typesizes.h
* sysdeps/unix/sysv/linux/s390/bits/typesizes.h
* sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
* sysdeps/unix/sysv/linux/x86/bits/typesizes.h:
Replace all uses of __UQUAD_TYPE with __U64_TYPE, and all
uses of __SQUAD_TYPE with __S64_TYPE.
* posix/sys/types.h, rpc/sys/types.h
(u_char): Define as unsigned char.
(u_short): Define as unsigned short.
(u_int): Define as unsigned int.
(u_long): Define as unsigned long.
(quad_t): Define as __int64_t.
(u_quad_t): Define as __uint64_t.
* stdlib/stdint.h (intptr_t): Define as __intptr_t.
(uintptr_t): Define as __uintptr_t.
* scripts/check-obsolete-constructs.py: Update allowed
definitions for the obsolete types. No longer allow
__STD_TYPE as an alias for typedef.
|
|
bits/time64.h always sets __TIME64_T_TYPE to be __time_t when
__TIMESIZE == 64, so we can unconditionally use __TIME64_T_TYPE to
define __time64_t; we don’t need another conditional in bits/types.h.
Also move the definition of __time64_t next to the definition of
__time_t.
* posix/bits/types.h (__time64_t): Unconditionally define
as __TIME64_T_TYPE. Move definition next to __time_t.
|
|
caddr_t is a BSD-derived alias for ‘char *’, obsoleted by the
introduction of ‘void *’ in C89 (!) daddr_t is a “disk address,”
but it’s always defined as ‘int’, making it too small for modern
disks and tapes. loff_t is another name for off64_t, from early
drafts of LFS. All three are already only exposed by sys/types.h
under __USE_MISC.
This patch adds them to the set of types that shall not be used in
installed headers (enforced by check-obsolete-constructs.py) and
expunges all remaining uses, internally as well as in installed
headers. Since __DADDR_T_TYPE is always defined as __S32_TYPE, and
daddr_t is obsolete so there’s no need to worry about future
variation, the patch also removes __DADDR_T_TYPE from the set of
macros that bits/typesizes.h is required to define. Instead
bits/types.h always defines __daddr_t as __S32_TYPE, and the
definition is moved to a more logical location within the file, next
to __caddr_t.
It’s always safe to change (__)loff_t to the matching (__)off64_t;
in a few internal files, I removed an unnecessary __ prefix.
daddr_t is only used for struct ustat, which is obsoleted by struct
statvfs and we already don’t declare it in public headers, and for an
ioctl parameter block in sys/mtio.h (which may or may not be obsolete,
I can’t tell). In sys/mtio.h I replaced both uses with ‘int’ to match
the use of bare ‘long int’ for most of the other fields of that
structure. In misc/ustat.c, the definition of struct ustat is not
actually necessary so I removed it entirely. In
sysdeps/unix/sysv/linux/ustat.c a definition is necessary but only
because INLINE_SYSCALL_CALL doesn’t work (on at least x86) when an
argument is a pointer to an incomplete type, so I substituted a dummy
definition.
Most of the internal uses of caddr_t are in the sunrpc and nis
directories, and since most of that code is obsolete, I mechanically
replaced them with char * rather than consider whether void * might
make more sense. Because “const caddr_t foo” is semantically
different from “const char *foo” (in the first case ‘foo’ itself is
const but the memory pointed to isn’t, in the second case the memory
pointed to is const but ‘foo’ isn’t) this change exposed some
const-correctness errors in sunrpc, which I fixed minimally. Outside
of sunrpc and nis, I put a little more thought into whether uses of
caddr_t should be void * instead.
* scripts/check-obsolete-constructs.py: Add caddr_t, daddr_t,
and loff_t to the set of obsolete types forbidden in public
headers.
* posix/bits/types.h: Unconditionally define __daddr_t as
__S32_TYPE. Move definition of __daddr_t next to definition
of __caddr_t.
* bits/typesizes.h
* sysdeps/mach/hurd/bits/typesizes.h
* sysdeps/unix/sysv/linux/alpha/bits/typesizes.h
* sysdeps/unix/sysv/linux/generic/bits/typesizes.h
* sysdeps/unix/sysv/linux/mips/bits/typesizes.h
* sysdeps/unix/sysv/linux/s390/bits/typesizes.h
* sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
* sysdeps/unix/sysv/linux/x86/bits/typesizes.h:
Don’t define __DADDR_T_TYPE.
* sysdeps/gnu/sys/mtio.h (struct mtget): Change all uses of
__daddr_t to int.
* misc/ustat.c: Remove definition of struct ustat; only
forward-declare it.
* sysdeps/unix/sysv/linux/ustat.c: Replace fields of
struct ustat with a size-preserving dummy field.
* hurd/Makefile (migheaderpipe): Rewrite loff_t as __off64_t.
* hurd/fd-read.c (_hurd_fd_read): Use off64_t instead of loff_t.
* hurd/fd-write.c (hurd_fd_write): Use off64_t instead of loff_t.
* hurd/hurd/fd.h (_hurd_fd_read, _hurd_fd_write): Declare
using __off64_t instead of __loff_t.
* support/xunistd.h (xcopy_file_range): Declare using off64_t
instead of loff_t.
* sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h
* sysdeps/unix/sysv/linux/lseek.c
* sysdeps/unix/sysv/linux/lseek64.c
* sysdeps/unix/sysv/linux/splice.c
Throughout, use off64_t instead of loff_t.
* sysdeps/unix/sysv/linux/sys/quota.h
(dqoff): Use __off64_t instead of __loff_t.
(quotactl): Declare using char * instead of caddr_t.
* sysdeps/unix/sysv/linux/test-errno-linux.c
(do_test): Cast to char * instead of caddr_t when calling quotactl.
* elf/dl-map-segments.h (_dl_map_segments): Cast to void *
instead of caddr_t when calling __mprotect and __mmap.
* elf/dl-minimal.c (malloc): Declare page as char *, not caddr_t.
* elf/dl-reloc.c (_dl_relocate_object): Declare textrels.start
as char *, not caddr_t. Cast to char *, not caddr_t, in
pointer arithmetic.
* intl/loadmsgcat.c: Remove two unnecessary casts to caddr_t
when calling munmap. Change a third cast to target void *
instead and add a comment explaining why this one is necessary.
* locale/loadlocale.c (_nl_load_locale): Use NULL instead of
`(caddr_t)0`, and remove an unnecessary cast to caddr_t when
calling munmap.
(_nl_unload_locale): Change casts when calling free and munmap
to target char *, and add a comment explaining why they are
necessary.
* sysdeps/gnu/net/if.h
(struct ifreq): Declare ifru_data as char *, not __caddr_t.
(struct ifconf): Declare ifcu_buf as char *, not __caddr_t.
* nis/nis_add.c
* nis/nis_call.c
* nis/nis_callback.c
* nis/nis_checkpoint.c
* nis/nis_findserv.c
* nis/nis_intern.h
* nis/nis_lookup.c
* nis/nis_mkdir.c
* nis/nis_modify.c
* nis/nis_ping.c
* nis/nis_remove.c
* nis/nis_rmdir.c
* nis/nis_server.c
* nis/nis_table.c
* nis/nis_util.c
* nis/nss_nisplus/nisplus-grp.c
* nis/nss_nisplus/nisplus-pwd.c
* nis/rpcsvc/nis_callback.h
* nis/rpcsvc/yp.h
* nis/ypclnt.c
* sunrpc/auth_des.c
* sunrpc/auth_unix.c
* sunrpc/authdes_prot.c
* sunrpc/authuxprot.c
* sunrpc/clnt_raw.c
* sunrpc/clnt_tcp.c
* sunrpc/clnt_udp.c
* sunrpc/clnt_unix.c
* sunrpc/key_call.c
* sunrpc/pm_getmaps.c
* sunrpc/pm_getport.c
* sunrpc/pmap_clnt.c
* sunrpc/pmap_prot2.c
* sunrpc/pmap_rmt.c
* sunrpc/proto.h
* sunrpc/rpc/auth.h
* sunrpc/rpc/clnt.h
* sunrpc/rpc/pmap_clnt.h
* sunrpc/rpc/pmap_rmt.h
* sunrpc/rpc/rpc_msg.h
* sunrpc/rpc/svc.h
* sunrpc/rpc/xdr.h
* sunrpc/rpc_clntout.c
* sunrpc/rpc_cmsg.c
* sunrpc/rpc_hout.c
* sunrpc/rpc_prot.c
* sunrpc/rpc_sample.c
* sunrpc/rpc_svcout.c
* sunrpc/svc.c
* sunrpc/svc_authux.c
* sunrpc/svc_raw.c
* sunrpc/svc_tcp.c
* sunrpc/svc_udp.c
* sunrpc/svc_unix.c
* sunrpc/xdr.c
* sunrpc/xdr_array.c
* sunrpc/xdr_mem.c
* sunrpc/xdr_rec.c
* sunrpc/xdr_ref.c
* sunrpc/xdr_sizeof.c
* sunrpc/xdr_stdio.c:
Mechanically replace all uses of caddr_t with char *.
* sunrpc/xdr_mem.c (xdrmem_create): Cast away const when
setting xdrs->x_private and xdrs->x_base.
* sunrpc/xdr_stdio.c (xdrstdio_getbytes): Correct argument
types in definition to match prototype.
|
|
sys/types.h unconditionally defines u_int8_t, u_int16_t, u_int32_t,
u_int64_t, and register_t. These are not part of any standard. The
u_intXX_t types are superseded by C99’s uintXX_t types (defined in
stdint.h). I’m not aware of a standardized exact equivalent of
register_t, but also I’ve never seen anyone use it for anything.
I could be persuaded to leave that one alone.
sys/types.h also unconditionally defines int8_t, int16_t, int32_t, and
int64_t, which are the same as the C99 exact-width signed types in
stdint.h. POSIX doesn’t require these to appear in sys/types.h, so in
principle they ought to be brought under __USE_MISC also. But, when I
tried that it broke about two dozen files just in our own source tree,
and POSIX doesn’t *forbid* sys/types.h to define these types, so I
think we should leave them alone.
* posix/sys/types.h (u_int8_t, u_int16_t, u_int32_t, u_int64_t)
(register_t): Move under #ifdef __USE_MISC.
Consolidate adjacent #ifdef __USE_MISC blocks.
* scripts/check_obsolete_constructs.py: Add register_t to the
set of obsolete typedefs that our headers should not use
(but sys/types.h may still define).
|
|
Currently register_t is, unlike all other types in sys/types.h,
defined using a GCC extension (__attribute__((mode(word)))), falling
back to ‘int’ if the extension is unavailable. This is a potential
ABI compatibility hazard for people using non-GNU compilers with
glibc. It’s also unnecessary; the bits/typesizes.h mechanism can
handle all of the existing variation in the definition. In most
cases, defining __REGISTER_T_TYPE as __SWORD_TYPE is sufficient.
Special handling is necessary for MIPS n32 and x86-64 x32, where
__SWORD_TYPE is ‘int’ and the appropriate type for register_t is
‘long long’. Unfortunately, this means we need to create a new
bits/typesizes.h variant for linux/mips. This variant is based
on the top-level bits/typesizes.h, not linux/generic/bits/typesizes.h,
to match the existing MIPS ABIs.
Tested using build-many-glibcs. The c++-types test confirms that the
physical type of register_t does not change on any supported platform.
* posix/sys/types.h: Typedef register_t as __register_t.
* posix/bits/types.h: Typedef __register_t using __REGISTER_T_TYPE.
* bits/typesizes.h
* sysdeps/mach/hurd/bits/typesizes.h
* sysdeps/unix/sysv/linux/alpha/bits/typesizes.h
* sysdeps/unix/sysv/linux/generic/bits/typesizes.h
* sysdeps/unix/sysv/linux/s390/bits/typesizes.h
* sysdeps/unix/sysv/linux/sparc/bits/typesizes.h:
Define __REGISTER_T_TYPE as __SWORD_TYPE.
* sysdeps/unix/sysv/linux/mips/bits/typesizes.h:
New file (copied from bits/typesizes.h).
Define __REGISTER_T_TYPE as __SWORD_TYPE for o32 and n64 ABIs.
Define __REGISTER_T_TYPE as __SQUAD_TYPE for n32.
* sysdeps/unix/sysv/linux/x86/bits/typesizes.h:
Define __REGISTER_T_TYPE as __SWORD_TYPE for o32 and 64-bit ABIs.
Define __REGISTER_T_TYPE as __SQUAD_TYPE for x32.
|
|
I've updated copyright dates in glibc for 2020. This is the patch for
the changes not generated by scripts/update-copyrights and subsequent
build / regeneration of generated files. As well as the usual annual
updates, mainly dates in --version output (minus libc.texinfo which
previously had to be handled manually but is now successfully updated
by update-copyrights), there is a fix to
sysdeps/unix/sysv/linux/powerpc/bits/termios-c_lflag.h where a typo in
the copyright notice meant it failed to be updated automatically.
Please remember to include 2020 in the dates for any new files added
in future (which means updating any existing uncommitted patches you
have that add new files to use the new copyright dates in them).
|
|
|
|
It fixes the tst-cancelx4 and tst-cancelx5 on sparc{64,v9}.
Checked on sparc64-linux-gnu and sparcv9-linux-gnu.
|
|
The generic one calls wait4.
Checked on x86_64-linux-gnu.
|
|
This also consolidate all waitpid implementations.
Checked on x86_64-linux-gnu.
|
|
The POSIX implementation is used as default and both BSD and Linux
version are removed. It simplifies the implementation for
architectures that do not provide either __NR_waitpid or
__NR_wait4.
Checked on x86_64-linux-gnu and powerpc64le-linux-gnu.
|
|
If the regex has more subexpressions than the number of elements allocated
in the regmatch_t array passed to regexec then proceed_next_node may
access the regmatch_t array outside its bounds.
No testcase added because even without this bug it would then crash in
pop_fail_stack which is bug 11053.
|
|
The generic version is straightforward. For Hurd, its nanosleep
implementation is moved to clock_nanosleep with adjustments from
generic unix implementation.
The generic clock_nanosleep unix version is also removed since
it calls nanosleep.
Checked on x86_64-linux-gnu and powerpc64le-linux-gnu.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
|
|
It sync with gnulib commit 6cfb4302b3e1da14d706198b693558290e9b00f4
and contains the fixes:
https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=32915b2a8a43825720755113bdffe9f67a591748
https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=48f07576b8cd935b48e1050551f45ab1a79b9f01
https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=5e407aba1f775d51b25481cb55f324c9868f62d7
https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=4e02b30c761c76d04057fa5f6bba71401f9310cd
https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=79f8ee4e389f8cb1339f8abed9a7d29816e2a2d4
Checked on x86_64-linux-gnu and i686-linux-gnu.
|
|
This patch replaces the fork+exec by posix_spawn on wordexp, which
allows a better scability on Linux and simplifies the thread
cancellation handling.
The only change which can not be implemented with posix_spawn the
/dev/null check to certify it is indeed the expected device. I am
not sure how effetive this check is since /dev/null tampering means
something very wrong with the system and this is the least of the
issues. My view is the tests is really out of the place and the
hardening provided is minimum.
If the idea is still to provide such check, I think a possibilty
would be to open /dev/null, check it, add a dup2 file action, and
close the file descriptor.
Checked on powerpc64le-linux-gnu and x86_64-linux-gnu.
* include/spawn.h (__posix_spawn_file_actions_addopen): New
prototype.
* posix/spawn_faction_addopen.c (posix_spawn_file_actions_addopen):
Add internal alias.
* posix/wordexp.c (create_environment, free_environment): New
functions.
(exec_comm_child, exec_comm): Use posix_spawn instead of fork+exec.
* posix/wordexp-test.c: Use libsupport.
|
|
|
|
Once wordexp switches to posix_spawn, testing for command execution
based on fork handlers will not work anymore. Therefore, move these
subtests into a new test, posix/tst-wordexp-nocmd, which uses a
different form of command execution detection, based on PID
namespaces.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
|
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:
sed -ri '
s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
$(find $(git ls-files) -prune -type f \
! -name '*.po' \
! -name 'ChangeLog*' \
! -path COPYING ! -path COPYING.LIB \
! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
! -path manual/texinfo.tex ! -path scripts/config.guess \
! -path scripts/config.sub ! -path scripts/install-sh \
! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
! -path INSTALL ! -path locale/programs/charmap-kw.h \
! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
! '(' -name configure \
-execdir test -f configure.ac -o -f configure.in ';' ')' \
! '(' -name preconfigure \
-execdir test -f preconfigure.ac ';' ')' \
-print)
and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:
chmod a+x sysdeps/unix/sysv/linux/riscv/configure
# Omit irrelevant whitespace and comment-only changes,
# perhaps from a slightly-different Autoconf version.
git checkout -f \
sysdeps/csky/configure \
sysdeps/hppa/configure \
sysdeps/riscv/configure \
sysdeps/unix/sysv/linux/csky/configure
# Omit changes that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
git checkout -f \
sysdeps/powerpc/powerpc64/ppc-mcount.S \
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
# Omit change that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
|
|
Problem reported by Stefan Liebler in:
https://sourceware.org/ml/libc-alpha/2019-08/msg00658.html
* posix/tst-regex.c: Convert this file from Latin-1 to UTF-8.
(do_test, test_expr): Adjust to the fact that this source file,
and the test data in ChangeLog.8, is now UTF-8 instead of Latin-1.
* posix/tst-regex.input: Copy from ChangeLog.old/ChangeLog.8,
so that it is now UTF-8.
|
|
The recent commit e6855a3bdfe147c52b29b5e7d70a95a8aa22ece0
changed the encoding of ChangeLog.old/ChangeLog.8 from ISO-8859 to UTF-8.
Unfortunately the test posix/tst-regex assumes the former encoding.
Furthermore Francesco Potortì is now written with 'ì' instead of 'i`'
which would lead to two further matches in the first call to test_expr.
This patch just copies the former ChangeLog.8 file to tst-regex.input
and adjusts the test in order to use this new input file.
ChangeLog:
* posix/tst-regex.c (do_test): Use tst-regex.input as input file.
* posix/tst-regex.input: New file.
|
|
* posix/regex_internal.c (re_node_set_insert):
Remove unnecessary assignment. Reported by Tim Rühsen in:
https://lists.gnu.org/r/bug-gnulib/2019-08/msg00026.html
|
|
This was found by Coverity (CID 1484201). [BZ#24844]
* posix/regex_internal.c (create_cd_newstate): Fix use of bad
pointer and/or memory leak when storage is exhausted.
|
|
The fix for BZ#21270 (commit 158d5fa0e19) added a mask to avoid offset larger
than 1^44 to be used along __NR_mmap2. However mips64n32 users __NR_mmap,
as mips64n64, but still defines off_t as old non-LFS type (other ILP32, such
x32, defines off_t being equal to off64_t). This leads to use the same
mask meant only for __NR_mmap2 call for __NR_mmap, thus limiting the maximum
offset it can use with mmap64.
This patch fixes by setting the high mask only for __NR_mmap2 usage. The
posix/tst-mmap-offset.c already tests it and also fails for mips64n32. The
patch also change the test to check for an arch-specific header that defines
the maximum supported offset.
Checked on x86_64-linux-gnu, i686-linux-gnu, and I also tests tst-mmap-offset
on qemu simulated mips64 with kernel 3.2.0 kernel for both mips-linux-gnu and
mips64-n32-linux-gnu.
[BZ #24699]
* posix/tst-mmap-offset.c: Mention BZ #24699.
(do_test_bz21270): Rename to do_test_large_offset and use
mmap64_maximum_offset to check for maximum expected offset value.
* sysdeps/generic/mmap_info.h: New file.
* sysdeps/unix/sysv/linux/mips/mmap_info.h: Likewise.
* sysdeps/unix/sysv/linux/mmap64.c (MMAP_OFF_HIGH_MASK): Define iff
__NR_mmap2 is used.
|
|
Keep these functions compatible with Gnulib while adding
__time64_t support. The basic idea is to move private API
declarations from include/time.h to time/mktime-internal.h, since
the former file cannot easily be shared with Gnulib whereas the
latter can.
Also, do some other minor cleanup while in the neighborhood.
* include/time.h: Include stdbool.h, time/mktime-internal.h.
(__mktime_internal): Move this prototype to time/mktime-internal.h,
since Gnulib needs it.
(__localtime64_r, __gmtime64_r) [__TIMESIZE == 64]:
Move these macros to time/mktime-internal.h, since Gnulib needs them.
(__mktime64, __timegm64) [__TIMESIZE != 64]: New prototypes.
(in_time_t_range): New static function.
* posix/bits/types.h (__time64_t) [__TIMESIZE == 64 && !defined __LIBC]:
Do not define as a macro in this case, so that portable code is
less tempted to use __time64_t.
* time/mktime-internal.h: Rewrite so that it does both glibc
and Gnulib work. Include time.h if not _LIBC.
(mktime_offset_t) [!_LIBC]: Define for gnulib.
(__time64_t, __gmtime64_r, __localtime64_r, __mktime64, __timegm64)
[!_LIBC || __TIMESIZE == 64]: New macros, mostly moved here
from include/time.h.
(__gmtime_r, __localtime_r, __mktime_internal) [!_LIBC]:
New macros, taken from GNulib.
(__mktime_internal): New prototype, moved here from include/time.h.
* time/mktime.c (mktime_min, mktime_max, convert_time)
(ranged_convert, __mktime_internal, __mktime64):
* time/timegm.c (__timegm64):
Use __time64_t, not time_t.
* time/mktime.c: Stop worrying about whether time_t is floating-point.
(__mktime64) [! (_LIBC && __TIMESIZE != 64)]:
Rename from mktime.
(mktime) [_LIBC && __TIMESIZE != 64]: New function.
* time/timegm.c [!_LIBC]: Include libc-config.h, not config.h,
for libc_hidden_def.
Include errno.h.
(__timegm64) [! (_LIBC && __TIMESIZE != 64)]:
Rename from timegm.
(timegm) [_LIBC && __TIMESIZE != 64]: New function.
First cut at publicizing __time64_t
|
|
The stub implementations are turned into compat symbols.
Linux actually has two reserved system call numbers (for getpmsg
and putpmsg), but these system calls have never been implemented,
and there are no plans to implement them, so this patch replaces
the wrappers with the generic stubs.
According to <https://bugzilla.redhat.com/show_bug.cgi?id=436349>,
the presence of the XSI STREAMS declarations is a minor portability
hazard because they are not actually implemented.
This commit does not change the TIRPC support code in
sunrpc/rpc_svcout.c. It uses additional XTI functionality and
therefore never worked with glibc.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
|
The test for obsolete typedefs in installed headers was implemented
using grep, and could therefore get false positives on e.g. “ulong”
in a comment. It was also scanning all of the headers included by
our headers, and therefore testing headers we don’t control, e.g.
Linux kernel headers.
This patch splits the obsolete-typedef test from
scripts/check-installed-headers.sh to a separate program,
scripts/check-obsolete-constructs.py. Being implemented in Python,
it is feasible to make it tokenize C accurately enough to avoid false
positives on the contents of comments and strings. It also only
examines $(headers) in each subdirectory--all the headers we install,
but not any external dependencies of those headers. Headers whose
installed name starts with finclude/ are ignored, on the assumption
that they contain Fortran.
It is also feasible to make the new test understand the difference
between _defining_ the obsolete typedefs and _using_ the obsolete
typedefs, which means posix/{bits,sys}/types.h no longer need to be
exempted. This uncovered an actual bug in bits/types.h: __quad_t and
__u_quad_t were being used to define __S64_TYPE, __U64_TYPE,
__SQUAD_TYPE and __UQUAD_TYPE. These are changed to __int64_t and
__uint64_t respectively. This is a safe change, despite the comments
in bits/types.h claiming a difference between __quad_t and __int64_t,
because those comments are incorrect. In all current ABIs, both
__quad_t and __int64_t are ‘long’ when ‘long’ is a 64-bit type, and
‘long long’ when ‘long’ is a 32-bit type, and similarly for __u_quad_t
and __uint64_t. (Changing the types to be what the comments say they
are would be an ABI break, as it affects C++ name mangling.) This
patch includes a minimal change to make the comments not completely
wrong.
sys/types.h was defining the legacy BSD u_intN_t typedefs using a
construct that was not necessarily consistent with how the C99 uintN_t
typedefs are defined, and is also too complicated for the new script to
understand (it lexes C relatively accurately, but it does not attempt
to expand preprocessor macros, nor does it do any actual parsing).
This patch cuts all of that out and uses bits/types.h's __uintN_t typedefs
to define u_intN_t instead. This is verified to not change the ABI on
any supported architecture, via the c++-types test, which means u_intN_t
and uintN_t were, in fact, consistent on all supported architectures.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* scripts/check-obsolete-constructs.py: New test script.
* scripts/check-installed-headers.sh: Remove tests for
obsolete typedefs, superseded by check-obsolete-constructs.py.
* Rules: Run scripts/check-obsolete-constructs.py over $(headers)
as a special test. Update commentary.
* posix/bits/types.h (__SQUAD_TYPE, __S64_TYPE): Define as __int64_t.
(__UQUAD_TYPE, __U64_TYPE): Define as __uint64_t.
Update commentary.
* posix/sys/types.h (__u_intN_t): Remove.
(u_int8_t): Typedef using __uint8_t.
(u_int16_t): Typedef using __uint16_t.
(u_int32_t): Typedef using __uint32_t.
(u_int64_t): Typedef using __uint64_t.
|
|
This patch fixes various places where a space should have been present
before '(' in accordance with the GNU Coding Standards. Most but not
all of the fixes in this patch are for calls to sizeof (but it's not
exhaustive regarding such calls that should be fixed).
Tested for x86_64, and with build-many-glibcs.py.
* benchtests/bench-strcpy.c (do_test): Use space before '('.
* benchtests/bench-string.h (cmdline_process_function): Likewise.
* benchtests/bench-strlen.c (do_test): Likewise.
(test_main): Likewise.
* catgets/gencat.c (read_old): Likewise.
* elf/cache.c (load_aux_cache): Likewise.
* iconvdata/bug-iconv8.c (do_test): Likewise.
* math/test-tgmath-ret.c (do_test): Likewise.
* nis/nis_call.c (rec_dirsearch): Likewise.
* nis/nis_findserv.c (__nis_findfastest_with_timeout): Likewise.
* nptl/tst-audit-threads.c (do_test): Likewise.
* nptl/tst-cancel4-common.h (set_socket_buffer): Likewise.
* nss/nss_test1.c (init): Likewise.
* nss/test-netdb.c (test_hosts): Likewise.
* posix/execvpe.c (maybe_script_execute): Likewise.
* stdio-common/tst-fmemopen4.c (do_test): Likewise.
* stdio-common/tst-printf.c (do_test): Likewise.
* stdio-common/vfscanf-internal.c (__vfscanf_internal): Likewise.
* stdlib/fmtmsg.c (NKEYWORDS): Likewise.
* stdlib/qsort.c (STACK_SIZE): Likewise.
* stdlib/test-canon.c (do_test): Likewise.
* stdlib/tst-swapcontext1.c (do_test): Likewise.
* string/memcmp.c (OPSIZ): Likewise.
* string/test-strcpy.c (do_test): Likewise.
(do_random_tests): Likewise.
* string/test-strlen.c (do_test): Likewise.
(test_main): Likewise.
* string/test-strrchr.c (do_test): Likewise.
(do_random_tests): Likewise.
* string/tester.c (test_memrchr): Likewise.
(test_memchr): Likewise.
* sysdeps/generic/memcopy.h (OPSIZ): Likewise.
* sysdeps/generic/unwind-dw2.c (execute_stack_op): Likewise.
* sysdeps/generic/unwind-pe.h (read_sleb128): Likewise.
(read_encoded_value_with_base): Likewise.
* sysdeps/hppa/dl-machine.h (elf_machine_runtime_setup): Likewise.
* sysdeps/hppa/fpu/feupdateenv.c (__feupdateenv): Likewise.
* sysdeps/ia64/fpu/sfp-machine.h (TI_BITS): Likewise.
* sysdeps/mach/hurd/spawni.c (__spawni): Likewise.
* sysdeps/posix/spawni.c (maybe_script_execute): Likewise.
* sysdeps/powerpc/fpu/tst-setcontext-fpscr.c (query_auxv):
Likewise.
* sysdeps/unix/sysv/linux/aarch64/bits/procfs.h (ELF_NGREG):
Likewise.
* sysdeps/unix/sysv/linux/arm/bits/procfs.h (ELF_NGREG): Likewise.
* sysdeps/unix/sysv/linux/arm/ioperm.c (init_iosys): Likewise.
* sysdeps/unix/sysv/linux/csky/bits/procfs.h (ELF_NGREG):
Likewise.
* sysdeps/unix/sysv/linux/m68k/bits/procfs.h (ELF_NGREG):
Likewise.
* sysdeps/unix/sysv/linux/nios2/bits/procfs.h (ELF_NGREG):
Likewise.
* sysdeps/unix/sysv/linux/spawni.c (maybe_script_execute):
Likewise.
* sysdeps/unix/sysv/linux/x86/bits/procfs.h (ELF_NGREG): Likewise.
* sysdeps/unix/sysv/linux/x86/bits/sigcontext.h
(FP_XSTATE_MAGIC2_SIZE): Likewise.
* sysdeps/x86/fpu/sfp-machine.h (TI_BITS): Likewise.
* time/test_time.c (main): Likewise.
|
|
The GNU Coding Standards specify that line breaks in expressions
should go before an operator, not after one. This patch fixes various
code to do this. It only changes code that appears to be mostly
following GNU style anyway, not files and directories with
substantially different formatting. It is not exhaustive even for
files using GNU style (for example, changes to sysdeps files are
deferred for subsequent cleanups). Some files changed are shared with
gnulib, but most are specific to glibc. Changes were made manually,
with places to change found by grep (so some cases, e.g. where the
operator was followed by a comment at end of line, are particularly
liable to have been missed by grep, but I did include cases where the
operator was followed by backslash-newline).
This patch generally does not attempt to address other coding style
issues in the expressions changed (for example, missing spaces before
'(', or lack of parentheses to ensure indentation of continuation
lines properly reflects operator precedence).
Tested for x86_64, and with build-many-glibcs.py.
* benchtests/bench-memmem.c (simple_memmem): Break lines before
rather than after operators.
* benchtests/bench-skeleton.c (TIMESPEC_AFTER): Likewise.
* crypt/md5.c (md5_finish_ctx): Likewise.
* crypt/sha256.c (__sha256_finish_ctx): Likewise.
* crypt/sha512.c (__sha512_finish_ctx): Likewise.
* elf/cache.c (load_aux_cache): Likewise.
* elf/dl-load.c (open_verify): Likewise.
* elf/get-dynamic-info.h (elf_get_dynamic_info): Likewise.
* elf/readelflib.c (process_elf_file): Likewise.
* elf/rtld.c (dl_main): Likewise.
* elf/sprof.c (generate_call_graph): Likewise.
* hurd/ctty-input.c (_hurd_ctty_input): Likewise.
* hurd/ctty-output.c (_hurd_ctty_output): Likewise.
* hurd/dtable.c (reauth_dtable): Likewise.
* hurd/getdport.c (__getdport): Likewise.
* hurd/hurd/signal.h (_hurd_interrupted_rpc_timeout): Likewise.
* hurd/hurd/sigpreempt.h (HURD_PREEMPT_SIGNAL_P): Likewise.
* hurd/hurdfault.c (_hurdsig_fault_catch_exception_raise):
Likewise.
* hurd/hurdioctl.c (fioctl): Likewise.
* hurd/hurdselect.c (_hurd_select): Likewise.
* hurd/hurdsig.c (_hurdsig_abort_rpcs): Likewise.
(STOPSIGS): Likewise.
* hurd/hurdstartup.c (_hurd_startup): Likewise.
* hurd/intr-msg.c (_hurd_intr_rpc_mach_msg): Likewise.
* hurd/lookup-retry.c (__hurd_file_name_lookup_retry): Likewise.
* hurd/msgportdemux.c (msgport_server): Likewise.
* hurd/setauth.c (_hurd_setauth): Likewise.
* include/features.h (__GLIBC_USE_DEPRECATED_SCANF): Likewise.
* libio/libioP.h [IO_DEBUG] (CHECK_FILE): Likewise.
* locale/programs/ld-ctype.c (set_class_defaults): Likewise.
* localedata/tests-mbwc/tst_swscanf.c (tst_swscanf): Likewise.
* login/tst-utmp.c (do_check): Likewise.
(simulate_login): Likewise.
* mach/lowlevellock.h (lll_lock): Likewise.
(lll_trylock): Likewise.
* math/test-fenv.c (ALL_EXC): Likewise.
* math/test-fenvinline.c (ALL_EXC): Likewise.
* misc/sys/cdefs.h (__attribute_deprecated_msg__): Likewise.
* nis/nis_call.c (__do_niscall3): Likewise.
* nis/nis_callback.c (cb_prog_1): Likewise.
* nis/nis_defaults.c (searchaccess): Likewise.
* nis/nis_findserv.c (__nis_findfastest_with_timeout): Likewise.
* nis/nis_ismember.c (internal_ismember): Likewise.
* nis/nis_local_names.c (nis_local_principal): Likewise.
* nis/nss_nis/nis-rpc.c (_nss_nis_getrpcbyname_r): Likewise.
* nis/nss_nisplus/nisplus-netgrp.c (_nss_nisplus_getnetgrent_r):
Likewise.
* nis/ypclnt.c (yp_match): Likewise.
(yp_first): Likewise.
(yp_next): Likewise.
(yp_master): Likewise.
(yp_order): Likewise.
* nscd/hstcache.c (cache_addhst): Likewise.
* nscd/initgrcache.c (addinitgroupsX): Likewise.
* nss/nss_compat/compat-pwd.c (copy_pwd_changes): Likewise.
(internal_getpwuid_r): Likewise.
* nss/nss_compat/compat-spwd.c (copy_spwd_changes): Likewise.
* posix/glob.h (__GLOB_FLAGS): Likewise.
* posix/regcomp.c (peek_token): Likewise.
(peek_token_bracket): Likewise.
(parse_expression): Likewise.
* posix/regexec.c (sift_states_iter_mb): Likewise.
(check_node_accept_bytes): Likewise.
* posix/tst-spawn3.c (do_test): Likewise.
* posix/wordexp-test.c (testit): Likewise.
* posix/wordexp.c (parse_tilde): Likewise.
(exec_comm): Likewise.
* posix/wordexp.h (__WRDE_FLAGS): Likewise.
* resource/vtimes.c (TIMEVAL_TO_VTIMES): Likewise.
* setjmp/sigjmp.c (__sigjmp_save): Likewise.
* stdio-common/printf_fp.c (__printf_fp_l): Likewise.
* stdio-common/tst-fileno.c (do_test): Likewise.
* stdio-common/vfprintf-internal.c (vfprintf): Likewise.
* stdlib/strfmon_l.c (__vstrfmon_l_internal): Likewise.
* stdlib/strtod_l.c (round_and_return): Likewise.
(____STRTOF_INTERNAL): Likewise.
* stdlib/tst-strfrom.h (TEST_STRFROM): Likewise.
* string/strcspn.c (STRCSPN): Likewise.
* string/test-memmem.c (simple_memmem): Likewise.
* termios/tcsetattr.c (tcsetattr): Likewise.
* time/alt_digit.c (_nl_parse_alt_digit): Likewise.
* time/asctime.c (asctime_internal): Likewise.
* time/strptime_l.c (__strptime_internal): Likewise.
* time/sys/time.h (timercmp): Likewise.
* time/tzfile.c (__tzfile_compute): Likewise.
|
|
This patch adds fall-through comments in some cases where -Wextra
produces implicit-fallthrough warnings.
The patch is non-exhaustive. Apart from architecture-specific code
for non-x86_64 architectures, it does not change sunrpc/xdr.c (legacy
code, probably should have such changes, but left to be dealt with
separately), or places that already had comments about the
fall-through but not matching the form expected by
-Wimplicit-fallthrough=3 (the default level with -Wextra; my
inclination is to adjust those comments to match rather than
downgrading to -Wimplicit-fallthrough=1 to allow any comment), or one
place where I thought the implicit fallthrough was not correct and so
should be handled separately as a bug fix. I think the key thing to
consider in review of this patch is whether the fall-through is indeed
intended and correct in each place where such a comment is added.
Tested for x86_64.
* elf/dl-exception.c (_dl_exception_create_format): Add
fall-through comments.
* elf/ldconfig.c (parse_conf_include): Likewise.
* elf/rtld.c (print_statistics): Likewise.
* locale/programs/charmap.c (parse_charmap): Likewise.
* misc/mntent_r.c (__getmntent_r): Likewise.
* posix/wordexp.c (parse_arith): Likewise.
(parse_backtick): Likewise.
* resolv/ns_ttl.c (ns_parse_ttl): Likewise.
* sysdeps/x86/cpu-features.c (init_cpu_features): Likewise.
* sysdeps/x86_64/dl-machine.h (elf_machine_rela): Likewise.
|
|
Non-sysdeps headers cannot be overriden by sysdeps headers across the
entire build, so it is necessary to turn such extension headers into
sysdeps headers themselves. The approach here follows the existing
<bits/shm.h> header (although it uses sysdeps/gnu instead of
sysdeps/generic).
Fixes commit 1d0fc213824eaa2a8f8c4385daaa698ee8fb7c92 ("Linux: Add
gettid system call wrapper [BZ #6399]") and commit
8f89ab216f205c2ffd90d1fc8454efdfc0b01dee ("posix: Fix missing wrapper
header for <bits/unistd_ext.h>").
|
|
This commit adds gettid to <unistd.h> on Linux, and not to the
kernel-independent GNU API.
gettid is now supportable on Linux because too many things assume a
1:1 mapping between libpthread threads and kernel threads.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
|
This fixes the same bug in fnmatch that was fixed by commit 7e2f0d2d77 for
regexp matching. As a side effect it also removes the use of an unbound
VLA.
|
|
For consistency with execve, the __argv arguments are not marked
nonnull.
|
|
From time to time I get fails in tst-spawn like:
tst-spawn.c:111: numeric comparison failure
left: 0 (0x0); from: xlseek (fd2, 0, SEEK_CUR)
right: 28 (0x1c); from: strlen (fd2string)
error: 1 test failures
tst-spawn.c:252: numeric comparison failure
left: 1 (0x1); from: WEXITSTATUS (status)
right: 0 (0x0); from: 0
error: 1 test failures
It turned out, that a child process is testing it's open file descriptors
with e.g. a sequence of testing the current position, setting the position
to zero and reading a specific amount of bytes.
Unfortunately starting with commit 2a69f853c03034c2e383e0f9c35b5402ce8b5473
the test is spawning a second child process which is sharing some of the
file descriptors. If the test sequence as mentioned above is running in parallel
it leads to test failures.
As the second call of posix_spawn shall test a NULL pid argument,
this patch is just moving the waitpid of the first child
before the posix_spawn of the second child.
ChangeLog:
* posix/tst-spawn do_test(): Move waitpid before posix_spawn.
|
|
Problem found by AddressSanitizer, reported by Hongxu Chen in:
https://debbugs.gnu.org/34140
* posix/regexec.c (proceed_next_node):
Do not read past end of input buffer.
|
|
Apply the following spelling fixes:
$ git grep -F -l 'relevent' |
xargs sed -i 's/relevent/relevant/g'
$ git grep -F -l 'checked fot' |
xargs sed -i 's/checked fot/checked for/g'
$ git grep -F -l "could't" |
xargs sed -i "s/could't/couldn't/g"
$ git grep -F -l 'wheter' | grep -Fv ChangeLog.old |
xargs sed -i 's/wheter/whether/g'
$ git grep -F -l 'neccessary' | grep -Fv ChangeLog.old |
xargs sed -i 's/neccessary/necessary/g'
$ git grep -F -l 'ouput' |
xargs sed -i 's/ouput/output/g'
$ git grep -F -w -l 'iput' |
xargs sed -i 's/iput/input/g'
This is inspired by a gnulib bug report at
https://lists.gnu.org/archive/html/bug-gnulib/2019-01/msg00081.html
* argp/argp-help.c: Fix typo in comment.
* misc/sys/cdefs.h: Likewise.
* posix/regexec.c (sift_states_iter_mb): Likewise.
* socket/sockatmark.c: Likewise.
* socket/sys/socket.h: Likewise.
* sysdeps/ia64/fpu/libm_sincos_large.S: Likewise.
* sysdeps/ia64/fpu/libm_sincosl.S: Likewise.
* sysdeps/ia64/fpu/s_cosl.S: Likewise.
* sysdeps/ieee754/dbl-64/k_rem_pio2.c: Likewise.
* sysdeps/unix/sockatmark.c: Likewise.
* time/strptime_l.c: Likewise.
|
|
Checked on powerpc64le-linux-gnu.
* posix/tst-spawn.c (do_test): Extend spargv to new required size and
fix typo.
|
|
Austin Group issue #411 [1] proposes that posix_spawn file action
posix_spawn_file_actions_adddup2 resets the close-on-exec when
source and destination refer to same file descriptor.
It solves the issue on multi-thread applications which uses
close-on-exec as default, and want to hand-chose specifically
file descriptor to purposefully inherited into a child process.
Current approach to achieve this scenario is to use two adddup2 file
actions and a temporary file description which do not conflict with
any other, coupled with a close file action to avoid leaking the
temporary file descriptor. This approach, besides being complex,
may fail with EMFILE/ENFILE file descriptor exaustion.
This can be more easily accomplished with an in-place removal of
FD_CLOEXEC. Although the resulting adddup2 semantic is slight
different than dup2 (equal file descriptors should be handled as
no-op), the proposed possible solution are either more complex
(fcntl action which a limited set of operations) or results in
unrequired operations (dup3 which also returns EINVAL for same
file descriptor).
Checked on aarch64-linux-gnu.
[BZ #23640]
* posix/tst-spawn.c (do_prepare, handle_restart, do_test): Add
posix_spawn_file_actions_adddup2 test to check O_CLOCEXEC reset.
* sysdeps/unix/sysv/linux/spawni.c (__spawni_child): Add
close-on-exec reset for adddup2 file action.
* sysdeps/posix/spawni.c (__spawni_child): Likewise.
[1] http://austingroupbugs.net/view.php?id=411
|
|
I've updated copyright dates in glibc for 2019. This is the patch for
the changes not generated by scripts/update-copyrights and subsequent
build / regeneration of generated files.
Please remember to include 2019 in the dates for any new files added
in future (which means updating any existing uncommitted patches you
have that add new files to use the new copyright dates in them).
* NEWS: Update copyright dates.
* catgets/gencat.c (print_version): Likewise.
* csu/version.c (banner): Likewise.
* debug/catchsegv.sh: Likewise.
* debug/pcprofiledump.c (print_version): Likewise.
* debug/xtrace.sh (do_version): Likewise.
* elf/ldconfig.c (print_version): Likewise.
* elf/ldd.bash.in: Likewise.
* elf/pldd.c (print_version): Likewise.
* elf/sotruss.sh: Likewise.
* elf/sprof.c (print_version): Likewise.
* iconv/iconv_prog.c (print_version): Likewise.
* iconv/iconvconfig.c (print_version): Likewise.
* locale/programs/locale.c (print_version): Likewise.
* locale/programs/localedef.c (print_version): Likewise.
* login/programs/pt_chown.c (print_version): Likewise.
* malloc/memusage.sh (do_version): Likewise.
* malloc/memusagestat.c (print_version): Likewise.
* malloc/mtrace.pl: Likewise.
* manual/libc.texinfo: Likewise.
* nptl/version.c (banner): Likewise.
* nscd/nscd.c (print_version): Likewise.
* nss/getent.c (print_version): Likewise.
* nss/makedb.c (print_version): Likewise.
* posix/getconf.c (main): Likewise.
* scripts/test-installation.pl: Likewise.
* sysdeps/unix/sysv/linux/lddlibc4.c (main): Likewise.
|
|
* All files with FSF copyright notices: Update copyright dates
using scripts/update-copyrights.
* locale/programs/charmap-kw.h: Regenerated.
* locale/programs/locfile-kw.h: Likewise.
|
|
From the glibc point of view, this removes duplicate macro
definitions and is obviously safe.
From the Gnulib point of view, this pacifies xlc 12.01 on AIX 7.1.
* posix/regex_internal.h:
(__attribute__, __attribute_warn_unused_result__):
Remove; already defined elsewhere.
|
|
This simplifies the code, by removing stuff intended for porting
to Gnulib but no longer needed there.
* posix/regcomp.c [!_LIBC]: No need to put #ifdef _LIBC around
uses of libc_hidden_def, weak_alias.
* posix/regcomp.c, posix/regexec.c: Use __restrict rather than
_Restrict_ except for public-facing headers.
* posix/regex_internal.h (attribute_hidden) [!_LIBC]:
Remove; already defined elsewhere.
* posix/regex.c, posix/regex_internal.h:
Use __GNUC_PREREQ instead of rolling our own.
* posix/regex_internal.h (__GNUC_PREREQ): Remove duplicate defn.
|