<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 13, 2021, 20:17 Belisko Marek <<a href="mailto:marek.belisko@gmail.com">marek.belisko@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I'm facing a strange issue. I have gsm modem and when modem is<br>
restarted (removed from usb bus and plugged back) one of services is<br>
restarted (with enabled systemd debug level):<br>
<br>
Jan 07 09:07:00 device systemd[1]: Received SIGCHLD from PID 166 (systemtest).<br>
Jan 07 09:07:00 device kernel[174]: option1 ttyUSB4: GSM modem<br>
(1-port) converter now disconnected from ttyUSB4<br>
Jan 07 09:07:00 device systemd[1]: Child 166 (systemtest) died<br>
(code=killed, status=1/HUP)<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Sounds like your process had opened /dev/ttyUSB4 at some point, and this became its "controlling tty" (because services start without one).</div><div dir="auto"><br></div><div dir="auto">The kernel always sends SIGHUP to processes when their controlling tty disappears or loses carrier (same happens when an xterm is closed). The signal literally means "hang up".</div><div dir="auto"><br></div><div dir="auto">If your service is accessing the modem, use the O_NOCTTY flag to avoid this.</div></div>