$ cd ../
FD Watch — bash

user@devops:~$ cat README.md

FD Watch

# Description

FD Watch (cpp-fd-watch) is a Linux file descriptor analyzer written in C++23 that reads /proc/sys/fs/file-nr, /proc/sys/fs/nr_open and, per process, /proc/<pid>/{fd,comm,limits,stat}. It shows the global system state (allocated fds, unused, file-max and the practical nr_open ceiling with utilization %), the top fd-consuming processes with names from /proc/<pid>/comm, per-process soft/hard limits from /proc/<pid>/limits (Max open files) with limit % and pressure warning (>=80%), and the process state distribution (running/sleeping/disk/zombie/idle) from /proc/<pid>/stat. Includes watch mode with live delta rates every N seconds (--watch N: allocated fds/s and process fds/s), full JSON output for scripting (--json) with {system, processes[], summary} structure, --top N and --min N filters, graceful handling of inaccessible processes (EACCES reported as "without access" without breaking the scan), ANSI colors (--no-color) and 17 self-verification tests (--selftest) validating synthetic parsing of file-nr/limits/stat, formatting, JSON escaping and smoke tests against real /proc. Zero dependencies: direct build with g++ -std=c++23.

# Key features

$ Global system state from /proc/sys/fs/file-nr: allocated fds, unused, file-max and utilization % over nr_open

$ Top fd consumers per process: real entry count from /proc/<pid>/fd with names from /proc/<pid>/comm

$ Per-process soft/hard limits from /proc/<pid>/limits (Max open files) with % of soft limit and pressure warning (>=80%)

$ Process state distribution (running/sleeping/disk/zombie/idle) from /proc/<pid>/stat

$ Watch mode with live delta rates every N seconds (--watch N): allocated fds/s and process fds/s with screen refresh

$ Full JSON output for scripting: system, processes[] and summary (--json)

$ --top N and --min N filters, graceful handling of inaccessible processes (EACCES) and ANSI colors (--no-color)

$ 17 self-verification tests: synthetic parsing of file-nr/limits/stat, formatting, JSON escaping and smoke tests against real /proc (--selftest)

# Gallery

Terminal del proyecto
FD Watch - Terminal del proyecto
Vista móvil
FD Watch - Vista móvil

# Technologies used

C++23