Annotation of researchv9/libc/gen/getshares.c, revision 1.1

1.1     ! root        1: /*LINTLIBRARY*/
        !             2: 
        !             3: /*
        !             4: **     Fill in details for lnode from ``shares'' record.
        !             5: **
        !             6: **     Returns 0 for failure, or last active time of user.
        !             7: */ 
        !             8: 
        !             9: #include       <sys/types.h>
        !            10: #include       <sys/lnode.h>
        !            11: #include       <shares.h>
        !            12: #include       <libc.h>
        !            13: 
        !            14: 
        !            15: unsigned long
        !            16: getshares(lp, uid, lock)
        !            17:        register struct lnode * lp;
        !            18:        int                     uid;
        !            19:        int                     lock;
        !            20: {
        !            21:        register long           posn;
        !            22:        Share                   share;
        !            23: 
        !            24:        lp->l_uid = uid;
        !            25:        lp->l_flags = 0;
        !            26:        lp->l_shares = 0;
        !            27:        lp->l_group = 0;
        !            28:        lp->l_usage = 0;
        !            29:        lp->l_charge = 0;
        !            30: 
        !            31:        if ( uid > MAXUID )
        !            32:                return 0;
        !            33: 
        !            34:        if ( !openshares(lock) )
        !            35:                return 0;
        !            36: 
        !            37:        posn = sizeof(Share) * uid;
        !            38: 
        !            39:        if ( lseek(ShareFd, posn, 0) == SYSERROR )
        !            40:                return 0;
        !            41: 
        !            42:        if ( read(ShareFd, &share, sizeof(Share)) != sizeof(Share) )
        !            43:                return 0;
        !            44: 
        !            45:        if ( share.l.l_uid != uid )
        !            46:                return 0;
        !            47: 
        !            48:        *lp = share.l;
        !            49: 
        !            50:        if ( share.extime == 0 )
        !            51:                return 1;
        !            52: 
        !            53:        return share.extime;
        !            54: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.