Sorry. I figured it out myself. There is a mode |=
O_APPEND in file_open in disk.c. Hmm.. But then why
don't we add O_APPEND to storeUfsCreate?
disk.c:63
if (mode & O_WRONLY)
mode |= O_APPEND;
Yee Man
--- Yee Man Chan <ymc@yahoo.com> wrote:
> Hi,
>
> I am playing with 2.4S6. I want to replace
> something in a swap file by something else of the
> same
> length. I supposed in UFS, it is gonna be like this:
>
> lseek(fd, offset, SEEK_SET);
> write(fd, buf, len);
>
> I find that there is storeWrite function that
> seems
> to be able to do these two steps. So I do
>
> storeWrite(entry->mem_obj->swapout.sio, buf, len,
> offset, NULL);
>
> However, I find that instead of writing to where
> I
> want it to be, it goes to the end of the file. Why
> is
> that? I run gdb with it many times but I still can't
> figure it out. The return value from lseek inside
> diskHandleWrite seems right, too. However, it still
> appends to the end of the file. Can anyone help me
> on
> this?
>
> Thanks in advance.
> Yee Man
>
> __________________________________________________
> Do You Yahoo!?
> Sign up for SBC Yahoo! Dial - First Month Free
> http://sbc.yahoo.com
__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com
Received on Thu Jul 04 2002 - 23:57:57 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:15:45 MST