procnto*

Microkernel and process manager (QNX Neutrino)

Note: The safety and standard versions of procnto use different default values for some of the command-line options. If you're using the QNX OS for Safety, see the entry for procnto included in Installing and Using the QNX OS for Safety.

Syntax:

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

Runs on:

QNX Neutrino

Options:

Note: Some options accept a tilde (~) that clears the boolean value.
-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.
Note: The -ad option isn't supported on any currently supported platform.
-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.
-d umask
(QNX Neutrino 6.6 or later) Use the given file-creation mask (umask) when creating the /proc/pid/cmdline and /proc/pid/ctl files. If you don't specify this option, procnto uses a mask of 0022. Access to these files is governed by a combination of POSIX permissions and process-manager abilities. For more information, see Controlling processes via the /proc filesystem in the “Processes” chapter of the QNX Neutrino Programmer's Guide.
-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, -~fe
Force (-fe) or don't force (-~fe) 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 the -fe option to simulate a system with no FPU.
-h, -~h
Disable (-h) or enable (-~h) 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. The default is to enable CPU halting. Be aware of any errata for your hardware and contact us if you need help working around them.
-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, -~p
Disable (-p) or enable (-~p) kernel preemption. Disabling kernel preemption prevents threads that are 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. The default is to enable kernel preemption.

This option doesn't interfere with adaptive partitioning because preemption checks are independent of adaptive partitioning and are based strictly on priority.

-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.
-s, -~s
(QNX Neutrino 7.0.1 or later) Enable (-s) or disable (-~s) safe shared mutexes. The problem with user-mode mutexes is that any thread can claim that any other thread is the owner of the mutex, which, when priority inheritance is applied, means that the latter's priority is boosted to that of the former. A shared mutex is safe if either every lock and unlock call goes through the kernel, or the mutex doesn't impact priority (i.e., it uses the PTHREAD_PRIO_NONE protocol). If you use this option, you should set the process-shared attribute to PTHREAD_PROCESS_SHARED for any barriers, mutexes, and reader/writer locks that are shared between processes. For more information, see Safely sharing mutexes, barriers, and reader/writer locks between processes in the QNX Neutrino Microkernel” chapter of the System Architecture guide.

If you specify the -s option, the kernel rejects any attempts to lock a PTHREAD_PRIO_INHERIT mutex whose owner isn't known to the kernel and that the locking thread claims is from a different process. In this case, pthread_mutex_lock() and SyncMutexLock() give an error of EINVAL.

-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 /proc/pid/as, /proc/pid/execfile, /proc/pid/mappings, /proc/pid/pmap, and /proc/pid/vmstat files. If you don't specify this option, procnto uses a mask of 0066. Access to these files is governed by a combination of POSIX permissions and process-manager abilities. For more information, see Controlling processes via the /proc filesystem in the “Processes” chapter of the QNX Neutrino Programmer's Guide.
-v[v]..., -~v
Be verbose; specifying more v characters increases the verbosity. If you specify the -v option, you'll get more useful information when a process is terminated by a signal. If you specify -~v, verbosity is turned off.

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.

There are different versions of procnto for different processors (see the Board Support Package for your board for specific information). The most common version is procnto-smp-instr, which runs on single- or multicore systems and is instrumented for system analysis. For more information, see the System Analysis Toolkit User's Guide and the Analyzing Performance chapter of the IDE User's Guide.

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

    (QNX Neutrino 7.0.1 or later) If you're running a safety version of the kernel, the release level includes an uppercase “S”.

  • You can use the appropriate startup-* command's -P option to specify the maximum number of CPUs to activate.

The kernel also manages named semaphores, which 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:

b
Enable backward compatibility (the default).
Note: See the release notes for the current behavior.
~b
Disable backward compatibility.
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).
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
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 superlock all memory (the default).
Note: If you enable both l and L, the L option takes priority.
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.
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 OS Images in Building Embedded Systems.
/proc/config
(QNX Neutrino 7.0.1 or later) A virtual file that summarizes the configuration settings for procnto. Here's some sample output:
# cat /proc/config
align_fault:off
fd_close_timeout:30
fpuemul:0
ker_verbose:1
maxfds:1000
nohalt:0
nopreempt:1
pregrow_size:65536
priv_prio.prio:64
priv_prio.saturate:0
procfs_ctl_umask:022
procfs_umask:066
shutdown_stack_len:128/0
safe_shared_mutexes:1
thread_stack_prot:NOEXEC
mmflags:0x19 (BACKWARDS_COMPAT,LOCKALL,SUPERLOCKALL)
  

The settings correspond to the command-line options as follows:

Field Option Description
align_fault -ad, -ae, -as Indicates whether unaligned accesses cause a fault; off or on. Disabling unaligned access emulation with the command-line option enables the generation of a fault on an unaligned access.
fd_close_timeout -T The time, in seconds, to wait for a close() to succeed in the event of a process termination
fpuemul -fe, -~fe Set when floating-point emulation is active, either because -fe was given, or because the device has no FPU.
ker_verbose -v The verbosity level
maxfds -F The maximum number of file descriptors that can be open at the same time
nohalt -h, -~h Whether or not CPU halting is disabled in the idle thread; 0 or 1
nopreempt -p Whether or not kernel preemption is disabled; 0 or 1
pregrow_size -H The initial heap size for procnto, in bytes
priv_prio.prio -P The lower end of the range of privileged priorities
priv_prio.saturate -P Whether or not out-of-range priority requests use the maximum allowed value (reach a “maximum saturation point”) instead of resulting in an error
procfs_ctl_umask -d The file-creation mask, in octal, used for the /proc/pid/ctl entries
procfs_umask -u The file-creation mask, in octal, used for the /proc/pid/as entries
shutdown_stack_len -S The number of bytes after and before the stack pointer to include in a kernel dump
safe_shared_mutexes -s Whether or not the kernel rejects any attempts to lock priority-impacting mutexes whose owner isn't known to the kernel and that the locking thread claims is from a different process; 0 or 1
thread_stack_prot -mx, -m~x Whether or not the PROT_EXEC flag is enabled for system-allocated threads; EXEC or NOEXEC

The mmflags field indicates which memory-management flags are set. You can use the -m command-line option to set some. The flags include the following:

Flag Option Description
BACKWARDS_COMPAT -mb Backward compatibility is enabled
CACHEOP_NOCACHE None Because of a specific chip erratum, cache operations can't be done on non-cacheable memory
LOCKALL -ml, -mL All memory is locked
RANDOMIZE -mr Address space layout randomization (ASLR) is being used
REQUIRE_EXEC -mX Any attempts by mmap() or mprotect() to turn on PROT_EXEC for a memory-mapped file mapping fail if the file doesn't have execute permission for the client process
SHMEM_GUARD -mg Add a guard page before any shared memory allocations
SUPERLOCKALL -mL All memory is superlocked
/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).
/proc/vm/stats
A global view of the state of virtual memory in the system.

Examples:

To disable preemption in kernel code:

procnto-smp-instr -p