linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RFC: Serial port DTR/RTS - O_NRESETDEV
@ 2025-11-07  7:53 H. Peter Anvin
  2025-11-07 17:37 ` Theodore Ts'o
  2025-11-09 20:43 ` Maciej W. Rozycki
  0 siblings, 2 replies; 33+ messages in thread
From: H. Peter Anvin @ 2025-11-07  7:53 UTC (permalink / raw)
  To: linux-serial, linux-api, LKML

Hi,

I recently ran into a pretty serious issue due to the Unix/Linux (mis)behavior
of forcing DTR and RTS asserted when a serial port is set, losing the
pre-existing status in the process. Since it is impossible probe for the
current status or even if it is a functional serial port without a file
descriptor, this is very problematic. This came up in the context of probing
for serial ports from an application, so even if termios could be modified
without a file descriptor (which it can't) it would not be safe.

I noted there was a patchset for that on linux-serial from 2022 which
apparently got dropped and never merged, but I think it has a pretty serious
problem: it used a sysfs setting to control the behavior, which may be
reasonable for a default, but at the end of it this is really something that
is determined by the intent of the open() call, just like O_NONBLOCK replaced
the old callout devices we once had.

It seems to me that this may very well be a problem beyond ttys, in which case
a new open flag to request to a driver that the configuration and (observable)
state of the underlying hardware device -- whatever it may be -- should not be
disturbed by calling open(). This is of course already the case for many
devices, not to mention block and non-devices, in which case this flag is a
don't care.

The best name I came up with was O_NRESETDEV, but it's not something I'm
particularly attached to.

If the opinion is that this *doesn't* have a scope beyond ttys, then perhaps
abusing the O_DIRECT flag for this purpose would be an alternative.

Thoughts?

	-hpa


^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2025-11-20 13:31 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-07  7:53 RFC: Serial port DTR/RTS - O_NRESETDEV H. Peter Anvin
2025-11-07 17:37 ` Theodore Ts'o
2025-11-09  2:25   ` H. Peter Anvin
2025-11-10  3:35     ` Theodore Ts'o
2025-11-10  5:00       ` H. Peter Anvin
2025-11-10 10:06         ` Maarten Brock
2025-11-10 20:19           ` Theodore Ts'o
2025-11-10 21:05             ` H. Peter Anvin
2025-11-11  3:51               ` Theodore Ts'o
2025-11-11  3:57                 ` H. Peter Anvin
2025-11-11  4:38                   ` Theodore Ts'o
2025-11-11 10:21                     ` Maarten Brock
2025-11-11 21:28                     ` H. Peter Anvin
2025-11-12 11:22                   ` Greg KH
2025-11-12 16:09                     ` H. Peter Anvin
2025-11-12 16:46                       ` Greg KH
2025-11-12 19:12                         ` H. Peter Anvin
2025-11-12 19:39                           ` Greg KH
2025-11-12 19:53                             ` H. Peter Anvin
2025-11-12 19:55                             ` H. Peter Anvin
2025-11-13 22:24                             ` RFC: Serial port DTR/RTS - O_<something> H. Peter Anvin
2025-11-14 10:26                               ` Maarten Brock
2025-11-14 18:49                               ` Maciej W. Rozycki
2025-11-14 18:53                                 ` H. Peter Anvin
2025-11-15 21:29                                   ` Ned Ulbricht
2025-11-15 22:29                                     ` H. Peter Anvin
2025-11-16  0:47                                     ` H. Peter Anvin
2025-11-18 16:33                                       ` Ned Ulbricht
2025-11-18 17:31                                         ` H. Peter Anvin
2025-11-18 18:05                                         ` H. Peter Anvin
2025-11-20 13:31                                           ` Ned Ulbricht
2025-11-10  5:20   ` RFC: Serial port DTR/RTS - O_NRESETDEV H. Peter Anvin
2025-11-09 20:43 ` Maciej W. Rozycki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).