GG.SPY@ISUMVS.BITNET ("John Hascall") (06/30/88)
> Date: Fri, 29 Apr 88 14:17:00 N > Sender: INFO-VAX Discussion <INFO-VAX@UBVM> > From: ARJAN%HROEUR51.BITNET@CUNYVM.CUNY.EDU > Subject: How to find the next available UIC > To: John Hascall <GA.JPH@ISUMVS> > > Whenever we want to add new users to sysuaf.dat, we try to find > the next uic available for this new user. (For accounting reasons > we do NOT use any uic that has been used before). The only way I > could think of was to scan sysuaf.dat completely, using $IDTOASC > in a wildcard operation, translate the usernames back to individual > UIC's with $ASCTOID, then examining the group and member value, thus > finding the highest member value of the specified group. > But this takes about THIRTY times as much cpu time as does AUTHORIZE > with a SHOW [XXXX,*]/BRIEF > > Does anybody know which calls authorize might be using ? > > ARJAN@HROEUR51.BITNET > ------- I do a very similar thing (except that I will re-use UICs). What I do is scan RIGHTSLIST by opening it for keyed access and repeatedly call SYS$GET with successively larger key-values (I can stop as soon as I get RMS$_RNF--you will need to look at all 64K possible members I guess). Here are some fragments, hope they are some help: .psect CODE,RD,NOWRT,EXE ; ; stat = open_right(context) ; : : $FAB_STORE FAB=FFU_$S_FAB(R11) - DNA=@RIGHTSFDEF+4,- DNS=RIGHTSFDEF,- FAC=<GET>,- FNA=@RIGHTSFNAM+4,- FNS=RIGHTSFNAM,- ORG=<IDX>,- SHR=<DEL,GET,PUT,UPD>,- XAB=FFU_$S_KEY0(R11) : $RAB_STORE RAB=FFU_$S_RAB(R11),- FAB=FFU_$S_FAB(R11),- RAC=<KEY>,- UBF=FFU_$S_RECORD(R11),- USZ=#64 : ; ; member = find_free_uic(context,min_group,max_group,flags) ; .entry FIND_FREE_UIC,M<R2,R3,R4,R5,R10,R11> SUBL2 #4,SP MOVL SP,R10 MOVL 4(AP),R11 $RAB_STORE RAB=FFU_$S_RAB(R11),- KBF=(R10),- KSZ=#4,- KRF=#0,- ROP=<RRL> MOVZWL 8(AP),R2 ; R2 is (current) group CLRLR 3 ; R3 is (attempted) member MOVL 12(AP),R4 ; R4 is max member MOVL 16(AP),R5 ; R5 is flags BBC #3,R5,5$ ; do not start at member 0? INCL R3 ; then start at member 1 5$: MOVL R3,(R10) INSV R2,#16,#14,(R10) PUSHAL FFU_$S_RAB(R11) CALLS #1,gSYS$GET BLBC R0,10$ BBS #0,R5,7$ ; always start a new group? INCL R3 CMPL R3,#65535 BLEQ 5$ 7$: INCL R2 CMPL R2,R4 BLEQ 5$ MNEGL #2,R0 ; ran out of allowable uic's RET 10$: CMPL R0,#RMS$_RNF BNEQ 99$ MOVL (R10),R0 ; first member not found RET 99$: MNEGL #1,R0 ; error RET ------ John Hascall ISU Comp Center
brister@td2cad.intel.com (James Brister) (07/06/88)
In article <8807040702.AA15775@ucbvax.Berkeley.EDU> GG.SPY@ISUMVS.BITNET ("John Hascall") writes: [a bunch of lines deleted] > > I do a very similar thing (except that I will re-use UICs). What I >do is scan RIGHTSLIST by opening it for keyed access and repeatedly call >SYS$GET with successively larger key-values (I can stop as soon as I get >RMS$_RNF--you will need to look at all 64K possible members I guess). I had to do the same sort of thing, (I too re-used UIC's) but what I did was get the record definition for sysuaf.dat from the MACRO library ($UAFDEF I believe). I then made a Pascal record out of it; open the sysuaf.dat file for keyed access on the UIC number, FINDK'd the first key in the index, and then did sequential reads on that index until I hit the end. This takes about the same amount of time AUTHORIZE does. If you want the program let me know and I'll e-mail it (or post it if anyone else wants me too.) ---------------------------------------------------------------------------- James Brister brister@td2cad.intel.com "These opinions are obviously those of a psychopath and no one else"