I use an unnamed channel for interprocess communication between a parent process and a child process created through fork (). I use the pipe () function included in unistd.h
I would suggest that once both file descriptors were closed (and in both processes), that the channel is freed / freed / destroyed / etc. But I did not find anything on the manual pages that finally confirm this. I am making a program that will work for a very long time, so I want to prevent memory leaks and other things of this kind.
The body of my function looks something like this:
int pipefds[2];
pipe( pipefds );
if ( fork() == 0 ) {
close( pipefds[1] );
...
//Use pipefds[0]
close( pipefds[0] );
} else {
close( pipefds[0] );
...
//Use pipefds[1]
close( pipefds[1] );
}
, , , , // /etc.
- , ?