Beispiel #1
0
int __FreeSeg( __segment seg )
{
#if defined(__QNX__)
    if( qnx_segment_free( seg ) == -1 ) {
        return( -1 );
    }
#elif defined(__WINDOWS__)
    if( __DoFreeSeg( seg ) ) {
        return( -1 );
    }
#elif defined(__OS2__)
    APIRET  rc;

    rc = __DoFreeSeg( seg );
    if( rc ) {
        return( __set_errno_dos( rc ) );
    }
#else
    tiny_ret_t rc;

    rc = TinyFreeBlock( seg );
    if( TINY_ERROR( rc ) ) {
        return( __set_errno_dos( TINY_INFO( rc ) ) );
    }
#endif
    return( 0 );
}
Beispiel #2
0
bool FreeUpMemory( void )
/***********************/
// make sure LnkReAlloc is kept up to date with what is put in here.
{
#if defined( __QNX__ )
    if( LastChanceSeg != (unsigned)-1 ) {
        /*
            If we're low on memory, the system is low on memory. Give
            something back to the OS so it can do it's job, and don't
            ever ask it for anything more.
        */
        qnx_segment_free( LastChanceSeg );
        LastChanceSeg = -1;
        _heapenable( 0 );
    }
#endif
    return( PermShrink() || CacheRelease() || SwapOutVirt() || SwapOutRelocs() );
}
Beispiel #3
0
_WCRTLINK void (hfree)( void_hptr cstg )
{
    unsigned            seg;
    unsigned            incr;
    struct _seginfo     info;

    if( cstg != NULL ) {
        incr = 1 << _HShift;
        seg = FP_SEG( cstg );
        for( ;; ) {
            if( qnx_segment_info( 0, _my_pid, seg, &info ) != seg )
                break;
            qnx_segment_free( seg );
            if( (info.flags & _PMF_HUGE) == 0 )
                break;
            seg += incr;
        }
    }
}
Beispiel #4
0
static bool setupscrnbuff( int srows, int scols )
/***********************************************/
{
    LP_PIXEL    scrn;
    int         num;
    int         i;
    int         rows;
    int         cols;

    if( dev_size( UIConHandle, -1, -1, &rows, &cols ) == -1 )
        return( false );
    if( rows == 0 ) {
        rows = srows;
        if( rows == 0 ) {
            rows = lines;
            if( rows == 0 ) {
                rows = 25;
            }
        }
    }
    if( cols == 0 ) {
        cols = scols;
        if( cols == 0 ) {
            cols = columns;
            if( columns == 0 ) {
                cols = 80;
            }
        }
    }

    UIData->width = cols;
    UIData->height = rows;
    UIData->cursor_type = C_NORMAL;

    num = UIData->width * UIData->height * 2;
    scrn = UIData->screen.origin;
#if defined( __386__ )
    scrn = realloc( scrn, num );
    if( scrn == NULL )
        return( false );
    if( (shadow = realloc( shadow, num )) == NULL ) {
        free( scrn );
        return( false );
    }
#else
    {
        unsigned        seg;

        if( scrn == NULL ) {
            seg = qnx_segment_alloc( num );
        } else {
            seg = qnx_segment_realloc( FP_SEG( scrn ), num );
        }
        if( seg == -1 )
            return( false );
        scrn = MK_FP( seg, 0 );
        if( shadow == NULL ) {
            seg = qnx_segment_alloc( num );
        } else {
            seg = qnx_segment_realloc( FP_SEG( shadow ), num );
        }
        if( seg == -1 ) {
            qnx_segment_free( FP_SEG( scrn ) );
            return( false );
        }
        shadow = MK_FP( seg, 0 );
    }
#endif
    save_cursor_type = -1; /* C_NORMAL; */
    num /= 2;
    for( i = 0; i < num; ++i ) {
        scrn[i].ch = ' ';       /* a space with normal attributes */
        scrn[i].attr = 7;       /* a space with normal attributes */
    }
    UIData->screen.origin = scrn;
    UIData->screen.increment = UIData->width;
    return( true );
}
Beispiel #5
0
void free_clk_pntr (void *phys) {
	phys = phys;
	qnx_segment_free(sel);
}