home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mitsch75.zip / scheme-7_5_17-src.zip / scheme-7.5.17 / src / microcode / bchdrn.h < prev    next >
C/C++ Source or Header  |  2000-12-05  |  4KB  |  173 lines

  1. /* -*-C-*-
  2.  
  3. $Id: bchdrn.h,v 1.10 2000/12/05 21:23:42 cph Exp $
  4.  
  5. Copyright (c) 1991-2000 Massachusetts Institute of Technology
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or (at
  10. your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful, but
  13. WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15. General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. */
  21.  
  22. /* Header file for overlapped I/O in bchscheme. */
  23.  
  24. #ifndef _BCHDRN_H_INCLUDED
  25. #define _BCHDRN_H_INCLUDED
  26.  
  27. #include "config.h"
  28. #include <errno.h>
  29. #include <signal.h>
  30.  
  31. #ifdef HAVE_UNISTD_H
  32. #  include <unistd.h>
  33. #else
  34. #  ifdef __unix__
  35.      extern ssize_t EXFUN (read, (int, PTR, size_t));
  36.      extern ssize_t EXFUN (write, (int, PTR, size_t));
  37. #  endif
  38. #endif
  39.  
  40. #ifdef HAVE_POSIX_SIGNALS
  41. #  define RE_INSTALL_HANDLER(signum,handler)    do { } while (0)
  42. #else
  43. #  define RE_INSTALL_HANDLER(signum,handler)    signal (signum, handler)
  44. #endif
  45.  
  46. /* Doesn't work on GNU/Linux or on FreeBSD.  Disable until we can
  47.    figure out what is going on.  */
  48. #define AVOID_SYSV_SHARED_MEMORY
  49.  
  50. #if !defined(AVOID_SYSV_SHARED_MEMORY) && defined(HAVE_SHMAT)
  51. #  define USE_SYSV_SHARED_MEMORY
  52. #endif
  53.  
  54. #if defined(__HPUX__)
  55.  
  56. #  define HAVE_PREALLOC
  57.  
  58. #  include <magic.h>
  59. #  if defined(SHL_MAGIC)
  60. #    define hpux8 1
  61. #  endif
  62.  
  63. /* Page tables can have no gaps in HP-UX < 8.0, leave a gap for malloc. */
  64.  
  65. #  if defined(hp9000s300) || defined(__hp9000s300)
  66. #    ifdef hpux8
  67. #      define ATTACH_POINT    0x60000000
  68. #    else /* not hpux8 */
  69. #      define MALLOC_SPACE    (2 << 20)    /* 2 Meg */
  70. #    endif /* hpux8 */
  71. #  endif /* hp9000s300 */
  72.  
  73. #endif /* __HPUX__ */
  74.  
  75. #ifdef USE_SYSV_SHARED_MEMORY
  76.  
  77. #define DRONE_VERSION_NUMBER        ((1 << 8) | 2)
  78.  
  79. #include <sys/time.h>
  80. #include <sys/ipc.h>
  81. #include <sys/shm.h>
  82. #include <sys/signal.h>
  83. #include <sys/types.h>
  84. #include <sys/wait.h>
  85.  
  86. #ifndef MALLOC_SPACE
  87. #  define MALLOC_SPACE    0
  88. #endif
  89.  
  90. #ifndef ATTACH_POINT
  91. #  define ATTACH_POINT    0
  92. #endif
  93.  
  94. #define DRONE_EXTRA_T
  95.  
  96. struct drone_extra_s
  97. {
  98.   pid_t my_pid;
  99.   pid_t my_ppid;
  100. };
  101.  
  102. typedef struct drone_extra_s drone_extra_t;
  103.  
  104. #define DRONE_PID    drone_extra.my_pid
  105. #define DRONE_PPID    drone_extra.my_ppid
  106.  
  107. #endif /* USE_SYSV_SHARED_MEMORY */
  108.  
  109. /* Shared definitions for all versions */
  110.  
  111. enum buffer_state
  112. {
  113.   buffer_idle,            /* 0 */
  114.   buffer_busy,            /* 1, used for scan or free */
  115.   buffer_ready,            /* 2, after being read */
  116.   buffer_queued,        /* 3, never written, use as if read */
  117.   buffer_being_read,        /* 4 */
  118.   buffer_read_error,        /* 5 */
  119.   buffer_being_written,        /* 6 */
  120.   buffer_write_error        /* 7 */
  121. };
  122.  
  123. struct buffer_info
  124. {
  125.   int index;
  126.   enum buffer_state state;
  127.   long position;
  128.   long size;
  129.   PTR bottom;
  130.   PTR top;
  131.   PTR end;
  132. };
  133.  
  134. enum drone_state
  135. {
  136.   drone_dead,            /* 0 */
  137.   drone_not_ready,        /* 1 */
  138.   drone_idle,            /* 2 */
  139.   drone_reading,        /* 3 */
  140.   drone_writing,        /* 4 */
  141.   drone_aborting        /* 5 */
  142. };
  143.  
  144. struct drone_info
  145. {
  146.   int index;
  147. #ifdef DRONE_EXTRA_T
  148.   drone_extra_t drone_extra;
  149. #endif
  150.   enum drone_state state;
  151.   int buffer_index;
  152.   long entry_offset;
  153. };
  154.  
  155. enum queue_entry_state
  156. {
  157.   entry_idle,            /* 0 */
  158.   entry_busy,            /* 1 */
  159.   entry_error            /* 2 */
  160. };
  161.  
  162. struct gc_queue_entry
  163. {
  164.   int index;
  165.   enum queue_entry_state state;
  166.   struct buffer_info * buffer;
  167.   int drone_index;
  168.   int error_code;
  169.   int retry_count;
  170. };
  171.  
  172. #endif /* _BCHDRN_H_INCLUDED */
  173.