mailing list of musl libc
 help / color / mirror / code / Atom feed
* loff_t definition in <fcntl.h> (vs. glibc in <sys/types.h>)
@ 2019-10-16 21:28 Petr Vorel
  2019-10-16 21:53 ` Rich Felker
  0 siblings, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2019-10-16 21:28 UTC (permalink / raw)
  To: Rich Felker; +Cc: musl

Hi Rich,

what is the reason for loff_t being defined in <fcntl.h> ?
It was defined some time ago, in v0.9.5.

glibc (and thus uclibc; + also Bionic) has it in <sys/types.h>, defined long
time before.  Who is correct? I guess loff_t not being posix, therefore it
shouldn't be in <sys/types.h> ?

I'm asking because it'd be nice to have it for both in single header
(portability).

Kind regards,
Petr


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: loff_t definition in <fcntl.h> (vs. glibc in <sys/types.h>)
  2019-10-16 21:28 loff_t definition in <fcntl.h> (vs. glibc in <sys/types.h>) Petr Vorel
@ 2019-10-16 21:53 ` Rich Felker
  2019-10-17 22:52   ` Petr Vorel
  0 siblings, 1 reply; 4+ messages in thread
From: Rich Felker @ 2019-10-16 21:53 UTC (permalink / raw)
  To: musl

On Wed, Oct 16, 2019 at 11:28:38PM +0200, Petr Vorel wrote:
> Hi Rich,
> 
> what is the reason for loff_t being defined in <fcntl.h> ?
> It was defined some time ago, in v0.9.5.
> 
> glibc (and thus uclibc; + also Bionic) has it in <sys/types.h>, defined long
> time before.  Who is correct? I guess loff_t not being posix, therefore it
> shouldn't be in <sys/types.h> ?
> 
> I'm asking because it'd be nice to have it for both in single header
> (portability).

The reason it's defined in fcntl.h is because that's where the
declarations for the only functions which use it in their interfaces
reside. If it needs to be made available from multiple places, that
could be done at some point, but this is a really minor type that
shouldn't be used except with with functions defined in terms of it.

Rich


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: loff_t definition in <fcntl.h> (vs. glibc in <sys/types.h>)
  2019-10-16 21:53 ` Rich Felker
@ 2019-10-17 22:52   ` Petr Vorel
  2019-10-18  1:21     ` Rich Felker
  0 siblings, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2019-10-17 22:52 UTC (permalink / raw)
  To: musl

Hi Rich,

> > what is the reason for loff_t being defined in <fcntl.h> ?
> > It was defined some time ago, in v0.9.5.

> > glibc (and thus uclibc; + also Bionic) has it in <sys/types.h>, defined long
> > time before.  Who is correct? I guess loff_t not being posix, therefore it
> > shouldn't be in <sys/types.h> ?

> > I'm asking because it'd be nice to have it for both in single header
> > (portability).

> The reason it's defined in fcntl.h is because that's where the
> declarations for the only functions which use it in their interfaces
> reside. If it needs to be made available from multiple places, that
> could be done at some point, but this is a really minor type that
> shouldn't be used except with with functions defined in terms of it.
Thanks for info. So maybe glibc shouldn't have defined it in <sys/types.h>.

FYI I'm handling compatibility issues for LTP [1], which often uses kernel API
in order to test it. Probably normal user space applications don't have needs we
have in LTP.

Kind regards,
Petr

[1] https://github.com/linux-test-project/ltp/


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: loff_t definition in <fcntl.h> (vs. glibc in <sys/types.h>)
  2019-10-17 22:52   ` Petr Vorel
@ 2019-10-18  1:21     ` Rich Felker
  0 siblings, 0 replies; 4+ messages in thread
From: Rich Felker @ 2019-10-18  1:21 UTC (permalink / raw)
  To: musl

On Fri, Oct 18, 2019 at 12:52:05AM +0200, Petr Vorel wrote:
> Hi Rich,
> 
> > > what is the reason for loff_t being defined in <fcntl.h> ?
> > > It was defined some time ago, in v0.9.5.
> 
> > > glibc (and thus uclibc; + also Bionic) has it in <sys/types.h>, defined long
> > > time before.  Who is correct? I guess loff_t not being posix, therefore it
> > > shouldn't be in <sys/types.h> ?
> 
> > > I'm asking because it'd be nice to have it for both in single header
> > > (portability).
> 
> > The reason it's defined in fcntl.h is because that's where the
> > declarations for the only functions which use it in their interfaces
> > reside. If it needs to be made available from multiple places, that
> > could be done at some point, but this is a really minor type that
> > shouldn't be used except with with functions defined in terms of it.
> Thanks for info. So maybe glibc shouldn't have defined it in <sys/types.h>.
> 
> FYI I'm handling compatibility issues for LTP [1], which often uses kernel API
> in order to test it. Probably normal user space applications don't have needs we
> have in LTP.

What did you encounter that needs it that's not declared in fcntl.h?
Are you sure you're not using loff_t where off_t would be the right
type? loff_t only appears in some kernel interfaces that were intended
to work the same regardless of whether glibc was configured for 32-bit
or 64-bit off_t.

Rich


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-18  1:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-16 21:28 loff_t definition in <fcntl.h> (vs. glibc in <sys/types.h>) Petr Vorel
2019-10-16 21:53 ` Rich Felker
2019-10-17 22:52   ` Petr Vorel
2019-10-18  1:21     ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).