mark@spider.co.uk (Mark Valentine) (05/10/89)
I came across the following code fragment, and was wondering about its history... It's not mentioned in any of the manuals I've looked at. #define DUPFLG 0100 ... dup(f1 | DUPFLG, f2); There was some parallel code (the other half of an #ifdef RES) which used a F_GETFD/F_DUPFD/F_SETFD sequence instead, so I guess that this must be somebody's way of saving the close-on-exec flag across a dup. Can anyone offer some enlightenment? Mark. __ Mark Valentine, Spider Systems Limited, Edinburgh, UK. /\oo/\ <mark@spider.co.uk, mark%spider.co.uk@uunet.uu.net, uunet!mcvax!ukc!spider!mark>
gwyn@smoke.BRL.MIL (Doug Gwyn) (05/10/89)
In article <19538@adm.BRL.MIL> mark@spider.co.uk (Mark Valentine) writes: > dup(f1 | DUPFLG, f2); That was an early implementation of what we now know of as dup2(f1,f2) or close(f2),fcntl(f1,F_DUPFD,f2). dup2() is still sometimes actually implemented that way in the system call interface, but user code should use one of the officially approved methods.