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