examine and modify the system flags word on a node
#include <sys/osinfo.h> #include <sys/utsname.h> int qnx_sflags( nid_t nid, long bits, long mask, long *old_bits, long *new_bits );
The qnx_sflags() function lets you examine and modify the system flags word on the node identified by nid. If nid is zero, the current node is used. Many bits are maintained by the system and may not be changed using this function. They're marked as read-only (RO).
At least the following flag bits are defined in <sys/osinfo.h>:
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 shows how bits and mask are applied:
bitvalue = (bitvalue & ~mask) | (bits & mask);
#include <stdio.h> #include <sys/osinfo.h> void main() { long bits, old_bits; /* Read current value without changing */ qnx_sflags( 0, 0, 0, &old_bits, 0 ); if ( old_bits & _PSF_PROTECTED ) printf("We are in protected mode.\n"); }
QNX
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | Yes, but modifies errno |
Thread | Yes |