xfs
[Top] [All Lists]

Re: how to use pwrite(...)?

To: 김일용 <bush@xxxxxxxxxxxxxxxx>
Subject: Re: how to use pwrite(...)?
From: Steve Lord <lord@xxxxxxx>
Date: Sun, 11 Feb 2001 09:13:41 -0600
Cc: linux-xfs@xxxxxxxxxxx
In-reply-to: Message from 김일용 <bush@super.inha.ac.kr> of "Sun, 11 Feb 2001 16:18:14 +0900." <LIEOKGILFIBAAGICFEGIMECICAAA.bush@super.inha.ac.kr>
Sender: owner-linux-xfs@xxxxxxxxxxx
bush@xxxxxxxxxxxxxxxx said:
>> Hi~
>> I had been upgrade myLinux to Linux 7.0 - kernel 2.4 - xfs
>> filesystem...

>> Because i must use pwrite(...) in my program...

>> but... argument of pwrite ... off_t is 4bytes...

>> so when i making a file ... the maximum size is 4GB...T.T

>> how to grow my maximum filesize upto 20GB using pwrite(...) 


The pwrite system call takes an loff_t (64 bit value) as its file offset
parameter:

asmlinkage ssize_t sys_pwrite(unsigned int fd, const char * buf,
                              size_t count, loff_t pos)

This is more likely to be an issue with the glibc version in the distribution
you are using. You need an LFS (large file support) enabled distribution to
use this version of pwrite and other calls. Another possibility is that you
are not using 

        -D_FILE_OFFSET_BITS=64

to compile your code, look in unistd.h for the prototypes for pread and
pwrite, if it looks something like this:

#ifdef __USE_UNIX98
# ifndef __USE_FILE_OFFSET64
extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset)
     __THROW;
extern ssize_t pwrite (int __fd, __const void *__buf, size_t __n,
                       __off_t __offset) __THROW;
# else
#  ifdef __REDIRECT
extern ssize_t __REDIRECT (pread, (int __fd, void *__buf, size_t __nbytes,
                                   __off64_t __offset) __THROW,
                           pread64);
extern ssize_t __REDIRECT (pwrite, (int __fd, __const void *__buf,
                                    size_t __nbytes, __off64_t __offset)
                           __THROW,
                        pwrite64);
#  else
#   define pread pread64
#   define pwrite pwrite64
#  endif
# endif

Then you can use the above define to switch to the 64 bit versions, otherwise
you may have to upgrade your glibc.


Steve



<Prev in Thread] Current Thread [Next in Thread>