[9fans] What's so special about seek() ?

2008-10-20 Thread Nathaniel W Filardo
/sys/src/libc/9syscall/mkfile has a rather odd looking special case for the seek system call... it looks like if seek fails (returns -1) that the first two arguments (fd and offset) are overwritten with -1. What's going on here? The manual page doesn't hint at anything... Thanks. --nwf;

Re: [9fans] What's so special about seek() ?

2008-10-20 Thread Nathaniel W Filardo
On Mon, Oct 20, 2008 at 09:19:50AM +0100, C H Forsyth wrote: seek is unusual because it returns a 64-bit value Forgive my ignorance, but I don't see how the code in question relates to returning a 64-bit value? --nwf; pgpZuSgZQbGYG.pgp Description: PGP signature

Re: [9fans] What's so special about seek() ?

2008-10-20 Thread Steve Simon
The seek system call is here /sys/src/9/port/sysfile.c:855 The arg variable here is a pointer to the users stack making the system call. most return values are 32 bit and are passed back through syscall() /sys/src/9/pc/trap.c:660 but seek is different, it overwrites 64 bits

Re: [9fans] What's so special about seek() ?

2008-10-20 Thread Nathaniel W Filardo
On Mon, Oct 20, 2008 at 10:11:22PM +0100, Charles Forsyth wrote: Forgive my ignorance, but I don't see how the code in question relates to returning a 64-bit value? MOVL a+0(FP),CX MOVL AX,0(CX) MOVL

Re: [9fans] What's so special about seek() ?

2008-10-20 Thread Charles Forsyth
Forgive my ignorance, but I don't see how the code in question relates to returning a 64-bit value? MOVL a+0(FP),CX MOVL AX,0(CX) MOVL AX,4(CX) that's how a 64-bit value is returned on 32-bit machines: