home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / RESCUE / TCX-LINU.TAR / tcx / config.h next >
Encoding:
C/C++ Source or Header  |  1994-01-09  |  7.0 KB  |  184 lines

  1. /* config.h, Version 1.0.1, 25/3/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 LINUX 
  27. /* #define    SUNOS         */
  28. /* #define    IRIX     */
  29. /* #define    ULTRIX         */
  30.  
  31. /************************************************************************/
  32. /* SUNOS requires the pstat command to be available.  This is part of     */
  33. /* the SunOs distribution but fix this following path if it's wrong.    */
  34. /************************************************************************/
  35.  
  36. #ifdef SUNOS
  37. #define    PSTATI    "/usr/etc/pstat -i"
  38. #endif
  39.  
  40. /************************************************************************/
  41. /* PATHUNTCX is the pathname where the untcx executable resides.  Note    */
  42. /* that this is the interpreter/unpacker and hence must exist with this    */
  43. /* path, or else the whole system will fail! This path should also be on*/
  44. /* a filesystem which the local system trusts setuid binaries from,    */
  45. /* since PATHUNTCX must run setuid to root.                */
  46. /************************************************************************/
  47.  
  48. #define    PATHUNTCX    "/usr/local/bin/untcx"
  49.  
  50. /************************************************************************/
  51. /* PATHTCX is the pathname to the tcx executable.  This does not have to*/
  52. /*  be installed setuid.                        */
  53. /************************************************************************/
  54.  
  55. #define    PATHTCX        "/usr/local/bin/tcx"
  56.  
  57. /************************************************************************/
  58. /* PATHPACKER is the pathname to the compression program you wish to use*/
  59. /* with the system. PACKEROPTS is an optional definition of options you    */
  60. /* wish to pass to the packer program. NB. The compression program must    */
  61. /* be a `filter', that is, it is capable of reading from stdion and    */
  62. /* compressing to stdout.                        */
  63. /************************************************************************/
  64.  
  65. #define    PATHPACKER    "/usr/bin/gzip"
  66. #define    PACKEROPTS    "-7"            /* Optional */
  67.  
  68. /************************************************************************/
  69. /* PATHUNPACK and the optional UNPACKOPTS serve a similar purpose to    */
  70. /* PATHPACKER and PACKEROPTS above. */
  71. /************************************************************************/
  72.  
  73. #define    PATHUNPACK    "/usr/bin/gunzip"
  74. /* #define    UNPACKOPTS    "-d"    */        /* Optional */
  75.  
  76. /************************************************************************/
  77. /* ENFSDIR is the pathname to the directory where emergency (out of disk*/
  78. /* space locally) or NFS mounted executables get unpacked to.        */
  79. /* On SUNOS, if you are using the "tmpfs", you will have to set ENFSDIR    */
  80. /* to a "real disk". (A "real disk" may also be an NFS mounted partition*/
  81. /* to which the machine has root access to).  There seems to be some    */
  82. /* problem with fcntl locks on SUNOS tmpfs.                */
  83. /************************************************************************/
  84.  
  85. #define    ENFSDIR        "/tmp/exec"
  86.  
  87. /************************************************************************/
  88. /* SCANRATE is the interval in seconds which the tcx daemon waits before*/
  89. /* rescanning all files it is currently managing, for recompression in    */
  90. /* the case of local files, or deletion from ENFSDIR in the case of     */
  91. /* emergency or NFS mounted executables.  Note that SCANRATE should    */
  92. /* probably not be larger than ENFSTIMEOUT or LOCALTIMEOUT defined    */
  93. /* below, otherwise you will undermine the purpose of those variables.    */
  94. /************************************************************************/
  95.  
  96. #define    SCANRATE    60        /* 60 seconds between scans */
  97.  
  98. /************************************************************************/
  99. /* ENFSTIMEOUT is the least number of seconds of disuse of an executable*/
  100. /* residing in ENFSDIR the tcx daemon will wait for, before it attempts    */
  101. /* to delete the executable. This should be set quite low if there isn't*/
  102. /* much disk space available in ENFSDIR.                */
  103. /* On SUNOS, this value only sets in after the inode is timed out of the*/
  104. /* inode cache.  This problem will be addressed in a future release.    */
  105. /************************************************************************/
  106.  
  107. #define    ENFSTIMEOUT    60        /* 60 seconds of inactivity */
  108.  
  109. /************************************************************************/
  110. /* LOCALTIMEOUT is the least number of seconds of disuse of an        */
  111. /* executable residing locally on the system that the tcx will wait    */
  112. /* before attempting to repack the executable.                */
  113. /* On SUNOS, this value only sets in after the inode is timed out of the*/
  114. /* inode cache.  This problem will be addressed in a future release.    */
  115. /************************************************************************/
  116.  
  117. #define    LOCALTIMEOUT    150        /* 2.5 minutes */
  118.  
  119. /************************************************************************/
  120. /************************************************************************/
  121. /* You should not need to edit anything after this point        */
  122. /************************************************************************/
  123. /************************************************************************/
  124.  
  125. #define    MAXHEADERSIZE    256
  126.  
  127. /* Define PUSLEEP (portable usleep definition)    */
  128.  
  129. #ifdef    IRIX
  130. #define _BSD_SIGNALS
  131. #define    PUSLEEP(x)    (sginap((long)((x)/10000)))
  132. #endif
  133.  
  134. #ifdef    ULTRIX
  135. #define    PUSLEEP(x)    (usleep(x))    /* usleep code in untcx.c */
  136. #endif
  137.  
  138. #ifdef    SUNOS
  139. #define    PUSLEEP(x)    (usleep(x))
  140. #endif
  141.  
  142. #ifdef LINUX
  143. #define    PUSLEEP(x) (usleep(x))
  144. #endif
  145.  
  146. #include    <stdlib.h>
  147. #include        <unistd.h>
  148. #include        <sys/time.h>
  149. #include        <sys/wait.h>
  150. #include        <sys/types.h>
  151.  
  152. #ifdef ULTRIX
  153. #include    <sys/param.h>
  154. #include    <sys/mount.h>
  155. #endif
  156.  
  157. #ifdef LINUX
  158. #include        <sys/vfs.h>
  159. #endif
  160.  
  161. #ifdef IRIX
  162. #include        <sys/statfs.h>
  163. #endif
  164.  
  165. #ifdef SUNOS
  166. #include        <sys/vfs.h>
  167. #endif
  168.  
  169. #include        <sys/stat.h>
  170.  
  171. #include    <fcntl.h>
  172. #include        <string.h>
  173. #include        <errno.h>
  174. #include        <signal.h>
  175. #include        <stdio.h>
  176.  
  177. #if defined(SUNOS) || defined(ULTRIX) || defined(LINUX)
  178. #include    <utime.h>
  179. #endif
  180.  
  181. #ifndef    MAXPATHLEN
  182. #define    MAXPATHLEN    1024
  183. #endif
  184.