Date: Mon, 13 Nov 1995 10:16:50 +1100 From: Bruce Evans <bde@zeta.org.au> To: bakul@netcom.com, hasty@rah.star-gate.com Cc: hackers@freebsd.org Subject: Re: linux's lseek vs freebsd's lseek Message-ID: <199511122316.KAA26938@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
>> (int)fp->f_offset += (int)uap->offset; >> ^^^^ ^^^^ >> The question is what is the implication of doing a signed addition as >> supposed to an unsigned addition as it is in the original file. >Huh? f_offset & uap->offset are of type quad_t, which is a >signed quantity and -ve offsets are perfectly reasonable >when you seek relative to file-end or current-position. POSIX requires off_t to be a signed arithmetic type so that negative offsets work right. In the above, the cast to (int) on the RHS throws away the top 32 bits on the i386, so seeking back 1 would actually seek forward 0xffffffff, while the cast to (int) on the LHS shouldn't compile. Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199511122316.KAA26938>