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