Example #1
0
/* enlist the current directory. */
F
FEnlDir(
    register AD *pad
    )
{
    F fOk;

    CheckForBreak();

    if (!FLoadStatus(pad, lckAll, flsExtraEd)) {
        Warn("not yet enlisted in %&P/C, enlist again later\n", pad);
        return fTrue;            /* keep trying other dirs */
    }

    if (pad->iedCur != iedNil) {
        Warn("directory %!&/U/Q already enlisted in %&P/C\n", pad, pad);
        FlushStatus(pad);
        return fTrue;
    }

    OpenLog(pad, fTrue);

    AddCurEd(pad, (pad->flags&flagGhost) != 0);
    FUpdateIedCache(pad->iedCur, pad);

    if (pad->flags&flagSyncFiles)
        MarkAll(pad);
    else
        MarkAllDirOnly(pad);
    fOk = FSyncMarked(pad, NULL);

    CloseLog();

    FlushStatus(pad);

    return fOk;
}
Example #2
0
RET_T Update( TARGET *targ )
/*********************************/
{
    DEPEND      *curdep;
    UINT32      startcount;
    bool        target_exists;
    RET_T       ret;

    CheckForBreak();
    if( targ->error ) {
        return( RET_ERROR );
    }
    if( targ->updated ) {
        return( RET_SUCCESS );
    }
    if( targ->special ) {
        PrtMsg( FTL | ATTEMPT_MAKE_SPECIAL, targ->node.name );
        ExitFatal();
    }
    if( targ->busy ) {
        PrtMsg( FTL | RECURSIVE_DEFINITION, targ->node.name );
        ExitFatal();
    }
    PrtMsg( DBG | INF | NEOL | UPDATING_TARGET, targ->node.name );
    targ->busy = true;
    targExists( targ );     /* find file using sufpath */
    startcount = cListCount;

    if( targ->depend == NULL || (targ->depend->clist == NULL && targ->depend->targs == NULL) ) {
        /* has no depend/explicit rules */
        PrtMsg( DBG | INF | M_EXPLICIT_RULE, M_NO );
        ret = tryImply( targ, false );
        if( ret == RET_ERROR ) {
            targ->busy = false;
            targ->error = true;
            return( RET_ERROR );
        } else if( ret == RET_WARN ) {
            // If target with no commands is acceptable, consider it done
            if( targ->allow_nocmd ) {
                targ->cmds_done = true;
            }
        }
    } else if( !targ->scolon ) {
        /* double colon */
        PrtMsg( DBG | INF | M_EXPLICIT_RULE, M_DCOLON );
        for( curdep = targ->depend; curdep != NULL; curdep = curdep->next ) {
            if( resolve( targ, curdep ) != RET_SUCCESS ) {
                targ->busy = false;
                targ->error = true;
                return( RET_ERROR );
            }
        }
        if( !Glob.compat_nmake ) {
            if( tryImply( targ, false ) == RET_ERROR ) {
                targ->busy = false;
                targ->error = true;
                return( RET_ERROR );
            }
        }
    } else {
        PrtMsg( DBG | INF | M_EXPLICIT_RULE, M_SCOLON );
        if( resolve( targ, targ->depend ) != RET_SUCCESS ) {
            targ->busy = false;
            targ->error = true;
            return( RET_ERROR );
        }
    }

    if( (targ->attr.symbolic || Glob.noexec || Glob.query)
        && startcount != cListCount ) {
        targ->existing = true;
        targ->touched = true;
        targ->executed = false;
        targ->date = YOUNGEST_DATE;
    }

    target_exists = targExists( targ );
    if( target_exists || targ->attr.symbolic || Glob.ignore ) {
        // Target exists or it is symbolic or we're ignoring errors,
        // therefore everyone's happy and we can charge forward
        PrtMsg( DBG | INF | TARGET_IS_UPDATED, targ->node.name );
    } else {
        // Target doesn't exist, we may be in trouble
        if( targ->cmds_done && Glob.nocheck ) {
            // Target doesn't exist even though we processed some commands,
            // but we're not checking existence of files. Consider it uptodate.
            targ->existing = true;
            PrtMsg( DBG | INF | TARGET_FORCED_UPTODATE, targ->node.name );
        } else if( Glob.cont ) {
            // Target doesn't exist but we're forcibly continuing. Report
            // nonfatal error.
            targ->error = true;
            targ->busy = false;
            PrtMsg( ERR | UNABLE_TO_MAKE, targ->node.name );
            return( RET_ERROR );
        } else {
            // Target doesn't exist and we have no clue how to make it. Bomb out.
            PrtMsg( FTL | UNABLE_TO_MAKE, targ->node.name );
            ExitFatal();
        }
    }

    targ->updated = ( !targ->attr.multi );
    targ->busy = false;
    targ->error = false;
    return( RET_SUCCESS );
}
Example #3
0
EnableAssert

