1: # include   <ingres.h>
   2: # include   <access.h>
   3: # include   <opsys.h>
   4: # include   <sccs.h>
   5: 
   6: SCCSID(@(#)last_page.c	8.2	1/17/85)
   7: 
   8: /*
   9: **	LAST_PAGE -- computes a tid for the last page in the relation.
  10: */
  11: 
  12: # ifdef xV6_UNIX
  13: struct stat
  14: {
  15:     char    junk[9], size0;
  16:     int size1;
  17:     char    junk2[25];
  18: };
  19: # endif
  20: 
  21: last_page(d, tid, buf)
  22: register DESC       *d;
  23: register TID        *tid;
  24: register struct accbuf  *buf;
  25: {
  26:     long        lpage;
  27:     struct stat stats;
  28: 
  29:     if ((buf != 0) && (abs(d->reldum.relspec) == M_HEAP) && (buf->mainpg == 0) && (buf->ovflopg == 0))
  30:         lpage = buf->thispage;
  31:     else
  32:     {
  33:         if (fstat(d->relfp, &stats))
  34:             syserr("last_page: fstat err %.14s", d->reldum.relid);
  35: #		ifdef xV6_UNIX
  36:         /* number of pages in relation - 1 */
  37:         lpage = ((stats.size1 >> 9) & 0177) + ((stats.size0 & I1MASK) << 7)- 1;
  38: #		else
  39:         lpage = stats.st_size / PGSIZE - 1;
  40: #		endif
  41: #		ifdef xATR2
  42:         if (tTf(26, 8))
  43:             printf("fstat-lp %.12s %ld\n", d->reldum.relid, lpage);
  44: #		endif
  45:     }
  46:     stuff_page(tid, &lpage);
  47:     tid->line_id = 0;
  48:     return (0);
  49: }

Defined functions

Defined struct's

stat defined in line 13; used 2 times
  • in line 27(2)
Last modified: 1986-04-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 747
Valid CSS Valid XHTML 1.0 Strict