home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume26 / tcx-1.1 / part01 / config.h next >
Encoding:
C/C++ Source or Header  |  1993-04-04  |  7.9 KB  |  195 lines

  1. /* config.h, Version 1.0.3, 5/4/1993 by Stewart Forster */
  2.  
  3. /************************************************************************/
  4. /*   Copyright (C) 1993 Stewart Forster                    */
  5. /*  This program is free software; you can redistribute it and/or modify*/
  6. /*  it under the terms of the GNU General Public License as published by*/
  7. /*  the Free Software Foundation; either version 2, or (at your option) */
  8. /*  any later version.                            */
  9. /*                                    */
  10. /*  This program is distributed in the hope that it will be useful,    */
  11. /*  but WITHOUT ANY WARRANTY; without even the implied warranty of    */
  12. /*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    */
  13. /*  GNU General Public License for more details.            */
  14. /*                                    */
  15. /*  You should have received a copy of the GNU General Public License    */
  16. /*  along with this program; if not, write to the Free Software        */
  17. /*  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.        */
  18. /************************************************************************/
  19.  
  20.  
  21. /************************************************************************/
  22. /*    OS TYPE DEFINITION                        */
  23. /* Define one of the following where appropriate            */
  24. /************************************************************************/
  25.  
  26. /* #define    SUNOS        /* */
  27. #define    IRIX        /* */
  28. /* #define    AIX        /* */
  29. /* #define    ULTRIX        /* */
  30. /* #define    LINUX        /* */
  31.  
  32. /************************************************************************/
  33. /* SUNOS requires the pstat command to be available.  This is part of     */
  34. /* the SunOs distribution but fix this following path if it's wrong.    */
  35. /************************************************************************/
  36.  
  37. #ifdef SUNOS
  38. #define    PSTATI    "/usr/etc/pstat -i"
  39. #endif
  40.  
  41. /************************************************************************/
  42. /* PATHUNTCX is the pathname where the untcx executable resides.  Note    */
  43. /* that this is the interpreter/unpacker and hence must exist with this    */
  44. /* path, or else the whole system will fail! This path should also be on*/
  45. /* a filesystem which the local system trusts setuid binaries from,    */
  46. /* since PATHUNTCX must run setuid to root.                */
  47. /************************************************************************/
  48.  
  49. #define    PATHUNTCX    "/usr/local/bin/untcx"
  50.  
  51. /************************************************************************/
  52. /* PATHTCX is the pathname to the tcx executable.  This should NOT be    */
  53. /* installed setuid root.                        */
  54. /************************************************************************/
  55.  
  56. #define    PATHTCX        "/usr/local/bin/tcx"
  57.  
  58. /************************************************************************/
  59. /* PATHPACKER is the pathname to the compression program you wish to use*/
  60. /* with the system. PACKEROPTS is an optional definition of options you    */
  61. /* wish to pass to the packer program. NB. The compression program must    */
  62. /* be a `filter', that is, it is capable of reading from stdion and    */
  63. /* compressing to stdout.                        */
  64. /************************************************************************/
  65.  
  66. #define    PATHPACKER    "/usr/local/bin/gzip"
  67. /*#define    PACKEROPTS    "-7"            /* Optional */
  68.  
  69. /************************************************************************/
  70. /* PATHUNPACK and the optional UNPACKOPTS serve a similar purpose to    */
  71. /* PATHPACKER and PACKEROPTS above.                    */
  72. /************************************************************************/
  73.  
  74. #define    PATHUNPACK    "/usr/local/bin/gzip"
  75. #define    UNPACKOPTS    "-d"            /* Optional */
  76.  
  77. /************************************************************************/
  78. /* UNPACK_IN_PLACE instructs the uncrompressor to unpack an executable    */
  79. /* where it lives if it resides on the local machine.  This is useful    */
  80. /* on machines with small /tmp's, plus it evenly distributes the disk    */
  81. /* workload.  It is generally deemed useful to have it turned on.    */
  82. /* Comment this out if you have a large unpack area for ENFSDIR (below)    */
  83. /* or if you have very limited CPU resources, since unpacking in place    */
  84. /* means that untcx will have to recompress the file later, rather than    */
  85. /* just deleting the temporary one from ENFSDIR.            */
  86. /************************************************************************/
  87.  
  88. #define    UNPACK_IN_PLACE    /* */
  89.  
  90. /************************************************************************/
  91. /* ENFSDIR is the pathname to the directory where emergency (out of disk*/
  92. /* space locally) or NFS mounted executables get unpacked to.        */
  93. /* On SUNOS, if you are using the "tmpfs", you will have to set ENFSDIR    */
  94. /* to a "real disk". (A "real disk" may also be an NFS mounted partition*/
  95. /* to which the machine has root access to).  There seems to be some    */
  96. /* problem with fcntl locks on SUNOS tmpfs.                */
  97. /************************************************************************/
  98.  
  99. #define    ENFSDIR        "/tmp/exec"
  100.  
  101. /************************************************************************/
  102. /* SCANRATE is the interval in seconds which the tcx daemon waits before*/
  103. /* rescanning all files it is currently managing, for recompression in    */
  104. /* the case of local files, or deletion from ENFSDIR in the case of     */
  105. /* emergency or NFS mounted executables.  Note that SCANRATE should    */
  106. /* probably not be larger than ENFSTIMEOUT or LOCALTIMEOUT defined    */
  107. /* below, otherwise you will undermine the purpose of those variables.    */
  108. /************************************************************************/
  109.  
  110. #define    SCANRATE    60        /* 60 seconds between scans */
  111.  
  112. /************************************************************************/
  113. /* ENFSTIMEOUT is the least number of seconds of disuse of an executable*/
  114. /* residing in ENFSDIR the tcx daemon will wait for, before it attempts    */
  115. /* to delete the executable. This should be set quite low if there isn't*/
  116. /* much disk space available in ENFSDIR.                */
  117. /* On SUNOS, this value only sets in after the inode is timed out of the*/
  118. /* inode cache.  This problem will be addressed in a future release.    */
  119. /************************************************************************/
  120.  
  121. #define    ENFSTIMEOUT    300        /* 5 minutes of inactivity */
  122.  
  123. /************************************************************************/
  124. /* LOCALTIMEOUT is the least number of seconds of disuse of an        */
  125. /* executable residing locally on the system that the tcx will wait    */
  126. /* before attempting to repack the executable.                */
  127. /* On SUNOS, this value only sets in after the inode is timed out of the*/
  128. /* inode cache.  This problem will be addressed in a future release.    */
  129. /************************************************************************/
  130.  
  131. #define    LOCALTIMEOUT    3600        /* 1 hour of inactivity */
  132.  
  133.  
  134. /************************************************************************/
  135. /************************************************************************/
  136. /* You should not need to edit anything after this point        */
  137. /************************************************************************/
  138. /************************************************************************/
  139.  
  140. #define    MAXHEADERSIZE    256
  141. #define    SIGTYPE    int
  142.  
  143. /* Define PUSLEEP (portable usleep definition)    */
  144.  
  145. #if defined(LINUX)
  146. #define    __USE_BSD_SIGNAL
  147. #define    SIGTYPE    void
  148. #endif
  149.  
  150. #if defined(IRIX)
  151. #define _BSD_SIGNALS
  152. #define    PUSLEEP(x)    (sginap((long)((x)/10000)))
  153. #endif
  154.  
  155. #if defined(ULTRIX) || defined(SUNOS) || defined(AIX) || defined(LINUX)
  156. #define    PUSLEEP(x)    (usleep(x))    /* usleep code in untcx.c for ULTRIX */
  157. #endif
  158.  
  159. #ifdef __STDC__
  160. #include    <stdlib.h>
  161. #endif
  162. #include        <unistd.h>
  163. #include        <sys/time.h>
  164. #include        <sys/wait.h>
  165.  
  166. #if defined(AIX)
  167. #include    <sys/id.h>
  168. #endif
  169.  
  170. #include        <sys/types.h>
  171.  
  172. #if defined(ULTRIX) || defined(LINUX)
  173. #include    <sys/param.h>
  174. #include    <sys/mount.h>
  175. #endif
  176.  
  177. #if defined(IRIX) || defined(AIX)
  178. #include        <sys/statfs.h>
  179. #endif
  180.  
  181. #if defined(SUNOS) || defined(LINUX)
  182. #include        <sys/vfs.h>
  183. #endif
  184.  
  185. #include        <sys/stat.h>
  186. #include    <fcntl.h>
  187. #include        <string.h>
  188. #include        <errno.h>
  189. #include        <signal.h>
  190. #include        <stdio.h>
  191.  
  192. #ifndef    MAXPATHLEN
  193. #define    MAXPATHLEN    1024
  194. #endif
  195.