tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Which way for posix_spawn close-on-exec improvements?
I’m thinking about implementing an improvement to posix_spawn’s close-on-exec behavior, and was wondering which direction folks lean in.
1. FreeBSD and some other platforms have posix_spawn_file_actions_addclosefrom_np as a spawn file action, which closes all descriptors equal to or greater than the one specified in the action.
2. Darwin has a spawn attribute flag POSIX_SPAWN_CLOEXEC_DEFAULT which causes file descriptors that haven’t been explicitly allowed via a file action to be closed.
Personally I prefer the latter; I became familiar with it at Apple, where we added it specifically to meet the needs of large applications that couldn’t have complete knowledge of the state of all their descriptors at the point where posix_spawn could be called. But there’s a certain simplicity with the FreeBSD “close everything from 3 on up” file action.
I’d love to hear thoughts on it. Neither seems like it’d be particularly difficult to add. (Heck, we could have both if we wanted, they don’t really conflict…)
— Chris
Sent from my iPad
Home |
Main Index |
Thread Index |
Old Index