Definition of off64_t - BSD
This is a discussion on Definition of off64_t - BSD ; Hi,
I am trying to port an application written on Linux to FreeBSD.
During compile, I am getting an error saying that off64_t is not
defined. Which header file do I need to include to get the definition
for off64_t ...
-
Definition of off64_t
Hi,
I am trying to port an application written on Linux to FreeBSD.
During compile, I am getting an error saying that off64_t is not
defined. Which header file do I need to include to get the definition
for off64_t ?
Thanks in advance,
Chandan
-
Re: Definition of off64_t
In article <19b8d345-e901-4c63-8035-c7ba6f0943df@m45g2000hsb.googlegroups.com>,
TC writes:
> Hi,
>
> I am trying to port an application written on Linux to FreeBSD.
> During compile, I am getting an error saying that off64_t is not
> defined. Which header file do I need to include to get the definition
> for off64_t ?
off64_t isn't defined on FreeBSD in a header supplied by the
system. You'll need to look at the definition on linux and
find the appropriate value in stdint.h
--
steve
-
Re: Definition of off64_t
On Tue, 30 Sep 2008 20:40:54 -0500, Steven G. Kargl wrote:
> In article
> <19b8d345-e901-4c63-8035-c7ba6f0943df@m45g2000hsb.googlegroups.com>,
> TC writes:
>> Hi,
>>
>> I am trying to port an application written on Linux to FreeBSD. During
>> compile, I am getting an error saying that off64_t is not defined.
>> Which header file do I need to include to get the definition for
>> off64_t ?
>
> off64_t isn't defined on FreeBSD in a header supplied by the system.
> You'll need to look at the definition on linux and find the appropriate
> value in stdint.h
It's almost certainly off_t (aka long long or perhaps unsigned long long
in c99). To the OP: FreeBSD doesn't have off64_t because off_t et al are
64 bits, even on 32-bit systems, and have been ever since the net4.4
release from UCB (at least). Consequently, there isn't a separate set of
interfaces for 32-bit and 64-bit files or file systems, they're all 64-
bit.
On the flip-side, if the OP doesn't want to fix the code, I suppose that
he could compile it as linux, under linux emulation...
Cheers,
--
Andrew
-
Re: Definition of off64_t
TC wrote:
> I am trying to port an application written on Linux to FreeBSD. During
> compile, I am getting an error saying that off64_t is not defined. Which
> header file do I need to include to get the definition for off64_t ?
As has already been mentioned, off_t is already 64 bits wide in FreeBSD.
There is a compat definition (for zfs and dtrace) somewhere in the kernel, but
that's not exposed to userspace.
In contrast to Linux, FreeBSD has made file offsets 64 bits wide by default a
long time ago. Unlike on Linux, you don't need to define evil things like
_FILE_OFFSET_BITS=64 and _LARGEFILE_SOURCE for stuff to Just Work[tm].
You may also enjoy my rant on the topic from a while back:
http://www.paeps.cx/weblog/code/EFBIG.html
In any case, your solution, if you need 64 bit offsets will probably be
something like:
#if defined __FreeBSD__
typedef off_t off64_t
#endif
- Philip
--
Philip Paeps Please don't email any replies
philip@paeps.cx I follow the newsgroup.
Owner of a lonley heart...
Owner of a broken heart...
selling on ebay? 3 days left, currently standing at £4.99 ...
spares or repairs :P