home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c004 / 1.ddi / CTSRVE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-04-18  |  4.2 KB  |  211 lines

  1. /*
  2.  *    c-tree Server Environment Dependent Code
  3.  *
  4.  *    This program is the CONFIDENTIAL and PROPRIETARY property 
  5.  *    of FairCom(R) Corporation. Any unauthorized use, reproduction or
  6.  *    transfer of this program is strictly prohibited.
  7.  *
  8.  *      Copyright (c) 1987, 1988, 1989 FairCom Corporation
  9.  *    (Subject to limited distribution and
  10.  *     restricted disclosure only.)
  11.  *    *** ALL RIGHTS RESERVED ***
  12.  *
  13.  *    4006 West Broadway
  14.  *    Columbia, MO 65203
  15.  *
  16.  *
  17.  *    c-tree(R)    Version 4.3
  18.  *            Release C
  19.  *            February 7, 1989 17:30
  20.  *
  21.  */
  22.  
  23. #include "ctstdr.h"
  24. #include "ctoptn.h"
  25. #include "ctstrc.h"
  26. #include "ctgvar.h"
  27. #include "cterrc.h"
  28. #include "ctcomm.h"
  29.  
  30. extern SSTATUS cts_stat;
  31. extern COUNT   cts_mxusr,cts_mxfil;
  32. TEXT         **chkcopy();
  33.  
  34. #define    rqsts    cts_stat.srqsts
  35. #define    redo    cts_stat.sredo
  36. #define    sets    cts_stat.ssets
  37. #define    waks    cts_stat.swaks
  38. #define    uwaks    cts_stat.suwaks
  39. #define    retry    cts_stat.sretry
  40. #define cts_wl    cts_stat.scts_wl
  41. #define cts_rl    cts_stat.scts_rl
  42. #define cts_ul    cts_stat.scts_ul
  43.  
  44. VOID  getsenv(pblk,argc,argv)
  45. SRVPRM         *pblk;
  46. int               argc;
  47. char               *argv[];
  48. {
  49.     TEXT *cp,**tpa;
  50.     COUNT i;
  51.  
  52.     pblk->spns  = CTS_NODSEC;
  53.     pblk->spbf  = CTS_BUFFER;
  54.     pblk->spsz  = CTS_MAXSMSG;
  55.     pblk->splk  = CTS_MAXLOK;
  56.     pblk->spky  = CTS_KEYOPS;
  57.  
  58. /*
  59.  * The c-tree Source Code License Agreement expressly prohibits you from
  60.  * modifying the copyright legend displayed by the following code.
  61.  */
  62.     printf("\n\n\n\t\tc-tree(R) SERVER V4.3 Release C\n");
  63.     tpa = chkcopy();
  64.     for (i = 0; i < 7; i++)
  65.         printf("\n%s",tpa[i]);
  66.  
  67.     while (argc-- > 1) {
  68.         switch (*(cp = *++argv)) {
  69.  
  70. case 'K':
  71. case 'k':
  72.         pblk->spky = atoi(++cp);
  73.         break;
  74. case 'U':
  75. case 'u':
  76.         cts_mxusr = atoi(++cp);
  77.         break;
  78. case 'F':
  79. case 'f':
  80.         cts_mxfil = atoi(++cp);
  81.         break;
  82. case 'N':
  83. case 'n':
  84.         pblk->spns = atoi(++cp);
  85.         break;
  86. case 'Z':
  87. case 'z':
  88.         pblk->spsz = atoi(++cp);
  89.         break;
  90. case 'B':
  91. case 'b':
  92.         pblk->spbf = atoi(++cp);
  93.         break;
  94. case 'L':
  95. case 'l':
  96.         pblk->splk = atoi(++cp);
  97.         break;
  98. default:
  99.         printf("\"%s\" is not recognized\n",cp);
  100.         break;
  101.         }
  102.     }
  103.  
  104.     printf(
  105.   "\n\nusers=%d files=%d buffers=%d sectors=%d message=%d locks=%d keyops=%d\n",
  106.         cts_mxusr,cts_mxfil,pblk->spbf,pblk->spns,pblk->spsz,
  107.         pblk->splk,pblk->spky);
  108.  
  109.     if (cts_mxusr < 1)
  110.         srvexit("Bad user value:",cts_mxusr,0);
  111.         
  112.     if (pblk->spsz < 256 || pblk->spsz < MAXLEN)
  113.         srvexit("Bad message length:",pblk->spsz,0);
  114. }
  115.  
  116. VOID prploop()
  117. {
  118. }
  119.  
  120. VOID signoff(ffrq,ausrcon,ausrmap,ausrtrn)
  121. LONG         ffrq[];
  122. USRCON         *ausrcon;
  123. COUNT             *ausrmap;
  124. LONG                 *ausrtrn;
  125. {
  126.     FAST CTFILE *ctnum;
  127.     FAST USRCON *u;
  128.     FAST RECLOK *r;
  129.     UCOUNT         sum;
  130.  
  131.     printf("\nServer requests: %ld",rqsts);
  132.  
  133.     printf("\nWrite locks: %ld   Read locks: %ld   Unlocks: %ld",
  134.         cts_wl,cts_rl,cts_ul);
  135.     printf("\nRemaining locks: ");
  136.     sum = 0;
  137.     for (ctnum = ct_key; ctnum < ct_key + cts_mxfil; ctnum++) {
  138.         r = ctnum->rlokh;
  139.         while (r != NULL) {
  140.             sum++;
  141.             r = r->rllink;
  142.         }
  143.     }
  144.     printf("%d",sum);
  145.  
  146.     printf("\nRetries w/o block: %ld",redo);
  147.  
  148.     printf("\nBlock history: seg ops = %ld  seg clr = %ld  usr wak = %ld",
  149.         sets,waks,uwaks);
  150.     printf("\nRetries after block: %ld",retry);
  151.  
  152.     printf("\nRemaining Segment Blocks: ");
  153.     sum = 0;
  154.     for (u = ausrcon; u < ausrcon + cts_mxusr; u++) {
  155.         if (u->ucsgop != CTNONE || u->ucslep > -1)
  156.             sum++;
  157.     }
  158.     printf("%d\n\n",sum);
  159.  
  160.     for (sum = 0; sum < MAX_FUNC; sum++)
  161.         if (ffrq[sum] > 0)
  162.             printf("F%03d %5ld      ",sum,ffrq[sum]);
  163. #ifdef CTDEBUG
  164.     arep(0);    /* dynamic memory analysis: supported in CTCLB2.C */
  165. #endif
  166.  
  167.     printf("\n");
  168.     for (sum = 0; sum < cts_mxusr; sum++)
  169.         if (ausrtrn[sum])    printf("U%03d TRN   ",sum);
  170.         else if (ausrmap[sum])    printf("U%03d LOG   ",sum);
  171. }
  172.  
  173. srvexit(msg,i,j)
  174. TEXT   *msg;
  175. int        i,j;
  176. {
  177.     srvmesg(msg,i,j);
  178.     printf("\n");
  179.     exit(i);
  180. }
  181.  
  182. srvmesg(msg,i,j)
  183. TEXT   *msg;
  184. int         i,j;
  185. {
  186.     printf("\n%s",msg);
  187.     if (i || j)
  188.         printf(" %d %d",i,j);
  189.     return(0);
  190. }
  191.  
  192. transact(mode,usrn,usrtrn)
  193. COUNT     mode,usrn;
  194. LONG          *usrtrn;
  195. {
  196.     switch (mode) {
  197. case BEGTRAN:
  198.     usrtrn[usrn] = 1L;
  199.     break;
  200. case ENDTRAN:
  201.     usrtrn[usrn] = 0L;
  202.     break;
  203. default:
  204.     usrtrn[usrn] = 0L;
  205.     break;
  206.     }
  207.     return(NO_ERROR);
  208. }
  209.  
  210. /* end of ctsrve.c */
  211.