0707070000020025061006440001460001440000010270440354666320400000500000000004Size150 0707070000020027711006440001460001440000010145240355100702200000500000000054NameSimple Accounting Package - from THE STORE! 0707070000020027741006440001460001440000010146400355227136700000600000000164Files./Size ./Name ./Files ./Remove ./Install ./acct.doc ./acct.week ./accton ./MAKEcpio ./sa ./sa.c ./MAKEflop ./sa.doc 0707070000020025071007770001460001440000010145230355100745400000700000001241Remove # Remove all the accounting stuff FILES="sa accton acct.week " for i in $FILES do /bin/rm -f /usr/adm/$i done # remove any accounting files that were created by acct.week /bin/rm -f /usr/adm/acctfile /usr/adm/week.* # get rid of the line in /usr/lib/crontab that calls acct.week grep -v "/usr/adm/acct.week" /usr/lib/crontab > /tmp/t /bin/rm /usr/lib/crontab mv /tmp/t /usr/lib/crontab # inform the user that if he put lines in /etc/rc to start the # accounting on reboot, he might want to get rid of them message -i "If you modified your /etc/rc to start accounting automatically, you may wish to remove the appropriate lines.\n\nTouch Enter to continue" 0707070000020031121007770001460001440000010163630355227134200001000000004017Install # # First create the /usr/adm directory if it does not yet exist, # and move all the appropriate files into it. # message -i "The executable files will be placed in /usr/adm along with the C code for the sa command. Data files will be accumulated there.\nTouch Enter to continue ...." ACCTDIR=/usr/adm EXECS="sa accton acct.week sa.c" DOCS="sa.doc acct.doc" if test ! -d $ACCTDIR then /bin/rm -f $ACCTDIR 2> /dev/null mkdir $ACCTDIR chmod 666 $ACCTDIR fi # Ask the user for the name of the person to whom mail should be # sent if there are problems (the default is root). echo " " echo "To what user should mail be sent if there are problems?" echo "(the default is $LOGNAME) \c" read CLERK if test "$CLERK" then true else CLERK=$LOGNAME fi sed -e s/accountant/$CLERK/ acct.week > /tmp/t cp /tmp/t acct.week for i in $EXECS do ln $i $ACCTDIR chown bin $ACCTDIR/$i chgrp bin $ACCTDIR/$i done # Now change the owners, groups and modes to the appropriate values for i in $DOCS do ln $i /u/$CLERK/Filecabinet/$i chown $CLERK /u/$CLERK/Filecabinet/$i done chmod 755 $ACCTDIR/sa chmod 766 $ACCTDIR/acct.week chown root $ACCTDIR/accton chmod 4755 $ACCTDIR/accton # Put a line in /usr/lib/crontab to do weekly accounting cat < /dev/null"' >> \ /usr/lib/crontab # Finally, tell the user where he that it is all done and where the # documentation is. message -i "There are two documents in the Filecabinet of $CLERK. sa.doc will tell you about sa - the program which reduces the accounting results to human readable form. acct.doc provides a few pointers. \nTouch Enter to continue." 0707070000020021761006440001460001440000010145260354666027400001100000001215acct.doc The accounting package lives in /usr/adm, consisting of two parts; 'acct' keeps track of all the processes which execute, 'sa' translates the data produced by 'acct' into human- readable form. If you want the accounting to start automatically whenever the machine reboots, put the following lines in /etc/rc: ------- if test -x /usr/adm/accton then /usr/adm/accton /usr/adm/acctfile 1> /dev/null 2> /usr/adm/acct.err fi ------ To start the accounting without reboot, su to super-user and type /usr/adm/accton /usr/adm/acctfile 2> /usr/adm/acct.err to halt it, su to super-user and type /usr/adm/accton 0707070000020025131007770001460001440000010145270354766435300001200000003017acct.week# this is a shell script which should be run once a week or so # via cron. first, it crunches the information contained in # the current accounting file into a more succint one which # contains the per-user stats and has a name indicating when # (i.e. which week) it was made. # next, it merges the current week's total with the those in the # file TOTALS, which will contain the sum of all per-user stats # since the time accounting is first started up (or the file # is removed). # then it empties out the old accounting file and starts up the # accounting process again. # the presence of the file 'acct.err' indicates that something went # wrong and needs to be fixed. # the person in charge of accounting CLERK=accountant ACCTFILE=/usr/adm/acctfile WEEKFILE=/usr/adm/week.`date | awk '{ print $2$3 }'` TOTALS=/usr/adm/totfile /bin/rm -f acct.err # create the file containing last week's stats /usr/adm/sa > $WEEKFILE 2> acct.err chmod 744 $WEEKFILE # merge this week's with the totals. if the file $TOTALS does # not exist, it will be created (hence the need to chmod). /usr/adm/sa -m $TOTALS chmod 744 $TOTALS # stop the accounting, empty the accounting file and restart # accounting. allow others to see, but not change, the file. /usr/adm/accton 1> /dev/null 2>> acct.err cp /dev/null $ACCTFILE chmod 744 $ACCTFILE /usr/adm/accton $ACCTFILE 1> /dev/null 2>> acct.err if test -s acct.err then # there was an error. send mail to some responsible person. /bin/mail $CLERK < acct.err else /bin/rm -f acct.err 2> /dev/null fi 0707070000020025051007550001460001440000010145310354665625300000700000054656acctonRU50 &. 0 ( .text&. .data 0,@.bss 0 0 ( OQ./HJf/H# 0N,/N& 0<N@NVH lB.NrJl. N p.N& `. Np.N& n .N!^Jlj  4fFp. n /(NX-@l. /N p.N& ` .N$b`. LN p.N& n .NrJlL  4f$. i/< NXp.N& `. N p.N& `. NLN^Nu0<3N@dN&Nu0<N@dN&NuNVHA -H. //.NP$9 g pLN^Nu `NVHA-H.//. NP$ n( g pLN^Nu `NVH<$n&nBB.G(J`RHH$gp%f -@"gtѮ "f&Sm kR`P.p/NX`> + f."/ /+NP @"'H`./."p// N Jf+ f .L<N^Nup-@-@-@-@-@RHH$  g$ #g" +g -fR`R`R`R`p*f$pѮ n -hl .D-@RR`Bp0fRB` .Ѐ"Ё"0Ё-@RHH$ | 0(f .gJg .`p-@`VR *fpѮ n -hR`8B` .Ѐ"Ё"0Ё-@RHH$ | 0(fBHH hg lfRR-| LAG-HHp-@-@HH$ Jgv Eg Gg XgT cg dgL eg fg gg og* sg ug xfp` p`p`p-@Jlp-@JfpdpѮ n -h>pdfBJ>l-| L >g* .>D-@>`Jg -| L`Jg-| LpXf | ` | -H*I\*L`Dp>-@ .>-@>.N$ЀЮ"n*1. .>NT-@>J>f Ю-@Jgȹg  Xg4 og xf-| L` lp-@`-| L`xJlp-@pѮ n -h6-h:Hn.Hn2 .Rrl .R`p//.:/.6N ^ @(HJ.g -| L`Jg -| L`Jg-| LKQJgHH`p0JfJg.-n`SJoJfIQ. /9 .6".:NXJg .2S-@"JlD`Jlp-@pѮ n -h6-h:Hn.Hn2 + f."/ /+NP @"'H`./."p// N SmVSm kRr0`.p0/NX` kR"nHRH`. nHRHp/NX nHJg$Sm` kRr `.p /NXS .䰮&mSm`J"g@p . ."N$0rH"nHp . ."NT-@"`pH nH0 nHCEbJ2n . /9 .6".:NXJfp+`p-rH"nH | 0(gpE`perH"nH`>NVp././././. /.N> @ N^NuNVp././././. /.N @ N^NuNVH<$n&| 8 ."KI . fp.N!p/N@X.  /9  .". NXJlp`p"n"g .". @-@-A B9 8B. /9  .". NXJgd*| R. d/9 ` .". NXJm,`>./ .". NX-@-A -ђ`. l/9 h .". NXJm`-y p-y t` -n-n./. 9 x"9 |NPX-@-A. /.".NXJo`. /9  .". NXJln`8./ .". NPX-@-A -` M o2./ .". NPX. /9 NXJl`Jgҹ 8eй c(| . /9  .". NXJg Ie0`T .". N$ 0 N./ .". NX./ 9 "9 NPX-@-A e$&L 5m0 8f1 8RJgR`R`R0R# 9nB | 8 L<N^Nu M o./ .". NXJm`./. .". NXN$ 0 N./.NPX./ .". NX-@-A R. /9  .".NXJo^. /9  .".NX-@-A`ZH?L ` H?LN "LNuH? o "($/ &/$N " LNuH? o/NX$/ &/$N//NP LNuH?$& /"/ `H?$/&/ /$"/(Nj "LNuH? o$&( / "/$NF " LNuH? o/NX$& / "/$N//NP LNu@UUŰcBCEHNJGf(g~JFf `0 FgrFDGQGmfJf` ^GkQJkցՀd RF Fm`LdFED@N N@M fBNuNn`(fFfJj$<B`$<B`H?$& /"/ `H?$/&/ /$"/(Nj "LNuH? o$&( / "/$NF " LNuH? o/NX$& / "/$N//NP LNu*BNb:G8<a,8<aᏄg$&<FN6`.HGODfJfJgRGSGgNu8<@ANBCFgDgNg Dg,NuNJk&Fg"Jg `Jk6g2$<`N LNu"`"/H8NVN0 LNu$<&HCĀ(f<Jg,<`&HBJ Bf4<`<Jg<`SB<B2Nu m `B>BFCNBNr, AKNux ,<.̂(ȃ⊄(΀ȁ∀NuJf F m F BJgk [ZNu<$q.N!x$g&./.p/N%Pp./< 8/N%P.N!x./ p/N%Pp./< ;p/N%PLN^Nu0<!N@dN&Nu0<N@Nu opJWg`RDNuNVH J f4p @# p @# # # .^"$$y B `( f fR  n*f,`# $&R+g Ae Ad&Jp @$Hc` A# c# y p @$A L N^Nu " # p.N$ @&H 9 Ae 9 .N$ @&H rf` y y Agp"y @" 9 AA&# r "A `NVH $n&JY# p @&L N^NuNVH &n+g.N +-@. N @$H gngh-K-J . V"$d-B` nX"nX .SJfd$ Ae A"%  J L N^Nu 9 ,ѯ0<N@dN& 9 ,# ,Nu0<N@dN&# ,BNu0<N@dN&BNuNVHn/<T/.N$ JlpN^Nup`0<6N@dN&NuNVH8BJlDF$".l"D`NVH8B .lDF$". lF lB@H@0B@H@`,& l//N%PlDJlDLN^NuNVH8&".(`NVH8 .&". ( lH@40H@0H@`2 l$//N%PlS LN^NuNVH0$.&. B02HBHC҂HABAЁL N^Nu0<N@dN&Nu# 4pNuNVN.N&$N^Nu0<N@NrCan't turn off accountingAccounting disabled Can't create accounting fileCan't create accounting fileAccounting already in process Can't start accountingAccounting started -+ 0123456789ABCDEF0123456789abcdef0x0X-+ -+ Fn CAy7Aׄ@È@Y@$C@@$@$@$@$@$?@$@$ ((((( H H P   Unknown error: * 2 < V f ~          * @ L X j y          % ; J V m ~        4 O ^ g p y         :Error 0Not ownerNo such file or directoryNo such processInterrupted system callI/O errorNo such device or addressArg list too longExec format errorBad file numberNo child processesNo more processesNot enough spacePermission deniedBad addressBlock device requiredDevice busyFile existsCross-device linkNo such deviceNot a directoryIs a directoryInvalid argumentFile table overflowToo many open filesNot a typewriterText file busyFile too largeNo space left on deviceIllegal seekRead-only file systemToo many linksBroken pipeArgument out of domainResult too largeNo message of desired typeIdentifier removedChannel number out of rangeLevel 2 not synchronizedLevel 3 haltedLevel 3 resetLink number out of rangeProtocol driver not attachedNo CSI structure availableLevel 2 haltedError 45Error 46Error 47Error 48Error 49Bad exchange descriptorBad request descriptorMessage tables fullAnode table overflowBad request codeInvalid slotFile locking deadlockBad font file format X.text,.data .bss 0XX1 .filegaccton.c.text,F.data .bss 8.textr.data .bss 8noerror.text.data .bss 8noerror.file%gprintf.c.textB.data .bss 8.file-gfprintf.c.textB.data .bss 8.file5gdoprnt.c.text D/.data T.bss 8.filegecvt.c.text ^@<.data .bss 8Pcvt buf 8.text.data .bss add_commd_addsub_commBd_subdadd1nunfluselnVgu1shzovflbshlshx shydiff.endas@geninfzdiff2:assgnFasexitJasbyeTuselZ.text.data .bss div_commd_divextremshsubdd4@dmsignJunpXunpxit~unp2punplrtopzerotopbigbotzerobotbigisnangeninfgennanclrbotgenzero usetop:isn2isn4gotnansignshs1shs78dmexitN.textPh.data .bss mul_commfd_muleswapofluflbackmsignzmexit~gennansigned0normu.textD.data .bss cvid_comi_unpkpd_packfd_commf_unpki_packf_packcvif_com,cvfi_comHdunp2dunp8dunp3dunp9dpk0dpksgnnorm1 norm"canceln0normxit.drcpokVdsgned0denlLdrcp1hdrcpbiguselndraunp2unp8unp3unp9spk0spksgn*spk2spk1spk5spk4f_rcp0rcp18rcp2Jsigned0drcp4Vrcpbighiupos~bigignshipzg_nshshrllsimplnshoflnshxitlrsimpr.filegfwrite.c.textD .data .bss .text@.data .bss noerrorP.textT.data .bss XX100fL2XX1XX3XX5XX4XX6.text.data .bss bcp5006bcp900(bcp350bcp450bcp400 bcp470.bcp460"bcp600Lbcp650Tbcp670h.filegctype.c.textp.data .bss .textpb.data .bss XX0L2XX1XX2XX3.filegflsbuf.c.text.data .bss .filegdata.c.text .data x.bss .filegperror.c.text  .data *.bss .file<gerrlst.c.text!^.data >:.bss .text!^.data ,.bss noerror!n.text!p.data ,.bss .text!x.data ,.bss L0!~L1!.fileXgmalloc.c.text!!.data ,.bss allocs allocp alloct allocx .text$ B.data ,.bss nd ,noerr1$8noerr2$V.text$b.data 0.bss noerror$r.filegisatty.c.text$v,.data 0.bss .text$.data 0.bss noerror$.text$.data 0.bss XX0$L2$XX1$XX2$XX3%XX6%2XX4%XX5%.XX7%8.text%@.data 0.bss L1%fXX1%XX3%XX2%.text%0.data 0.bss XX3%.text%.data 0.bss noerror&.text& .data 0.bss .filegcuexit.c.text& .data 0.bss .text&$ .data 0.bss exit& environ 0_startmain,errno 4acctrperror printfaccess!^creatclose$b_iob fprintf__cerror&_doprnt_flsbufmemcpyfwrite_ctype lrem__$ldiv__Tecvt ^dbsub__fcvt strlen!xgetpid!pkill@dbdiv__dbmul__Pdbtol__ltodb__faddafaddafaddffsub.afsubPafsubfxdbadd___cvfd_cvdfd_exted_norm d_rcp@d_uselnfdivafdivafdivfd_nrcp6fmul\afmultafmulf_cvid_cvdi_cvif(_cvfiDfltodb__fltol__@dbtofl__ltofl__$ultofl__$ultodb__d_unpk\fltused_wrtchk_bufendt lmul__p_xflsbuf8uldiv__%@_bufsync |ldivtulmul%lmul_cleanupfclose_lastbuf fflushfree#@write%_findbuf_stdbuf malloc!_smbuf isatty$v_sibuf H_sobuf Psys_nerr &sys_errl >sbrk$ realloc#jsbrk2$ _end Xbrk$Hioctl$lrem$uldiv%R_exit&$_etext&.etext&._edata 0edata 0end X0707070000020027751007770001460001440000010146410355100717400001100000000044MAKEcpiocat Files | cpio -ocBv > ACCOUNT+IN 0707070000020027671007550001460001440000010145630354665625700000300000102074saRsًR A w .textA .data H@.bss w OQ./HJf/H# N,/NAj0<N@NVH-| p-@-@ .`` n -h`. ^ n /(N3pXJfR n -h`p-@`p. a n /(N3pXJfR n -h n -h `p-@`.p-@`$S b@0; NJPTbJg . d/< ,N Xp.NAjp -@p./.N?X-@l. N:zp.NAj./< /.N?Pf N(`Jg.N`NLN^NuNVHp09 -@"瀐"| # ."瀐$p09 .N"| ё ."瀐&p09 .N"| "ё ."瀐(p09 .N"| &ё ."瀐*p09 .Nb"| *ё ."瀐,p09 .N<"| .ё ."瀐.p09 .N"| 2ёLN^NuNVHp0. r -@p0. -@JgS .-@` .`LN^NuNVH 9 "瀐"| Jf  l R ` 9 R `LN^NuNVHpK.N; @-H n. n/( n/( n/( N\X @/ n/(NJX @/ n/(N8X @/ n//< /.N n` LN^NuNVH.K .N2T-@.KN3. .N2T-@.N3p<. .N2T-@p .N; @-H./././< /.N n` LN^NuNVHHnHnHn/< /.N . .N3-@ ."逐-@.K .N3ЮЮ`LN^NuNVH. xzpd//< xN P @ f <`8Hn/< /< xN rl <` .`LN^NuNVH nA. nA/ nA/HnHnHn/./< /< xN rlp`>HnNX"n#@HnNX"n#@HnNX"n#@ p`LN^NuNVHHnNLXJg$ ."瀐"| A.N @` ."瀐"|  1Ѯ ."瀐"| " 1Ѯ ."瀐"| & 1Ѯ ."瀐"| * 1Ѯ ."瀐"| . 1Ѯ ."瀐"| 2 1ѮHnNRX @` LN^NuNVH./././. /./< /< ,N . xNA:p.NAjLN^NuNVH. /< /< N PB lX ."瀐"| Jo6 ."瀐"| A.N~ @./< /< N PR`LN^NuNVH. N; @# x. /9 xN4X @# x~`". x/< /< ,N Pp`. 1/.N4X @# xzf ./< 3/< ,N Pp`Z. xzpd//< xN P. /< V/9 x~N PN<-@N$-@ m l .f6.N @./< Z/9 x~N PN-@N-@`p .lB ."瀐"| A.N @./< ^/9 x~N PN-@`$. x/< b/9 x~N PNn-@`8.NA:Jg./< eN Xp`&./9 xN X. xNA:p`LN^NuNVH$. $n-nS` LN^NuJoJn".Nrf ng`SRl ` &.p //*/.N N @-Hg &׮תJlp` (* HH"| , 1l.N:.Jf`Z nB n`@0< N@dNA`BNuNVHA-H.//. NP$ n( g pLN^Nu ` /o("/ "o oSвWg fBNu Nu`NVA -H././< N PN^NuNVA-H./. /.N PN^NuNVH$nA-H|-J J-H.N;-@|./. HnN PLN^NuNVH $n&n Bp$g | 0(gFSm jRp`.N-@"| 1f./.N@Xrg`p%f p$p%f>Sm jRp`.N-@谂gn./.N@Xrgt`vp*f Bp$`p-@B` .Ѐ"ЁЂr0-@p$ | 0(fJf-|-B rlg hfp$Jgp[f Hn/ NP @&H f pL N^Nu | 0(gpl-@  $pcgHp[gBSm jRp`.N-@"| 1f./.N@Xrgjpcg psgp[fHn/ Hn/.//.N>`Hn/ /././/.N:-@g .ѮJg Jf`Jg .`p`NVH $nGBBBBBB . d bZ@0; NJ.***JJJJJJJ2JJJJJ.JJ6Rv `v`vSm jRp`pL N^Nu.N$  +g -f$RS` jRp`.N$Sm | 0(fpfj0(g` | 0(gp0` | 0(gp7`pW"-A lJgJf. N3Ю-@R`zJgp.f .RJg^pegpEf^JgV .RJfH Sm jRp`.N$ | 0(f p+gp-f Sm`JgJgJgrBHnNX-@-AJg".@-@-A lf nrӐ P h !n`` .".N."nX"Q"i"`@Jg g .D-@ lg< hf2 nrӐ P h0./N@Xrf nB .` nrӐ P h `NVH<$.&. (.$n&nJg nrӐ P h`(H-Lpcf fxSm kRp`.N*pg0psf | 0Xfp[fJ2XfJg RSnpgJo./N@Xrf nBf pLp.N;/N2@X`(. /9  .". N,PX-@-A ppbpN-./ .". N,P`p Ю l: 9 "9 `J. /9  .". N,PX-@-A pⴀep"DN-./ .". N*X`NVH$n . fp.N;/N2@XB. /9  .". N)XJf .". LN^Nu. /9  .". N)XJo* .". `,R. /9  .".N,PX` .". @-@-A. /9  .".N)XJl. /9  .".N)XJl$S./. .".N(X-@-A`. /9  .". N)XJo .".` .".@` o /"Y@ H@Ҁ / o4/gSg&/gS Q f @SkQ /Nu`NVH-| n-H-H||A-HHn//. N $ nB LN^NuNVH<$n&nBB.G(J`RHH$gp%f -@"gtѮ "f&Sm kR`P.p/N6X`> + f."/ /+N2P @"'H`./."p// N0 Jf+ f .L<N^Nup-@-@-@-@-@RHH$  g$ #g" +g -fR`R`R`R`p*f$pѮ n -hl .D-@RR`Bp0fRB` .Ѐ"Ё"0Ё-@RHH$ | 0(f .gJg .`p-@`VR *fpѮ n -hR`8B` .Ѐ"Ё"0Ё-@RHH$ | 0(fBHH hg lfRR-| "LAG-HHp-@-@HH$ Jgv Eg Gg XgT cg dgL eg fg gg og* sg ug xfp` p`p`p-@Jlp-@JfpdpѮ n -h>pdfBJ>l-| #L >g* .>D-@>`Jg -| %L`Jg-| 'LpXf | )` | :-H*I\*L`Dp>-@ .>-@>.N?ЀЮ"n*1. .>N2T-@>J>f Ю-@Jgȹg  Xg4 og xf-| KL` lp-@`-| NL`xJlp-@pѮ n -h6-h:Hn.Hn2 .Rrl .R`p//.:/.6N$^ @(HJ.g -| QL`Jg -| SL`Jg-| ULKQJgHH`p0JfJg.-n`SJoJfIQ. /9  .6".:N)XJg .2S-@"JlD`Jlp-@pѮ n -h6-h:Hn.Hn2 + f."/ /+N2P @"'H`./."p// N0 SmVSm kRr0`.p0/N6X` kR"nHRH`. nHRHp/N6X nHJg$Sm` kRr `.p /N6XS .䰮&mSm`J"g@p . ."N?0rH"nHp . ."N2T-@"`pH nH0 nHCEbJ2n . /9  .6".:N)XJfp+`p-rH"nH | 0(gpE`perH"nH`>NVp././././. /.N> @ N^NuNVp././././. /.N @ N^NuNVH<$n&| ."KI . fp.N;/N2@X. b/9 ^ .". N)XJlp`p"n"g .". @-@-A B9 B. j/9 f .". N)XJgd*| nR. /9  .". N)XJm,`>./ .". N*X-@-A -ђ`. /9  .". N)XJm`-y -y ` -n-n./. 9 "9 N,PX-@-A. /.".N)XJo`. /9  .". N)XJln`8./ .". N,PX-@-A -` M o2./ .". N,PX. /9 N)XJl`Jgҹ eй c(| . /9  .". N)XJg e0`T .". N-$ 0 N-./ .". N)X./ 9 "9 N,PX-@-A e$&L 5m0 f1 RJgR`R`R0R# 9nB | L<N^Nu M o./ .". N)XJm`./. .". N*XN-$ 0 N-./.N,PX./ .". N)X-@-A R. /9  .".N)XJo^. /9  .".N*X-@-A`ZH?L ` H?LN "LNuH? o "($/ &/$N " LNuH? o/N-X$/ &/$N//N.P LNuH?$& /"/ `H?$/&/ /$"/(Nj "LNuH? o$&( / "/$NF " LNuH? o/N-X$& / "/$N//N.P LNu@UUŰcBCEHN.JGf(g~JFf `0 FgrFDGQGmfJf` ^GkQJkցՀd RF Fm`LdFED@N/ N/@M fBNuN/n`(fFfJj$<B`$<B`H?$& /"/ `H?$/&/ /$"/(Nj "LNuH? o$&( / "/$NF " LNuH? o/N-X$& / "/$N//N.P LNu*BNb:G8<a,8<aᏄg$&<FN/6`.HGODfJfJgRGSGgNu8<@ANBCFgDgNg Dg,NuNJk&Fg"Jg `Jk6g2$<`N LNu"`"/H8NVN0 LNu$<&HCĀ(f<Jg,<`&HBJ Bf4<`<Jg<`SB<B2Nu m `B>BFCNBNr, AKNux ,<.̂(ȃ⊄(΀ȁ∀NuJf F m F BJgk [ZNu<Jl tp# * g.N=BB* B%j LN^NuNVH$n* fBpLN^Nu.N* f* gJg jb* gp`p`NVH$n * HHrRrBfT* HH"| , q"jd jR.   fZ.Nrf LN^Nup. `* HHrrf:n p.Hn* HH/NANPrf p. ` `* HHrrf"Jg jfJf* HHrD€f .N JfJ`pfD* HHrD€f.N@Sm jR. `.p. /NX* gp`p. ` NVH $n&j *$%K* HHrD€gp`* HH"| , 1$Jlp` &* HH"| , 1l.NJo,./ * HH/NANPg pL N^Nup`NVH$n* HHrrg** HH@f pLN^Nu* @ Jf.Nh jfV* HHrD€fH* HH"| , 1$Jlp` $* HH"| , 1l.Np`vNVH$n* HH$pl. "|  q%HA&H* HH"| ,#`f.N; @%Hg& * HH"| ,A"jC `, "| xA%HA(H* HH"| ,#%j.N>Jg* f LN^NuNVH$n* HH"| , 1$l* HH%qLN^Nul$`NVH$|  9 |l "| $q.N;$g&./.p/NANPp./< /NANP.N;./ p/NANPp./< p/NANPLN^NuNVH$nN;$.N;` p . N@40p . N?$ "XgRJg*ap./.N;XJf&R zo nB`p./.N;XJg n LN^Nu0<!N@dNA`Nu0<N@Nu opJWg`RDNuNVH J f4p @# p @# # # .^"$$y B `( f fR  n*f,`# $&R+g Ae Ad&Jp @$Hc` A# c# y p @$A L N^Nu " # p.N>p @&H 9 Ae 9 .N>p @&H rf` y y Agp"y  @" 9 AA&# r "A `NVH $n&JY# p @&L N^NuNVH &n+g.N +-@. N @$H gngh-K-J . V"$d-B` nX"nX .SJfd$ Ae A"%  J L N^Nu 9 ѯ0<N@dNA` 9 # Nu0<N@dNA`# BNu0<N@dNA`BNuNVHn/<T/.N> JlpN^Nup`0<6N@dNA`NuNVH8BJlDF$".l"D`NVH8B .lDF$". lF lB@H@0B@H@`,& l//N@PlDJlDLN^Nu0<N@dNA`Nu0<N@dNA`NuNVH8&".(`NVH8 .&". ( lH@40H@0H@`2 l$//N@PlS LN^NuNV//$".`NV// .$". lB@H@0B@H@`4& l//N@PlD&$N^NuNVH0$.&. B02HBHC҂HABAЁL N^NuNVH$n gD* g jb jf(Jf$pѪp j ђ .LN^Nup`0< N@dNA`BNu0<N@dNA`Nu# pNuNVN5.NAN^Nu0<N@Nr/usr/adm/acctfilesauid user sys elapse mem io rw-m-musage: sa [ -m mergefile ] [ acctfile ] %-4d %-10s %-10s %-10s %10ld %10ld %10ld%4d:%02d:%02d%d:%d:%d%d%d %s %s %s %ld %ld %ldsa: %s %s %s %s %s %s %s tempXXXXXXw+can't open temporary file %s rcan't open old accounting file %s %s %s %s %scan't overwrite old file %s C@@$C@@$?@A>???-+ 0123456789ABCDEF0123456789abcdef0x0X-+ -+ Fn CAy7Aׄ@È@Y@$C@@$@$@$@$@$?@$@$ ((((( H y } x x ( yUnknown error:           , ? Q b t           ' 8 G V n {         7 F T m  $ 9 J W m:Error 0Not ownerNo such file or directoryNo such processInterrupted system callI/O errorNo such device or addressArg list too longExec format errorBad file numberNo child processesNo more processesNot enough spacePermission deniedBad addressBlock device requiredDevice busyFile existsCross-device linkNo such deviceNot a directoryIs a directoryInvalid argumentFile table overflowToo many open filesNot a typewriterText file busyFile too largeNo space left on deviceIllegal seekRead-only file systemToo many linksBroken pipeArgument out of domainResult too largeNo message of desired typeIdentifier removedChannel number out of rangeLevel 2 not synchronizedLevel 3 haltedLevel 3 resetLink number out of rangeProtocol driver not attachedNo CSI structure availableLevel 2 haltedError 45Error 46Error 47Error 48Error 49Bad exchange descriptorBad request descriptorMessage tables fullAnode table overflowBad request codeInvalid slotFile locking deadlockBad font file format .text,.data .bss XX1 .filegsa.c.text, {.data .bss .filegfgets.c.text .data .bss .text .data .bss noerror .file/gfprintf.c.text B.data .bss .text N6.data .bss L2 |L0 bL1 x.file7gscanf.c.text .data .bss .fileBgdoscan.c.text .data .bss setup0stringPnumberf.fileJgatof.c.text .data 8.bss .fileRgfilbuf.c.text.data .bss .fileZgldexp.c.textF.data  .bss .filengfrexp.c.textl.data 0.bss .text\b.data  .bss L5L1L3L2L6L4.filevgsprintf.c.text\.data  .bss .file~gdoprnt.c.text D/.data  T.bss .filegecvt.c.text$^@<.data ^.bss Pcvt$buf .text(.data .bss add_comm(d_add)sub_comm)Bd_sub)dadd1)nunfl)useln*Vgu1)shz*ovfl*bshl)shx* shy*diff*.endas*@geninf*zdiff2*:assgn*Fasexit*Jasbye*Tusel*Z.text*.data .bss div_comm*d_div+extrem+shsub,dd4+@dmsign,Junp+Xunpxit+~unp2+punpl+rtopzero+topbig+botzero+botbig+isnan+geninf+gennan+clrbot,genzero, usetop,:isn2+isn4+gotnan,sign,shs1,shs7,8dmexit,N.text,Ph.data .bss mul_comm,fd_mul,eswap,ofl-ufl-back,msign-zmexit-~gennan-signed0-normu-.text-D.data .bss cvid_com-i_unpk0pd_pack.fd_comm-f_unpk/i_pack0f_pack/cvif_com.,cvfi_com.Hdunp2.dunp8.dunp3.dunp9.dpk0.dpksgn.norm1/ norm/"canceln/0normxit/.drcpok/Vdsgned0/denl/Ldrcp1/hdrcpbig/usel/ndra/unp2/unp8/unp3/unp9/spk00spksgn0*spk20spk10spk50spk40f_rcp00rcp108rcp20Jsigned00drcp40Vrcpbig0hiupos0~bigi0gnsh0ipz0g_nsh0shr0ll0simpl0nshofl0nshxit0lr0simpr0.fileEgfwrite.c.text0D .data .bss .text2@.data .bss noerror2P.text2T.data .bss XX1002fL22XX12XX32XX52XX42XX62.text2.data .bss bcp50036bcp9003(bcp3503bcp4503bcp4003 bcp4703.bcp4603"bcp6003Lbcp6503Tbcp6703h.text3p0.data .bss L03L13.fileXgctype.c.text3.data .bss .text3b.data .bss XX03L23XX13XX23XX33.fileagfopen.c.text4B.data .bss _endopen4Z.fileigfindiop.c.text5D@.data .bss .fileqgflsbuf.c.text5.data .bss .fileygdata.c.text:z.data x.bss .filegperror.c.text:z .data .bss .filegerrlst.c.text;.data :.bss .filegmktemp.c.text;.data .bss .text;.data .bss noerror;.text;.data .bss .text;.data .bss L0;L1;.filegmalloc.c.text;!.data .bss allocs allocp alloct allocx .text>pB.data .bss nd noerr1>noerr2>.text>.data .bss noerror>.file gisatty.c.text>,.data .bss .text>.data .bss noerror?.text?.data .bss XX0?L2?>XX1?4XX2?>XX3?VXX6?XX4?XXX5?~XX7?.text?.data .bss noerror?.text?.data .bss noerror?.text?.data .bss L1?XX1?XX3@,XX2@*.text@4v.data .bss L1@VXX1@nXX4@XX2@pXX3@.text@0.data .bss XX3@.file&gungetc.c.text@`.data .bss .textA:.data .bss noerrorAJ.textAN.data .bss noerrorA^.textA` .data .bss .file4gcuexit.c.textAj.data .bss .textA .data .bss exitAjenviron _startmain,errno my_acct s_array old_fp xztemp_fp x~tempfile xold_buf xdeflt progname header strcmp3p_iob fprintf open?perror:zread?processmergestatsexpandnext_newto_strnmalloc;to_timesprintfldiv__2Tlmul__3to_tickssscanf next_old&fgets parse_olmerge_li>die2unlinkA:mktemp;fopen4link _filbufmemccpy N_bufendt ,_bufsync:.__cerrorA`_doprntscanf fscanf _doscan strlen;_ctype ungetc@atofdbtofl__.memset\ltodb__-dbmul__,Pdbadd__(dbsub__)dbdiv__*ldexp_findbuf9Rfflush68_lastbuf (frexpgetpid;kill2@_flsbuf6memcpy2fwrite0lrem__?ecvt$^fcvt$dbtol__-fadd(afadd(afaddf(fsub).afsub)Pafsubf)x_cvfd-_cvdf.d_exte.d_norm/ d_rcp/@d_usel/nfdiv*afdiv*afdivf*d_nrcp/6fmul,\afmul,tafmulf,_cvid-_cvdi-_cvif.(_cvfi.Dfltodb__-fltol__.@ltofl__.$ultofl__.$ultodb__-d_unpk.\fltused0_wrtchk8_xflsbuf7uldiv__?ldiv2tulmul@lmul3freopen4&_findiop5Dfclose5_cleanup5close>free=writeAN_stdbuf _smbuf xisatty>_sibuf y_sobuf }sys_nerr |sys_errl ulrem__@4access;sbrk>prealloc=sbrk2>p_end brk>ioctl>lrem? uldiv?ulrem@D_exitA_etextAetextA_edata edata end 0707070000020031101006440001460001440000010144770355227076700000500000017223sa.c#include #include #include /* purpose: go through the entries in /usr/adm/acctfile and sum everything up by user, producing as output the total stats per user, sorted by uid, to the standard output. this should probably be run once every week or so, since /usr/adm/acctfile can get really big quickly. a good idea is to have it run, put the output somewhere sensible (say /usr/adm/acct.week or something) and wipe the old file clean. then the accounting process can be restarted. a small shell script should do the trick. it would also be nice to have some sort of merger program to take the results from each week's dump and combine them into a cumulative file. */ #define MAXUSERS 1000 #define LINE_SIZE 75 struct acct my_acct; struct s_stats { int uid; long utime; long stime; long etime; long mem; long io; long rw; } s_array[MAXUSERS]; FILE *old_fp, *temp_fp; char *tempfile; char old_buf[100]; /* holds a line from the old accounting file, if any */ char deflt[] = "/usr/adm/acctfile"; char progname[] = "sa"; char header[] = "uid user sys elapse mem io rw"; main(argc, argv) int argc; char *argv[]; { int m_flag, err_flag, fd, nbytes; char *file, *old_file; file = deflt; m_flag = err_flag = 0; switch (argc) { case 1: break; case 2: file = argv[1]; break; case 3: if (strcmp(argv[1], "-m") == 0) { m_flag++; old_file = argv[2]; } else err_flag = 1; break; case 4: if (strcmp(argv[1], "-m") == 0) { m_flag++; old_file = argv[2]; file = argv[3]; } else err_flag = 1; break; default: err_flag = 1; break; } if (err_flag) { fprintf(stderr, "usage: sa [ -m mergefile ] [ acctfile ]\n"); exit(-1); } nbytes = sizeof(struct acct); if ((fd = open(file, O_RDONLY)) < 0) { perror(progname); exit(-1); } while (read(fd, (char *) &my_acct, nbytes) == nbytes) { process(); } if (m_flag) merge(old_file); else stats(); } /* add the information in 'my_acct' to the appropriate user's statistics. right now all we keep track of is user time, system time elapsed time memory usage characters transferred blocks read or written */ process() { int i; long expand(); s_array[(i = my_acct.ac_uid)].uid = i; s_array[i].utime += expand(my_acct.ac_utime); s_array[i].stime += expand(my_acct.ac_stime); s_array[i].etime += expand(my_acct.ac_etime); s_array[i].mem += expand(my_acct.ac_mem); s_array[i].io += expand(my_acct.ac_io); s_array[i].rw += expand(my_acct.ac_rw); } /* given a number in the form of a comp_t (defined in /usr/include/sys/acct.h), return a long value which is the closest integer. */ long expand(t) comp_t t; { long nt; unsigned int tt; /* use the top three bits as an exponent, base 8 */ tt = t >> 13; /* take the bottom 13 bits ... */ nt = t & 017777; /* and shift three bits left (into a long, so we have plenty to use) for tt times */ while (tt != 0) { tt--; nt <<= 3; } return(nt); } /* once all the ACCT structs have been read and added up, print out a line of information by user for any uid with non-zero time. */ /* return the next uid with non-zero accounting stats, or MAXUSERS if there are no more. */ next_new() { static int i; while ((s_array[i].utime == 0) && (i < MAXUSERS)) i++; return(i++); } /* convert an s_struct into a nice format for printing and return a pointer to the string. */ char * to_str(s) struct s_stats *s; { char *to_time(), *p, *malloc(); p = malloc(LINE_SIZE); sprintf(p, "%-4d %-10s %-10s %-10s %10ld %10ld %10ld", s->uid, to_time(s->utime), to_time(s->stime), to_time(s->etime), s->mem, s->io, s->rw); return(p); } /* convert a time from CPU ticks (which on this machine are 60/sec, but may vary on others - adjust to suit) to hours, minutes, seconds. return in a string with form HHHH:MM:SS . note that strange things happen if hours > 9999. */ #define SEC 60 /* may be 100 on some machines */ #define MIN 3600 /* so that these two would be 6000 */ #define HOUR 216000 /* and 360000, respectively */ char * to_time(ticks) long ticks; { char *malloc(), *p; int hour, min, sec; ticks -= (hour = (ticks / HOUR)) * HOUR; ticks -= (min = (ticks / MIN)) * MIN; sec = ticks / SEC; p = malloc(12); sprintf(p, "%4d:%02d:%02d", hour, min, sec); return(p); } /* convert from a time in the form HHHH:MM:SS to a number of CPU clock ticks. the inverse of 'to_time()'. */ long to_ticks(time) char *time; { int hour, min, sec; sscanf(time, "%d:%d:%d", &hour, &min, &sec); return(hour * HOUR + min * MIN + sec * SEC); } /* return the uid from the next line in the old accounting file, or MAXUSERS if at EOF. */ next_old() { int uid; if (fgets(old_buf, 100, old_fp) == NULL) return(MAXUSERS); if (sscanf(old_buf, "%d", &uid) < 1) return(MAXUSERS); return(uid); } /* process the next line from an old accounting file, putting the information from it into the structure passed as a parameter. return 0 if okay, 1 if end-of-file. */ parse_old(s) struct s_stats *s; { char t1[12], t2[12], t3[12]; int uid; long to_ticks(); if (sscanf(old_buf, "%d %s %s %s %ld %ld %ld", &(s->uid), t1, t2, t3, &(s->mem), &(s->io), &(s->rw)) < 7) return(1); s->utime = to_ticks(t1); s->stime = to_ticks(t2); s->etime = to_ticks(t3); return(0); } /* return a pointer to a string containing the formatted sum of a line from the old accounting file and the entry in the new table for the same uid. */ char * merge_line(uid) int uid; { char *to_str(); struct s_stats s; /* if a line from the old file is invalid, just put in the new line */ if (parse_old(&s)) return(to_str(&s_array[uid])); s.utime += s_array[uid].utime; s.stime += s_array[uid].stime; s.etime += s_array[uid].etime; s.mem += s_array[uid].mem; s.io += s_array[uid].io; s.rw += s_array[uid].rw; return(to_str(&s)); } /* print the given message and die, removing any temporary files */ die(s1, s2, s3, s4, s5) char *s1, *s2, *s3, *s4, *s5; { fprintf(stderr, "sa: %s %s %s %s %s\n", s1, s2, s3, s4, s5); unlink(tempfile); exit(-1); } /* print the statistics of the new accounting file only onto the standard output. */ stats() { char *to_str(); int i; fprintf(stdout, "%s\n", header); for (i = 0; i < MAXUSERS; i++) if (s_array[i].utime > 0) fprintf(stdout, "%s\n", to_str(&s_array[i])); } /* merge the current accounting file information with that it other one, placing the result in the other. return 0 if everything okay, 1 (and keep all files in original condition) if some problem occurs. */ merge(old) char *old; { char *mktemp(), *merge_line(); int i, old_f, new_f; struct s_stats s; tempfile = mktemp("tempXXXXXX"); if ((temp_fp = fopen(tempfile, "w+")) < 0) { fprintf(stderr, "can't open temporary file %s\n", tempfile); return(1); } if ((old_fp = fopen(old, "r")) == NULL) { fprintf(stderr, "can't open old accounting file %s\n", old); return(1); } /* remove the header from the old file */ fgets(old_buf, 100, old_fp); fprintf(temp_fp, "%s\n", header); old_f = next_old(); new_f = next_new(); while ((old_f < MAXUSERS) || (new_f < MAXUSERS)) { if (old_f == new_f) { fprintf(temp_fp, "%s\n", merge_line(old_f)); old_f = next_old(); new_f = next_new(); } else if (new_f < old_f) { fprintf(temp_fp, "%s\n", to_str(&s_array[new_f])); new_f = next_new(); } else { fprintf(temp_fp, "%s", old_buf); old_f = next_old(); } } if (unlink(old)) { fprintf("can't overwrite old file %s\n", old); return(1); } link(tempfile, old); unlink(tempfile); return(0); } 0707070000020025041007770001460001440000010140740355100712500001100000000044MAKEflopcat Files | cpio -ocBv > /dev/fp021 0707070000020027721006440001460001440000010146420355100303200000700000003147sa.doc ssssaaaa((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 ssssaaaa((((1111)))) NNNNAAAAMMMMEEEE sa - system accounting program SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS sa [ -m mergefile ] [ acctfile ] DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN _S_a takes data from _a_c_c_t_f_i_l_e, a file created by _a_c_c_t(2), to create a summary of system use on a per-login basis. The output is a list, in ascending uid order, of uid, user, system and elapsed times, memory usage, character and block I/O usage, preceded by a one-line header. Only uids with non-zero user times are listed. If the -m flag is given, nothing is sent to the standard output. Instead, the statistics are summed with those in the file _m_e_r_g_e_f_i_l_e, and the results placed in it. _M_e_r_g_e_f_i_l_e _w_i_l_l _b_e _c_r_e_a_t_e_d _i_f _n_o_t current statistics. If no _a_c_c_t_f_i_l_e is given, /_u_s_r/_a_d_m/_a_c_c_t_f_i_l_e is used in default. OOOOPPPPEEEERRRRAAAATTTTIIIIOOOONNNN An accounting file can be created by a program which calls _a_c_c_t(2); if the shell script /_e_t_c/_r_c calls such a program, it will be executed automatically every time the system is started. However, the effective user ID of the calling process must be super-user. SSSSEEEEEEEE AAAALLLLSSSSOOOO _a_c_c_t(2),_a_c_c_t(_4) 0707070000020027721006440001460001440000010146420355100303200001300000000000TRAILER!!!n, nothing is sent to the standard output. Instead, the statistics are summed with those in the file _m_e_r_g_e_f_i_l_e, and the results placed in it. _M_e_r_g_e_f_i_l_e _w_i_l_l _b_e _c_r_e_a_t_e_d _i_f _n_o_t current statistics. If no _a_c_c_t_f_i_l_e is given, /_u_s_r/_a_d_m/_a_c_c_t_f_i_l_e is used in default. OOOOPPPPEEEERRRRAAAATTTTIIIIOOOONNNN An accounting file can be created by a program which calls _a_c_c_t(2); if the shell script /_e_t_c/_r_c calls such a program, it will be executed automatically every time the system is started. However, the effective user ID of the calling process must be super-user. SSSSEEEEEEEE AAAALLLLSSSSOOOO _a_c_c_t(2),_a_c_c_t(_4) 0707070000020027721006440001460001440000010146420355100303200001300000000000TRAILER!!!n, nothing is sent to the standard output. Instead, the statistics are summed with those in the file _m_e_r_g_e_f_i_l_e, and the results placed in it. _M_e_r_g_e_f_i_l_e _w_i_l_l _b_e _c_r_e_a_t_e_d _i_f _n_o_t current statistics. If no _a_c_c_t_f_i_l_e is given, /_u_s_r/_a_d_m/_a_c_c_t_f_i_l_e is used in default. OOOOPPPPEEEERRRRAAAATTTTIIIIOOOONNNN An accounting file can be created by a program which calls _a_c_c_t(2); if the shell script /_e_t_c/_r_c calls such a program, it will be executed automatically every time the system is started. However, the effective user ID of the calling process must be super-user. SSSSEEEEEEEE AAAALLLLSSSSOOOO _a_c_c_t(2),_a_c_c_t(_4) 0707070000020027721006440001460001440000010146420355100303200001300000000000TRAILER!!!n, nothing is sent to the standard output. Instead, the statistics are summed with those in the file _m_e_r_g_e_f_i_l_e, and the results placed in it. _M_e_r_g_e_f_i_l_e _w_i_l_l _b_e _c_r_e_a_t_e_d _i_f _n_o_t current statistics. If no _a_c_c_t_f_i_l_e is given, /_u_s_r/_a_d_m/_a_c_c_t_f_i_l_e is used in default. OOOOPPPPEEEERRRRAAAATTTTIIIIOOOONNNN An accounting file can be created by a program which calls _a_c_c_t(2); if the shell script /_e_t_c/_r_c calls such a program, it will be executed automatically every time the system is started. However, the effective user ID of the calling process must be super-user. SSSSEEEEEEEE AAAALLLLSSSSOOOO _a_c_c_t(2),_a_c_c_t(_4) 0707070000020027721006440001460001440000010146420355100303200001300000000000TRAILER!!!n, nothing is sent to the standard output. Instead, the statistics are summed with those in the file _m_e_r_g_e_f_i_l_e, and the results placed in it. _M_e_r_g_e_f_i_l_e _w_i_l_l _b_e _c_r_e_a_t_e_d _i_f _n_o_t current statistics. If no _a_c_c_t_f_i_l_e is given, /_u_s_r/_a_d_m/_a_c_c_t_f_i_l_e is used in default. OOOOPPPPEEEERRRRAAAATTTTIIIIOOOONNNN An accounting file can be created by a program which calls _a_c_c_t(2); if the shell script /_e_t_c/_r_c calls such a program, it will be executed automatically every time the system is started. However, the effective user ID of the calling process must be super-user. SSSSEEEEEEEE AAAALLLLSSSSOOOO _a_c_c_t(2),_a_c_c_t(_4) 0707070000020027721006440001460001440000010146420355100303200001300000000000TRAILER!!!n, nothing is sent to the standard output. Instead, the statistics are summed with those in the file _m_e_r_g_e_f_i_l_e, and the results placed in it. _M_e_r_g_e_f_i_l_e _w_i_l_l _b_e _c_r_e_a_t_e_d _i_f _n_o_t current statistics. If no _a_c_c_t_f_i_l_e is given, /_u_s_r/_a_d_m/_a_c_c_t_f_i_l_e is used in default. OOOOPPPPEEEERRRRAAAAT