Re: llseek and file size limit !!!!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 25, 2006 at 09:34:16 +0800, Derry Wang wrote:
> no matter how many bits are the offset type defined, you still can 
> access file again and again.
> llseek will put file pointer in the offset position. Then you can call 
> llseek again and again.
> Till the file pointer is in the position what you want.

Totally useless, really. 2^32 is 2GB. Imagine you have 200GB file -- so
you would call llseek 50 times to get in the middle!

Besides the 32-bit interface will probably refuse to work with large
files anyway.

There is actually a macro, that has to be defined before importing
features.h that affects how off_t gets defined (and therefore which
interface will be provided by libc) - _LARGEFILE_SOURCE and
_LARGEFILE64_SOURCE.

> derry
> 
> pradeep singh wrote:
> 
> >Hi all
> >llseek method has its second argument as offset which is of type unsigned 
> >long.
> >And the last argument decides whence i.e from where to start the offset, 
> >right?
> >Now i have a doubt.
> >If the data type of offset is unsigned long this means i can only
> >access a file till its 2^32 byte after if i start from its beginning,
> >using llseek.
> >On the other hand ulimit -a shows me i can have a file size of
> >unlimited size, which is indeed some value subjected to storage space
> >on which file resides and also the filesystem.right?
> >
> >Then does this means i cant access a file beyond its 2^32 byte using
> >llseek and  starting from its beginning?
> >
> >Is it so or am i missing something here?
> >Any pointers or links will be appreciated.
> >Thank you.
> >Pradeep
> >--
> >play the game
> >
> >--
> >Kernelnewbies: Help each other learn about the Linux kernel.
> >Archive:       http://mail.nl.linux.org/kernelnewbies/
> >FAQ:           http://kernelnewbies.org/faq/
> >
> >
> >
> > 
> >
> 
> 
> 
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> 
-- 
						 Jan 'Bulb' Hudec <bulb@xxxxxx>

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux