File: hostopts.h

package info (click to toggle)
hercules 3.07-2.2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 14,536 kB
  • sloc: ansic: 162,921; sh: 8,522; makefile: 784; perl: 202; sed: 16
file content (365 lines) | stat: -rw-r--r-- 14,601 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
/* HOSTOPTS.H   (c) Copyright "Fish" (David B. Trout), 2005-2009     */
/*              Host-specific features and options for Hercules      */

// $Id: hostopts.h 5586 2009-12-31 10:29:11Z rbowler $

//    This header file #included by 'featall.h' and 'hercules.h'

/*
   All HOST-operating-specific (Win32, Apple. Linux, etc) FEATures
   and OPTIONs that cannot be otherwise determined via configure.ac
   tests should be #defined here, and ONLY here!

   -----------------------------------------------------------------
   REMINDER: please do NOT use host-specific tests anywhere else in
   Hercules source code if you can help it! (e.g. #ifdef WIN32, etc)

   Instead, add a test to configure.ac which tests for the availability
   of the specific feature in question and then #defines a OPTION_XXX
   which can then be used in Hercules source code.
   -----------------------------------------------------------------

   The ONLY allowed exception is in the Hercules.h and htypes.h
   header files where different header files need to be #included
   (e.g. sockets) and/or typedef/#defines need to be made depending
   on the host build system type.

   ONLY IF such a configure.ac test is impractical or otherwise not
   possible should you then hard-code the OPTION_XXX setting here in
   this member (and ONLY in this member!) depending on the host o/s.

   Thus, all of the below hard-coded options are candidates for some
   future configure.ac test.

   Feel free to design one.

   Please. :)
*/

#ifndef _HOSTOPTS_H
#define _HOSTOPTS_H

#if defined(_MSVC_)
#include "hercwind.h"   // (need HAVE_DECL_SIOCSIFHWADDR, etc)
#endif

/*-------------------------------------------------------------------*/
/* ZZ FIXME
                  'OPTION_SCSI_ERASE_TAPE'
                  'OPTION_SCSI_ERASE_GAP'

    NOTE: The following SHOULD in reality be some sort of test
    within configure.ac, but until we can devise some sort of
    simple configure test, we must hard-code them for now.

    According to the only docs I could find:

       MTERASE   Erase the media from current position.
                 If the field mt_count is nonzero, a full
                 erase is done (from current position to
                 end of media). If mt_count is zero, only
                 an erase gap is written. It is hard to
                 say which drives support only one but not
                 the other option

    HOWEVER, since it's hard to say which drivers support short
    erase-gaps and which support erase-tape (and HOW they support
    them if they do! For example, Cygwin is currently coded to
    perform whichever type of erase the drive happens to support;
    e.g. if you try to do an erase-gap but the drive doesn't support
    short erases, it will end up doing a LONG erase [of the entire
    tape]!! (and vice-versa: doing a long erase-tape on a drive
    that doesn't support it will cause [Cygwin] to do an erase-
    gap instead)).

    THUS, the SAFEST thing to do is to simply treat all "erases",
    whether short or long, as 'nop's for now (in order to prevent
    the accidental erasure of an entire tape!) Once we happen to
    know for DAMN SURE that a particular host o/s ALWAYS does what
    we want it to should we then change the below #defines. (and
    like I said, they really SHOULD be in some type of configure
    test/setting and not here).
*/
/*-------------------------------------------------------------------*\

                     File name comparisons
                  ('strcmp' vs. 'strcasecmp')

   On Windows, file names are not case sensitive. While the case
   of the file name may be preserved by the file system (and thus
   show file names in both upper/lower case in directory listings
   for example), the file system itself is NOT case-sensitive. File
   names "Foo", "foo", "fOo", "FoO", etc, all refer to the same file.

   On other platforms however (e.g. *nix), the file system IS case
   sensitive. File names "Foo", "foo", "fOo", "FoO", etc, all refer
   to different files on such systems. Thus we define a 'strfilecmp'
   macro to be used for filename comparisons and define it to be
   strcasecmp on Win32 platforms and strcmp for other platforms.

\*-------------------------------------------------------------------*/


/*-------------------------------------------------------------------*/
/* Constants used in "#if OPTION_NAME == OPTION_VALUE" statements    */
/*-------------------------------------------------------------------*/

//       HOW_TO_IMPLEMENT_SH_COMMAND

