Linux-kernel mailing list archive 1997-11,: Re: file ID redesign proposal

# Re: file ID redesign proposal

Jeremy Fitzhardinge (jeremy@zip.com.au)
Wed, 26 Nov 1997 23:28:56 +1100

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Tomasz Motylewski: "Re: TTY changes to 2.1.65"
- Previous message: Ingo Molnar: "Re: file ID redesign proposal"

Ingo Molnar wrote:
>
> On Wed, 26 Nov 1997, Alan Cox wrote:
>
> > > NOTE: the only problem i see with this scheme (so far), are we required to
> > > guarantee first-free-file-ID-allocation of file IDs?
> >
> > If you expect most code to work yet.
>
> note that although the proposed scheme does not *guarantee* first-free
> allocation, we can guarantee some kind of predictable allocation behavior,
> the question is, how 'widely' applications assume first-free behavior.

Lots of programs are perfectly in their rights to expect the traditional
"next free fd" behaviour. The most troublesome will be the shells: not
only do they themselves use it, they pass on that behaviour to shell
scripts. I'd expect that any program which uses mildly complex fd
manipulation takes advantage of this behaviour.

The idiom which is most likely to break is

close_all();
open("/dev/ttyX", O_RDWR);
dup();
dup();

A newly execd program could reasonably expect this to work:

int main()
{
int fd = dup(2);
assert(fd == 3);
...

In other words, I really don't think you can get away without
reproducing this behaviour.

J

- Next message: Tomasz Motylewski: "Re: TTY changes to 2.1.65"
- Previous message: Ingo Molnar: "Re: file ID redesign proposal"