procnto*

Microkernel and process manager (QNX Neutrino)

Syntax:

procnto* [-a d|e|s] [-c] [-d umask] [-e n|o] [-F number] [-fe]
         [-h] [-H size] [-mmemmgr_configuration]  
         [-P priority[s]] [-p] [-S bytes_after[,bytes_before]]
         [-T timeout] [-u umask] [-v]

Runs on:

QNX Neutrino

Options:

-ad
Disable alignment fault emulation. The procnto manager doesn't attempt to make misaligned memory accesses work; they'll cause a SIGBUS signal for the offending thread.
-ae
Enable alignment fault emulation. The procnto manager attempts to make misaligned memory accesses work, although they'll be slow. This isn't guaranteed to work; offending threads may still get a SIGBUS signal.

In QNX Neutrino 6.6 and later on ARMv7 processors, specifying this option allows misaligned accesses to be performed in hardware. On these targets, ThreadCtl(_NTO_TCTL_ALIGN_FAULT, ...) no longer changes the alignment-fault behavior on a per-thread basis.

-as
Use the system default for alignment faults. The default is -ae for all supported platforms.
-c
(QNX Neutrino Core OS 6.3.2 or later) Prevent the adaptive partitioning scheduler from automatically running threads that receive events from interrupt handlers as critical.
Note: The -c option has an effect only if:
  • you're using Adaptive Partitioning
  • the thread receiving an event from an interrupt handler is running in a partition configured with a critical budget

For more information, see the Adaptive Partitioning User's Guide.

-d umask
(QNX Neutrino 6.6 or later) Use the given file-creation mask (umask) when creating the entries in /proc/pid/ctl. If you don't specify this option, procnto uses a mask of 0022.
-e n|o
(QNX Neutrino 6.4.0 or later) Specify which value to use for EALREADY:
  • -eo — use the old value, which is the same as that of EBUSY
  • -en — use the POSIX-compliant value
Note: In QNX Neutrino 6.4.0, the default value for EALREADY was the old one (corresponding to -eo); in QNX Neutrino 6.6.0, it's changed to the new value (corresponding to -en).

For more information, see "Changes to EALREADY" in the entry for errno in the QNX Neutrino C Library Reference.

-F number
The maximum number of file descriptors that can be open at the same time. The minimum allowable value is 100. The default value is 1000, but might be constrained by the RLIMIT_NOFILE system resource.
Note: Sockets, named semaphores, message queues, channel IDs (chids), and connection IDs (coids) all use file descriptors.

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

-fe
Force floating-point emulation. The default is to use floating-point hardware in the CPU if present, and to emulate it in software if the CPU has no FPU (see fpemu.so). Use this option to simulate a system with no FPU.
-h
Disable CPU halting in idle thread. Some CPU and supporting chipsets can lock up if the CPU halts when idle; you'll notice the need for the -h option right away because your system will lock up after booting.
-H size
Set the initial heap size for procnto. If more memory is required, it's dynamically obtained; however, by setting a properly calculated value, you can speed up boot time and reduce the amount of physical memory fragmentation.

The size parameter indicates the number of bytes to grow the heap in advance. You can postfix this value with a multiplier character, such as "k" (kilobyte) or "m" (megabyte). For example:

1m == 1024k == 0x100000

If the number is less than 1024 and it isn't postfixed by a multiplier character, it's assumed to be in kilobytes. The default value is 64 KB, and the minimum size permitted is 1 KB.

-m memmgr_configuration
(QNX Neutrino Core OS 6.3.2 or later) Control the behavior of the memory manager. The memmgr_configuration string is a sequence of characters that enable (or if preceded with a ~ character, disable) memory-manager aspects. See "Memory configuration," below.
Note: If you specify more than one -m option, procnto ignores all but the last one.
-P priority[s]
Set the upper end of the range of unprivileged priorities to priority − 1. Priorities range from 0 through 255:
Range Priorities
Idle thread 0
Unprivileged 1 through (priority − 1)
Privileged 1 through 255

In order to run at a priority above the unprivileged range, a process must have the PROCMGR_AID_PRIORITY ability enabled (see procmgr_ability() in the C Library Reference). The default value of priority is 64. If priority is less than 10, procnto uses a value of 10; if priority is greater than 256, it uses a value of 256.