#define  USE_FORK_API_FOR_SH_COMMAND           4
#define  USE_W32_POOR_MANS_FORK                5
#define  USE_ANSI_SYSTEM_API_FOR_SH_COMMAND    9


//       SET_CONSOLE_CURSOR_SHAPE_METHOD

#define  CURSOR_SHAPE_NOT_SUPPORTED             0
#define  CURSOR_SHAPE_VIA_SPECIAL_LINUX_ESCAPE  1
#define  CURSOR_SHAPE_WINDOWS_NATIVE            2


/*-------------------------------------------------------------------*/
/* The following is now handled automatically for ALL host platforms */
/*-------------------------------------------------------------------*/

#undef    OPTION_TUNTAP_SETNETMASK      /* (default initial setting) */
#undef    OPTION_TUNTAP_SETMACADDR      /* (default initial setting) */
#undef    OPTION_TUNTAP_DELADD_ROUTES   /* (default initial setting) */
#undef    OPTION_TUNTAP_CLRIPADDR       /* (default initial setting) */

#if defined(HAVE_DECL_SIOCSIFNETMASK) && \
            HAVE_DECL_SIOCSIFNETMASK

  #define OPTION_TUNTAP_SETNETMASK      /* TUNTAP_SetNetMask works   */

#endif
#if defined(HAVE_DECL_SIOCSIFHWADDR) && \
            HAVE_DECL_SIOCSIFHWADDR

  #define OPTION_TUNTAP_SETMACADDR      /* TUNTAP_SetMACAddr works   */

#endif
#if defined(HAVE_DECL_SIOCADDRT) && defined(HAVE_DECL_SIOCDELRT) && \
            HAVE_DECL_SIOCADDRT  &&         HAVE_DECL_SIOCDELRT

  #define OPTION_TUNTAP_DELADD_ROUTES   /* Del/Add Routes    works   */

#endif
#if defined(HAVE_DECL_SIOCDIFADDR) && \
            HAVE_DECL_SIOCDIFADDR

  #define OPTION_TUNTAP_CLRIPADDR       /* TUNTAP_ClrIPAddr works    */

#endif


/*-------------------------------------------------------------------*/
/* Hard-coded Win32-specific features and options...                 */
/*-------------------------------------------------------------------*/
#if defined(WIN32)                      /* "Windows" options         */

#if defined(HDL_BUILD_SHARED) && defined(_MSVC_)
  #define  DLL_IMPORT   __declspec ( dllimport )
  #define  DLL_EXPORT   __declspec ( dllexport )
#else
  #define  DLL_IMPORT   extern
  #define  DLL_EXPORT
#endif

#define HTTP_SERVER_CONNECT_KLUDGE

/*  Note:  OPTION_FISHIO  only possible with  OPTION_FTHREADS        */
#if defined(OPTION_FTHREADS)
  #define OPTION_FISHIO                 /* Use Fish's I/O scheduler  */
#else
  #undef  OPTION_FISHIO                 /* Use Herc's I/O scheduler  */
#endif

#define OPTION_W32_CTCI                 /* Fish's TunTap for CTCA's  */
#undef  TUNTAP_IFF_RUNNING_NEEDED       /* TunTap32 doesn't allow it */

#define OPTION_SCSI_TAPE                /* SCSI tape support         */
#ifdef _MSVC_
#define OPTION_SCSI_ERASE_TAPE          /* SUPPORTED!                */
#define OPTION_SCSI_ERASE_GAP           /* SUPPORTED!                */
#else // (mingw or cygwin?)
#undef  OPTION_SCSI_ERASE_TAPE          /* (NOT supported!)          */
#undef  OPTION_SCSI_ERASE_GAP           /* (NOT supported!)          */
#endif
#undef  OPTION_FBA_BLKDEVICE            /* (no FBA BLKDEVICE support)*/

#define MAX_DEVICE_THREADS          0   /* (0 == unlimited)          */
#undef  MIXEDCASE_FILENAMES_ARE_UNIQUE  /* ("Foo" same as "fOo"!!)   */

#define DEFAULT_HERCPRIO    0
#define DEFAULT_TOD_PRIO  -20
#define DEFAULT_CPU_PRIO   15
#define DEFAULT_DEV_PRIO    8