F
FEnlInit(
    AD *pad
    )
{
    PTH pthEtc[cchPthMax];
    PTH pthSrc[cchPthMax];
    PTH pthDiff[cchPthMax];
    PTH pthCur[cchPthMax];
    PTH *pth;

    CheckForBreak();

    CheckProjectDiskSpace(pad, cbProjectFreeMin);

    ChkPerms(pad);

    if (!FPthExists(pth = SzPrint(pthEtc, szEtcPZ, pad, (char *)NULL), fTrue) ||
        !FPthExists(pth = SzPrint(pthSrc, szSrcPZ, pad, (char *)NULL), fTrue) ||
        !FPthExists(pth = SzPrint(pthDiff, szDifPZ, pad, (char *)NULL), fTrue))
        FatalError("directory %s does not exist\n", pth);

    /* we key the existence of the project on the status file */
    if (!FPthExists(PthForStatus(pad, pth), fFalse))
        FatalError("project %&P does not exist\n", pad);

    if (FPthExists(SzPrint(pth, "%&/U/Q/R", pad), fFalse)) {
        AD ad;

        CopyAd(pad, &ad);    /* copy current values */
        FLoadRc(&ad);        /* load what's in the rc file */

        /* if this is not the same project, warn the user, but continue
           with the enlist.  This allows overlaid project directories.
        */
        if (NmCmp(pad->nmProj, ad.nmProj, cchProjMax) != 0 ||
            PthCmp(pad->pthSRoot, ad.pthSRoot) != 0 ||
            PthCmp(pad->pthURoot, ad.pthURoot) != 0 ||
            PthCmp(pad->pthSSubDir, ad.pthSSubDir) != 0 ||
            PthCmp(pad->pthUSubDir, ad.pthUSubDir) != 0) {
            // OK, now we *think* we're already enlisted.  Are we?
            F fOk = fTrue;

            if (FLoadStatus(pad, lckNil, flsNone)) {
                if (pad->iedCur != iedNil) {
                    Warn("directory %!&/U/Q already enlisted in %&P/C\n", &ad, &ad);
                    fOk = FQContinue();
                }
                FlushStatus(pad);
            }
            if (!fOk)
                return fFalse;
        }
    }

    /* Warn if the user is enlisting under the etc, src, or diff dirs. */
    PthForUDir(pad, pthCur);
    if (FPthPrefix(pthEtc,  pthCur, pth) ||
        FPthPrefix(pthSrc,  pthCur, pth) ||
        FPthPrefix(pthDiff, pthCur, pth))
        Warn("enlisting from a subdirectory of the SLM system\n");

    /* Check for user on net drive or if volume label already enlisted */
    ChkDriveVol(pad);

    return fTrue;
}
Example #4
0
VOID
DumpSharedNode(
    PVOID SharedNodeSplayLinks,
    ULONG Indent
    )
/*++

    Purpose:

        Dump a shared lock node

    Arguments:

        SharedNodeSplayLinks        - splay links of an exclusive node

        Indent                      - indent level to use

    Return:

        None

--*/
{
    LOCKTREE_NODE LockTreeNode, *pLockTreeNode;
    SH_LOCK ShLock, *pShLock;
    SINGLE_LIST_ENTRY *pLink;

    pLockTreeNode = LockTreeAddress(SharedNodeSplayLinks);

    if (!ReadAtAddress(pLockTreeNode, &LockTreeNode, sizeof(LOCKTREE_NODE), &pLockTreeNode)) {

        return;
    }

    MakeSpace(Indent);

    dprintf("%sLockTreeNode @ %08x ("
            "P = %08x  R = %08x  L = %08x)\n",
            Space,
            pLockTreeNode,
            LockTreeAddress(DbgRtlParent(LockTreeNode.Links)),
            LockTreeAddress(DbgRtlRightChild(LockTreeNode.Links)),
            LockTreeAddress(DbgRtlLeftChild(LockTreeNode.Links)));

    RestoreSpace(Indent);

    for (pLink = LockTreeNode.Locks.Next;
         pLink;
         pLink = ShLock.Link.Next) {

        CheckForBreak();

        pShLock = CONTAINING_RECORD( pLink, SH_LOCK, Link );

        if (!ReadAtAddress(pShLock, &ShLock, sizeof(SH_LOCK), &pShLock)) {

            return;
        }
    
        MakeSpace(Indent);

        dprintf("%sLock @ %08x\n", Space, pShLock);

        RestoreSpace(Indent);

        DumpFileLockInfo(&ShLock.LockInfo, Indent);
    }
}