(QNX Neutrino 6.6 or later) You can append an s or S to the priority if you want out-of-range priority requests by default to use the maximum allowed value (reach a "maximum saturation point") instead of resulting in an error.

-p
Disable kernel preemption. This prevents threads running in kernel space from being preempted by a higher-priority thread. This can be useful when debugging a system with a frequent source of high-priority interrupts.
-S bytes_after[,bytes_before]
(QNX Neutrino 6.6.0 or later) Specify the number of bytes after and (optionally) before the stack pointer to include in a kernel dump. The default values are 128 bytes after and 0 bytes before. If you specify a value that's zero or greater than UINT_MAX, it's ignored. For more information, see the "Reading a Kernel Dump" technote.
-T timeout
(QNX Neutrino 6.4.0 or later) Specify the number of seconds to wait for a close() to succeed in the event of a process termination. The default is 30 seconds; if you specify a value of 0, the default is used.

When a process terminates, any outstanding connections are closed. This means that an _IO_CLOSE message is synthesized and sent to the resource manager responsible for that connection.

Because it is not guaranteed that the server will reply in a reasonable amount of time (e.g., a Qnet node may be down), a TimerTimeout() call before the send guarantees that the termination process will proceed.

-u umask
(QNX Neutrino 6.4.0 or later) Use the given file-creation mask (umask) when creating the entries in /proc/pid/as. If you don't specify this option, procnto uses a mask of 0066.
Note: Opening /proc/pid/as for read-only access succeeds, even if the file permissions would normally say that it should fail with an EACCES. Instead the kernel marks the OCB as allowing only devctl() commands. This prevents unprivileged processes from examining a process's memory, but still allows a non-root pidin to display some useful information.

For more information about these files, see "/proc filesystem," below.

-v[v]...
Be verbose. Specifying more v characters increases the verbosity. If you specify this option, you'll get more useful information when a process is terminated by a signal.

Description:

The procnto system process contains the microkernel, process management, memory management and pathname management. It's required in all bootable images made using the mkifs utility. For more information, see the QNX Neutrino System Architecture guide.

Note: To determine the release version of the kernel on your system, use the uname -a command.

There are different versions of procnto for different processors (see the Board Support Package for your board for specific information):

procnto-smp
All supported multicore processors.
procnto
All other supported processors.

There's also an instrumented version of each of the above (e.g., procnto-smp-instr) that you'll use for system analysis. For more information, see the System Analysis Toolkit User's Guide and the "Analyzing Your System with Kernel Tracing" chapter of the IDE User's Guide.

Note: If you're using an SMP version of procnto, you can use the appropriate startup-* command's -P option to specify the maximum number of CPUs to activate.

