Date: Wed, 16 Nov 2011 13:14:28 +0000 From: Alexander Best <arundel@freebsd.org> To: freebsd-hackers@freebsd.org Cc: Joerg Sonnenberger <joerg@britannica.bec.de> Subject: Re: easy way to determine if a stream or fd is seekable Message-ID: <20111116131428.GA40723@freebsd.org> In-Reply-To: <20111116102239.GA2687@britannica.bec.de> References: <20111115202450.GA73512@freebsd.org> <20111116102239.GA2687@britannica.bec.de>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed Nov 16 11, Joerg Sonnenberger wrote: > On Tue, Nov 15, 2011 at 08:24:50PM +0000, Alexander Best wrote: > > one of the things i'm missing is an easy way to determine, whether a stream or > > fd is seekable. i checked the dd(1) and hd(1) sources and those tools are > > performing so much stuff just to find out if this is the case, and they still > > are doing a very poor job. > > Isn't the primary issue that FreeBSD doesn't properly report errors for > lseek(2)? I think you should start from that and not hack around the > fallout... what do you mean? lseek(2) returns -1, when the file descriptor is not seekable. i fired lseek(2) at all sorts of file types (dir, sockets, ...) and it always returned the correct result. cheers. alex > > Joerg
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111116131428.GA40723>