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