posix_spawnattr_settypeid()

Updated: April 19, 2023

Set the type identifier of a spawn attributes object

Synopsis:

#include <spawn.h>

int posix_spawnattr_settypeid(
       posix_spawnattr_t *attrp, uint32_t type_id);

Arguments:

attrp
A pointer to the spawn attributes object that you want to modify.
type_id
The type identifier to associate with the spawned process.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

A type identifier associates a process or channel with a set of rules in order to protect or restrict it. The security policy contains the rules for all type identifiers. To learn more about security policies, see Security Policies in the System Security Guide.

This function is equivalent to calling secpol_posix_spawnattr_settypeid(), but secpol_posix_spawnattr_settypeid() is simpler to use and allows a process to work both with and without security policies.

The posix_spawnattr_settypeid() function sets the type_id attribute in the spawn attributes object pointed to by attrp. You must have already initialized the spawn attributes object by calling posix_spawnattr_init(). In order for the type identifier to take effect:

The calling process must have the PROCMGR_AID_SETTYPEID ability with a range that includes this type identifier.
Note: While a process inherits its parent's type identifier by default, the effect may not be identical to spawning with the same type identifier set with posix_spawnattr_settypeid(). When you use posix_spawnattr_settypeid(), the abilities of the child process are reset to those that the security policy indicates the type should have even if they differ from the parent. When a child acquires its type identifier through inheritance, it also inherits its parent's procmgr abilities.

For more information about spawn attributes, see the entry for posix_spawn().

Note: This function is a QNX Neutrino extension.

Returns:

EOK
Success.
EINVAL
The value specified by attrp or type_id was invalid.

Classification:

QNX Neutrino

Safety:  
Cancellation point No
Interrupt handler Yes
Signal handler Yes
Thread Yes