On 2023-06-04 13:42, Sergey Bugaev via Libc-alpha wrote:
- int flags = O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC; + int flags = O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC | O_IGNORE_CTTY;
Why is O_IGNORE_CTTY useful here? O_DIRECTORY means that the file cannot be a tty. (If GNU/Hurd is sending an extra RPC in this case, surely that's a performance bug that should be fixed in _hurd_port2fd or whatever, not in every 'open' caller.)
- open_flags = O_RDWR | O_CREAT | O_EXCL | O_CLOEXEC; + open_flags = O_RDWR | O_CREAT | O_EXCL | O_CLOEXEC | O_IGNORE_CTTY;
Similarly, why is O_IGNORE_CTTY useful here? O_CREAT | O_EXCL means that the file cannot be a tty. (There are a couple of instances of this.)
I'm still interested in whether there could be a way to pass O_IGNORE_CTTY when using fopen () too -- but that doesn't have to block this patchset either.
I suppose fopen could add a new 'T' flag, as a GNU extension, that would add O_IGNORE_CTTY to the open flags.