[Previous]
[Contents]
[Next]

qnx_segment_info()

get information on a segment owned by a given process

Synopsis:

#include <sys/seginfo.h>
unsigned qnx_segment_info( pid_t proc, pid_t pid,
                           unsigned segment,
                           struct _seginfo *buf );

Description:

The qnx_segment_info() function allows you to get information on segment segment owned by process pid. The information is placed in buf. This information includes the segment's location, its size in bytes and its access flags.

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.

The _seginfo() structure contains at least the following members:

short unsigned selector
The memory segment.
short unsigned flags
The type of segment, using QNX's defined flags, not Intel's.
long addr
If the _PMF_DMA_SAFE flag is set, then the physical address in real memory is returned. Otherwise the virtual address is returned.
Note: Take care if this address is passed to qnx_segment_overlay(), since it assumes a physical address. The qnx_segment_overlay_flags() function allows you to specify either a physical or virtual address.

long nbytes
The size of the segment.

Returns:

A segment number on success. On error, it returns -1, and errno is set.

Errors:

ESRCH
Process pid doesn't exist.
EINVAL
The pid isn't associated with the indicated segment.

Examples:

#include <i86.h>
#include <stdio.h>
#include <sys/seginfo.h>
void main()
  {
    struct _seginfo buf;
    unsigned char msg[100];
    unsigned seg;


    seg = FP_SEG( msg );
    qnx_segment_info( 0, 0, seg, &buf );
    printf( "Seg %4.4x  Offset %8.8lx  Size %ld\n",
         buf.selector, buf.addr, buf.nbytes );
  }

Classification:

QNX

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

See also:

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_index(), qnx_segment_overlay_flags(), qnx_segment_overlay(), qnx_segment_put(), qnx_segment_raw_alloc(), qnx_segment_raw_free(), qnx_segment_realloc()


[Previous]
[Contents]
[Next]