File descriptors

QNX SDP8.0User's GuideUser

The total number of file descriptors (FDs) has a hard limit of 32767 per process, but you're more likely to be constrained by the -F option to procnto, which applies to all processes except procnto itself, or the RLIMIT_NOFILE system resource, which can be set for each process. The default value is 1000; the minimum is 100.

Note:
Sockets, named semaphores, and message queues all use file descriptors. Connection IDs (coids) for side channels are returned from a different space than FDs, so they don't count towards the limit set by the procnto -F option or RLIMIT_NOFILE.

While procnto isn't bound by the -F option setting, it's still constrained by the hard limit of 32767 open FDs, so any of its operations that entail creating new FDs will start failing if that limit has been reached. The primary consumer of procnto FDs is mmap() operations on files, either explictly by passing an FD from an open() call to mmap() or implicitly through loading executable objects. The current FDs owned by procnto can be examined by running the command pidin -p fds.

To get the current limit, use the ksh builtin command, ulimit (see the Utilities Reference), or call getrlimit() (see the C Library Reference).

If you set procnto -F to a value larger than the default (but smaller than the hard limit) to support a large-scale system in which individual processes can have many open files (and possibly create more processes that open more files), this setting can affect system-wide performance. Specifically, if a process has many open FDs but suddenly needs to shut down, the process's terminator thread will send an _IO_CLOSE message to every one that the process has open. Thus, process termination can take a long time. This means when writing applications, you should ensure that your code closes FDs as soon as it's done with them and doesn't rely on the terminator thread to do so during shutdown.

Page updated: