comments on LFS suport in samba-2
borsenkow.msk at sni.de
Tue Nov 24 15:22:18 GMT 1998
I apologize in advance for any error/omission - I tried to sort things out
for myself as well :)
LFS specification ( http://www.sas.com/standards/large.file/ ) defines two
possible ways to access large files on 32 bit systems. The main one assumes
64 bit off_t type. It also adds some additional types, and requires that
application must use only opaque types. The transitional way assumes
explicit 64 bit interface (open64 etc) and adds explicit 64 bit types
off64_t etc. As I plan to move on new version of our system, which supports
LFS, I am very much interested in seamless transition to samba-2. Here are
some notes about possible problems.
1. To use "large off_t", application must define _LARGEFILE_SOURCE
To use transitional interface, application must define
Nobody prevents a particular system from supporting these without any
additional flags; but our
system supports both, and I have to tell, which to use.
Can we select particular model and stick to it? Defining these flags
probably won't break anything
on other systems, but will add more portablity.
2. The LFS specs define the standard way for application to get
system-specific additional flags/libs
They are (for "large off_t"):
and LFS64_* for explicit model. There is API as well as command
omterface to get these values;
here is example (from LFS spec):
An example of compiling a program using transitional versions of SUS
interfaces such as lseek64() and fopen64():
c89 -D_LARGEFILE64_SOURCE \
$(getconf LFS64_CFLAGS) a.c \
$(getconf LFS64_LDFLAGS) \
Again, a particular system may not need them; our does. It results in
selecting model we use
testing for getconf
if it exists - add the results to CFLAGS, LDFLAGS, LIBS
Can anybody make a quick check, if getconf is supported on LFS systems
SAMBA currently runs on?
And if it returns meaningful values?
3. LFS specs provide the following ways to open large (>2GB) file:
"large off_t" - no restiction
off64_t - using one of
open (..., O_LARGEFILE, ...) or open64()
It is explicitly stated, that use of 32 bit open() on large file should
fail. I could not find any use of
one of above mentioned interfaces in samba source.
Please not, that anything can be defined as macro.
The following is our system specific, but should not harm much
4. To use LFS interface, unistd.h *must* be included as the very first
header. There is no porblem moving
it to top of include/includes.h; and test for LFS support should start
Anybody objects to it?
5. We don't have stat(), lstat(), stat64() etc but a single xstat(); all
others are simply defined in
<sys/stat.h>. Is it O.K. to add
to test for stat64?
So the main question is, which model will samba support? off64_t is marked
as transitional, so "large off_t" is probably preferred. But note, that
currently samba will blindly use *64 functions if it finds them.
More information about the samba-technical