Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Jul 1998 10:02:02 +0400
From:      Vadim Kolontsov <vadim@tversu.ru>
To:        freebsd-hackers@FreeBSD.ORG
Subject:   negative offset
Message-ID:  <19980730100202.A9992@tversu.ru>

next in thread | raw e-mail | index | archive | help
Hello,

  FreeBSD (2.2.6, at least) allows to have negative offset in file (for 
example, after lseek(fd, -N, SEEK_END) in file which is smaller than N). 
What it was intended for? To have a "symmetrical behaviour" for offsets 
beyond the end or for some more practical reason? Do any other OSes have
such behavior (for example, Solaris doesn't). Is it POSIX? Why manpages
says nothing about it (am I miss something?) ?
  It can broke some programs that expects EINVAL on such lseek() and
just ignores it, assuming that if N is bigger than filesize, the
offset will remain zero (I dislike such practice, but..). Actually,
it brokes xlogmaster 1.4.1 (author promised to fix it in a next
release).
  And what is N = filesize + 1? FreeBSD's lseek() returns -1,
and now I have to analyze errno to understand if it was an error or
just a simple negative offset..
 
Regards,
V.
-- 
Vadim Kolontsov
Tver Internet Center NOC

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980730100202.A9992>