void CacheFini( void ) /**************************** * Called while the program is exiting */ { #if !defined( __UNIX__ ) #ifdef CACHE_STATS Glob.cachestat = 0; #endif #ifndef NDEBUG CacheRelease(); #endif #endif }
void CacheFini( void ) /**************************** * Called while the program is exiting */ { #ifdef USE_DIR_CACHE #ifdef CACHE_STATS Glob.cachestat = 0; #endif #ifndef NDEBUG CacheRelease(); #endif #endif }
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() ); }
void *LnkReAlloc( void *src, size_t size ) /****************************************/ // reallocate a block of memory. { void *dest; #ifdef TRMEM void (*ra)( void ); ra = _trmem_guess_who(); /* must be first thing */ #endif for( ;; ) { #ifdef TRMEM dest = _trmem_realloc( src, size, ra, TrHdl ); #else dest = realloc( src, size ); #endif if( dest != NULL ) break; if( !CacheRelease() && !SwapOutVirt() && !SwapOutRelocs() ) { LnkMsg( FTL + MSG_NO_DYN_MEM, NULL ); // see note 1 below } } return( dest ); }
STATIC RET_T perform( TARGET *targ, DEPEND *dep, DEPEND *impldep, time_t max_time ) /*********************************************************************************/ { CLIST *clist; CLIST *before; RET_T ret; DEPEND *depend; DEPEND *impliedDepend; depend = NULL; impliedDepend = NULL; assert( targ != NULL && dep != NULL ); if( Glob.query ) { ++cListCount; return( RET_WARN ); } if( Glob.touch ) { ++cListCount; ResetExecuted(); if( !targ->attr.symbolic ) { CacheRelease(); if( TouchFile( targ->node.name ) != RET_SUCCESS ) { PrtMsg( ERR | COULD_NOT_TOUCH, targ->node.name ); return( RET_ERROR ); } } targ->touched = true; return( RET_SUCCESS ); } /* means that this is a sufsuf made implicit rule */ if( impldep == NULL ) { clist = dep->clist; depend = dep; impliedDepend = NULL; } else { clist = impldep->clist; depend = targ->depend; impliedDepend = dep; } if( clist == NULL ) { clist = DotCList( DOT_DEFAULT ); if( clist == NULL ) { // No commands in Microsoft and POSIX mode is considered OK // and executed if( Glob.compat_nmake || Glob.compat_posix ) { targ->cmds_done = true; return( RET_SUCCESS ); } if( targ->attr.symbolic != false ) { targ->cmds_done = true; return( RET_SUCCESS ); } if( targ->allow_nocmd ) { /* for UNIX folks: make target symbolic */ targ->attr.symbolic = true; return( RET_SUCCESS ); } PrtMsg( FTL | NO_DEF_CMDS_FOR_MAKE, DotNames[DOT_DEFAULT], targ->node.name ); ExitFatal(); } } if( !Glob.noexec ) { ResetExecuted(); } if( !doneBefore ) { before = DotCList( DOT_BEFORE ); if( before != NULL ) { ++cListCount; if( ExecCList( before ) != RET_SUCCESS ) { PrtMsg( FTL | S_COMMAND_RET_BAD, DotNames[DOT_BEFORE] ); ExitFatal(); } } doneBefore = true; } exPush( targ, depend, impliedDepend ); ret = carryOut( targ, clist, findMaxTime( targ, dep, max_time ) ); exPop(); if( ret == RET_ERROR ) { ExitError(); } return( ret ); }
STATIC RET_T carryOut( TARGET *targ, CLIST *clist, time_t max_time ) /******************************************************************/ { CLIST *err; int i; struct utimbuf times; char msg[max( MAX_RESOURCE_SIZE, _MAX_PATH )]; assert( targ != NULL && clist != NULL ); ++cListCount; if( ExecCList( clist ) == RET_SUCCESS ) { if( Glob.rcs_make && !Glob.noexec && !Glob.touch ) { if( max_time != OLDEST_DATE ) { targ->date = max_time; targ->backdated = true; if( TrySufPath( msg, targ->node.name, NULL, false ) == RET_SUCCESS ) { if( USE_AUTO_DEP( targ ) ) { // target has auto dependency info // result: max_time may be incorrect! CacheRelease(); checkForAutoDeps( targ, msg, &max_time ); } times.actime = max_time; times.modtime = max_time; utime( msg, × ); CacheRelease(); } } } targ->cmds_done = true; return( RET_SUCCESS ); } /* * ok - here is something I don't like. In this portion of code here, * carryOut is ignoring the target passed to it, and digging the targets * out of the stack. Be careful of changes. */ PrtMsg( ERR | NEOL | LAST_CMD_MAKING_RET_BAD ); for( i = exStackP - 1; i >= 0; --i ) { PrtMsg( ERR | NEOL | PRNTSTR, exStack[i].targ->node.name ); if( i > 0 ) { PrtMsg( ERR | NEOL | PRNTSTR, ";" ); } } MsgGetTail( LAST_CMD_MAKING_RET_BAD, msg ); PrtMsg( ERR | PRNTSTR, msg ); err = DotCList( DOT_ERROR ); if( err != NULL ) { ++cListCount; if( ExecCList( err ) != RET_SUCCESS ) { PrtMsg( FTL | S_COMMAND_RET_BAD, DotNames[DOT_ERROR] ); ExitFatal(); } } else if( !(targ->attr.precious || targ->attr.symbolic) ) { if( !Glob.hold && targExists( targ ) ) { if( Glob.erase || GetYes( SHOULD_FILE_BE_DELETED ) ) { if( unlink( targ->node.name ) != 0 ) { PrtMsg( FTL | SYSERR_DELETING_ITEM, targ->node.name ); ExitFatal(); } } } } if( Glob.cont ) { return( RET_WARN ); } return( RET_ERROR ); }