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

ToolTool idScopeResultSecurity
List Open Descriptorsfile_descriptors.list_openReadFilterable descriptor records with kind, flags, position, inode, and optional target.High
Count Open Descriptorsfile_descriptors.count_openReadOnly { "count": number }; it does not resolve targets or collect descriptor details.Medium
Inspect Descriptorfile_descriptors.inspectReadOne descriptor record by non-negative descriptor number.High
Get Descriptor Usagefile_descriptors.get_usageReadOpen count, process limits, remaining capacity, and utilization.Medium

file_descriptors.list_open accepts:

  • kind: optional resource-kind filter
  • targetContains: optional case-insensitive target substring
  • maxEntries: 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.