#ifdef _MSVC_
  #define HOW_TO_IMPLEMENT_SH_COMMAND   USE_W32_POOR_MANS_FORK
  #define SET_CONSOLE_CURSOR_SHAPE_METHOD CURSOR_SHAPE_WINDOWS_NATIVE
  #define OPTION_EXTCURS                /* Extended cursor handling  */
#else
  #define HOW_TO_IMPLEMENT_SH_COMMAND   USE_FORK_API_FOR_SH_COMMAND
  #define SET_CONSOLE_CURSOR_SHAPE_METHOD CURSOR_SHAPE_VIA_SPECIAL_LINUX_ESCAPE
  #undef  OPTION_EXTCURS                /* Normal cursor handling    */
#endif

#define IsEventSet(h)   (WaitForSingleObject(h,0) == WAIT_OBJECT_0)

/*-------------------------------------------------------------------*/
/* Hard-coded Solaris-specific features and options...               */
/*-------------------------------------------------------------------*/
#elif defined(__sun__) && defined(__svr4__)

#define __SOLARIS__ 1

/* jbs 10/15/2003 need to define INADDR_NONE if using Solaris 10
   and not Solaris Nevada aka OpenSolaris */
#if !defined(INADDR_NONE)
  #define INADDR_NONE                   0xffffffffU
#endif

#undef  OPTION_SCSI_TAPE                /* No SCSI tape support      */
#undef  OPTION_SCSI_ERASE_TAPE          /* (NOT supported)           */
#undef  OPTION_SCSI_ERASE_GAP           /* (NOT supported)           */
#define DLL_IMPORT   extern
#define DLL_EXPORT
/* #undef  OPTION_PTTRACE maybe not, after all */

#define MAX_DEVICE_THREADS          0   /* (0 == unlimited)          */
#define MIXEDCASE_FILENAMES_ARE_UNIQUE  /* ("Foo" and "fOo" unique)  */

#define DEFAULT_HERCPRIO    0
#define DEFAULT_TOD_PRIO  -20
#define DEFAULT_CPU_PRIO   15
#define DEFAULT_DEV_PRIO    8

#define HOW_TO_IMPLEMENT_SH_COMMAND       USE_ANSI_SYSTEM_API_FOR_SH_COMMAND
#define SET_CONSOLE_CURSOR_SHAPE_METHOD   CURSOR_SHAPE_NOT_SUPPORTED
#undef  OPTION_EXTCURS                  /* Normal cursor handling    */


/*-------------------------------------------------------------------*/
/* Hard-coded Apple-specific features and options...                 */
/*-------------------------------------------------------------------*/
#elif defined(__APPLE__)                /* "Apple" options           */

#define DLL_IMPORT   extern
#define DLL_EXPORT

#define TUNTAP_IFF_RUNNING_NEEDED       /* Needed by tuntap driver?? */

#undef  OPTION_SCSI_TAPE                /* No SCSI tape support      */
#undef  OPTION_SCSI_ERASE_TAPE          /* (NOT supported)           */
#undef  OPTION_SCSI_ERASE_GAP           /* (NOT supported)           */
#undef  OPTION_FBA_BLKDEVICE            /* (no FBA BLKDEVICE support)*/

#define MAX_DEVICE_THREADS          0   /* (0 == unlimited)          */
#define MIXEDCASE_FILENAMES_ARE_UNIQUE  /* ("Foo" and "fOo" unique)  */

#define DEFAULT_HERCPRIO    0
#define DEFAULT_TOD_PRIO  -20
#define DEFAULT_CPU_PRIO   15
#define DEFAULT_DEV_PRIO    8

#define HOW_TO_IMPLEMENT_SH_COMMAND       USE_ANSI_SYSTEM_API_FOR_SH_COMMAND
#define SET_CONSOLE_CURSOR_SHAPE_METHOD   CURSOR_SHAPE_NOT_SUPPORTED
#undef  OPTION_EXTCURS                  /* Normal cursor handling    */


/*-------------------------------------------------------------------*/
/* Hard-coded FreeBSD-specific features and options...               */
/*-------------------------------------------------------------------*/
#elif defined(__FreeBSD__)              /* "FreeBSD" options         */

#define DLL_IMPORT   extern
#define DLL_EXPORT

#define TUNTAP_IFF_RUNNING_NEEDED       /* Needed by tuntap driver?? */

#undef  OPTION_SCSI_ERASE_TAPE          /* (NOT supported)           */
#undef  OPTION_SCSI_ERASE_GAP           /* (NOT supported)           */

