Arpit
Arpit

Reputation: 4399

open limitation based on file size

Is there any limitation on "open" based on file size. ? My file size is 2 GB will it open successfully and is there any timing issue can come ? filesystem is rootfs.

Upvotes: 0

Views: 121

Answers (2)

MarkR
MarkR

Reputation: 63538

rootfs may not support large files; consider using a proper filesystem instead (tmpfs is almost the same as rootfs, but with more features).

rootfs is intended only for booting and early use.

Upvotes: 2

Thomas
Thomas

Reputation: 181745

From the open man page:

O_LARGEFILE

(LFS) Allow files whose sizes cannot be represented in an off_t (but can be represented in an off64_t) to be opened. The _LARGEFILE64_SOURCE macro must be defined in order to obtain this definition. Setting the _FILE_OFFSET_BITS feature test macro to 64 (rather than using O_LARGEFILE) is the preferred method of obtaining method of accessing large files on 32-bit systems (see feature_test_macros(7)).

On a 64-bit system, off_t will be 64 bits and you'll have no problem. On a 32-bit system, you'll need the suggested workaround to allow for files larger than 2 GB.

Upvotes: 3

Related Questions