return the segment with the given index
#include <sys/seginfo.h>
unsigned qnx_segment_index( pid_t proc,
pid_t pid,
unsigned index );
The qnx_segment_index() function returns a segment value for the process pid using index to select the segment. The index parameter is a small integer that indexes into the process' segment table. If pid is zero, the calling process is used.
If proc is equal to zero or PROC_PID, pid is assumed to be local on this node. To obtain information on a process on another node, proc should be a virtual circuit to that node and pid should be the local process ID on that node.
A segment value is returned on success. If the segment entry exists but isn't in use, a zero is returned. If the index is greater than the number of segments in the process or the process doesn't exist, -1 is returned and errno is set.
#include <sys/kernel.h>
#include <sys/seginfo.h>
void main()
{
int i;
unsigned seg;
pid_t pid;
struct _seginfo buf;
pid = PROC_PID;
for( i = 0;
( seg = qnx_segment_index( PROC_PID, pid, i ) )
!= -1;
++i )
if( seg ) {
qnx_segment_info( PROC_PID, pid, seg, &buf );
printf( "selector = %04x, length = %08ld\n",
buf.selector, buf.nbytes );
}
}
QNX
| Safety: | |
|---|---|
| Interrupt handler | No |
| Signal handler | Yes, but modifies errno |
| Thread | Yes |
errno, qnx_segment_alloc(), qnx_segment_alloc_flags(), qnx_segment_arm(), qnx_segment_flags(), qnx_segment_free(), qnx_segment_get(), qnx_segment_huge(), qnx_segment_info(), qnx_segment_overlay_flags(), qnx_segment_overlay(), qnx_segment_put(), qnx_segment_raw_alloc(), qnx_segment_raw_free(), qnx_segment_realloc()