File Descriptor Diagnostics
Inspect process-level iOS file descriptor counts, limits, utilization, and open descriptor metadata through read-scoped remote tools.
The iOS file-descriptor suite helps diagnose leaked files, sockets, pipes, and other process resources. It is included in the aggregate Ansight product and can also be installed as AnsightToolsFileDescriptorDiagnostics.
Register the Suite
import AnsightCore
import AnsightToolsFileDescriptorDiagnostics
let diagnosticOptions = AnsightFileDescriptorDiagnosticsOptions(
includeTargets: false
)
try AnsightRuntime.shared.registerFileDescriptorDiagnosticsTools(
options: diagnosticOptions
)
Set includeTargets to false to suppress resolved file paths and socket metadata. The options also support a custom maximum scanned descriptor range. If that range is below the process descriptor range, the count tool fails rather than returning a misleading undercount.
Tool Reference
| Tool | Tool id | Scope | Result | Security |
|---|---|---|---|---|
| List Open Descriptors | file_descriptors.list_open | Read | Filterable descriptor records with kind, flags, position, inode, and optional target. | High |
| Count Open Descriptors | file_descriptors.count_open | Read | Only { "count": number }; it does not resolve targets or collect descriptor details. | Medium |
| Inspect Descriptor | file_descriptors.inspect | Read | One descriptor record by non-negative descriptor number. | High |
| Get Descriptor Usage | file_descriptors.get_usage | Read | Open count, process limits, remaining capacity, and utilization. | Medium |
file_descriptors.list_open accepts:
kind: optional resource-kind filtertargetContains: optional case-insensitive target substringmaxEntries: maximum records to return after filtering
Snapshot results indicate whether collection was complete, the scanned descriptor limit, and the capture time.
Security
All four tools are read-scoped, but listing and inspection can disclose file paths and socket metadata. Prefer count and usage for routine leak detection, disable targets when paths are unnecessary, and keep the suite limited to controlled development or QA builds.