Article View: rec.arts.sf.written
Article #757Re: โThe end of software secrecy is almost upon
From: Dan Cross
Date: Fri, 30 Oct 2026 11:25
Date: Fri, 30 Oct 2026 11:25
124 lines
5773 bytes
5773 bytes
In article <20261030105900.000020ce@yahoo.com>,
Michael S <already5chosen@yahoo.com> wrote:
>On Fri, 30 Oct 2026 02:22:43 -0000 (UTC)
>cross@spitfire.i.gajendra.net (Dan Cross) wrote:
>
>> In article <20261030005434.00005458@yahoo.com>,
>> Michael S <already5chosen@yahoo.com> wrote:
>> >On Thu, 29 Oct 2026 22:26:40 GMT
>> >scott@slp53.sl.home (Scott Lurndal) wrote:
>> >
>> >> Michael S <already5chosen@yahoo.com> writes:
>> >> >On Thu, 29 Oct 2026 16:20:39 -0000 (UTC)
>> >> >[snip]
>> >> >Does it block when your command processor is bash and your command
>> >> >string is "my_subprocess &"?
>> >>
>> >> You might need to do 'nohup my_subprocess &' if my_subprocess
>> >> doesn't intercept SIGHUP.
>> >
>> >
>> >You are likely right. Otherwise OS will kill my_subprocess at about
>> >the same time the caller of system() gets control back.
>> >I would not figure it out myself.
>>
>> Only if you intended to close the TTY the programs were started
>> on. Otherwise, I don't see why it would be necessary:
>
>What happens when caller is GUI-style application?
That depends on a number of factors, but basically, "it does the
same thing". Why would it be any different?
SIGHUP is the "hangup" signal, and _usually_ generated by the
kernel when a process loses its controlling terminal, though it
_can_ be sent from the command line (or a program) using the
`kill` command or one of its many imitators (basically, anything
that invokes `raise()` or the `kill()` system call).
The classic example of its use was a dial-in terminal line that
recognized modem status and reacted to a "carrier detect" signal
dropping; the kernel would clean up by SIGHUP'ing the process
group of anything associated with that terminal; one can see
this readily in early Unix kernel sources. This is a reason why
SIGHUP is one of the few signals a shell will actually honor.
Nowadays, this most often happens when an interactive session
associated with a pseudoterminal is closed; this could be window
in a terminal emulator program, or it could be a network login
via e.g. `ssh` that closes.
For programs that are not associated with a TTY at all, this
won't happen; this is why traditionally Unix daemons often
overloaded SIGHUP to force reloading a config file or similar:
since daemons are not generally associated with user ttys (or
often any TTY at all, including the console), the kernel will
never automatically send them a SIGHUP to terminate, so it's a
"safe" signal to pick for administrative control.
Crucially, using `system()` to invoke a program, even one that
is backgrounded, does not usually allocate a new terminal, nor
does it necessarily close one (though I suppose one could use it
to invoke something like, `kill -9 -1` to zap all of one's
processes; you could even background that if you wanted, but
that seems silly).
GUI programs are no different in this regard. Many of them may
not even be associated with a tty device at all, and may receive
their "session has ended" notification some other way.
So I go back to my original statement, "only if you intended to
close the TTY the programs were started on." IF you intend to
start some long-running program in the background and you won't
stay logged in after doing that, then sure, use `nohup`. But
if you don't care about that, then you don't need to bother.
The OS will not kill your program when the shell started by
`system` exits or anything; nor will the shell itself.
- Dan C.
>> ```
>> term% cat a.c
>> #include <stdio.h>
>> #include <stdlib.h>
>> #include <time.h>
>> #include <unistd.h>
>>
>> int
>> main(void)
>> {
>> time_t now = time(NULL);
>> printf("Starting child, time is %s", asctime(gmtime(&now)));
>> sleep(5);
>> now = time(NULL);
>> printf("Bye bye, now is %s", asctime(gmtime(&now)));
>> }
>> term% cat b.c
>> #include <stdio.h>
>> #include <stdlib.h>
>> #include <time.h>
>> #include <unistd.h>
>>
>> int
>> main(void)
>> {
>> time_t now = time(NULL);
>> printf("Parent starting, time is %s", asctime(gmtime(&now)));
>> system("./a &");
>> printf("./a started in background\n");
>> sleep(2);
>> now = time(NULL);
>> printf("Ahhh!!! time is %s", asctime(gmtime(&now)));
>> return 0;
>> }
>> term% make a
>> cc -O2 -pipe -o a a.c
>> term% make b
>> cc -O2 -pipe -o b b.c
>> term% ./b
>> Parent starting, time is Fri Oct 30 02:21:06 2026
>> ./a started in background
>> Starting child, time is Fri Oct 30 02:21:06 2026
>> Ahhh!!! time is Fri Oct 30 02:21:08 2026
>> term% Bye bye, now is Fri Oct 30 02:21:11 2026
>> ```
Technical Details
Message-ID:
<11c1uqd$keq$1@reader2.panix.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!panix!.POSTED.spitfire.i.gajendra.net!not-for-mailReferences:
<11amvre$15far$1@dont-email.me> <20261030005434.00005458@yahoo.com> <11c0v1j$her$1@reader2.panix.com> <20261030105900.000020ce@yahoo.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail From: cross@spitfire.i.gajendra.net (Dan Cross) Newsgroups: rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers Subject: Re: โThe end of software secrecy is almost upon Date: Fri, 30 Oct 2026 11:25:01 -0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Message-ID: <11c1uqd$keq$1@reader2.panix.com> References: <11amvre$15far$1@dont-email.me> <20261030005434.00005458@yahoo.com> <11c0v1j$her$1@reader2.panix.com> <20261030105900.000020ce@yahoo.com> Injection-Date: Fri, 30 Oct 2026 11:25:01 -0000 (UTC) Injection-Info: reader2.panix.com; posting-host="spitfire.i.gajendra.net:166.84.136.80"; logging-data="20954"; mail-complaints-to="abuse@panix.com" X-Newsreader: trn 4.0-test77 (Sep 1, 2010) Originator: cross@spitfire.i.gajendra.net (Dan Cross)