[comp.os.minix] MINIX Stdio

arthur@warwick.UUCP (John Vaudin) (09/05/89)

There is is problem with MINIX stdio, both the original and the
new one, namely that they use dynamically allocated
io_buf's. 

Shouldn't be a problem I hear you say, shouldn't be visible to the user
etc etc.. BUT: Try this

#include <stdio.h>

FILE *fred=stdin;

main()
{
}

Doesn't work does it ? Should do shouldn't it ?

This has caused me loads of hassle when trying to port UNIX software
to MINIX. I rewrote the MINIX stdio library so it did it properly since
I think THIS SHOULD WORK. Now I'm going to have to do it all again Sigh!!

John Vaudin            arthur@uk.ac.warwick.cs

cechew@bruce.OZ (Earl Chew) (09/07/89)

From article <1977@diamond.warwick.ac.uk>, by arthur@warwick.UUCP (John Vaudin):
> There is is problem with MINIX stdio, both the original and the
> new one, namely that they use dynamically allocated
> io_buf's. 

I regard this as only a minor irritation.

#include <stdio.h>
FILE *fred=stdin; main() {return 0;}

> Doesn't work does it ? Should do shouldn't it ?

Well, no, it didn't work. It will work once I release the next set of patches.
Note that:

#include <stdio.h>
FILE *fred; main() {fred=stdin; return 0;}

will work.

> This has caused me loads of hassle when trying to port UNIX software
> to MINIX. I rewrote the MINIX stdio library so it did it properly since
> I think THIS SHOULD WORK. Now I'm going to have to do it all again Sigh!!

It hasn't caused me any hassle but John obviously feels quite strongly about
it. Fortunately for John to make the change to my stdio only required editing
a few lines of stdio.h and stdio.c; not a rewrite of the _entire_ library.
I think that the change is transparent.

Note that the FILE * structures, apart from stdin, stdout and stderr, are still
allocated dynamically. Stdin, stdout and stderr are allocated at compile time,
but their buffers are not.

Earl