Ritesh wrote:
Hello gurus,
i just wanted to understand popen() functionality in detail.
per my understanding, this is similar to fork and when called from inside the program (lets say parent), it opens a file descriptor (pipe) and executes the passed argumnet in a forked (child) process.
however, i have following doubts.
1. the parent process which calls this, is it blocked until the popen(cmd) (lets say its invoking 'cmd' shell script) is completed?
No, otherwise no one could communicate with the child across the pipe pair
that's set up. The whole point is to allow the parent and child to communicate;
the parent must be running to be able to communicate. popen(3C) implies this,
but doesn't actually say it, by saying the environment of the child process is
"just like fork".
2. is there any timer associated with this call? i mean lets say i am executing a script through popen and that script goes in a loop, what happens to the parent process?
The child continues to run until something else (kill, pclose) stops it. The
parent runs during this time as well.
thanks for your help in advance.
-rp
This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code