dup2

Guy Harris guy at auspex.auspex.com
Wed Feb 13 05:30:43 AEST 1991


>Do you mean that V7 had dup2 but System V doesn't?

Yes.  For whatever reason, that particular branch of the family didn't
have "dup2()"; it did, however, have "fcntl()" and the F_DUPFD
subfunction thereof, at least as far back as S3 (I don't remember
whether earlier members of that branch had it).

S5R3 picked up "dup2()", which is in POSIX; 4.2BSD picked up "fcntl()",
which is also in POSIX.

>And what about systems that don't have fcntl?

If you have neither "fcntl()" nor "dup2()", you're not dealing with a
UNIX, or lookalike, that does a reasonable job of looking like a modern
UNIX (it's not as modern as V7, even), in which case 1) you may have a
problem if you need "dup2()"-like functionality (you might have to
repeatedly "dup()" the file descriptor until it reaches the desired
value, and then close all the intermediate descriptors) and 2) you
probably have a bunch of other problems as well. 



More information about the Comp.unix.wizards mailing list