This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 1/4] Add architecture specific socket.h header
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Tue, 22 Mar 2016 07:27:04 -0300
- Subject: Re: [PATCH 1/4] Add architecture specific socket.h header
- Authentication-results: sourceware.org; auth=none
- References: <1458592867-3057-1-git-send-email-adhemerval dot zanella at linaro dot org> <1458592867-3057-2-git-send-email-adhemerval dot zanella at linaro dot org> <alpine dot DEB dot 2 dot 10 dot 1603212310560 dot 17899 at digraph dot polyomino dot org dot uk>
On 21-03-2016 20:11, Joseph Myers wrote:
> On Mon, 21 Mar 2016, Adhemerval Zanella wrote:
>
>> To avoid namespace pollution socket.h can not include limits.h to
>> get LONG_MAX and INT_MAX, so the option is either using compiler
>> builtin defintions (__LONG_MAX__ and __INT_MAX__) or by creating
>> archicteture specific headers. The first option has the downside
>> of relying on existense of builtin, which might not be true for all
>> current compilers.
>
> The normal approach is to include <bits/wordsize.h>. That should avoid
> any need for architecture-specific variants of socket.h.
>
I though about using __WORDSIZE == 64 as the compiler test to check if
sizeof (size_t) is larger than sizeof (socklen_t), but I was not sure
how safe it is for all the architectures. It seems to be ok for
all current ports though. I will change that.