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