[Previous]
[Contents]
[Next]

qnx_sflags()

examine and modify the system flags word on a node

Synopsis:

#include <sys/osinfo.h>
#include <sys/utsname.h>
int qnx_sflags( nid_t nid,
                long bits, long mask,
                long *old_bits, long *new_bits );

Description:

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>:

_PSF_PROTECTED (RO)
The cpu is running in protected mode.
_PSF_NDP_INSTALLED (RO)
There is an 80x87 installed.
_PSF_EMU16_INSTALLED (RO)
There is a 16-bit 80x87 emulator running. Set when the emulator starts and cleared if it terminates.
_PSF_EMU32_INSTALLED (RO)
There is a 32-bit 80387 emulator running. Set when the emulator starts and cleared if it terminates.
_PSF_32BIT (RO)
A 32-bit version of QNX is running.
_PSF_RESERVE_DOS (RO)
Lower 640K reserved for DOS.

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);

Returns:

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

Errors:

EPERM
The calling process doesn't have sufficient privilege to change the system flags.

Examples:

#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");
  }

Classification:

QNX

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

See also:

errno, qnx_psinfo()


[Previous]
[Contents]
[Next]