popen() fails while system() works

Rainer Hochreiter rainer@hochreiter.at
Tue Jan 11 15:11:00 GMT 2005


> On Mon, Jan 10, 2005 at 08:56:58AM +0100, Rainer Hochreiter wrote:
>> but what's the real reason why popen() results in the address conflict
>> and system() does not?!
>
> AFAICT, popen() calls fork() and system() does not.

this is not true - both functions call vfork()!

cygwin-1.5.12-1/newlib/libc/stdlib/system.c:165 if ((pid = vfork ()) == 0)
cygwin-1.5.12-1/newlib/libc/posix/popen.c:92    switch (pid = vfork()) {

system() calls execve() while popen() calls execl() to start execution of
another file!

-- 
rainer hochreiter             | web:    www.hochreiter.at
lilienfelder str. 43          | e-mail: rainer@hochreiter.at
a-3150 wilhelmsburg / austria | mobile: +43 664 2812175


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list