[systemd-devel] How to start a service when a device is created under /dev/pts/

Mantas Mikulėnas grawity at gmail.com
Mon Feb 13 10:12:16 UTC 2023


On Mon, Feb 13, 2023 at 11:12 AM Giuseppe Sacco <giuseppe at sguazz.it> wrote:

> Hello,
> I am working on hylafax, a program for sending and receiving faxes, and I
> am facing a problem when it should wait for a device that is not in /dev/
> but in /dev/pts/. It seems that udev events only cover device creation in
> /dev/ and are not fired when the device appear in /dev/pts.
>

Pseudoterminals are not actually "devices" – they don't exist in /dev or
/sys, only in their own separate virtual filesystem (/dev/pts is not part
of /dev), so there are no kernel uevents (and therefore no udev events) for
the creation of a pty.

I'm not entirely sure whether it even makes sense for a .service unit to
wait for a specific pty? I mean, the entire design of ptys is that they're
assigned on a first-come basis and there's no way for a process to claim a
specific pty for itself, so there's no way for faxgetty at .service to be sure
that pty/0 is your fax thing and not e.g. someone's xterm or an incoming
SSH connection.

What is supposed to be creating /dev/pts/0 in your case? It might be
simplest to have the same software directly start faxgetty@<ptyname>.service
as well.

-- 
Mantas Mikulėnas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20230213/85f9d746/attachment.htm>


More information about the systemd-devel mailing list