How to write to the middle of a swap file?

From: Yee Man Chan <ymc@dont-contact.us>
Date: Thu, 4 Jul 2002 22:13:09 -0700 (PDT)

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
Received on Thu Jul 04 2002 - 23:13:17 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:15:45 MST