Starting in QNX Neutrino 6.3.0, procnto also manages named semaphores, which mqueue used to do (mqueue now manages named semaphores only if it detects that procnto isn't doing so). Named semaphores appear in the pathname space under /dev/sem. The sem_* client functions handle named semaphores; for more information, see the QNX Neutrino C Library Reference.

Memory configuration options

The memory configuration characters that you can specify with the -m option include the following:

a
(QNX Neutrino 6.4.1 or later) Automatically mark memory pages that have a mem_offset() performed on it as unmovable when defragmenting physical memory. This has an effect only if defragmenting is enabled (see the -md option below). For more information, see "Automatically marking memory as unmovable" in the "Process Manager" chapter of the System Architecture guide.
~a
(QNX Neutrino 6.4.1 or later) Disable the automatic marking of memory pages as unmovable (the default).
b
Enable backward compatibility (the default).
Note: See the release notes for the current behavior.
~b
Disable backward compatibility.
c
(QNX Neutrino 6.6 or later) Clear memory when it's freed.
~c
(QNX Neutrino 6.6 or later) Don't clear memory when it's freed (the default). When memory is freed for later reuse, the contents of that memory remain untouched; whatever the application that owned the memory left behind is left intact until the next time that memory is allocated by another process. At that point, before the memory is handed to the next process, it's zeroed.
d
(QNX Neutrino 6.4.1 or later) Enable the defragmenting of physical memory (the default). For more information, see "Defragmenting physical memory" in the "Process Manager" chapter of the System Architecture guide.
~d
(QNX Neutrino 6.4.1 or later) Disable the defragmenting of physical memory.
g
(QNX Neutrino 6.6 or later) Add a guard page before any shared memory allocations. The default is not to add one.
~g
(QNX Neutrino 6.6 or later) Don't add a guard page before any shared memory allocations (the default).
i
Make munmap() act as if UNMAP_INIT_REQUIRED were specified (i.e., POSIX initialization of the page to all zeroes is required the next time the underlying physical memory is allocated). This is the default.
~i
Make munmap() act as if UNMAP_INIT_OPTIONAL were specified (i.e., initialization of the underlying physical memory to zeroes on its next allocation is optional). See "Initializing allocated memory" in the "Interprocess Communication (IPC)" chapter of the System Architecture guide.
l
("el") Lock all memory; act as if mlockall(MCL_CURRENT|MCL_FUTURE) were specified at the start of every program. For more information, see mlockall() in the QNX Neutrino C Library Reference.
~l
Don't lock all memory (the default).
L
Lock and superlock all memory; act as if ThreadCtl(_NTO_TCTL_IO,0) were specified at the start of every program (but only insofar as locking the memory; programs don't actually get I/O privileges). For more information, see "Locking memory" in the "Process Manager" chapter of the System Architecture guide.
~L
Don't lock or superlock all memory (the default).
Note: If you enable both l and L, the L option takes priority.

The memory options are processed in the order that you specify them. For example, if you specify -ml~L, the l enables locking, and then ~L clears both locking and superlocking; if you specify -m~Ll, the ~L clears locking and superlocking, and then l enables locking.

P
Turn on full allocation of high memory for all processes. This is mostly useful only for testing.
~P
Make sure that all anonymous allocation occurs below the 4 GB mark (the default).
r
(QNX Neutrino 6.5.0 or later; not supported by the QNX Neutrino RTOS Safe Kernel 1.0) Use address space layout randomization (ASLR) by default. If you use this option, the kernel places certain items (e.g., the stack, libc) at different addresses every time you run a process. This can help prevent someone from hacking into a program.

A child process normally inherits its parent's ASLR setting. You can use the on command, the SPAWN_ASLR_INVERT flag for spawn(), or the POSIX_SPAWN_ASLR_INVERT extended flag for posix_spawn() to change this setting for a new process.

~r
(QNX Neutrino 6.5.0 or later; not supported by the QNX Neutrino RTOS Safe Kernel 1.0) Don't use address space layout randomization (the default). Just as for -mr, you can change the ASLR setting when you start a process.
v
Enable variable page sizes (the default). This automatically allows for mapping to be performed with different page sizes to achieve better performance.
~v
Disable variable page sizes.
X
(QNX Neutrino 6.6 or later) Fail any attempts by mmap() or mprotect() to turn on PROT_EXEC for a memory-mapped file mapping if the file doesn't have execute permission for the client process; an error of EACCES will be given instead.
~X
(QNX Neutrino 6.6 or later) Allow mmap() or mprotect() to turn on PROT_EXEC for a memory-mapped file mapping even if the file doesn't have execute permission for the client process.
x
(QNX Neutrino 6.4.0 or later) Enable the PROT_EXEC flag for system-allocated threads (the default). This option allows gcc to generate code on the stack, which it does when taking the address of a nested function (a GCC extension).
~x
(QNX Neutrino 6.4.0 or later) Turn off PROT_EXEC for system-allocated stacks, which increases security but disallows taking the address of nested functions. You can still do this on a case-by-case basis by doing an mprotect() call that turns on PROT_EXEC for the required stacks.

The /proc filesystem

The Process Manager component of procnto implements a /proc filesystem that includes the following:

/proc/pid
Virtual directories that let you access and control every process and thread running within the system. For more information, see "Controlling processes via the /proc filesystem" in the "Processes" chapter of the QNX Neutrino Programmer's Guide.
/proc/boot/
The image filesystem that comprises the boot image. For more information, see "Making an OS Image" in Building Embedded Systems.
/proc/dumper
A special entry that receives notification when a process terminates abnormally. The dumper utility watches this entry.
/proc/mount/
Pathname-space mountpoints.
Note: If you list the contents of the /proc directory, /proc/mount doesn't show up, but you can list the contents of /proc/mount.
/proc/qnetstats
If you're using Transparent Distributed Processing (TDP), the lsm-qnet.so module places a qnetstats entry in /proc. If you open this name and read from it, the Qnet resource manager code responds with the current statistics for Qnet.
/proc/self/
The address space for yourself (i.e., for the process that's making the query).

Examples:

To disable preemption in kernel code:

procnto -p