[Previous]
[Contents]
[Next]

qnx_segment_realloc()

change the size of a segment

Synopsis:

#include <sys/seginfo.h>
unsigned qnx_segment_realloc( unsigned segment,
                              long nbytes );

Description:

The qnx_segment_realloc() function allows you to change the size of segment to nbytes. The segment must have been previously allocated. If the new size is smaller, the segment is truncated. You may only reallocate a segment that you own exclusively (that is, it can't be shared), and it is not DMA-safe.

Returns:

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

Errors:

EBUSY
The segment is shared with another process, and cannot be changed in size.
EINVAL
The parameter nbytes is 0, or the segment doesn't exist.
ENOMEM
Insufficient system memory to allocate the segment or insufficient local process manager memory to manage the segment.

Examples:

#include <i86.h>
#include <sys/seginfo.h>

void main()
  {
    unsigned base;
    char __far *p;

    /* Allocate a 32 Kbyte buffer */
    base = qnx_segment_alloc( 32768 );

    /* Now make the buffer larger */
    qnx_segment_realloc( base, 60000 );

    /* Point at byte 50,000 in the array */
    p = MK_FP( base, 50000 );

    /* Set the byte and read it back */
    *p = 'a';
    printf( "base = %u, p = %08lx\n", base, p );
    printf( "*p = %c\n", *p );
  }

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


[Previous]
[Contents]
[Next]