[comp.os.minix] POSIX question

poole@forty2.UUCP (Simon Poole) (01/11/89)

In article <579@forty2.UUCP> poole@forty2.UUCP (Simon Poole) writes:
>X		- `more' reads from file descriptor 2 (stderr), but
>X		  the standard ST-Minix `init' opens stdout and stdin 
>X                  only for writing:
>X		  Fix: change the modes in the open calls in
>X                       /usr/src/sttools/init.c to 2.
>X		- the `execv' libary call doesn't pass the enviroment
>X                  of the current process to `execve' (this breaks the
>X                  `v' and `!' commands):

Being inquisitive, I consulted IEEE 1003.1 (POSIX, I've only got access
to a 1986 copy of the trial draft standard, is there anything more recent?)
on the above two problems, the second one being easy:

  quoted from section 3.1.2 Execute a File
 
   'For those forms not containing an envp pointer (execl(), execv(),
    execlp(), and execvp()) the enviroment is taken from the external
    variable environ.'

I was however quite suprised to find out that POSIX (well at least the
copy of the standard I've got) does not address the subject of `pre-
opened' files (in Unix normally the files with filehandles 0, 1 and 2)
at all (except that they are inherited over exec's). Now considering
the importance of the `tool' concept in Unix (which depends on some
kind of standard for passing preopened files for input and output to a
program), I'm really amazed that there is no reference at all to this 
subject.

[As far as I can see, the only work around is to use stdio (which
presumely knows what is customary under the hosts operating system)
and get the filehandle for stdout etc. with fileno(3)]

Is this a problem or am I just stupid (more likely)?


-- 
----------------------------------------------------------------------------
UUCP:   ...mcvax!cernvax!forty2!poole			Simon Poole
BITNET: K538915@CZHRZU1A
----------------------------------------------------------------------------

ast@cs.vu.nl (Andy Tanenbaum) (01/12/89)

In article <583@forty2.UUCP> poole@forty2.UUCP (Simon Poole) writes:
>Being inquisitive, I consulted IEEE 1003.1 (POSIX, I've only got access
>to a 1986 copy of the trial draft standard, is there anything more recent?)

Yes.  The final, definitive standard has been published.  It is called:
"Portable Operating System Interface for Computer Environments"
and has IEEE number 1003.1 and can be ordered from

Secretary, IEEE Standards Board
IEEE
345 East 47th St
New York, NY 10017
USA

Andy Tanenbaum (ast@cs.vu.nl)