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