[kwlug-disc] Question about ... sockets?
Hubert Chathi
hubert at uhoreg.ca
Tue Feb 2 13:35:51 EST 2021
On Tue, 2 Feb 2021 11:18:11 -0500, Mikalai Birukou via kwlug-disc <kwlug-disc at kwlug.org> said:
> A need/want: I want process to start some other process, giving it
> some way to communicate with creator process. This communication
> should be only between these two running processes, i.e. kernel help
> us here.
It's been a very long time (about 20 years) since I've done this sort of
thing, but I think what you want are
pipes. https://tldp.org/LDP/lpg/node7.html has a bunch of information
including C code examples, and I think 6.2 Half-duplex UNIX Pipes is
what you want. You could also look at 6.4.2 Message Queues or 6.4.4
Shared Memory, but I've never tried using either of those.
> My currently limited understanding:
[...]
> - How should process be started so that it isn't given implicitly any
> resources from initializing process, only passing explicitly
> particular open connection(s)? I head fork is making copies of
> descriptors :/ ? Is there other way? Can someone explain this, or give
> links to userland-parsable resources/docs?
IIRC, fork is the only real way to start another process. I think that
everything else is just a wrapper around fork. Generally, you just do a
fork and immediately close all the resources that you don't need in the
child process, and then (if necessary) exec another program.
More information about the kwlug-disc
mailing list