Here is the problem: I have a daemon that receives requests from the client, performs a function (from some module) because of the request, and returns a response to the client. After fork () I close STDIN, STDOUT and STDERR. One function is to check dmesg. To do this, I get dmesg output through open (DMESG, "/ bin / dmesg |"). I do not close this fh after reading, because I thought that it automatically closes after the function finishes. But this does not happen, and I get zombies for every dmesg call.
Q How can I reinitialize STDIN / STDOUT / STDERR Perl? I found: "The problem with closing STDOUT instead of reopening is that if you open other files, they can get fd 0.1 or 2 - prevent the reopening of STDOUT in the future." by jmanning2k And I think this has something to do with it, but I really don't understand. I hope someone can explain this to me.
I know that I can avoid the problem, for example. calling dmesg via qx (); or just closing fh, but I want to understand where the zombies come from.
source
share