Configurable limits

When you're trying to determine your system's limits, you can get the values of configurable limits, special read-only variables that store system information.

Note: QNX Neutrino also supports configuration strings, which are similar to, and frequently used in conjunction with, environment variables. For more information, see the Configuring Your Environment chapter.

You can use the POSIX getconf utility to get the value of a configurable limit or a configuration string. Since getconf is a POSIX utility, scripts that use it instead of hard-coded QNX Neutrino-specific limits can adapt to other POSIX environments.

Some configurable limits are associated with a path; their names start with _PC_. When you get the value of these limits, you must provide the path (see Filesystem limits,” below). For example, to get the maximum length of the filename, type:

getconf _PC_NAME_MAX pathname

Other limits are associated with the entire system; their names start with _SC_. You don't have to provide a path when you get their values. For example, to get the maximum number of files that a process can have open, type:

getconf _SC_OPEN_MAX

In general, you can't change the value of the configurable limits—they're called “configurable” because the system can set them.

The QNX Neutrino libraries provide various functions that you can use in a program to work with configurable limits:

pathconf()
Get the value of a configurable limit that's associated with a path.
sysconf()
Get the value of a limit for the entire system.
setrlimit()
Change the value of certain limits. For example, you can use this function to limit the number of files that a process can open; this limit also depends on the value of the -F option to procnto.