For a namespace clean function, implement
_execve
, otherwise implement
execve
. The implementation of this
functionality will be tightly bound to any operating
infrastructure for handling multiple processes.
A minimal implementation, such as that for bare metal coding, only offers a single user thread of control. It is thus impossible to start a new process, so this function always fails.
#include <errno.h> #undef errno; extern int errno; int _execve (char *name, char **argv, char **env) { errno = ENOMEM; return -1; /* Always fails */ } /* _execve () */
The choice of errno
is somewhat
arbitrary. However no value for "no processes available" is
provided, and ENOMEM
is the closest in meaning
to this.