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