bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 2/2] Use O_IGNORE_CTTY where appropriate


From: Paul Eggert
Subject: Re: [PATCH v3 2/2] Use O_IGNORE_CTTY where appropriate
Date: Mon, 5 Jun 2023 13:58:53 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]