Glenn Fowler wrote: > > Should ksh93/libshell use |posix_spawn()| instead of |vfork()| ? > > it should and it does > > all ast and ksh fork()/exec() is done by the ast spawnveg() > which configures to the local system at compile time > if posix_spawn is available then it is used > a few other non-standard fork+exec combinations are also checked > before vfork+exec, finally defaulting to fork+exec > > note that there are instances where ksh prefers pure fork() > although it can work around that too
Quick test: I've set "-DSHOPT_SPAWN" at built time (since the buildlog.log doesn't list SHOPT_SPAWN when compiling ast-ksh) but ksh93 still calls |vfork()|: -- snip -- ksh93 -o gmacs $ ls stopped in _vfork at 0xff23725c 0xff23725c: _vfork : mov 3, %o0 stopped in _vfork at 0xff23725c 0xff23725c: _vfork : mov 3, %o0 (dbx) where =>[1] _vfork(0x1, 0xff0ead00, 0xff0eacfc, 0xffbfdb40, 0x9eeb4, 0xbc00), at 0xff23725c [2] spawnveg(0x28242, 0x280d8, 0x28104, 0x1, 0x280a1, 0x27710), at 0xff05e538 [3] _spawnveg(0x28242, 0x1, 0xff38f678, 0xff38c000, 0x0, 0x44848), at 0xff3477f0 [4] path_spawn(0xffffffff, 0x280d8, 0x28240, 0x3d, 0x3, 0x28242), at 0xff349778 [5] sh_ntfork(0xff38c000, 0x1, 0xff38f678, 0xff38f220, 0xff38c000, 0x0), at 0xff359a00 [6] sh_exec(0x280a8, 0x24, 0xff38f220, 0x232f0, 0x65ab0, 0xff0eac40), at 0xff3551a4 [7] exfile(0xff38f220, 0x280a8, 0x34, 0xff38f678, 0xff38f678, 0xff38c000), at 0xff318e60 [8] sh_main(0xff38f220, 0x319c8, 0xff38c000, 0xff38c000, 0xff38c000, 0xff38c000), at 0xff3183b0 -- snip -- ;-( I've removed "-DSHOPT_SPAWN" from the built options but |vfork()| still gets called (=no change) ... ;-( ---- Bye, Roland -- __ . . __ (o.\ \/ /.o) roland.mainz at nrubsig.org \__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer /O /==\ O\ TEL +49 641 7950090 (;O/ \/ \O;)