@cks What's the alternative? Just return N?
Conversation
Notices
-
Embed this notice
Jef Poskanzer :batman: (jef@mastodon.social)'s status on Monday, 23-Oct-2023 10:41:12 JST Jef Poskanzer :batman:
-
Embed this notice
Haelwenn /элвэн/ :triskell: (lanodan@queer.hacktivis.me)'s status on Monday, 23-Oct-2023 10:41:11 JST Haelwenn /элвэн/ :triskell:
@jef @cks Now that one sounds terrifying as you typically don't want to end up closing file descriptors like stdin/stdout/stderr. -
Embed this notice
Chris Siebenmann (cks@mastodon.social)'s status on Monday, 23-Oct-2023 10:52:35 JST Chris Siebenmann
@lanodan @jef Yeah, there are a whole collection of fun bugs to the effect of 'open and/or dup returned 0, 1, or 2 by surprise, just look what broke'. Although it's not quite the same, since those FDs would already be open if you just returned N.
(You hit this bug if you start programs with 0, 1, and/or 2 closed, instead of open to /dev/null or something. These days a lot of things take care to always start programs with 0, 1, and 2 opened to *something* for this reason.)
Haelwenn /элвэн/ :triskell: likes this. -
Embed this notice
Chris Siebenmann (cks@mastodon.social)'s status on Monday, 23-Oct-2023 11:06:57 JST Chris Siebenmann
@lanodan @jef The usual alternative to dup() is some special emulation of open(), although you maybe don't want to emulate too much of it, as I read about recently in http://phala.isatty.net/~amber/hacks/devfd
Haelwenn /элвэн/ :triskell: likes this. -
Embed this notice
Haelwenn /элвэн/ :triskell: (lanodan@queer.hacktivis.me)'s status on Monday, 23-Oct-2023 11:12:14 JST Haelwenn /элвэн/ :triskell:
@cks @jef Quite interesting that FreeBSD would need a special virtual filesystem while on Linuxes it’s just a symlink /dev/fd to /proc/self/fd
In conversation permalink
-
Embed this notice