Seems easier just to do open with the additional flag.Not if you want to write portable software.
This is how you write portable code. #ifndef F_CLOEXEC #define F_CLOEXEC 0 #endif .... fd = open(... F_CLOEXEC); if (fd < 0) fail(); set_cloexec(fd);You are proposing changing 10-15 years old c library api/abi that supports threads today. Even better, thease are suport libaries that are used by other support libraries 4-5 layers deep, and you want to change their interface. Very few of them are under my control.
As I see it, NetBSD can choose to be supporting safe function usage, I think netbsd should, since I'll use the feature if its there.
Love