delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/01/16/05:04:27

Date: Tue, 16 Jan 2001 12:02:36 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
cc: djgpp-workers AT delorie DOT com
Subject: Re: /dev/zero & /dev/full FSEXTs
In-Reply-To: <3A63764C.2CE7F394@phekda.freeserve.co.uk>
Message-ID: <Pine.SUN.3.91.1010116115713.1793L-100000@is>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Mon, 15 Jan 2001, Richard Dawe wrote:

> Would an FSEXT hook for setmode() be useful?

I agree with DJ that this seems problematic, as binary/text is handled on 
non-primitive level.

It might be useful to have a raw/cooked mode hook (assuming we make the 
IOCTL call in setmode a primitive on its own right), but I'd say let's 
leave this alone until some application needs it.

> > > +   case __FSEXT_lseek:
> > > +     fd     = va_arg(args, int);
> > > +     offset = va_arg(args, off_t);
> > > +     whence = va_arg(args, int);
> > > +
> > > +     /* This must be emulated, since the FSEXT has been called. */
> > > +     emul = 1;
> > > +
> > > +     *rv = offset;
> > 
> > Even if `offset' and `whence' point before the beginning?
> 
> The handling of lseek() is a little tricky, since we have an infinitely
> long non-existent file. ;) SEEK_SET is easy. SEEK_CUR and SEEK_END are
> tricky, since they require some knowledge of how big the file is.
> 
> Seeks on /dev/full are supposed to always succeed. I do not know if this
> is true for /dev/zero also. For our implementation, it is.
> 
> What do you think the behaviour for SEEK_CUR and SEEK_END should be?

I didn't necessarily mean to say that what you wrote was wrong, just to 
make sure those decisions were not taken by default.  If you think this 
behavior is appropriate for these special devices, I don't mind.

> > > + #include <sys/xdevices.h>
> > 
> > Is this header used on other platforms?
> 
> No, it just seemed like a good name. It does not exist on Linux.

If other platforms have headers for these purposes, let's use the same 
names.  If no popular platform has a header for this, it's okay to use 
any name you fancy, including xdevices.h.

> Thanks for the comments, Eli.

Thank _you_ for doing the work.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019