qnx_spawn_process

qnx_spawn_process — is an implementation of the C function qnx_spawn.

Syntax

qnx_spawn_process (exec, node, priority, scheduler,
flags, program, arg_list, file_list, ctfile)

		

Arguments

exec

If non-nil, then execute the process, otherwise spawn a separate task.

node

The node on which to spawn, or zero for the current node.

priority

The scheduler priority of the new task.

scheduler

the scheduler algorithm for the new task.

flags

The spawn flags.

program

The program name.

arg_list

Arguments to the program, as a list, excluding the program name.

file_list

A list of up to 10 files to be associated with the first 10 file descriptors of the new process. If any element in the list is a non-file, then use the corresponding file descriptor in the current process. A nil file-list indicates that all 10 file descriptors will be inherited from the calling task.

ctfile

A file associated with the controlling terminal for the new process.

Returns

The task ID of the new task, or -1 if an error occurs, and the errno is set.

Description

This is an implementation of the qnx_spawn C function. It is currently only available in QNX 4. This is the lowest level function for creating a new process.

Passing -1 to the priority option will cause the new task to inherit its priority from the parent, otherwise a value from 1-31 is acceptable.

Passing -1 to the scheduler option will cause the new task to inherit its scheduler activities from the parent, otherwise the following flags are defined for the scheduler option:

    SCHED_FIFO First-in, First-Out scheduling algorithm.

    SCHED_RR Round-robin scheduling algorithm.

    SCHED_OTHER Adaptive scheduling.

The following spawn flags are defined for the flags option:

    _SPAWN_BGROUND The process will be started with SIGINT and SIGQUIT ignored.

    _SPAWN_DEBUG The process will be started with the single step flag set. Rarely used.

    _SPAWN_HOLD The process will be started in a STOPPED state.

    _SPAWN_NEWPGRP The new process will start a new process group.

    _SPAWN_NOHUP The process will be started with SIGHUP ignored

    _SPAWN_NOZOMBIE When the new process terminates it will not become a zombie waiting for its father to do a wait on its death. The parent process will not see the child process die and a SIGCHILD will not be set.

    _SPAWN_SETSID The new process will start a new session.

    _SPAWN_SIGCLR The new process will not inherit ignored signals from its parent.

    _SPAWN_TCSETPGRP The new process will start a new terminal group. ALL keyboard breaks will be directed a it.

    _SPAWN_XCACHE Instruct the file system to place the executable in cache in hopes that it will be loaded again soon.

The library "const/QNXOS" should be required to use these constants

Errors that can happen when using this function:

    E2BIG  The sum of the bytes used by the new process image's argument list and environment is too big.

    EACCES  No permissions to execute program.

    EAGAIN  No free process entries or local memory.

    EINVAL  The priority or the scheduling policy is invalid.

    ENAMETOOLONG  The length of the program name, expanded to it's full path, is too long.

    ENOENT  The program does not exist.

    ENOEXEC  The program is not the correct format (not an executable).

    ENOLIC  Insufficient licenses to use this function.

    ENOMEM  Not enough system memory.

    ENONDP  The program needs an 80x87. A co-processor is not installed and the emulator (emu87) is not running.

    ETXTBUSY  The program to launch is open for write (busy).

The ctfile is a file descriptor associated with the new process. This parameter is only meaningful if the _SPAWN_SETID flag is set. If you wish to start a new session without a controlling terminal then pass -1.

Example

Examples of this function are beyond the scope of this documentation.

See Also

exec, fork, wait