File: common.h

package info (click to toggle)
ghc 9.6.6-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 158,216 kB
  • sloc: haskell: 648,228; ansic: 81,656; cpp: 11,808; javascript: 8,444; sh: 5,831; fortran: 3,527; python: 3,277; asm: 2,523; makefile: 2,298; yacc: 1,570; lisp: 532; xml: 196; perl: 145; csh: 2
file content (52 lines) | stat: -rw-r--r-- 1,418 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#pragma once

#include "runProcess.h"

enum std_handle_behavior {
    // Close the handle
    STD_HANDLE_CLOSE,
    // dup2 the specified fd to standard handle
    STD_HANDLE_USE_FD,
    // dup2 the appropriate end of the given pipe to the standard handle and
    // close the other end.
    STD_HANDLE_USE_PIPE
};

struct std_handle {
    enum std_handle_behavior behavior;
    union {
        int use_fd;
        struct {
            int parent_end, child_end;
        } use_pipe;
    };
};

int get_max_fd(void);

// defined in find_executable.c
#if !defined(HAVE_EXECVPE)
char *find_executable(char *workingDirectory, char *filename);
#endif

// defined in fork_exec.c
ProcHandle
do_spawn_fork (char *const args[],
               char *workingDirectory, char **environment,
               struct std_handle *stdInHdl,
               struct std_handle *stdOutHdl,
               struct std_handle *stdErrHdl,
               gid_t *childGroup, uid_t *childUser,
               int flags,
               char **failed_doing);

// defined in posix_spawn.c
ProcHandle
do_spawn_posix (char *const args[],
                char *workingDirectory, char **environment,
                struct std_handle *stdInHdl,
                struct std_handle *stdOutHdl,
                struct std_handle *stdErrHdl,
                gid_t *childGroup, uid_t *childUser,
                int flags,
                char **failed_doing);