]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/baconfig.h
Final changes
[bacula/bacula] / bacula / src / baconfig.h
1 /*
2  * General header file configurations that apply to
3  * all daemons.  System dependent stuff goes here.
4  *
5  *   Version $Id$
6  */
7 /*
8    Copyright (C) 2000-2005 Kern Sibbald
9
10    This program is free software; you can redistribute it and/or
11    modify it under the terms of the GNU General Public License
12    version 2 as amended with additional clauses defined in the
13    file LICENSE in the main source directory.
14
15    This program is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
18    the file LICENSE for additional details.
19
20  */
21
22
23 #ifndef _BACONFIG_H
24 #define _BACONFIG_H 1
25
26 /* Bacula common configuration defines */
27
28 #undef  TRUE
29 #undef  FALSE
30 #define TRUE  1
31 #define FALSE 0
32
33 #ifdef HAVE_TLS
34 #define have_tls 1
35 #else
36 #define have_tls 0
37 #endif
38
39 #ifndef ETIME
40 #define ETIME ETIMEDOUT
41 #endif
42
43 #ifdef PROTOTYPES
44 # define __PROTO(p)     p
45 #else
46 # define __PROTO(p)     ()
47 #endif
48
49 #ifdef DEBUG
50 #define ASSERT(x) if (!(x)) { \
51    char *jcr = NULL; \
52    Emsg1(M_ERROR, 0, _("Failed ASSERT: %s\n"), #x); \
53    jcr[0] = 0; }
54 #else
55 #define ASSERT(x)
56 #endif
57
58 /* Allow printing of NULL pointers */
59 #define NPRT(x) (x)?(x):_("*None*")
60  
61 #ifdef WIN32
62 #undef ENABLE_NLS
63 #endif
64
65 #ifdef ENABLE_NLS
66    #include <libintl.h>
67    #include <locale.h>
68    #ifndef _
69       #define _(s) gettext((s))
70    #endif /* _ */
71    #ifndef N_
72       #define N_(s) (s)
73    #endif /* N_ */
74 #else /* !ENABLE_NLS */
75    #ifndef _
76       #define _(s) (s)
77    #endif
78    #ifndef N_
79       #define N_(s) (s)
80    #endif
81    #ifndef textdomain
82       #define textdomain(d)
83    #endif
84    #ifndef bindtextdomain
85       #define bindtextdomain(p, d)
86    #endif
87    #ifndef setlocale
88       #define setlocale(p, d)
89    #endif
90 #endif /* ENABLE_NLS */
91
92 /* This should go away! ****FIXME***** */
93 #define MAXSTRING 500
94
95 /* Maximum length to edit time/date */
96 #define MAX_TIME_LENGTH 50
97
98 /* Maximum Name length including EOS */
99 #define MAX_NAME_LENGTH 128
100
101 /* Maximume number of user entered command args */
102 #define MAX_CMD_ARGS 30
103
104 /* All tape operations MUST be a multiple of this */
105 #define TAPE_BSIZE 1024
106
107 #ifdef DEV_BSIZE 
108 #define B_DEV_BSIZE DEV_BSIZE
109 #endif
110
111 #if !defined(B_DEV_BSIZE) & defined(BSIZE)
112 #define B_DEV_BSIZE BSIZE
113 #endif
114
115 #ifndef B_DEV_BSIZE
116 #define B_DEV_BSIZE 512
117 #endif
118
119 /*
120  * Set to time limit for other end to respond to
121  *  authentication.  Normally 10 minutes is *way*
122  *  more than enough. The idea is to keep the Director
123  *  from hanging because there is a dead connection on
124  *  the other end.
125  */
126 #define AUTH_TIMEOUT 60 * 10
127
128 /*
129  * Default network buffer size
130  */
131 #define DEFAULT_NETWORK_BUFFER_SIZE (64 * 1024)
132
133 /*
134  * Stream definitions.  Once defined these must NEVER
135  *   change as they go on the storage media.
136  * Note, the following streams are passed from the SD to the DIR
137  *   so that they may be put into the catalog (actually only the
138  *   stat packet part of the attr record is put in the catalog.
139  *
140  *   STREAM_UNIX_ATTRIBUTES
141  *   STREAM_UNIX_ATTRIBUTES_EX
142  *   STREAM_MD5_DIGEST
143  *   STREAM_SHA1_DIGEST
144  *   STREAM_SHA256_DIGEST
145  *   STREAM_SHA512_DIGEST
146  */
147 #define STREAM_NONE               0    /* Reserved Non-Stream */
148 #define STREAM_UNIX_ATTRIBUTES    1    /* Generic Unix attributes */
149 #define STREAM_FILE_DATA          2    /* Standard uncompressed data */
150 #define STREAM_MD5_DIGEST         3    /* MD5 digest for the file */
151 #define STREAM_GZIP_DATA          4    /* GZip compressed file data */
152 /* Extended Unix attributes with Win32 Extended data.  Deprecated. */
153 #define STREAM_UNIX_ATTRIBUTES_EX 5    /* Extended Unix attr for Win32 EX */
154 #define STREAM_SPARSE_DATA        6    /* Sparse data stream */
155 #define STREAM_SPARSE_GZIP_DATA   7
156 #define STREAM_PROGRAM_NAMES      8    /* program names for program data */
157 #define STREAM_PROGRAM_DATA       9    /* Data needing program */
158 #define STREAM_SHA1_DIGEST       10    /* SHA1 digest for the file */
159 #define STREAM_WIN32_DATA        11    /* Win32 BackupRead data */
160 #define STREAM_WIN32_GZIP_DATA   12    /* Gzipped Win32 BackupRead data */
161 #define STREAM_MACOS_FORK_DATA   13    /* Mac resource fork */
162 #define STREAM_HFSPLUS_ATTRIBUTES 14   /* Mac OS extra attributes */
163 /*** FIXME ***/
164 #define STREAM_UNIX_ATTRIBUTES_ACCESS_ACL 15 /* Standard ACL attributes on UNIX */
165 #define STREAM_UNIX_ATTRIBUTES_DEFAULT_ACL 16 /* Default ACL attributes on UNIX */
166 /*** FIXME ***/
167 #define STREAM_SHA256_DIGEST     17    /* SHA-256 digest for the file */
168 #define STREAM_SHA512_DIGEST     18    /* SHA-512 digest for the file */
169 #define STREAM_SIGNED_DIGEST     19    /* Signed File Digest, ASN.1 Encoded */
170 #define STREAM_ENCRYPTED_FILE_DATA 20  /* Encrypted, uncompressed data */
171 #define STREAM_ENCRYPTED_WIN32_DATA 21 /* Encrypted, uncompressed Win32 BackupRead data */
172
173
174 /*
175  *  File type (Bacula defined).
176  *  NOTE!!! These are saved in the Attributes record on the tape, so
177  *          do not change them. If need be, add to them.
178  *
179  *  This is stored as 32 bits on tape, but only FT_MASK bits are
180  *    used for the file type. The upper bits are used to indicate
181  *    additional optional fields in the attribute record.
182  */
183 #define FT_MASK       0xFFFF          /* Bits used by FT (type) */
184 #define FT_LNKSAVED   1               /* hard link to file already saved */
185 #define FT_REGE       2               /* Regular file but empty */
186 #define FT_REG        3               /* Regular file */
187 #define FT_LNK        4               /* Soft Link */
188 #define FT_DIREND     5               /* Directory at end (saved) */
189 #define FT_SPEC       6               /* Special file -- chr, blk, fifo, sock */
190 #define FT_NOACCESS   7               /* Not able to access */
191 #define FT_NOFOLLOW   8               /* Could not follow link */
192 #define FT_NOSTAT     9               /* Could not stat file */
193 #define FT_NOCHG     10               /* Incremental option, file not changed */
194 #define FT_DIRNOCHG  11               /* Incremental option, directory not changed */
195 #define FT_ISARCH    12               /* Trying to save archive file */
196 #define FT_NORECURSE 13               /* No recursion into directory */
197 #define FT_NOFSCHG   14               /* Different file system, prohibited */
198 #define FT_NOOPEN    15               /* Could not open directory */
199 #define FT_RAW       16               /* Raw block device */
200 #define FT_FIFO      17               /* Raw fifo device */
201 /* This directory packet is sent to the FD file processing routine so
202  * that it can filter packets, but otherwise, it is not used
203  * or saved */
204 #define FT_DIRBEGIN  18               /* Directory at beginning (not saved) */
205 #define FT_INVALIDFS 19               /* File system not allowed for */
206
207 /* Definitions for upper part of type word (see above). */
208 #define AR_DATA_STREAM (1<<16)        /* Data stream id present */
209
210 /*
211  * Tape label types -- stored in catalog
212  */
213 #define B_BACULA_LABEL 0
214 #define B_ANSI_LABEL   1
215 #define B_IBM_LABEL    2
216
217 /* Size of File Address stored in STREAM_SPARSE_DATA. Do NOT change! */
218 #define SPARSE_FADDR_SIZE (sizeof(uint64_t))
219
220
221 /* This is for dumb compilers/libraries like Solaris. Linux GCC
222  * does it correctly, so it might be worthwhile
223  * to remove the isascii(c) with ifdefs on such
224  * "smart" systems.
225  */
226 #define B_ISSPACE(c) (isascii((int)(c)) && isspace((int)(c)))
227 #define B_ISALPHA(c) (isascii((int)(c)) && isalpha((int)(c)))
228 #define B_ISUPPER(c) (isascii((int)(c)) && isupper((int)(c)))
229 #define B_ISDIGIT(c) (isascii((int)(c)) && isdigit((int)(c)))
230
231 /* For multiplying by 10 with shift and addition */
232 #define B_TIMES10(d) ((d<<3)+(d<<1))
233
234
235 typedef void (HANDLER)();
236 typedef int (INTHANDLER)();
237
238 #ifdef SETPGRP_VOID
239 # define SETPGRP_ARGS(x, y) /* No arguments */
240 #else
241 # define SETPGRP_ARGS(x, y) (x, y)
242 #endif
243
244 #ifndef S_ISLNK
245 #define S_ISLNK(m) (((m) & S_IFM) == S_IFLNK)
246 #endif
247
248 /* Added by KES to deal with Win32 systems */
249 #ifndef S_ISWIN32
250 #define S_ISWIN32 020000
251 #endif
252
253 #ifndef INADDR_NONE
254 #define INADDR_NONE ((unsigned long) -1)
255 #endif
256
257 #ifdef TIME_WITH_SYS_TIME
258 # include <sys/time.h>
259 # include <time.h>
260 #else
261 # ifdef HAVE_SYS_TIME_H
262 #  include <sys/time.h>
263 # else
264 #  include <time.h>
265 # endif
266 #endif
267
268 #ifndef O_BINARY
269 #define O_BINARY 0
270 #endif
271
272 #ifndef O_NOFOLLOW
273 #define O_NOFOLLOW 0
274 #endif
275
276 #ifndef MODE_RW
277 #define MODE_RW 0666
278 #endif
279
280 #ifdef DEBUG_MUTEX
281 extern void _p(char *file, int line, pthread_mutex_t *m);
282 extern void _v(char *file, int line, pthread_mutex_t *m);
283
284 #define P(x) _p(__FILE__, __LINE__, &(x))
285 #define V(x) _v(__FILE__, __LINE__, &(x))
286
287 #else
288 extern void _p(pthread_mutex_t *m);
289 extern void _v(pthread_mutex_t *m);
290
291 #define P(x) _p(&(x))
292 #define V(x) _v(&(x))
293
294 #endif /* DEBUG_MUTEX */
295
296 /* These probably should be subroutines */
297 #define Pw(x) \
298    do { int errstat; if ((errstat=rwl_writelock(&(x)))) \
299       e_msg(__FILE__, __LINE__, M_ABORT, 0, "Write lock lock failure. ERR=%s\n",\
300            strerror(errstat)); \
301    } while(0)
302
303 #define Vw(x) \
304    do { int errstat; if ((errstat=rwl_writeunlock(&(x)))) \
305          e_msg(__FILE__, __LINE__, M_ABORT, 0, "Write lock unlock failure. ERR=%s\n",\
306            strerror(errstat)); \
307    } while(0)
308
309 #define LockRes()   b_LockRes(__FILE__, __LINE__)
310 #define UnlockRes() b_UnlockRes(__FILE__, __LINE__)
311
312 #ifdef DEBUG_MEMSET
313 #define memset(a, v, n) b_memset(__FILE__, __LINE__, a, v, n)
314 void b_memset(const char *file, int line, void *mem, int val, size_t num);
315 #endif
316
317
318 /*
319  * The digit following Dmsg and Emsg indicates the number of substitutions in
320  * the message string. We need to do this kludge because non-GNU compilers
321  * do not handle varargs #defines.
322  */
323 /* Debug Messages that are printed */
324 #ifdef DEBUG
325 #define Dmsg0(lvl, msg)             if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg)
326 #define Dmsg1(lvl, msg, a1)         if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1)
327 #define Dmsg2(lvl, msg, a1, a2)     if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2)
328 #define Dmsg3(lvl, msg, a1, a2, a3) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3)
329 #define Dmsg4(lvl, msg, arg1, arg2, arg3, arg4) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4)
330 #define Dmsg5(lvl, msg, a1, a2, a3, a4, a5) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5)
331 #define Dmsg6(lvl, msg, a1, a2, a3, a4, a5, a6) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6)
332 #define Dmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7)
333 #define Dmsg8(lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8)
334 #define Dmsg9(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9) if ((lvl)<=debug_level) d_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9)
335 #define Dmsg10(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) if ((lvl)<=debug_level) d_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
336 #define Dmsg11(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) if ((lvl)<=debug_level) d_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
337 #define Dmsg12(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12) if ((lvl)<=debug_level) d_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
338 #define Dmsg13(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13) if ((lvl)<=debug_level) d_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13)
339 #else
340 #define Dmsg0(lvl, msg)
341 #define Dmsg1(lvl, msg, a1)
342 #define Dmsg2(lvl, msg, a1, a2)
343 #define Dmsg3(lvl, msg, a1, a2, a3)
344 #define Dmsg4(lvl, msg, arg1, arg2, arg3, arg4)
345 #define Dmsg5(lvl, msg, a1, a2, a3, a4, a5)
346 #define Dmsg6(lvl, msg, a1, a2, a3, a4, a5, a6)
347 #define Dmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7)
348 #define Dmsg8(lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8)
349 #define Dmsg11(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
350 #define Dmsg12(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
351 #define Dmsg13(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13)
352 #endif /* DEBUG */
353
354 #ifdef TRACE_FILE
355 #define Tmsg0(lvl, msg)             t_msg(__FILE__, __LINE__, lvl, msg)
356 #define Tmsg1(lvl, msg, a1)         t_msg(__FILE__, __LINE__, lvl, msg, a1)
357 #define Tmsg2(lvl, msg, a1, a2)     t_msg(__FILE__, __LINE__, lvl, msg, a1, a2)
358 #define Tmsg3(lvl, msg, a1, a2, a3) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3)
359 #define Tmsg4(lvl, msg, arg1, arg2, arg3, arg4) t_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4)
360 #define Tmsg5(lvl, msg, a1, a2, a3, a4, a5) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5)
361 #define Tmsg6(lvl, msg, a1, a2, a3, a4, a5, a6) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6)
362 #define Tmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7)
363 #define Tmsg8(lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8)
364 #define Tmsg9(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9) t_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9)
365 #define Tmsg10(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) t_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
366 #define Tmsg11(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) t_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
367 #define Tmsg12(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12) t_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
368 #define Tmsg13(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13) t_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13)
369 #else
370 #define Tmsg0(lvl, msg)
371 #define Tmsg1(lvl, msg, a1)
372 #define Tmsg2(lvl, msg, a1, a2)
373 #define Tmsg3(lvl, msg, a1, a2, a3)
374 #define Tmsg4(lvl, msg, arg1, arg2, arg3, arg4)
375 #define Tmsg5(lvl, msg, a1, a2, a3, a4, a5)
376 #define Tmsg6(lvl, msg, a1, a2, a3, a4, a5, a6)
377 #define Tmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7)
378 #define Tmsg8(lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8)
379 #define Tmsg11(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
380 #define Tmsg12(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
381 #define Tmsg13(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13)
382 #endif /* TRACE_FILE */
383
384
385
386 /* Messages that are printed (uses d_msg) */
387 #define Pmsg0(lvl, msg)             p_msg(__FILE__, __LINE__, lvl, msg)
388 #define Pmsg1(lvl, msg, a1)         p_msg(__FILE__, __LINE__, lvl, msg, a1)
389 #define Pmsg2(lvl, msg, a1, a2)     p_msg(__FILE__, __LINE__, lvl, msg, a1, a2)
390 #define Pmsg3(lvl, msg, a1, a2, a3) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3)
391 #define Pmsg4(lvl, msg, arg1, arg2, arg3, arg4) p_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4)
392 #define Pmsg5(lvl, msg, a1, a2, a3, a4, a5) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5)
393 #define Pmsg6(lvl, msg, a1, a2, a3, a4, a5, a6) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6)
394 #define Pmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7)
395 #define Pmsg8(lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8)
396 #define Pmsg9(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9) p_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9)
397 #define Pmsg10(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) p_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
398 #define Pmsg11(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) p_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
399 #define Pmsg12(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12) p_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
400 #define Pmsg13(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13) p_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13)
401 #define Pmsg14(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14) p_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14)
402
403
404 /* Daemon Error Messages that are delivered according to the message resource */
405 #define Emsg0(typ, lvl, msg)             e_msg(__FILE__, __LINE__, typ, lvl, msg)
406 #define Emsg1(typ, lvl, msg, a1)         e_msg(__FILE__, __LINE__, typ, lvl, msg, a1)
407 #define Emsg2(typ, lvl, msg, a1, a2)     e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2)
408 #define Emsg3(typ, lvl, msg, a1, a2, a3) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3)
409 #define Emsg4(typ, lvl, msg, a1, a2, a3, a4) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4)
410 #define Emsg5(typ, lvl, msg, a1, a2, a3, a4, a5) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4, a5)
411 #define Emsg6(typ, lvl, msg, a1, a2, a3, a4, a5, a6) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4, a5, a6)
412
413 /* Job Error Messages that are delivered according to the message resource */
414 #define Jmsg0(jcr, typ, lvl, msg)             j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg)
415 #define Jmsg1(jcr, typ, lvl, msg, a1)         j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1)
416 #define Jmsg2(jcr, typ, lvl, msg, a1, a2)     j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2)
417 #define Jmsg3(jcr, typ, lvl, msg, a1, a2, a3) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3)
418 #define Jmsg4(jcr, typ, lvl, msg, a1, a2, a3, a4) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4)
419 #define Jmsg5(jcr, typ, lvl, msg, a1, a2, a3, a4, a5) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5)
420 #define Jmsg6(jcr, typ, lvl, msg, a1, a2, a3, a4, a5, a6) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5, a6)
421
422 /* Queued Job Error Messages that are delivered according to the message resource */
423 #define Qmsg0(jcr, typ, lvl, msg)             q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg)
424 #define Qmsg1(jcr, typ, lvl, msg, a1)         q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1)
425 #define Qmsg2(jcr, typ, lvl, msg, a1, a2)     q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2)
426 #define Qmsg3(jcr, typ, lvl, msg, a1, a2, a3) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3)
427 #define Qmsg4(jcr, typ, lvl, msg, a1, a2, a3, a4) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4)
428 #define Qmsg5(jcr, typ, lvl, msg, a1, a2, a3, a4, a5) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5)
429 #define Qmsg6(jcr, typ, lvl, msg, a1, a2, a3, a4, a5, a6) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5, a6)
430
431
432 /* Memory Messages that are edited into a Pool Memory buffer */
433 #define Mmsg0(buf, msg)             m_msg(__FILE__, __LINE__, buf, msg)
434 #define Mmsg1(buf, msg, a1)         m_msg(__FILE__, __LINE__, buf, msg, a1)
435 #define Mmsg2(buf, msg, a1, a2)     m_msg(__FILE__, __LINE__, buf, msg, a1, a2)
436 #define Mmsg3(buf, msg, a1, a2, a3) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3)
437 #define Mmsg4(buf, msg, a1, a2, a3, a4) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4)
438 #define Mmsg5(buf, msg, a1, a2, a3, a4, a5) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4, a5)
439 #define Mmsg6(buf, msg, a1, a2, a3, a4, a5, a6) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4, a5, a6)
440 #define Mmsg7(buf, msg, a1, a2, a3, a4, a5, a6, a7) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4, a5, a6)
441 #define Mmsg8(buf,msg,a1,a2,a3,a4,a5,a6,a7,a8) m_msg(__FILE__,__LINE__,buf,msg,a1,a2,a3,a4,a5,a6)
442 #define Mmsg11(buf,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) m_msg(__FILE__,__LINE__,buf,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
443 #define Mmsg15(buf,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15) m_msg(__FILE__,__LINE__,buf,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15)
444
445 class POOL_MEM;
446 /* Edit message into Pool Memory buffer -- no __FILE__ and __LINE__ */
447 int  Mmsg(POOLMEM **msgbuf, const char *fmt,...);
448 int  Mmsg(POOLMEM *&msgbuf, const char *fmt,...);
449 int  Mmsg(POOL_MEM &msgbuf, const char *fmt,...);
450
451
452 class JCR;
453 void d_msg(const char *file, int line, int level, const char *fmt,...);
454 void p_msg(const char *file, int line, int level, const char *fmt,...);
455 void e_msg(const char *file, int line, int type, int level, const char *fmt,...);
456 void j_msg(const char *file, int line, JCR *jcr, int type, time_t mtime, const char *fmt,...);
457 void q_msg(const char *file, int line, JCR *jcr, int type, time_t mtime, const char *fmt,...);
458 int  m_msg(const char *file, int line, POOLMEM **msgbuf, const char *fmt,...);
459 int  m_msg(const char *file, int line, POOLMEM *&pool_buf, const char *fmt, ...);
460
461
462 /* Use our strdup with smartalloc */
463 #ifndef __WXGTK__
464 #undef strdup
465 #define strdup(buf) bad_call_on_strdup_use_bstrdup(buf)
466 #endif
467
468 /* Use our fgets which handles interrupts */
469 #undef fgets
470 #define fgets(x,y,z) bfgets((x), (y), (z))
471
472 /* Use our sscanf, which is safer and works with known sizes */
473 #define sscanf bsscanf
474
475 #ifdef DEBUG
476 #define bstrdup(str) strcpy((char *)b_malloc(__FILE__,__LINE__,strlen((str))+1),(str))
477 #else
478 #define bstrdup(str) strcpy((char *)bmalloc(strlen((str))+1),(str))
479 #endif
480
481 #ifdef DEBUG
482 #define bmalloc(size) b_malloc(__FILE__, __LINE__, (size))
483 #endif
484
485 /*
486  * Replace codes needed in both file routines and non-file routines
487  * Job replace codes -- in "replace"
488  */
489 #define REPLACE_ALWAYS   'a'
490 #define REPLACE_IFNEWER  'w'
491 #define REPLACE_NEVER    'n'
492 #define REPLACE_IFOLDER  'o'
493
494 /* This probably should be done on a machine by machine basic, but it works */
495 /* This is critical for the smartalloc routines to properly align memory */
496 #define ALIGN_SIZE (sizeof(double))
497 #define BALIGN(x) (((x) + ALIGN_SIZE - 1) & ~(ALIGN_SIZE -1))
498
499
500 /* =============================================================
501  *               OS Dependent defines
502  * ============================================================= 
503  */
504
505 #ifndef HAVE_FSEEKO
506 /* Bad news. This OS cannot handle 64 bit fseeks and ftells */
507 #define fseeko fseek
508 #define ftello ftell
509 #endif
510
511 #if defined (__digital__) && defined (__unix__)
512 /* Tru64 - it does have fseeko and ftello , but since ftell/fseek are also 64 bit */
513 /* take this 'shortcut' */
514 #define fseeko fseek
515 #define ftello ftell
516 #endif
517
518
519 #ifdef __alpha__
520 #define OSF 1
521 #endif
522
523 #ifdef HAVE_SUN_OS
524    /*
525     * On Solaris 2.5, threads are not timesliced by default, so we need to
526     * explictly increase the conncurrency level.
527     */
528 #include <thread.h>
529 #define set_thread_concurrency(x)  thr_setconcurrency(x)
530 extern int thr_setconcurrency(int);
531 #define SunOS 1
532
533 #else
534
535
536 /* Not needed on most systems */
537 #define set_thread_concurrency(x)
538
539 #endif
540
541 #if defined(HAVE_DARWIN_OS) || defined(HAVE_OSF1_OS)
542 /* Apparently someone forgot to wrap getdomainname as a C function */
543 extern "C" int getdomainname(char *name, int len);
544 #endif
545
546 #ifdef HAVE_OSF1_OS
547 extern "C" int mknod ( const char *path, int mode, dev_t device );
548 #endif
549
550 #ifdef HAVE_CYGWIN
551 /* They don't really have it */
552 #undef HAVE_GETDOMAINNAME
553 #endif
554
555 /* Define Winsock functions if we aren't on Windows */
556 #if (!defined HAVE_WIN32) || (defined HAVE_CYGWIN)
557 #define WSA_Init() 0 /* 0 = success */
558 #define WSACleanup() 0 /* 0 = success */
559 #endif
560
561 #ifdef HAVE_AIX_OS
562 #endif
563
564 /* HP-UX 11 specific workarounds */
565
566 #ifdef HAVE_HPUX_OS
567 # undef h_errno
568 extern int h_errno;
569 /* the {get,set}domainname() functions exist in HPUX's libc.
570  * the configure script detects that correctly.
571  * the problem is no system headers declares the prototypes for these functions
572  * this is done below
573  */
574 extern "C" int getdomainname(char *name, int namelen);
575 extern "C" int setdomainname(char *name, int namelen);
576 #define uLong unsigned long
577 #endif /* HAVE_HPUX_OS */
578
579
580 #ifdef HAVE_OSF1_OS
581 #undef HAVE_CHFLAGS  /* chflags is incorrectly detected */
582 extern "C" int fchdir(int filedes);
583 extern "C" long gethostid(void);
584 #endif
585
586
587 /* Added by KES to deal with Win32 systems */
588 #ifndef S_ISWIN32
589 #define S_ISWIN32 020000
590 #endif
591
592
593 /* Disabled because it breaks internationalisation...
594 #undef HAVE_SETLOCALE
595 #ifdef HAVE_SETLOCALE
596 #include <locale.h>
597 #else
598 #define setlocale(x, y) ("ANSI_X3.4-1968")
599 #endif
600 #ifdef HAVE_NL_LANGINFO
601 #include <langinfo.h>
602 #else
603 #define nl_langinfo(x) ("ANSI_X3.4-1968")
604 #endif
605 */
606
607 /* Fake entry points if regex does not exist */
608 #ifndef HAVE_REGEX_H
609 #define regcomp(x, y, z) 1
610 #define regfree(x)
611 #define regerror(rc, preg, prbuf, len) bstrncpy(prbuf, "REGEX not available on this system.", len)
612 #define regex_t int
613 #define regmatch_t char
614 #endif
615
616 #endif /* _BACONFIG_H */