Do we need sys_open() et al (_LARGEFILE64_SOURCE and open64())?
abartlet at samba.org
Sun Mar 25 15:56:57 MDT 2012
On Sun, 2012-03-25 at 08:19 -0700, Jeremy Allison wrote:
> On Sun, Mar 25, 2012 at 01:55:04PM +1100, Andrew Bartlett wrote:
> > While we are thinking about sys_ wrappers, I wondered if we still really
> > needed the sys_*() wrappers for open64 etc?
> > man feature_test_macros(7) says:
> > _LARGEFILE64_SOURCE
> > Expose definitions for the alternative API specified by the LFS
> > (Large File Summit) as a "transitional extension" to the Single UNIX
> > Specification. (See http://opengroup.org/platform/lfs.html.) The
> > alternative API consists of a set of new objects (i.e., functions and
> > types) whose names are suffixed with "64" (e.g., off64_t versus off_t,
> > lseek64() versus lseek(), etc.). New programs should not employ this
> > interface; instead _FILE_OFFSET_BITS=64 should be employed.
> > _FILE_OFFSET_BITS
> > Defining this macro with the value 64 automatically converts
> > references to 32-bit functions and data types related to file I/O and
> > file system operations into references to their 64-bit counterparts.
> > As such, are there any systems that we need that have
> > _LARGEFILE64_SOURCE but not _FILE_OFFSET_BITS?
> > Thanks,
> Oooh. That's a really good point. It would simplify
> those interfaces. How do we find out if the open64
> etc. are still being used on platforms ?
I've done some research on the build farm. I've checked the size of
off_t, as the way of knowing if large file support is in place:
grep "checking size of off_t" build.samba_3_master*.log
Every reporting host has off_t being 8 bytes. This is probably because
we first declare _FILE_OFFSET_BITS 64.
Therefore I think, we can safely move to setting only _FILE_OFFSET_BITS.
We probably should refuse to build if off_t is not 8 at least 8 bytes
This would remove the calls to open64() etc, that all the hosts are
currently using, and go back to standard open(). (every host declares
HAVE_EXPLICIT_LARGEFILE_SUPPORT at the moment)
The comments in configure.in are an interesting history. Others will
need to comment as to if the special cases mentioned there matter any
more (Solaris with gcc 2.6 and 2.7 for example), but I think Samba 4.0
would be a good time to require a genuinely 64-bit capable platform.
Andrew Bartlett http://samba.org/~abartlet/
Authentication Developer, Samba Team http://samba.org
More information about the samba-technical