Skip to content

ProcCreate

Description

Create a new process

Parameters

Name Direction Description
path in Path to executable to be executed.
argv in NULL terminated array containing zero-terminated strings.
envp in NULL terminated array containing zero-terminated strings.
alloc in Allocator used to allocate the returned Proc handle. The same allocator must be passed to ProcDestroy.

Success

New created Proc object opaque handle.

Failure

NULL.

Usage example (Cross-references)

Usage examples (Cross-references)
    #define WRITE_END 1
    
    Proc *ProcCreate(const char *filepath, char **argv, char **envp, Allocator *alloc) {
        if (!alloc) {
            LOG_FATAL("ProcCreate requires an allocator");
    Proc *ProcCreate(const char *filepath, char **argv, char **envp, Allocator *alloc) {
        if (!alloc) {
            LOG_FATAL("ProcCreate requires an allocator");
        }
    #if defined(__APPLE__) || defined(__linux__)
    
        // create a new child process
        Proc *proc = ProcCreate(argv[1], argv + 1, envp, &alloc.base);
    
        // write something to it's stdout
Last updated on