Home
Support

Knowledge Base

BSPs and drivers
Community resources
Product documentation
Questions?
Contact us

What are the ways to know the number of open file descriptors at runtime?
 
________________________________________________________________________

Applicable Environment
________________________________________________________________________
  • Topic: What are the ways to know the number of open file descriptors at runtime?
  • SDP: 6.5.0
  • Target: Any supported target
________________________________________________________________________

Recommendation
________________________________________________________________________

There are few methods to get to the total number of opened file descriptors at run-time. These are listed below

(a) 'pidin fds' displays the information about each process's connections and file descriptors. This includes the comprehensive list of all file descriptors including message queues, sockets, named semaphores etc;

(b) In IDE, go to 'QNX System Information' Perspective and establish the connection with the target system. Go to 'Connection Information View'. This shows the list of file descriptors for the selected process.

(c) In IDE, go to 'QNX System Information' Perspective and establish the connection with the target system. Go to 'System Resources View'. It displays information about CPU usage, heap size, and the number of open file descriptors, for all the processes.

(d) programmatically you can retrieve the number of file descriptors associated with every process by using the devctl DCMD_PROC_INFO, which returns the information by filling out the procfs_info structure.

devctl( fd, DCMD_PROC_INFO, &my_info, sizeof(my_info), NULL);
Where fd is an open file descriptor to the entry "/proc/<process ID>/as". Upon successful devctl the number of file descriptor associated with the process in question will be set in my_info.num_fdcons. The sum of all my_info.num_fdcons for all processes in the system gives the total opened number of open file descriptors. For definitions of procfs_info, refer procfs.h and debug.h in $(QNX_TARGET)\usr\include\sys.

________________________________________________________________________
NOTE: This entry has been validated against the SDP version listed above. Use caution when considering this advice for any other SDP version. For supported releases, please reach out to QNX Technical Support if you have any questions/concerns.
________________________________________________________________________


Related Attachments
 None Found





Please contact us with your questions or concerns.