Well, i'm studying unix process structure, i.e, how to create and manage processes in Unix, using C.
I know how to use function fork() to create a child, however, to change the "parent" to a deamon process it is not clear to me how to put that in C code.
I need to daemonize a process that will create 3 other processes, each one will be responsible for executing different actions (that comunicate to their parent using unnamed pipes).
Something like this:
(...)
for (i = 0; i < 3; i++) {
pid_t id = fork();
if (id == 0) {
switch (i) {
case 0:
case 1:
case 2:
}
else {
}
}
But this code is only for a "normal" process...
Question one: first of all, i create the childs first and after that will change a parent process to a deamon one?
Question two: how?
Tks in advance,
Claudia