NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lib/45148: dup2(3) and dup3(3) should support EINVAL
The following reply was made to PR lib/45148; it has been noted by GNATS.
From: David Laight <david%l8s.co.uk@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: lib/45148: dup2(3) and dup3(3) should support EINVAL
Date: Sun, 17 Jul 2011 09:48:40 +0100
On Sun, Jul 17, 2011 at 03:25:02AM +0000, David Holland wrote:
>
> dup3 should be a superset of dup2, IOW, dup2(a, b) === dup3(a, b, 0).
> Anything else is insane and begging for bizarre problems in the future.
Seems to me it should actually have the functionality of, dup(), dup2()
and fcntl(F_DUPFD) - depending on the flags.
So as well as O_CLOEXEC and O_NONBLOCK it needs a O_SCAN_FREE.
Then:
dup(nfd) == fcntl(nfd, F_DUPFD, 0)
fcntl(nfd, F_DUPFD, ofd) == dup3(nfd, ofd, O_SCAN_FREE)
dup2(nfd, ofd) == dup3(nfd, ofd, 0)
Oh - and the man page really ought to include the fcntl() action.
David
--
David Laight: david%l8s.co.uk@localhost
Home |
Main Index |
Thread Index |
Old Index