change the size of a segment
#include <sys/seginfo.h> unsigned qnx_segment_realloc( unsigned segment, long nbytes );
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.
A segment number on success. On error, -1 is returned and errno is set.
#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 ); }
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_index(), qnx_segment_info(), qnx_segment_overlay_flags(), qnx_segment_overlay(), qnx_segment_put(), qnx_segment_raw_alloc(), qnx_segment_raw_free()