[Previous]
[Contents]
[Next]

qnx_segment_arm()

arm a segment, so other processes have permission to use it

Synopsis:

#include <sys/seginfo.h>
int qnx_segment_arm( pid_t pid,
                     unsigned segment,
                     unsigned flags );

Description:

This qnx_segment_arm() function arms segments so that other processes have permission to share them. The other process is selected by pid, and the segment by segment. This function is used in conjunction with the qnx_segment_get() and qnx_segment_put() functions.

Before a process may get a segment from you or give a segment to you, you must call this function to grant it access. Each of the three parameters controls one aspect of the access. The defaults set when your process starts are:

qnx_segment_arm( my_pid, -1, 0 );

You don't need to call this function to get/put segments to yourself. This often occurs when you share your own segment with two access modes, typically read/write data and code.

There are two cases to consider when calling qnx_segment_arm():

The two processes would typically use messages to communicate the desire to pass a segment and the segment's value.

The pid argument indicates who is allowed to get/put a segment. The possible values are as follows:

pid = 0
No process
pid = -1
Any process
pid < 0
Member of process group -pid
Otherwise
the particular process id

The seg argument indicates the segment to which you are granting access. It may have the following values:

seg = 0
No segment
seg = -1
Any segment
Otherwise
the particular segment

The flags argument is used in conjunction with the qnx_segment_get() function only. When another process gets a segment from you, it inherits the flags on this segment. You may override the values of the following flags by setting them in addition to the _PMF_INUSE flag:

In this case, you MUST specify all flags that you want passed to the new segment. A value of zero for flags causes the new segment to inherit the flags unmodified.

Returns:

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

Errors:

At this time, there are no known reasons for qnx_segment_arm() to fail.

Examples:

See qnx_segment_get() and qnx_segment_put().

Classification:

QNX

Safety:
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

errno, qnx_segment_alloc(), qnx_segment_alloc_flags(), qnx_segment_flags(), qnx_segment_free(), qnx_segment_get(), qnx_segment_huge(), qnx_segment_index(), qnx_segment_info(), qnx_segment_overlay_flags(), qnx_segment_overlay(), qnx_segment_put(), qnx_segment_raw_alloc(), qnx_segment_raw_free(), qnx_segment_realloc()


[Previous]
[Contents]
[Next]