how to use lseek() system call with over 2G files?

Dan Nelson dnelson at allantgroup.com
Tue Jan 6 09:48:52 PST 2004


In the last episode (Jan 06), Alex said:
> Hi everybody!
> 
> Some time ago there wasn't any possibility to create disk file larger 
> than 2G and there was no problem with lseek().

Some time ago meaning around 1997?  FreeBSD has had 64-bit file access
since at least 2.2.0.  I don't remember if earlier versions had support
for it or not.

> But as for now we can do it but I looked into headers and found off_t is 
> equal to long -> no more than 2G on i386 machines.

Actually, off_t is equal to __int64_t, which is a long long.  Which
headers are you looking at?

FreeBSD 4.x:
/usr/include/machine/ansi.h:69:#define  _BSD_OFF_T_     __int64_t
/usr/include/sys/types.h:82:typedef     _BSD_OFF_T_     off_t; /* file offset */

FreeBSD 5.x:
/usr/include/sys/_types.h:49:typedef    __int64_t       __off_t; /* file offset */
/usr/include/sys/types.h:194:typedef     __off_t         off_t;          /* file offset */

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-questions mailing list