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