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