How bahamas10/sshp works
sshp is a parallel SSH executor: it reads hosts from a file or stdin, starts a bounded number of child commands, and presents their output in line, host-grouped, or output-joined mode. Its main runtime is concentrated in src/sshp.c; src/fdwatcher.c provides the epoll/kqueue readiness abstraction used to collect child output. The graph follows the documented workflow and sampled call relationships; individual option parsing and output-formatting details are not fully shown in the excerpts.
Main entry points: sshp.c Output event loop · fdwatcher.h FD watcher API · fdwatcher.c Event backend
Components 18
Input and control
- CLI and orchestration
src/sshp.c - Host list
src/sshp.c
Process execution
- Job scheduler
src/sshp.c - Child launcher
src/sshp.c
Event collection
- Child output pipes
src/sshp.c - FD watcher API
src/fdwatcher.h - Event backend
src/fdwatcher.c - Output event loop
src/sshp.c
Output and status
- Line mode
src/sshp.c - Group mode
src/sshp.c - Join mode
src/sshp.c - Exit status
src/sshp.c - Runtime status
src/sshp.c
Other components
- User
- Host input
- SSH or command
- Terminal output
- Signal sender
Connections 22
- User → CLI and orchestration: invokes
- Host input → CLI and orchestration: provides hosts
- CLI and orchestration → Host list: parses hosts
- CLI and orchestration → Job scheduler: runs jobs
- Job scheduler → Host list: selects hosts
- Job scheduler → Child launcher: starts jobs
- Child launcher → SSH or command: executes
- SSH or command → Child output pipes: writes output
- CLI and orchestration → FD watcher API: registers pipes
- FD watcher API → Event backend: uses backend
- Event backend → Output event loop: returns events
- Output event loop → Child output pipes: reads output
- Output event loop → Line mode: formats lines
- Output event loop → Group mode: streams by host
- Output event loop → Join mode: groups output
- Line mode → Terminal output: writes output
- Group mode → Terminal output: writes output
- Join mode → Terminal output: writes output
- Output event loop → Exit status: reaps children
- Exit status → CLI and orchestration: sets exit code
- Signal sender → Runtime status: sends SIGUSR1
- Runtime status → Terminal output: prints status