|
|
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 <shares.h> ! 10: #include <libc.h> ! 11: ! 12: ! 13: unsigned long ! 14: getshares(lp, uid, lock) ! 15: register struct lnode * lp; ! 16: int uid; ! 17: int lock; ! 18: { ! 19: register long posn; ! 20: Share share; ! 21: ! 22: lp->l_uid = uid; ! 23: lp->l_flags = 0; ! 24: lp->l_shares = 0; ! 25: lp->l_group = 0; ! 26: lp->l_usage = 0; ! 27: lp->l_charge = 0; ! 28: ! 29: if ( uid > MAXUID ) ! 30: return 0; ! 31: ! 32: if ( !openshares(lock) ) ! 33: return 0; ! 34: ! 35: posn = sizeof(Share) * uid; ! 36: ! 37: if ( lseek(ShareFd, posn, 0) == SYSERROR ) ! 38: return 0; ! 39: ! 40: if ( read(ShareFd, &share, sizeof(Share)) != sizeof(Share) ) ! 41: return 0; ! 42: ! 43: if ( share.l.l_uid != uid ) ! 44: return 0; ! 45: ! 46: *lp = share.l; ! 47: ! 48: if ( share.extime == 0 ) ! 49: return 1; ! 50: ! 51: return share.extime; ! 52: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.