unlink a segment from a process
#include <sys/seginfo.h> int qnx_segment_free( unsigned segment );
The qnx_segment_free() function unlinks the segment segment from the currently running process. If the link count goes to zero, the memory is returned to the system. Each call to qnx_segment_get() or qnx_segment_put() increases the link count by one.
If you unlink a segment allocated using qnx_segment_overlay(), the memory isn't returned to the system.
#include <i86.h> #include <sys/seginfo.h> void main() { unsigned base; char __far *p; /* Allocate a 32 Kbyte array */ base = qnx_segment_alloc( 32768 ); /* Point at byte 16,000 in the array */ p = MK_FP( base, 16000 ); /* Set the byte and read it back */ *p = 'a'; printf( "base = %u, p = %08lx\n", base, p ); printf( "*p = %c\n", *p ); qnx_segment_free( base ); }
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_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()