Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!uunet!auspex!guy From: guy@auspex.auspex.com (Guy Harris) Newsgroups: comp.unix.wizards Subject: Re: dup2 Message-ID: <5965@auspex.auspex.com> Date: 12 Feb 91 18:30:43 GMT References: <27B1CA1C.22559@ics.uci.edu> <15136@smoke.brl.mil> <122373@uunet.UU.NET> Organization: Auspex Systems, Santa Clara Lines: 19 >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.