[Mono-dev] execv fails with error status 126

Paolo Molaro lupus at ximian.com
Wed Oct 17 11:41:59 EDT 2007


On 10/17/07 Miguel de Icaza wrote:
> 
> > > 1. execv() is a Dllimport from libc.
> > 
> > You should use the Process class.
> > 
> > > 2. This behavior is not consistently seen. 
> > > 3. Application is a daemon process.
> > > 4. mono version used 1.1.13
> > 
> > You should use mono 1.2.5 and up.
> > 
> > That said, you should post the signature of the method you're using to
> > dllimport execv and the way you're calling it: it's most likely that
> > is incorrect (for example, do you null terminate the array?).
> 
> He should not be using execv anyways because execv will not properly
> prepare the runtime for another process (file descriptors used by the
> parent need to be explicitly closed after fork, and there are a few
> other cleanup tasks that must be done after fork).

I assumed he didn't use fork or he'd likely have also other issues.
He also didn't mention using fork and we always advised against using it.
execv() by itself to execute another process in place of the current
should work, but as I said in the first line of my reply, the Process
class should likely be used.

lupus

-- 
-----------------------------------------------------------------
lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better



More information about the Mono-devel-list mailing list