#define MAX_DEVICE_THREADS          0   /* (0 == unlimited)          */
#define MIXEDCASE_FILENAMES_ARE_UNIQUE  /* ("Foo" and "fOo" unique)  */

#define DEFAULT_HERCPRIO    0
#define DEFAULT_TOD_PRIO  -20
#define DEFAULT_CPU_PRIO   15
#define DEFAULT_DEV_PRIO    8

#define HOW_TO_IMPLEMENT_SH_COMMAND       USE_ANSI_SYSTEM_API_FOR_SH_COMMAND
#define SET_CONSOLE_CURSOR_SHAPE_METHOD   CURSOR_SHAPE_NOT_SUPPORTED
#undef  OPTION_EXTCURS                  /* Normal cursor handling    */


/*-------------------------------------------------------------------*/
/* GNU Linux options...                                              */
/*-------------------------------------------------------------------*/
#elif defined(__gnu_linux__)            /* GNU Linux options         */

#define DLL_IMPORT   extern
#define DLL_EXPORT

#define TUNTAP_IFF_RUNNING_NEEDED       /* Needed by tuntap driver?? */

#define OPTION_SCSI_TAPE                /* SCSI tape support         */
#undef  OPTION_SCSI_ERASE_TAPE          /* (NOT supported)           */
#undef  OPTION_SCSI_ERASE_GAP           /* (NOT supported)           */
#define OPTION_FBA_BLKDEVICE            /* FBA block device support  */

#define MAX_DEVICE_THREADS          0   /* (0 == unlimited)          */
#define MIXEDCASE_FILENAMES_ARE_UNIQUE  /* ("Foo" and "fOo" unique)  */

#define DEFAULT_HERCPRIO    0
#define DEFAULT_TOD_PRIO  -20
#define DEFAULT_CPU_PRIO   15
#define DEFAULT_DEV_PRIO    8

#if defined( HAVE_FORK )
  #define HOW_TO_IMPLEMENT_SH_COMMAND     USE_FORK_API_FOR_SH_COMMAND
#else
  #define HOW_TO_IMPLEMENT_SH_COMMAND     USE_ANSI_SYSTEM_API_FOR_SH_COMMAND
#endif
#define SET_CONSOLE_CURSOR_SHAPE_METHOD   CURSOR_SHAPE_VIA_SPECIAL_LINUX_ESCAPE
#undef  OPTION_EXTCURS                  /* Normal cursor handling    */


/*-------------------------------------------------------------------*/
/* Hard-coded OTHER (DEFAULT) host-specific features and options...  */
/*-------------------------------------------------------------------*/
#else                                   /* "Other platform" options  */

#warning hostopts.h: unknown target platform: defaulting to generic platform settings.

#define DLL_IMPORT   extern             /* (a safe default)          */
#define DLL_EXPORT

#undef TUNTAP_IFF_RUNNING_NEEDED        /* (tuntap support unknown)  */
#undef  OPTION_SCSI_TAPE                /* (NO SCSI tape support)    */
#undef  OPTION_SCSI_ERASE_TAPE          /* (NOT supported)           */
#undef  OPTION_SCSI_ERASE_GAP           /* (NOT supported)           */
#undef  OPTION_FBA_BLKDEVICE            /* (no FBA BLKDEVICE support)*/

#define MAX_DEVICE_THREADS          0   /* (0 == unlimited)          */
#define MIXEDCASE_FILENAMES_ARE_UNIQUE  /* ("Foo" and "fOo" unique)  */

#define DEFAULT_HERCPRIO    0
#define DEFAULT_TOD_PRIO  -20
#define DEFAULT_CPU_PRIO   15
#define DEFAULT_DEV_PRIO    8

#if defined( HAVE_FORK )
  #define HOW_TO_IMPLEMENT_SH_COMMAND     USE_FORK_API_FOR_SH_COMMAND
#else
  #define HOW_TO_IMPLEMENT_SH_COMMAND     USE_ANSI_SYSTEM_API_FOR_SH_COMMAND
#endif
#define SET_CONSOLE_CURSOR_SHAPE_METHOD   CURSOR_SHAPE_NOT_SUPPORTED
#undef  OPTION_EXTCURS                  /* Normal cursor handling    */


#endif // (host-specific tests)

#endif // _HOSTOPTS_H