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

Re: TCP proxy for host on subnet



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, Jun 13, 2017 at 08:39:03AM -0400, Greg Wooledge wrote:
> On Sat, Jun 10, 2017 at 03:20:33PM +0200, tomas@tuxteam.de wrote:
> > What the "session" (actually the terminal) is doing when you hit ^C is
> > to send a signal (typically number 2, SIGINT) to the running process.
> 
> SIGINT is sent to all the foreground processes, not just one [...]

Agreed.

> > What the "session" (actually the terminal) is doing when you hit ^C is
> > to send a signal (typically number 2, SIGINT) to the running process.
> > 
> > (To find out which one exactly, you can issue "stty -a" on your terminal;
> > an entry like "intr = ^C" is telling you that the INT (called here "intr",
> > confusing, I know) signal is bound to the CTRL-C key (abbreviated ^C).
> 
> You've got this backwards.  The terminal driver has a concept of "the
> key that causes me to send SIGINT to all the foreground processes",
> a.k.a "the interrupt key".  The stty command uses the "intr" label for
> this feature.  stty -a will show you which key is currently bound to it.
> On Linux and BSD systems, by default it is Ctrl-C.  On commercial System V
> Unix-based machines, it's typically DEL.

I think we are saying the same here (although your extra details are,
of course very informative).

[...]

> >   kill -INTR <pid>
> 
> Two mistakes here.
> 
> 1) It's -INT, not -INTR.

Yes. I obviously got confused with the stty naming :)

> 2) Sending SIGINT to a single process is *not* the same as pressing
>    Ctrl-C in a terminal.  Ctrl-C sends SIGINT to all the forground
>    processes, not just one.

Right. As far as I remember, you can send the signal to all members
of a process group if you send it to the negative PID of the process
group leader.

[sysV style process mgmt]

> If you're a historian.  Otherwise, I wouldn't recommend reading these.
> They will warp your brain, and teach you bad habits.

I disagree. Know the downsides, use critically. I think I talked about
the downsides. If you *have* a process manager (systemd, runit, pies,
you name it), then use it. For small tasks, I still use the SysV scheme
(and for my usual init). I think I made that clear :)

We just seem to differ on "how bad" the classical scheme is: for me,
it's "sometimes good enough". But yes, know its downsides.

> These are infinitely preferable.  They're simpler *and* more robust.
> 
> Aso see <http://mywiki.wooledge.org/ProcessManagement> for a more
> general discussion of processes, and why the PID file model fails.

Thanks for the wiki entry!

Cheers
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAllAOYUACgkQBcgs9XrR2kbr/QCfXr0ls0lYVX2cMmXas9WUTHMs
pyAAn1j+iHuqsiCzqdIyr96lmObFeXuO
=GUnV
-----END PGP SIGNATURE-----


Reply to: