Improve apps plugin processing by stelfrag · Pull Request #21863 · netdata/netdata

@stelfrag

…ptimize related logic

- Added `fds_max` field to `pid_stat` structure to track the highest file descriptor index seen (+1) for improved management.
- Replaced all occurrences of `fds_size` with `fds_max` where appropriate for iteration and logic adjustments.
- Enhanced `cleanup_negative_pid_fds` and other file descriptor handling to respect `fds_max`.
- Ensured consistent updates to `fds_max` during PID file descriptor processing.

cubic-dev-ai[bot]

@stelfrag

@stelfrag

@stelfrag

- Introduced `PROCFILE_FLAG_NEEDS_SEEK` to mark file descriptors requiring a seek before the next read.
- Refactored seek logic to skip unnecessary operations for freshly reopened file descriptors.
- Improved handling of non-seekable files by integrating fallback logic directly into the read path.