This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Patch: Convert linux-generic to use <bits/fcntl-linux.h>
- From: Chris Metcalf <cmetcalf at tilera dot com>
- To: Andreas Jaeger <aj at suse dot com>
- Cc: "libc-ports at sourceware dot org" <libc-ports at sourceware dot org>, libc-alpha<libc-alpha at sourceware dot org>
- Date: Wed, 24 Oct 2012 16:43:25 -0400
- Subject: Re: Patch: Convert linux-generic to use <bits/fcntl-linux.h>
- References: <50883C05.5090807@suse.com> <508841FA.4060104@tilera.com> <508849BF.50205@suse.com>
On 10/24/2012 4:04 PM, Andreas Jaeger wrote:
> On 10/24/2012 09:31 PM, Chris Metcalf wrote:
>> On 10/24/2012 3:05 PM, Andreas Jaeger wrote:
>>> Here's a patch for linux-generic to use <bits/fcntl-linux.h>.
>>> The patch is also part of my git branch aj/shared-linux-fcntl.
>>
>> Does it make sense to move the O_LARGEFILE definition to bits/fcntl-linux.h
>> instead, i.e. if __O_LARGEFILE is not defined, provide a definition that's
>> conditional on _WORDSIZE? That seems like a more natural default,
>> particularly as more platforms will be 64-bit with time and thus want zero
>> for O_LARGEFILE. <bits/wordsize.h> could either be unconditionally
>> included, or just included ifndef __O_LARGEFILE.
>
> We could have:
> #ifdef __USE_LARGEFILE64
> # if __WORDSIZE == 64
> # define O_LARGEFILE 0
> # else
> # define O_LARGEFILE __O_LARGEFILE
> # endif
> #endif
>
> but this needs we need to include <bits/wordsize.h> in
> <bits/fcntl-linux.h> which is not always the case today.
>
> Especially, there's no double inclusion protection for <bits/wordsize.h>
> so if <bits/fcntl.h> already includes <bits/wordsize.h>, it will give
> warnings about redefinitions.
>
> How can we solve that? What do others thing?
I think it's OK to include it freely here or elsewhere. All the existing
<wordsize.h> headers just offer #defines, which can be repeated multiple
times as long as each time the variable is defined to the same value.
>> Likewise, it might make sense to take the linux-generic version of struct
>> flock/flock64 into bits/fcntl-linux.h, with an "#ifndef __struct_flock" or
>> equivalent so that platforms with variant definitions of those structures
>> can provide them.
>
> Yes, struct flock cleanup is another topic which I did not tackle yet on
> purpose. If you like to give it a go, you're welcome ;)
>
>> This would leave us in the natural-seeming position of having linux-generic
>> use the generic Linux version of fcntl.h with no customizations :-)
>
> ;)
>
> It's already quite short after my patch,
Yes, perhaps I should have mentioned that I think the patch is definitely a
good thing as-is!
--
Chris Metcalf, Tilera Corp.
http://www.tilera.com