[Previous]
[Contents]
[Next]

qnx_pflags()

examine and modify the system flags control word of the process

Synopsis:

#include <sys/psinfo.h>
int qnx_pflags( long bits, long mask,
                long *old_bits, long *new_bits );

Description:

The qnx_pflags() function lets you examine and modify the system flags word of the currently running process. Some bits are maintained by the system and may not be changed using this function. They are marked as read-only (RO).

At least the following flag bits are defined:

_PPF_IMMORTAL
The process can catch, ignore or mask SIGKILL.
_PPF_INFORM
Request death messages.
Caution: Don't spawn processes while the _PPF_INFORM flag is set - your process and Proc will become Send-blocked.

It's best not to use this flag at all; use a I/O manager (or resource manager) and watch for _IO_CLOSE messages from the processes you're interested in.


_PPF_FIXED
Segments won't be relocated in memory.
_PPF_FLAT
The process is running in flat model (RO).
_PPF_PRIORITY_REC
Have received messages queue in priority order.
_PPF_PRIORITY_FLOAT
Adjust priority to match that of received message. If a process sets this flag, the messages sent to it are ordered as if _PPF_PRIORITY_REC were set as well.
_PPF_NOCLDSTOP
The process has a handler for SIGCHLD.
_PPF_SIGCATCH
Request signal messages.
_PPF_SERVER
The process is a server that accepts messages. In particular, it accepts and replies to system message code 0 defined in <sys/sys_msg.h>.
_PPF_32BIT
The process is running in 32-bit mode (RO).
_PPF_VID
The process is virtual (RO).
_PPF_MID
The process is a messenger proxy (RO).
_PPF_VMID
The process is a virtual messenger proxy (RO).
_PPF_EXECING
The process is currently being executed (RO).
_PPF_LOADING
The process is currently being loaded (RO).
_PPF_TERMING
The process is currently being terminated (RO).
_PPF_TO_BE_HELD
The process is to be held when next made ready (RO).
_PPF_NOZOMBIE
The process won't become a zombie on death (RO).
_PPF_SLEADER
The process is a session leader (RO).

The mask argument selects which bits are changed, while the bits argument sets the new value. A 1-bit in mask changes that bit. If the pointers to old_bits and new_bits aren't NULL, they're used to store the values for the bits before and after the call.

The following C code illustrates how bits and mask are applied:

bitvalue = (bitvalue & ~mask) | (bits & mask);

Returns:

0
Success
-1
An error occurred. errno is set to indicate the error.

Errors:

EPERM
You don't have sufficient permissions to change one or more flags.

Examples:

#include <stdio.h>
#include <sys/psinfo.h>

void main()
  {
    long bits, old_bits;

    /* Read current value without changing */
    qnx_pflags( 0, 0, &old_bits, 0 );

    /* Jam load new value */
    bits = old_bits;
    qnx_pflags( bits, bits, 0, 0 );

    /* OR in some bits */
    qnx_pflags( ~0, _PPF_PRIORITY_REC, 0, 0 );

    /* AND off some bits */
    qnx_pflags( 0, _PPF_PRIORITY_REC, 0, 0 );
  }

Classification:

QNX

Safety:
Interrupt handler No
Signal handler Yes, but modifies errno
Thread Yes

See also:

errno, qnx_psinfo()


[Previous]
[Contents]
[Next]