Module Dependency Diagram

Copy Markdown View Source
graph TD
    NR[NetRunner] --> S[NetRunner.Stream]
    NR --> P[NetRunner.Process]
    S --> P
    P --> EX[Process.Exec]
    P --> ST[Process.State]
    P --> OP[Process.Operations]
    P --> PI[Process.Pipe]
    P --> NI[Process.Nif]
    P --> SIG[NetRunner.Signal]
    P --> STATS[Process.Stats]
    EX --> NI
    PI --> NI
    ST --> PI
    ST --> OP
    ST --> STATS
    W[NetRunner.Watcher] --> NI
    W --> SIG
    APP[NetRunner.Application] --> W
    D[NetRunner.Daemon] --> P

    subgraph "C Native"
        SH[shepherd.c]
        NIFC[net_runner_nif.c]
        PROTO[protocol.h]
        UTIL[utils.h]
    end

    NI -.->|loads| NIFC
    EX -.->|spawns| SH
    NIFC --> PROTO
    NIFC --> UTIL
    SH --> PROTO

Module Reference

Public API

ModulePurpose
NetRunnerTop-level API: run/2, stream!/2, stream/2
NetRunner.ProcessGenServer managing a single OS process lifecycle
NetRunner.StreamStream.resource wrapper for incremental I/O
NetRunner.DaemonSupervised long-running process for supervision trees
NetRunner.SignalSignal atom → platform-specific number resolution

Internal Modules

ModulePurpose
NetRunner.Process.ExecProcess spawning: UDS, Port.open, SCM_RIGHTS, FD wrapping
NetRunner.Process.NifNIF function stubs (@on_load :load_nifs)
NetRunner.Process.PipePipe struct wrapping a NIF FD resource
NetRunner.Process.StateGenServer state struct
NetRunner.Process.OperationsPending operation queue (park on EAGAIN, retry on ready)
NetRunner.Process.StatsI/O statistics accumulator
NetRunner.WatcherDynamicSupervisor child that kills OS process on GenServer death
NetRunner.ApplicationOTP application: starts WatcherSupervisor

C Components

FileLinesPurpose
c_src/shepherd.c~600Persistent child watchdog: fork, FD pass, poll loop, kill escalation, PTY, cgroup
c_src/net_runner_nif.c~480NIF: read/write/close/create_fd/dup_fd/kill/signal_number with enif_select
c_src/protocol.h~35Shared protocol constants
c_src/utils.h~20Debug/error macros