2. Process Creation and Execution Manager#

2.1. Introduction#

The process creation and execution manager provides the functionality associated with the creation and termination of processes.

The directives provided by the process creation and execution manager are:

2.2. Background#

POSIX process functionality can not be completely supported by RTEMS. This is because RTEMS provides no memory protection and implements a single process, multi-threaded execution model. In this light, RTEMS provides none of the routines that are associated with the creation of new processes. However, since the entire RTEMS application (e.g. executable) is logically a single POSIX process, RTEMS is able to provide implementations of many operations on processes. The rule of thumb is that those routines provide a meaningful result. For example, getpid() returns the node number.

2.3. Operations#

The only functionality method defined by this manager which is supported by RTEMS is the _exit service. The implementation of _exit shuts the application down and is equivalent to invoking either exit or rtems_shutdown_executive.

2.4. Directives#

This section details the process creation and execution manager’s directives. A subsection is dedicated to each of this manager’s directives and describes the calling sequence, related constants, usage, and status codes.

2.4.1. fork - Create a Process#

CALLING SEQUENCE:

#include <sys/types.h>
int fork( void );

STATUS CODES:

ENOSYS

This routine is not supported by RTEMS.

DESCRIPTION:

This routine is not supported by RTEMS.

NOTES:

NONE

2.4.2. execl - Execute a File#

CALLING SEQUENCE:

int execl(
    const char *path,
    const char *arg,
    ...
);

STATUS CODES:

ENOSYS

This routine is not supported by RTEMS.

DESCRIPTION:

This routine is not supported by RTEMS.

NOTES:

NONE

2.4.3. execv - Execute a File#

CALLING SEQUENCE:

int execv(
    const char *path,
    char const *argv[],
    ...
);

STATUS CODES:

ENOSYS

This routine is not supported by RTEMS.

DESCRIPTION:

This routine is not supported by RTEMS.

NOTES:

NONE

2.4.4. execle - Execute a File#

CALLING SEQUENCE:

int execle(
    const char *path,
    const char *arg,
    ...
);

STATUS CODES:

ENOSYS

This routine is not supported by RTEMS.

DESCRIPTION:

This routine is not supported by RTEMS.

NOTES:

NONE

2.4.5. execve - Execute a File#

CALLING SEQUENCE:

int execve(
    const char *path,
    char *const argv[],
    char *const envp[]
);

STATUS CODES:

ENOSYS

This routine is not supported by RTEMS.

DESCRIPTION:

This routine is not supported by RTEMS.

NOTES:

NONE

2.4.6. execlp - Execute a File#

CALLING SEQUENCE:

int execlp(
    const char *file,
    const char *arg,
    ...
);

STATUS CODES:

ENOSYS

This routine is not supported by RTEMS.

DESCRIPTION:

This routine is not supported by RTEMS.

NOTES:

NONE

2.4.7. execvp - Execute a File#

CALLING SEQUENCE:

int execvp(
    const char *file,
    char *const argv[],
    ...
);

STATUS CODES:

ENOSYS

This routine is not supported by RTEMS.

DESCRIPTION:

This routine is not supported by RTEMS.

NOTES:

NONE

2.4.8. pthread_atfork - Register Fork Handlers#

CALLING SEQUENCE:

#include <sys/types.h>
int pthread_atfork(
    void (*prepare)(void),
    void (*parent)(void),
    void (*child)(void)
);

STATUS CODES:

0

This routine is a non-functional stub.

DESCRIPTION:

This routine is non-functional stub.

NOTES:

The POSIX specification for pthread_atfork() does not address the behavior when in a single process environment. Originally, the RTEMS implementation returned -1 and set errno to ENOSYS. This was an arbitrary decision part with no basis from the wider POSIX community. The FACE Technical Standard includes profiles without multiple process support and defined the behavior in a single process environment to return 0. Logically, the application can register atfork handlers but they will never be invoked.

2.4.9. wait - Wait for Process Termination#

CALLING SEQUENCE:

#include <sys/types.h>
#include <sys/wait.h>
int wait(
    int *stat_loc
);

STATUS CODES:

ENOSYS

This routine is not supported by RTEMS.

DESCRIPTION:

This routine is not supported by RTEMS.

NOTES:

NONE

2.4.10. waitpid - Wait for Process Termination#

CALLING SEQUENCE:

int wait(
    pid_t  pid,
    int   *stat_loc,
    int    options
);

STATUS CODES:

ENOSYS

This routine is not supported by RTEMS.

DESCRIPTION:

This routine is not supported by RTEMS.

NOTES:

NONE

2.4.11. _exit - Terminate a Process#

CALLING SEQUENCE:

void _exit(
    int status
);

STATUS CODES:

NONE

DESCRIPTION:

The _exit() function terminates the calling process.

NOTES:

In RTEMS, a process is equivalent to the entire application on a single processor. Invoking this service terminates the application.