This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Reduce kernel-features.h duplication
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Tue, 13 May 2014 21:46:57 +0200
- Subject: Re: Reduce kernel-features.h duplication
- Authentication-results: sourceware.org; auth=none
- References: <Pine dot LNX dot 4 dot 64 dot 1405122348570 dot 25715 at digraph dot polyomino dot org dot uk>
On Mon, May 12, 2014 at 11:53:24PM +0000, Joseph S. Myers wrote:
> This patch reduces duplication between different architectures'
> kernel-features.h files by making the architecture-independent file
> define various macros unconditionally (instead of only for a
> particular list of architectures), with the architecture-specific
> files then undefining the macros if necessary.
>
> Specifically, __ASSUME_O_CLOEXEC (O_CLOEXEC flag to open) and
> __ASSUME_SOCK_CLOEXEC (SOCK_NONBLOCK and SOCK_CLOEXEC flags to socket)
> are supported on all architectures as of 2.6.32 or the minimum kernel
> version for the architecture if later. For __ASSUME_IN_NONBLOCK,
> __ASSUME_PIPE2, __ASSUME_EVENTFD2, __ASSUME_SIGNALFD4 and
> __ASSUME_DUP3, the relevant syscalls were added for alpha in 2.6.33
> but otherwise the features are available as of 2.6.32. For
> __ASSUME_UTIMES, support is everywhere in 2.6.32 except for
> asm-generic architectures and hppa.
>
> Although those were the main cases of duplication among
> kernel-features.h files, some other cases of unnecessary definitions
> were also cleaned up: the hppa file defined various macros that were
> either no longer used at all, or defined by the main file by default
> anyway, the ia64 file had duplicative definitions of __ASSUME_PSELECT
> and __ASSUME_PPOLL, while mips had such a definition of
> __ASSUME_IPC64.
>
> Really, rather than being defined in the main file then undefined for
> asm-generic architectures, __ASSUME_UTIMES should become an
> hppa-specific macro. Given that __ASSUME_ATFCTS and
> __ASSUME_UTIMENSAT are now always true, the only live __ASSUME_UTIMES
> conditional is in sysdeps/unix/sysv/linux/utimes.c, which is not used
> for asm-generic architectures. I think the desired state would be an
> hppa-specific file (that includes sysdeps/unix/sysv/linux/utimes.c if
> __ASSUME_UTIMES, and otherwise has fallback code), with the fallback
> code being removed from the main utimes.c. But I think that's most
> reasonably a separate cleanup once __ASSUME_ATFCTS and
> __ASSUME_UTIMESAT have both had conditional code cleaned up.
>
> Given this patch, I think it's straightforward to move non-ex-ports
> architectures to having their own kernel-features.h files, like
> ex-ports architectures, rather than conditionals in the main file
> (i.e., such a move won't require the architecture-specific file to
> contain anything that isn't genuinely architecture-specific), and
> would encourage architecture maintainers to do so.
>
> Tested x86_64 that the installed shared libraries are unchanged by
> this patch. Note that on some architectures this *will* cause
> __ASSUME_* macros to be defined in cases where they weren't previously
> but should have been (but this is just optimization, not a fix to a
> user-visible bug, so doesn't need a bug report in Bugzilla).
>
looks ok.