From owner-freebsd-hackers@FreeBSD.ORG Thu Nov 17 21:48:05 2011 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.org Received: by hub.freebsd.org (Postfix, from userid 1233) id D1F581065670; Thu, 17 Nov 2011 21:48:05 +0000 (UTC) Date: Thu, 17 Nov 2011 21:48:05 +0000 From: Alexander Best To: freebsd-hackers@FreeBSD.org Message-ID: <20111117214805.GA96937@freebsd.org> References: <20111117175514.274040@gmx.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20111117175514.274040@gmx.com> Cc: Subject: Re: easy way to determine if a stream or fd is seekable X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Nov 2011 21:48:05 -0000 On Thu Nov 17 11, Dieter BSD wrote: > > lseek() on a tape drive does not return an error, nor does it > > actually do anything. > > IIRC some tape drives can seek, while others cannot. > Vague memories that it is supposed to be possible to put a > filesystem on a DECtape and mount the filesystem. or how about the following: 1) if the file argument we're seeking on is a tape drive, just do a regular seek operation. 2) afterwards use ftell() to verify that the seek REALLY happend. if it didn't, return -1 and set errno = EBADF. cheers. alex > > It might be that FreeBSD doesn't currently support seeking > on a tape, but we shouldn't paint ourselves into a corner > by assuming that it is fundimentally impossible.