-+-+-+-+-+-+-+-+ START OF PART 5 -+-+-+-+-+-+-+-+ Vni X*/ X unsigned fh2$v_journal_file : 1; /* this is a journal file V `20 X*/ X unsigned fh2$v_fill_2 : 1; X `7D fh2$r_journal_bits; X `7D fh2$r_journal_overlay; X unsigned char fh2$b_ru_active; /* If non-zero, file has active rec un Vi X*/ X unsigned short fh2$w_pad; X unsigned long fh2$l_highwater; /* high-water mark in file */ X unsigned long fh2$l_pad2`5B2`5D; X unsigned long fh2$r_class_prot`5B5`5D; /* security classification mas Vk */ X unsigned short fh2$w_pad3`5B201`5D; X unsigned short fh2$w_checksum; /* file header checksum */ X`7D; X#pragma standard $ CALL UNPACK [.LKSTAT]LKSTAT.H;1 1046529584 $ create 'f' XFrom:`09CBS%UK.AC.ULCC.NCDLAB::NET.UU.UUNET::MCSUN!CERNVAX!CHX400!CGCH!FIZCI VBA-GEIGY.CH!BNEBGA 22-DEC-1990 11:03:15.34 XTo:`09A.Harper XCC:`09 XSubj:`09lkstat - last minute correction X XVia: UK.AC.ULCC.NCDLAB; Sat, 22 Dec 90 11:03 GMT XDate:`09`09Sat, 22 DEC 90 11:04:16 BST XFrom:`09`09INFOVAX@UK.AC.ULCC.NCDLAB XTo:`09`09A.Harper@UK.AC.KCL.CC.OAK XDate-Sent: 19 Dec 90 13:42:36 GMT XOriginal-From: mcsun!cernvax!chx400!cgch!fizciba-geigy.ch!bnebga@net.uu.uune Vt (Gary Nebbett) XOrganization: Ciba-Geigy AG, Basel, Switzerland XSubject: lkstat - last minute correction XMessage-Id: <1990Dec19.143310@fizciba-geigy.ch> XOriginal-To: info-vax@com.sri.kl XReply-To: mcsun!cernvax!chx400!cgch!fizciba-geigy.ch!bnebga@net.uu.uunet (Ga Vry Nebbett) XSender: INFOVAX-request@UK.AC.ULCC.NCDLAB X X XIt appears that the field RSB$B_CGMODE of an RSB sometimes Xcontains a value outside the range LCK$K_NLMODE to XLCK$K_EXMODE, and this causes the code that uses this Xfield as an index into an array to fail. X XTo make lkstat more robust, you should add X#include Xto the top of lkstat.c and modify the two occurances of the statement`20 Xmode`5Brsb->rsb$b_cgmode`5D Xin routine rsb_disp() to read Xrsb->rsb$b_mode > LCK$K_EXMODE ? "??" : mode`5Brsb->rsb$b_cgmode`5D X XRegards, X`09Gary Nebbett (/pn=gary.nebbett/ou=chcgbs30/@ciba-geigy.ch) X $ CALL UNPACK [.LKSTAT]LKSTAT.MOD;1 1125909519 $ create 'f' XFrom:`09CBS%UK.AC.ULCC.NCDLAB::NET.UU.UUNET::MCSUN!CERNVAX!CHX400!CGCH!FIZCI VBA-GEIGY.CH!BNEBGA 22-DEC-1990 12:51:51.65 XTo:`09A.Harper XCC:`09 XSubj:`09lkstat - a program to summarise Locks & Resources (LONG) X XVia: UK.AC.ULCC.NCDLAB; Sat, 22 Dec 90 12:51 GMT XDate:`09`09Sat, 22 DEC 90 12:52:59 BST XFrom:`09`09INFOVAX@UK.AC.ULCC.NCDLAB XTo:`09`09A.Harper@UK.AC.KCL.CC.OAK XDate-Sent: 19 Dec 90 10:36:07 GMT XOriginal-From: mcsun!cernvax!chx400!cgch!fizciba-geigy.ch!bnebga@net.uu.uune Vt (Gary Nebbett) XOrganization: Ciba-Geigy AG, Basel, Switzerland XSubject: lkstat - a program to summarise Locks & Resources (LONG) XMessage-Id: <1990Dec19.112802@fizciba-geigy.ch> XOriginal-To: info-vax@com.sri.kl XReply-To: mcsun!cernvax!chx400!cgch!fizciba-geigy.ch!bnebga@net.uu.uunet (Ga Vry Nebbett) XSender: INFOVAX-request@UK.AC.ULCC.NCDLAB X X Xlkstat is a program which is intended to make the operation of the VMS Xdistributed lock manager more understandable, and to provide insight into so Vme Xof its uses. It summarises the information about locks and resources which c Van Xbe obtained from the local node. I think that it is complementary to the SDA Xfunctions - lkstat gives an overview and SDA can be used to investigate the Xdetail. X XHopefully the source to lkstat should be found in two further postings Xtitled "SOURCE: lkstat (part n of 2)" X XFor each resource on the system lkstat reports: X X whether the resource serves as a directory entry X which node has mastered the resource X the mode of the most restrictive granted lock (that the local node knows Xabout) X the number of sub-resources X the number of queued locks X an interpretation of the resource name, including FID->name conversion X(option) X Xif requested lkstat will also report X X number of locks on resource that are "local" locks X number of locks on resource that are "process copy" locks X number of locks on resource that are "master copy" locks X number of locks on resource that are owned by processes X number of locks on resource that are owned by the system X number of locks on each of the three queues (granted, converting, waiting) X XBy default lkstat only reports on root resources but will list all resources V if Xrequested. X XThe address of the RSB is also included in the listing to facilitate further Xinvestigation with SDA. Once you have started SDA and read sys$system:sysdef Xyou can view resources and locks using the following techniques: X XSDA> form `5Baddress of RSB provided by lkstat`5D XSDA> form `5Baddress of LKB, see *`5D XSDA> sho lock `5BLKID found on RHS of LKB$_LKID entry`5D XSDA> sho reso /lock= `5Blockid found on RHS of LKB$_LKID entry`5D X X X* The address of the LKB is found by looking at the values to the right hand Xside of the RSB fields RSB$L_GRQFL, RSB$L_CVTQFL and RSB$L_WTQFL; if these Xvalues differ from the values to the left of the name then they represent an Xaddress 38 (hex) bytes beyond the start of an LKB. So for example if the val Vue Xto the right of the symbol RSB$L_GRQFL differs from the value to the left th Ven Xthe command X XSDA> form `5Bvalue to right of RSB$L_GRQFL`5D - 38 X Xshould display the LKB. If all the queues appear to be empty, you have proba Vbly Xselected a "directory only" resource. X XNote that lkstat needs CMEXEC privilege to read the RSB and LKB structures a Vnd Xread access to every indexf.sys file on the system to convert file IDs to Xnames; if you do not request FID to filename translation or do not have the Xnecessary privilege, lkstat will just report the FID itself. X XIf a summary is requested, the values for number of locks and number of Xresources should closely match the number of these items reported by "monito Vr Xlocks". If FID to filename conversion is used, the output should correlate Xreasonably well with the output of "show dev /fi" for each mounted disk. X XTo provide the FID to filename mapping lkstat uses sys$device_scan to locate Xall the disk devices on your system - this will only work on VMS V5.2 and Xlater; for earlier system you could modify the code to locate the disk devic Ves Xby some other means. The disk devices are recorded in a fix sized table, whi Vch Xis currently set to hold 255 entries; this seems very large from my Xperspective, but may not be big enough for you - just increase MAXDISKS if t Vhis Xis a problem. X XTo keep the length of each report as short as possible, the output widths ha Vve Xbeen chosen so that they comfortably hold the typical values that I see; you Xmay need to increase this if you have many locks on your system. X X XThere are two main areas where I have used a "more than average" amount of`2 V0 Xguesswork: X If you have a system where file IDs exceed 65536 or have volume sets then y Vou X may experience some problems with the FID->name conversion; I think it shou Vld X work but have not been able to test it. X X The establishment of a relationship between volume lock names and device na Vmes X uses the result of lib$getdvi with an item code of DVI$_DEVLOCKNAM. The X comments in the code detail my uncertainties in this area. X X Xlkstat should be defined something like X X$ lks*tat :== $exe$files:lkstat X Xand used follows: X X$ lkstat `5B-anslo`5D `5Bfilename`5D X Xwhere X -a : list all resources, otherwise only root resources reported X -l : examine all LKBs attached to each RSB and produce summary of findings X -s : produce a summary of total locks, resources, etc X -n : attempt FID -> name conversion X -o : send output to file `5Bfilename`5D X XThe lock database may change whilst lkstat is running (lkstat does not lock V the Xdatabase against changes); it will report a summary of the errors it Xencountered whilst scanning the database. These are not fatal errors and lks Vtat Xwill continue to run, but the information presented may not be self-consiste Vnt X(eg it might report that there are 10 locks on the system 7 of which are own Ved Xby the system and 2 of which are owned by processes; the 10th lock was deque Vued Xduring the counting process). X X Xlkstat is built by compiling lkstat.c and linking the object against the C Xrun-time library and sys$system:sys.stb/selective_search. lkstat needs Xdescriptions of four VMS data structures for which there is no ".h" file Xprovided with VAXC. I have manually created the information and bundled it i Vn a Xsingle include file. If you have a tool to create .h files automatically, yo Vu Xmight prefer to use those .h files. The entries in sys$share:lib.mlb are: X$lkbdef, $rsbdef, $hm2def, $fh2def. X XCopies of volumes 1 and 2 of the VMS Internals and Data Structures Xpress Xupdates will help you to interpret the output of lkstat. Volume 1, Chapter 1 V0 Xis on "Lock Management" and Appendix H in Volume 1, (updated in Volume 2) is X"Lock and Resource Use by VMS Components" X XThe following (perhaps slightly overlong) extract was taken from the output V of X$ lkstat -anso x. X XThe F11B$a locks are File Access Arbitration Locks and summarise the most Xrestrictive mode of access to the files by processes on this node. X XThe F11B$q locks are Quota Cache Entry Locks. The value to the right of the Xhash is the UIC of the quota entry. X XThe F11B$v locks are Volume Blocking Locks, used by applications that requir Ve Xexclusive access to a volume (e.g. anal/disk/repair). They are also parent Xlocks for F11B$c and F11B$s locks (the slight indentation in the listing is Xintended to convey this relationship). X XThe F11B$c locks are Cache locks for indexf.sys, bitmap.sys and quota.sys. X XThe F11B$s locks are File Serialization Locks which coordinate shared access V to Xfile headers, etc. X XFiles with more sophisticated access sharing requirements also have RMS$ Fil Ve XLocks. X XThe fields are: X Xrsb address of RSB block Xfla flags - D=Directory, O=Only_directory, X=other_unusual_flags_present Xsub number of subresources Xcg mode of most restrictive granted lock Xm access mode of lock Xgrou group for non-system-wide locks Xnode node on which lock is mastered Xname an interpretation of the resource name X Xreso total number of resources on this node Xmast total number of resources mastered on this node Xroot total number of root resources (i.e. resources which have no parent) Xrmst total number of root resources mastered on this node Xdir total number of resources that serve as directory entries Xdiro total number of resources that serve only as directory entries Xlock total number of locks on this node Xlcl total number of "local" locks on this node Xpcpy total number of "process copy" locks on this node Xmcpy total number of "master copy" locks on this node Xsys total number of system owned locks on this node Xproc total number of process owned locks on this node Xchn maximum chain length in resource hash table encountered X Xlcl, pcpy, mcpy, sys and proc are only available when lkstat is invoked with Xthe -l option X Xreso mast root rmst dir diro lock lcl pcpy mcpy sys proc chn X 699 232 392 131 63 46 993 0 0 0 0 0 9 Xrsb fla sub cg lck m grou node name X808288c0 0 CR 1 K 0 ZEUS25 F11B$aUSERS `5B000000`5DINDEXF.S VYS;1 X8082df60 0 PR 1 K 0 F11B$aUSERS `20 X`5BUSERS.BNEBGA.SRC`5DLKSTAT.EXE;5 X80814de0 0 CW 1 K 0 F11B$aUSERS `20 X`5BUSERS.BNEBGA.A1MAIL$`5DMAIL.X4M;1 X8082bfc0 0 EX 1 K 0 F11B$aUSERS `20 X`5BUSERS.BNEBGA.TMP`5DLKSTAT_README.TPU$JOURNAL;1 X80804320 D 0 EX 1 K 0 F11B$aUSERS `5B`5DTPU$WORK.TPU$W VORK; `20 X808239b0 0 CW 1 K 0 ZEUS22 F11B$aUSERS `5B000000`5DQUOTA.SY VS;1 X807fdcb0 D 0 PW 1 K 0 F11B$aUSERS `5BUSERS.BNEBGA`5DX. V;1 X807fb0b0 0 PW 1 K 0 ZEUS25 F11B$aUSERS `20 X`5BUSERS.BNEBGA.DECW`5DDECW$CALENDAR_FILE.DWC;1 X8082ffb0 0 PR 1 K 0 F11B$aUSERS `20 X`5BUSERS.BNEBGA.A1MAIL$`5DFK2F0TGK.001;1 X8081a1c0 0 PR 1 K 0 F11B$aUSERS `20 X`5BUSERS.BNEBGA.COM`5DMYEVE.TPU$SECTION;7 X80807c30 0 PW 1 K 0 F11B$qUSERS #11,23 X807f9cc0 40 CR 1 K 0 ZEUS23 F11B$vUSERS `20 X80826a80 0 NL 1 K 0 ZEUS23 F11B$c`5B000000`5DINDEXF.SYS;1 X808003e0 0 NL 1 K 0 ZEUS23 F11B$c`5B000000`5DBITMAP.SYS;1 X80819b90 0 PR 1 K 0 ZEUS23 F11B$c`5B000000`5DQUOTA.SYS;1 X80817250 0 NL 1 K 0 ZEUS23 F11B$s`5BUSERS.BNEBGA.SRC`5DSTRINGS.C V;7 X80821750 0 NL 1 K 0 ZEUS23 F11B$s`5BUSERS.BNEBGA.SRC`5DWATCH.OBJ V;5 X808017d0 0 NL 1 K 0 ZEUS23 F11B$s`5BUSERS.BNEBGA.SRC`5DWATCH.EXE V;12 X8080a830 0 NL 1 K 0 ZEUS23 F11B$s`5BUSERS.BNEBGA.SRC`5DLKSTAT.EX VE;5 X8082baf0 0 NL 1 K 0 ZEUS23 F11B$s`5BUSERS.BNEBGA.SRC`5DLKSTAT.DM VP;1 X8081de40 0 NL 1 K 0 ZEUS23 F11B$s`5BUSERS.BNEBGA.SRC`5DSETUP.COM V;11 X8081fb20 0 NL 1 K 0 ZEUS23 F11B$s`5BUSERS.BNEBGA.SRC`5DLKSTAT.DM VP;2 X807fed30 0 NL 1 K 0 ZEUS23 F11B$s`5BUSERS.BNEBGA.SRC`5DTAR.C;16 X8081a530 0 NL 1 K 0 ZEUS23`20 XF11B$s`5BUSERS.BNEBGA.TMP`5DLKSTAT_README.TPU$JOURNAL;1 X80832370 0 NL 1 K 0 ZEUS23 F11B$s`5BUSERS.BNEBGA.SRC`5DLKSTAT.RE VADME;1 X80806840 0 NL 1 K 0 ZEUS23 F11B$s`5BUSERS.BNEBGA.SRC`5DTAP.C;1 X80815af0 0 NL 1 K 0 ZEUS23 F11B$s`5BUSERS.BNEBGA.SRC`5DSTRINGS.O VBJ;6 X8080d900 0 NL 1 K 0 ZEUS23 F11B$s`5BUSERS.BNEBGA.SRC`5DWC.EXE;8 X80821070 0 NL 1 K 0 ZEUS23 F11B$s`5BUSERS.BNEBGA.SRC`5DPS.DIR;1 X808248d0 0 NL 1 K 0 ZEUS23 F11B$s`5BUSERS`5DBNEBGA.DIR;1 X80833a20 0 NL 1 K 0 ZEUS23 F11B$s`5BUSERS.BNEBGA`5DCOM.DIR;1 X80815780 0 NL 1 K 0 ZEUS23 F11B$s`5BUSERS.BNEBGA.COM`5DCD.COM;24 X808047f0 0 NL 1 K 0 ZEUS23 F11B$s`5BUSERS.BNEBGA.COM`5DCLEAR.COM V;1 X8081ff40 0 NL 1 K 0 ZEUS23 F11B$s`5BUSERS.BNEBGA.SRC`5DTRACE.C;7 V8 X807fe230 0 NL 1 K 0 ZEUS23 F11B$s`5BUSERS.BNEBGA.SRC`5DTRACE.EXE V;50 X8081eb50 0 NL 1 K 0 ZEUS23 F11B$s`5BUSERS.BNEBGA`5DX.;1 X8080bee0 0 NL 1 K 0 ZEUS23 F11B$s`5BUSERS.BNEBGA`5DSRC.DIR;1 X8081a8a0 0 NL 1 K 0 ZEUS23 F11B$s`5BUSERS.BNEBGA.SRC`5DWHOIS.C;5 V7 +-+-+-+-+-+-+-+- END OF PART 5 +-+-+-+-+-+-+-+-