procve

Creates a new process, with the specified characteristics.

Library:LibC
Classification:Novell
Service:File and Directory I/O

Syntax

  #include <proc.h> 
   
  pid_t procve (
     const char      *path,
     unsigned long    flags,
     const char      *env[],
     wiring_t        *wiring,
     struct fd_set   *fds,
     void            *appdata,
     size_t           appdata_size,
     void            *reserved,
     const char      *argv[] );
  

Parameters

path

(IN) Points to the location of the binary for the process. The path is relative to $cwd unless a full path is specified.

flags

(IN) Specifies one or more flags that influence how the process is created. See Process Flags.

env

(IN) Points to an array of environment variables. If passed as NULL, the child process inherits the parent's environment at the time of the call.

wiring

(IN) Points to file descriptors for standard input, standard output, and errno for the process. Pass NULL to inherit system defaults for wiring. To set up application-specific values, see wiring_t.

fds

(IN) Points to a list of files to open. Not currently implemented. Pass in NULL.

appdata

(IN) Points to application-supplied data. Not currently implemented. Pass in NULL.

appdata_size

(IN) Specifies the size, in bytes, of the application data. Not currently implemented. Pass in 0.

reserved

(IN) Reserved. Pass NULL.

argv

(IN) Points to an array of arguments. The first argument argv [0] must be the name of the executable. Subsequent arguments are command line parameters for the executable. The last argument in the array must be NULL, to indicate the end.

Return Values

If the PROC_DETACHED flag is not set, returns a process ID on success. Otherwise, returns -1 and sets errno. The most common errors are listed below.

If the PROC_DETACHED flag is set, returns 0 on success. Otherwise, returns -1 and sets errno. The most common errors are listed below.

Decimal

Constant

Description

1

ENOENT

The loader couldn’t find the load file (in the suggested path).

3

ENOEXEC

The specified child process is not an NLM.

5

ENOMEM

Insufficient memory to perform the operation.

6

EACCES

Initialization failed or the domain is invalid.

16

EINUSE

The NLM is not multiload NLM and an instance already exists or the NLM attempted to export a duplicate symbol.

19

EWRNGKND

The NLM version is incorrect or the NLM format is invalid.

21

ERESOURCE

An error satisfying autoload list or missing symbol(s)

28

EIO

The loader couldn't read the file.

64

EISDIR

The DOS path is invalid.

65

ENAMETOOLONG

The pathname is too long.

105

ENOCONTEXT

Insufficient LibC context to continue.

Remarks

The procve function is a partial replacement for the fork function immediately followed by a call to the exec function. If you are using the latest support pack, the procve function can start either a LibC based NLM or a CLib based NLM.

If you create a detached process by setting the PROC_DETACHED flag, this function does not return the process ID of the detached process because you cannot perform any operations on a detached process.

The fds parameter allows the parent to specify which, if any, of its open file descriptors are to be opened in the new process. Not all file types can be opened successfully:

  • If any of the file descriptors specified was opened with the FD_CLOEXEC flag, the file cannot be opened in the new process.

  • If any of the file descriptors specified reference FIFOs, the pipe in the parent is marked “stale,” and the only function the parent can successfully call with that file descriptor is close.

For sample code, see ProcXe.c.

See Also