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