home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR41 / CBASE11.ZIP / BLKIO.MAN < prev    next >
Text File  |  1993-01-01  |  6KB  |  175 lines

  1. NAME
  2.      lockb - block file record locking
  3.  
  4. SYNOPSIS
  5.      #include <blkio.h>
  6.  
  7.      int lockb(bp, ltype, start, len)
  8.      BLKFILE *bp;
  9.      int ltype;
  10.      bpos_t start;
  11.      bpos_t len;
  12.  
  13. DESCRIPTION
  14.      The lockb function will allow segments of a block file to be
  15.      locked.  bp is the BLKFILE pointer for the file to be locked.
  16.  
  17.      ltype indicates the target status of the lock.  The lock types
  18.      available are:
  19.  
  20.        B_UNLCK unlock block file segment
  21.        B_RDLCK lock block file segment for reading
  22.        B_WRLCK lock block file segment for reading and writing
  23.        B_RDLKW lock block file segment for reading (wait)
  24.        B_WRLKW lock block file segment for reading and writing (wait)
  25.  
  26.      For the lock types which wait, lockb will not return until the
  27.      lock is available.  For the lock types which do not wait, if the
  28.      lock is unavailable because of a lock held by another process  a
  29.      value of -1 is returned and errno set to EAGAIN.
  30.  
  31.      start is the first block to lock.  len is the number of
  32.      contiguous blocks including and following block start to be
  33.      locked or unlocked.  A lock may be set to extend to the end of
  34.      the file by setting len to zero.
  35.  
  36.      The buffers are flushed before unlocking.
  37.  
  38.      lockb will fail if one or more of the following is true:
  39.  
  40.      [EAGAIN]       ltype is B_RDLCK and the file segment to be locked
  41.                     is already write locked by another process, or
  42.                     ltype is B_WRLCK and the file segment to be locked
  43.                     is already read or write locked by another
  44.                     process.
  45.      [EINVAL]       bp is is not a valid BLKFILE pointer.
  46.      [EINVAL]       ltype is not one of the valid lock types.
  47.      [BENOPEN]      bp is not open.
  48.      [BENOPEN]      ltype is B_RDLCK or B_RDLKW and bp is not opened
  49.                     for reading or ltype is B_WRLCK or B_WRLKW and bp
  50.                     is not open for writing.
  51.  
  52. DIAGNOSTICS
  53.      Upon successful completion, a value of 0 is returned.  Otherwise,
  54.      a value of -1 is returned, and errno set to indicate the error.
  55.  
  56. NAME
  57.      bsetbuf - assign buffering to a block file
  58.  
  59. SYNOPSIS
  60.      #include <blkio.h>
  61.  
  62.      int bsetbuf(bp, buf)
  63.      BLKFILE *bp;
  64.      void *buf;
  65.  
  66. DESCRIPTION
  67.      The bsetbuf function causes the storage area pointed to by buf to
  68.      be used by the block file associated with BLKFILE pointer bp
  69.      instead of an automatically allocated buffer area.  If buf is the
  70.      NULL pointer, bp will be completely unbuffered.  Otherwise, it
  71.      must point to a storage area of size no less than
  72.  
  73.           header size + block size * buffer count
  74.  
  75.      bsetbuf may be called at any time after opening the block file,
  76.      before and after it is read or written; the buffers are flushed
  77.      before installing the new buffer area.
  78.  
  79.      bsetbuf will fail if one or more of the following is true:
  80.  
  81.      [EINVAL]       bp is not a valid BLKFILE pointer.
  82.      [BENBUF]       bp is unbuffered and buf is not the NULL
  83.                     pointer.
  84.      [BENOPEN]      bp is not open.
  85.  
  86. SEE ALSO
  87.      bopen, bsetvbuf.
  88.  
  89. DIAGNOSTICS
  90.      Upon successful completion, a value of 0 is returned.  Otherwise,
  91.      a value of -1 is returned, and errno set to indicate the error.
  92.  
  93. NOTES
  94.      A common source of error is allocating buffer space as an
  95.      automatic variable in a code block, and then failing to close the
  96.      block file in the same block.
  97.  
  98. NAME
  99.      bsetvbuf - assign buffering to a block file
  100.  
  101. SYNOPSIS
  102.      #include <blkio.h>
  103.  
  104.      int bsetvbuf(bp, buf, blksize, bufcnt)
  105.      BLKFILE *bp;
  106.      void *buf;
  107.      size_t blksize;
  108.      size_t bufcnt;
  109.  
  110. DESCRIPTION
  111.      The bsetvbuf function causes the block size and buffer block
  112.      count of the block file associated with BLKFILE pointer bp to be
  113.      changed to bufcnt and blksize, with the same effects as if the
  114.      file had been opened with these values.  If bufcnt has a value of
  115.      zero, the file will be completely unbuffered.  If buf is not the
  116.      NULL pointer, the storage area it points to will be used instead
  117.      of one automatically allocated for buffering.  In this case, buf
  118.      must point to a storage area of size no less than
  119.  
  120.           header size + block size * buffer count
  121.  
  122.      bsetvbuf may be called at any time after opening the block file,
  123.      before and after it is read or written.
  124.  
  125.      bsetvbuf will fail if one or more of the following is true:
  126.  
  127.      [EINVAL]       bp is not a valid BLKFILE pointer.
  128.      [EINVAL]       blksize is less than 1.
  129.      [ENOMEM]       Enough memory is not available for the
  130.                     calling process to allocate.
  131.      [BENOPEN]      bp is not open.
  132.  
  133. SEE ALSO
  134.      bopen, bsetbuf.
  135.  
  136. DIAGNOSTICS
  137.      Upon successful completion, a value of 0 is returned.  Otherwise,
  138.      a value of -1 is returned, and errno set to indicate the error.
  139.  
  140. NOTES
  141.      A common source of error is allocating buffer space as an
  142.      automatic variable in a code block, and then failing to close the
  143.      block file in the same block.
  144.  
  145. NAME
  146.      bsync - synchronize a block file
  147.  
  148. SYNOPSIS
  149.      #include <blkio.h>
  150.  
  151.      int bsync(bp)
  152.      BLKFILE *bp;
  153.  
  154. DESCRIPTION
  155.      The bsync function causes the block file associated with BLKFILE
  156.      pointer bp to be synchronized with its buffers; any buffered data
  157.      which has been written to the buffers is written to the file.
  158.      The header, if it has been modified, is written out last.  The
  159.      block file remains open and the buffers retain their contents.
  160.      If bp is open read-only or is not buffered, there will be no data
  161.      to synchronize and bsync will return a value of zero immediately.
  162.  
  163.      bsync will fail if one or more of the following is true:
  164.  
  165.      [EINVAL]       bp is not a valid BLKFILE pointer.
  166.      [BENOPEN]      bp is not open.
  167.  
  168. SEE ALSO
  169.      bexit, bflush, bputb.
  170.  
  171. DIAGNOSTICS
  172.      Upon successful completion, a value of 0 is returned.  Otherwise,
  173.      a value of -1 is returned, and errno set to indicate the error.
  174.  
  175.