]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/baconfig.h
f052b13cdead87fc852e32849673cfcfc8584b17
[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 #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 #define FT_INVALIDDT 20               /* Drive type not allowed for */
222
223 /* Definitions for upper part of type word (see above). */
224 #define AR_DATA_STREAM (1<<16)        /* Data stream id present */
225
226 /*
227  * Tape label types -- stored in catalog
228  */
229 #define B_BACULA_LABEL 0
230 #define B_ANSI_LABEL   1
231 #define B_IBM_LABEL    2
232
233 /* Size of File Address stored in STREAM_SPARSE_DATA. Do NOT change! */
234 #define SPARSE_FADDR_SIZE (sizeof(uint64_t))
235
236
237 /* This is for dumb compilers/libraries like Solaris. Linux GCC
238  * does it correctly, so it might be worthwhile
239  * to remove the isascii(c) with ifdefs on such
240  * "smart" systems.
241  */
242 #define B_ISSPACE(c) (isascii((int)(c)) && isspace((int)(c)))
243 #define B_ISALPHA(c) (isascii((int)(c)) && isalpha((int)(c)))
244 #define B_ISUPPER(c) (isascii((int)(c)) && isupper((int)(c)))
245 #define B_ISDIGIT(c) (isascii((int)(c)) && isdigit((int)(c)))
246
247 /* For multiplying by 10 with shift and addition */
248 #define B_TIMES10(d) ((d<<3)+(d<<1))
249
250
251 typedef void (HANDLER)();
252 typedef int (INTHANDLER)();
253
254 #ifdef SETPGRP_VOID
255 # define SETPGRP_ARGS(x, y) /* No arguments */
256 #else
257 # define SETPGRP_ARGS(x, y) (x, y)
258 #endif
259
260 #ifndef S_ISLNK
261 #define S_ISLNK(m) (((m) & S_IFM) == S_IFLNK)
262 #endif
263
264 /* Added by KES to deal with Win32 systems */
265 #ifndef S_ISWIN32
266 #define S_ISWIN32 020000
267 #endif
268
269 #ifndef INADDR_NONE
270 #define INADDR_NONE ((unsigned long) -1)
271 #endif
272
273 #ifdef TIME_WITH_SYS_TIME
274 # include <sys/time.h>
275 # include <time.h>
276 #else
277 # ifdef HAVE_SYS_TIME_H
278 #  include <sys/time.h>
279 # else
280 #  include <time.h>
281 # endif
282 #endif
283
284 #ifndef O_BINARY
285 #define O_BINARY 0
286 #endif
287
288 #ifndef O_NOFOLLOW
289 #define O_NOFOLLOW 0
290 #endif
291
292 #ifndef MODE_RW
293 #define MODE_RW 0666
294 #endif
295
296 #ifdef DEBUG_MUTEX
297 extern void _p(char *file, int line, pthread_mutex_t *m);
298 extern void _v(char *file, int line, pthread_mutex_t *m);
299
300 #define P(x) _p(__FILE__, __LINE__, &(x))
301 #define V(x) _v(__FILE__, __LINE__, &(x))
302
303 #else
304 extern void _p(pthread_mutex_t *m);
305 extern void _v(pthread_mutex_t *m);
306
307 #define P(x) _p(&(x))
308 #define V(x) _v(&(x))
309
310 #endif /* DEBUG_MUTEX */
311
312 /* These probably should be subroutines */
313 #define Pw(x) \
314    do { int errstat; if ((errstat=rwl_writelock(&(x)))) \
315       e_msg(__FILE__, __LINE__, M_ABORT, 0, "Write lock lock failure. ERR=%s\n",\
316            strerror(errstat)); \
317    } while(0)
318
319 #define Vw(x) \
320    do { int errstat; if ((errstat=rwl_writeunlock(&(x)))) \
321          e_msg(__FILE__, __LINE__, M_ABORT, 0, "Write lock unlock failure. ERR=%s\n",\
322            strerror(errstat)); \
323    } while(0)
324
325 #define LockRes()   b_LockRes(__FILE__, __LINE__)
326 #define UnlockRes() b_UnlockRes(__FILE__, __LINE__)
327
328 #ifdef DEBUG_MEMSET
329 #define memset(a, v, n) b_memset(__FILE__, __LINE__, a, v, n)
330 void b_memset(const char *file, int line, void *mem, int val, size_t num);
331 #endif
332
333
334 /*
335  * The digit following Dmsg and Emsg indicates the number of substitutions in
336  * the message string. We need to do this kludge because non-GNU compilers
337  * do not handle varargs #defines.
338  */
339 /* Debug Messages that are printed */
340 #ifdef DEBUG
341 #define Dmsg0(lvl, msg)             if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg)
342 #define Dmsg1(lvl, msg, a1)         if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1)
343 #define Dmsg2(lvl, msg, a1, a2)     if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2)
344 #define Dmsg3(lvl, msg, a1, a2, a3) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3)
345 #define Dmsg4(lvl, msg, arg1, arg2, arg3, arg4) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4)
346 #define Dmsg5(lvl, msg, a1, a2, a3, a4, a5) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5)
347 #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)
348 #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)
349 #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)
350 #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)
351 #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)
352 #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)
353 #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)
354 #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)
355 #else
356 #define Dmsg0(lvl, msg)
357 #define Dmsg1(lvl, msg, a1)
358 #define Dmsg2(lvl, msg, a1, a2)
359 #define Dmsg3(lvl, msg, a1, a2, a3)
360 #define Dmsg4(lvl, msg, arg1, arg2, arg3, arg4)
361 #define Dmsg5(lvl, msg, a1, a2, a3, a4, a5)
362 #define Dmsg6(lvl, msg, a1, a2, a3, a4, a5, a6)
363 #define Dmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7)
364 #define Dmsg8(lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8)
365 #define Dmsg11(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
366 #define Dmsg12(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
367 #define Dmsg13(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13)
368 #endif /* DEBUG */
369
370 #ifdef TRACE_FILE
371 #define Tmsg0(lvl, msg)             t_msg(__FILE__, __LINE__, lvl, msg)
372 #define Tmsg1(lvl, msg, a1)         t_msg(__FILE__, __LINE__, lvl, msg, a1)
373 #define Tmsg2(lvl, msg, a1, a2)     t_msg(__FILE__, __LINE__, lvl, msg, a1, a2)
374 #define Tmsg3(lvl, msg, a1, a2, a3) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3)
375 #define Tmsg4(lvl, msg, arg1, arg2, arg3, arg4) t_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4)
376 #define Tmsg5(lvl, msg, a1, a2, a3, a4, a5) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5)
377 #define Tmsg6(lvl, msg, a1, a2, a3, a4, a5, a6) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6)
378 #define Tmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7)
379 #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)
380 #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)
381 #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)
382 #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)
383 #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)
384 #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)
385 #else
386 #define Tmsg0(lvl, msg)
387 #define Tmsg1(lvl, msg, a1)
388 #define Tmsg2(lvl, msg, a1, a2)
389 #define Tmsg3(lvl, msg, a1, a2, a3)
390 #define Tmsg4(lvl, msg, arg1, arg2, arg3, arg4)
391 #define Tmsg5(lvl, msg, a1, a2, a3, a4, a5)
392 #define Tmsg6(lvl, msg, a1, a2, a3, a4, a5, a6)
393 #define Tmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7)
394 #define Tmsg8(lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8)
395 #define Tmsg11(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
396 #define Tmsg12(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
397 #define Tmsg13(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13)
398 #endif /* TRACE_FILE */
399
400
401
402 /* Messages that are printed (uses d_msg) */
403 #define Pmsg0(lvl, msg)             p_msg(__FILE__, __LINE__, lvl, msg)
404 #define Pmsg1(lvl, msg, a1)         p_msg(__FILE__, __LINE__, lvl, msg, a1)
405 #define Pmsg2(lvl, msg, a1, a2)     p_msg(__FILE__, __LINE__, lvl, msg, a1, a2)
406 #define Pmsg3(lvl, msg, a1, a2, a3) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3)
407 #define Pmsg4(lvl, msg, arg1, arg2, arg3, arg4) p_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4)
408 #define Pmsg5(lvl, msg, a1, a2, a3, a4, a5) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5)
409 #define Pmsg6(lvl, msg, a1, a2, a3, a4, a5, a6) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6)
410 #define Pmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7)
411 #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)
412 #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)
413 #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)
414 #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)
415 #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)
416 #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)
417 #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)
418
419
420 /* Daemon Error Messages that are delivered according to the message resource */
421 #define Emsg0(typ, lvl, msg)             e_msg(__FILE__, __LINE__, typ, lvl, msg)
422 #define Emsg1(typ, lvl, msg, a1)         e_msg(__FILE__, __LINE__, typ, lvl, msg, a1)
423 #define Emsg2(typ, lvl, msg, a1, a2)     e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2)
424 #define Emsg3(typ, lvl, msg, a1, a2, a3) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3)
425 #define Emsg4(typ, lvl, msg, a1, a2, a3, a4) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4)
426 #define Emsg5(typ, lvl, msg, a1, a2, a3, a4, a5) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4, a5)
427 #define Emsg6(typ, lvl, msg, a1, a2, a3, a4, a5, a6) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4, a5, a6)
428
429 /* Job Error Messages that are delivered according to the message resource */
430 #define Jmsg0(jcr, typ, lvl, msg)             j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg)
431 #define Jmsg1(jcr, typ, lvl, msg, a1)         j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1)
432 #define Jmsg2(jcr, typ, lvl, msg, a1, a2)     j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2)
433 #define Jmsg3(jcr, typ, lvl, msg, a1, a2, a3) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3)
434 #define Jmsg4(jcr, typ, lvl, msg, a1, a2, a3, a4) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4)
435 #define Jmsg5(jcr, typ, lvl, msg, a1, a2, a3, a4, a5) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5)
436 #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)
437
438 /* Queued Job Error Messages that are delivered according to the message resource */
439 #define Qmsg0(jcr, typ, lvl, msg)             q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg)
440 #define Qmsg1(jcr, typ, lvl, msg, a1)         q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1)
441 #define Qmsg2(jcr, typ, lvl, msg, a1, a2)     q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2)
442 #define Qmsg3(jcr, typ, lvl, msg, a1, a2, a3) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3)
443 #define Qmsg4(jcr, typ, lvl, msg, a1, a2, a3, a4) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4)
444 #define Qmsg5(jcr, typ, lvl, msg, a1, a2, a3, a4, a5) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5)
445 #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)
446
447
448 /* Memory Messages that are edited into a Pool Memory buffer */
449 #define Mmsg0(buf, msg)             m_msg(__FILE__, __LINE__, buf, msg)
450 #define Mmsg1(buf, msg, a1)         m_msg(__FILE__, __LINE__, buf, msg, a1)
451 #define Mmsg2(buf, msg, a1, a2)     m_msg(__FILE__, __LINE__, buf, msg, a1, a2)
452 #define Mmsg3(buf, msg, a1, a2, a3) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3)
453 #define Mmsg4(buf, msg, a1, a2, a3, a4) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4)
454 #define Mmsg5(buf, msg, a1, a2, a3, a4, a5) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4, a5)
455 #define Mmsg6(buf, msg, a1, a2, a3, a4, a5, a6) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4, a5, a6)
456 #define Mmsg7(buf, msg, a1, a2, a3, a4, a5, a6, a7) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4, a5, a6)
457 #define Mmsg8(buf,msg,a1,a2,a3,a4,a5,a6,a7,a8) m_msg(__FILE__,__LINE__,buf,msg,a1,a2,a3,a4,a5,a6)
458 #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)
459 #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)
460
461 class POOL_MEM;
462 /* Edit message into Pool Memory buffer -- no __FILE__ and __LINE__ */
463 int  Mmsg(POOLMEM **msgbuf, const char *fmt,...);
464 int  Mmsg(POOLMEM *&msgbuf, const char *fmt,...);
465 int  Mmsg(POOL_MEM &msgbuf, const char *fmt,...);
466
467
468 class JCR;
469 void d_msg(const char *file, int line, int level, const char *fmt,...);
470 void p_msg(const char *file, int line, int level, const char *fmt,...);
471 void e_msg(const char *file, int line, int type, int level, const char *fmt,...);
472 void j_msg(const char *file, int line, JCR *jcr, int type, time_t mtime, const char *fmt,...);
473 void q_msg(const char *file, int line, JCR *jcr, int type, time_t mtime, const char *fmt,...);
474 int  m_msg(const char *file, int line, POOLMEM **msgbuf, const char *fmt,...);
475 int  m_msg(const char *file, int line, POOLMEM *&pool_buf, const char *fmt, ...);
476
477
478 /* Use our strdup with smartalloc */
479 #ifndef __WXGTK__
480 #undef strdup
481 #define strdup(buf) bad_call_on_strdup_use_bstrdup(buf)
482 #endif
483
484 /* Use our fgets which handles interrupts */
485 #undef fgets
486 #define fgets(x,y,z) bfgets((x), (y), (z))
487
488 /* Use our sscanf, which is safer and works with known sizes */
489 #define sscanf bsscanf
490
491 #ifdef DEBUG
492 #define bstrdup(str) strcpy((char *)b_malloc(__FILE__,__LINE__,strlen((str))+1),(str))
493 #else
494 #define bstrdup(str) strcpy((char *)bmalloc(strlen((str))+1),(str))
495 #endif
496
497 #ifdef DEBUG
498 #define bmalloc(size) b_malloc(__FILE__, __LINE__, (size))
499 #endif
500
501 /*
502  * Replace codes needed in both file routines and non-file routines
503  * Job replace codes -- in "replace"
504  */
505 #define REPLACE_ALWAYS   'a'
506 #define REPLACE_IFNEWER  'w'
507 #define REPLACE_NEVER    'n'
508 #define REPLACE_IFOLDER  'o'
509
510 /* This probably should be done on a machine by machine basic, but it works */
511 /* This is critical for the smartalloc routines to properly align memory */
512 #define ALIGN_SIZE (sizeof(double))
513 #define BALIGN(x) (((x) + ALIGN_SIZE - 1) & ~(ALIGN_SIZE -1))
514
515
516 /* =============================================================
517  *               OS Dependent defines
518  * ============================================================= 
519  */
520
521 #ifndef HAVE_FSEEKO
522 /* Bad news. This OS cannot handle 64 bit fseeks and ftells */
523 #define fseeko fseek
524 #define ftello ftell
525 #endif
526
527 #if defined (__digital__) && defined (__unix__)
528 /* Tru64 - it does have fseeko and ftello , but since ftell/fseek are also 64 bit */
529 /* take this 'shortcut' */
530 #define fseeko fseek
531 #define ftello ftell
532 #endif
533
534
535 #ifdef __alpha__
536 #define OSF 1
537 #endif
538
539 #ifdef HAVE_SUN_OS
540    /*
541     * On Solaris 2.5, threads are not timesliced by default, so we need to
542     * explictly increase the conncurrency level.
543     */
544 #include <thread.h>
545 #define set_thread_concurrency(x)  thr_setconcurrency(x)
546 extern int thr_setconcurrency(int);
547 #define SunOS 1
548
549 #else
550
551
552 /* Not needed on most systems */
553 #define set_thread_concurrency(x)
554
555 #endif
556
557 #if defined(HAVE_DARWIN_OS) || defined(HAVE_OSF1_OS)
558 /* Apparently someone forgot to wrap getdomainname as a C function */
559 extern "C" int getdomainname(char *name, int len);
560 #endif
561
562 #ifdef HAVE_OSF1_OS
563 extern "C" int mknod ( const char *path, int mode, dev_t device );
564 #endif
565
566
567 /* Define Winsock functions if we aren't on Windows */
568 #if !defined HAVE_WIN32
569 #define WSA_Init() 0 /* 0 = success */
570 #define WSACleanup() 0 /* 0 = success */
571 #endif
572
573 #ifdef HAVE_AIX_OS
574 #endif
575
576 /* HP-UX 11 specific workarounds */
577
578 #ifdef HAVE_HPUX_OS
579 # undef h_errno
580 extern int h_errno;
581 /* the {get,set}domainname() functions exist in HPUX's libc.
582  * the configure script detects that correctly.
583  * the problem is no system headers declares the prototypes for these functions
584  * this is done below
585  */
586 extern "C" int getdomainname(char *name, int namelen);
587 extern "C" int setdomainname(char *name, int namelen);
588 #define uLong unsigned long
589 #endif /* HAVE_HPUX_OS */
590
591
592 #ifdef HAVE_OSF1_OS
593 #undef HAVE_CHFLAGS  /* chflags is incorrectly detected */
594 extern "C" int fchdir(int filedes);
595 extern "C" long gethostid(void);
596 #endif
597
598
599 /* Added by KES to deal with Win32 systems */
600 #ifndef S_ISWIN32
601 #define S_ISWIN32 020000
602 #endif
603
604
605 /* Disabled because it breaks internationalisation...
606 #undef HAVE_SETLOCALE
607 #ifdef HAVE_SETLOCALE
608 #include <locale.h>
609 #else
610 #define setlocale(x, y) ("ANSI_X3.4-1968")
611 #endif
612 #ifdef HAVE_NL_LANGINFO
613 #include <langinfo.h>
614 #else
615 #define nl_langinfo(x) ("ANSI_X3.4-1968")
616 #endif
617 */
618
619 #endif /* _BACONFIG_H */