home *** CD-ROM | disk | FTP | other *** search
/ linuxmafia.com 2016 / linuxmafia.com.tar / linuxmafia.com / pub / linux / backup / star-1.3.1.tar.gz / star-1.3.1.tar / star-1.3.1 / star / fifo.h < prev    next >
Text File  |  2000-11-09  |  3KB  |  80 lines

  1. /* @(#)fifo.h    1.6 00/11/09 Copyright 1989 J. Schilling */
  2. /*
  3.  *    Definitions for a "fifo" that uses
  4.  *    shared memory between two processes
  5.  *
  6.  *    Copyright (c) 1989 J. Schilling
  7.  */
  8. /*
  9.  * This program is free software; you can redistribute it and/or modify
  10.  * it under the terms of the GNU General Public License as published by
  11.  * the Free Software Foundation; either version 2, or (at your option)
  12.  * any later version.
  13.  *
  14.  * This program is distributed in the hope that it will be useful,
  15.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.  * GNU General Public License for more details.
  18.  *
  19.  * You should have received a copy of the GNU General Public License
  20.  * along with this program; see the file COPYING.  If not, write to
  21.  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  22.  */
  23.  
  24. typedef    struct    {
  25.     BOOL    reading;    /* true if currently reading from tape    */
  26.     int    swapflg;    /* -1: init, 0: FALSE, 1: TRUE        */
  27.     long    blocksize;    /* Blocksize for each transfer        */
  28.     long    blocks;        /* Full blocks transfered on Volume    */
  29.     long    parts;        /* Bytes fom partial transferes on Volume */
  30.     long    lastsize;    /* Size of last transfer (for backtape)    */
  31.     long    Tblocks;    /* Total blocks transfered        */
  32.     long    Tparts;        /* Total Bytes fom parttial transferes    */
  33.     int    volno;        /* Volume #                */
  34. } m_stats;
  35.  
  36. typedef struct {
  37.     char    *putptr;    /* put pointer within shared memory */
  38.     char    *getptr;    /* get pointer within shared memory */
  39.     char    *base;        /* base of fifo within shared memory segment*/
  40.     char    *end;        /* end of real shared memory segment */
  41.     int    size;        /* size of fifo within shared memory segment*/
  42.     int    ibs;        /* input transfer size    */
  43.     int    obs;        /* output transfer size    */
  44.     unsigned long    icnt;    /* input count (incremented on each put) */
  45.     unsigned long    ocnt;    /* output count (incremented on each get) */
  46.     int    hiw;        /* highwater mark */
  47.     int    low;        /* lowwater mark */
  48.     int    flags;        /* fifo flags */
  49.     int    gp[2];        /* sync pipe for get process */
  50.     int    pp[2];        /* sync pipe for put process */
  51.     int    puts;        /* fifo put count statistic */
  52.     int    gets;        /* fifo get get statistic */
  53.     int    empty;        /* fifo was empty count statistic */
  54.     int    full;        /* fifo was full count statistic */
  55.     int    maxfill;    /* max # of bytes in fifo */
  56.     m_stats    stats;        /* statistics            */
  57. } m_head;
  58.  
  59. #define    gpin    gp[0]        /* get pipe in  */
  60. #define    gpout    gp[1]        /* get pipe out */
  61. #define    ppin    pp[0]        /* put pipe in  */
  62. #define    ppout    pp[1]        /* put pipe out */
  63.  
  64. #define    FIFO_AMOUNT(p)    ((p)->icnt - (p)->ocnt)
  65.  
  66. #define    FIFO_IBLOCKED    0x001    /* input  (put side) is blocked    */
  67. #define    FIFO_OBLOCKED    0x002    /* output (get side) is blocked    */
  68. #define    FIFO_FULL    0x004    /* fifo is full            */
  69. #define    FIFO_MEOF    0x008    /* EOF on input (put side)    */
  70. #define    FIFO_MERROR    0x010    /* error on input (put side)    */
  71. #define    FIFO_EXIT    0x020    /* exit() on non tape side    */
  72.  
  73. #define    FIFO_IWAIT    0x200    /* input (put side) waits after first record */
  74. #define    FIFO_I_CHREEL    0x400    /* change input tape reel if fifo gets empty */
  75. #define    FIFO_O_CHREEL    0x800    /* change output tape reel if fifo gets empty*/
  76.  
  77. #if    !defined(HAVE_SMMAP) && !defined(HAVE_USGSHM) && !defined(HAVE_DOSALLOCSHAREDMEM)
  78. #undef    FIFO            /* We cannot have a FIFO on this platform */
  79. #endif
  80.