]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/baconfig.h
Add Peter Eriksson's const code + turn bsscanf code
[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  * Default network buffer size
99  */
100 #define DEFAULT_NETWORK_BUFFER_SIZE (32 * 1024)
101
102 /*
103  * Stream definitions.  Once defined these must NEVER
104  *   change as they go on the storage media.
105  * Note, the following streams are passed from the SD to the DIR
106  *   so that they may be put into the catalog (actually only the
107  *   stat packet part of the attr record is put in the catalog.
108  *
109  *   STREAM_UNIX_ATTRIBUTES
110  *   STREAM_UNIX_ATTRIBUTES_EX
111  *   STREAM_MD5_SIGNATURE
112  *   STREAM_SHA1_SIGNATURE
113  */
114 #define STREAM_UNIX_ATTRIBUTES    1    /* Generic Unix attributes */
115 #define STREAM_FILE_DATA          2    /* Standard uncompressed data */
116 #define STREAM_MD5_SIGNATURE      3    /* MD5 signature for the file */
117 #define STREAM_GZIP_DATA          4    /* GZip compressed file data */
118 /* Extended Unix attributes with Win32 Extended data.  Deprecated. */
119 #define STREAM_UNIX_ATTRIBUTES_EX 5    /* Extended Unix attr for Win32 EX */
120 #define STREAM_SPARSE_DATA        6    /* Sparse data stream */
121 #define STREAM_SPARSE_GZIP_DATA   7
122 #define STREAM_PROGRAM_NAMES      8    /* program names for program data */
123 #define STREAM_PROGRAM_DATA       9    /* Data needing program */
124 #define STREAM_SHA1_SIGNATURE    10    /* SHA1 signature for the file */
125 #define STREAM_WIN32_DATA        11    /* Win32 BackupRead data */
126 #define STREAM_WIN32_GZIP_DATA   12    /* Gzipped Win32 BackupRead data */
127 #define STREAM_MACOS_FORK_DATA   13    /* Mac resource fork */
128 #define STREAM_HFSPLUS_ATTRIBUTES 14   /* Mac OS extra attributes */
129 #define STREAM_UNIX_ATTRIBUTES_ACL 15 /* ACL attributes on UNIX */
130
131 /* 
132  *  File type (Bacula defined).           
133  *  NOTE!!! These are saved in the Attributes record on the tape, so
134  *          do not change them. If need be, add to them.
135  *
136  *  This is stored as 32 bits on tape, but only FT_MASK bits are
137  *    used for the file type. The upper bits are used to indicate
138  *    additional optional fields in the attribute record.
139  */
140 #define FT_MASK       0xFFFF          /* Bits used by FT (type) */
141 #define FT_LNKSAVED   1               /* hard link to file already saved */  
142 #define FT_REGE       2               /* Regular file but empty */
143 #define FT_REG        3               /* Regular file */
144 #define FT_LNK        4               /* Soft Link */
145 #define FT_DIREND     5               /* Directory at end (saved) */
146 #define FT_SPEC       6               /* Special file -- chr, blk, fifo, sock */
147 #define FT_NOACCESS   7               /* Not able to access */
148 #define FT_NOFOLLOW   8               /* Could not follow link */
149 #define FT_NOSTAT     9               /* Could not stat file */
150 #define FT_NOCHG     10               /* Incremental option, file not changed */
151 #define FT_DIRNOCHG  11               /* Incremental option, directory not changed */
152 #define FT_ISARCH    12               /* Trying to save archive file */
153 #define FT_NORECURSE 13               /* No recursion into directory */
154 #define FT_NOFSCHG   14               /* Different file system, prohibited */
155 #define FT_NOOPEN    15               /* Could not open directory */
156 #define FT_RAW       16               /* Raw block device */
157 #define FT_FIFO      17               /* Raw fifo device */
158 /* This directory packet is sent to the FD file processing routine so
159  * that it can filter packets, but otherwise, it is not used
160  * or saved */
161 #define FT_DIRBEGIN  18               /* Directory at beginning (not saved) */
162
163 /* Definitions for upper part of type word (see above). */
164 #define AR_DATA_STREAM (1<<16)        /* Data stream id present */
165
166 /*
167  * Internal code for Signature types
168  */
169 #define NO_SIG   0
170 #define MD5_SIG  1
171 #define SHA1_SIG 2
172
173 /* Size of File Address stored in STREAM_SPARSE_DATA. Do NOT change! */
174 #define SPARSE_FADDR_SIZE (sizeof(uint64_t))
175
176
177 /* This is for dumb compilers/libraries like Solaris. Linux GCC
178  * does it correctly, so it might be worthwhile
179  * to remove the isascii(c) with ifdefs on such
180  * "smart" systems.
181  */
182 #define B_ISSPACE(c) (isascii((int)(c)) && isspace((int)(c)))
183 #define B_ISALPHA(c) (isascii((int)(c)) && isalpha((int)(c)))
184 #define B_ISUPPER(c) (isascii((int)(c)) && isupper((int)(c)))
185 #define B_ISDIGIT(c) (isascii((int)(c)) && isdigit((int)(c)))
186
187 /* For multiplying by 10 with shift and addition */
188 #define B_TIMES10(d) ((d<<3)+(d<<1))
189
190
191 typedef void (HANDLER)();
192 typedef int (INTHANDLER)();
193
194 #ifdef SETPGRP_VOID
195 # define SETPGRP_ARGS(x, y) /* No arguments */
196 #else
197 # define SETPGRP_ARGS(x, y) (x, y)
198 #endif
199
200 #ifndef S_ISLNK
201 #define S_ISLNK(m) (((m) & S_IFM) == S_IFLNK)
202 #endif
203
204 /* Added by KES to deal with Win32 systems */
205 #ifndef S_ISWIN32
206 #define S_ISWIN32 020000
207 #endif
208
209 #ifndef INADDR_NONE
210 #define INADDR_NONE ((unsigned long) -1)
211 #endif
212
213 #ifdef TIME_WITH_SYS_TIME
214 # include <sys/time.h>
215 # include <time.h>
216 #else
217 # ifdef HAVE_SYS_TIME_H
218 #  include <sys/time.h>
219 # else
220 #  include <time.h>
221 # endif
222 #endif
223
224 #ifndef O_BINARY
225 #define O_BINARY 0
226 #endif
227
228 #ifndef O_NOFOLLOW
229 #define O_NOFOLLOW 0
230 #endif
231
232 #ifndef MODE_RW
233 #define MODE_RW 0666
234 #endif
235
236 #ifdef DEBUG_MUTEX
237 extern void _p(char *file, int line, pthread_mutex_t *m);
238 extern void _v(char *file, int line, pthread_mutex_t *m);
239
240 #define P(x) _p(__FILE__, __LINE__, &(x))
241 #define V(x) _v(__FILE__, __LINE__, &(x))
242
243 #else
244
245 /* These probably should be subroutines */
246 #define P(x) \
247    do { int errstat; if ((errstat=pthread_mutex_lock(&(x)))) \
248       e_msg(__FILE__, __LINE__, M_ABORT, 0, "Mutex lock failure. ERR=%s\n",\
249            strerror(errstat)); \
250    } while(0)
251
252 #define V(x) \
253    do { int errstat; if ((errstat=pthread_mutex_unlock(&(x)))) \
254          e_msg(__FILE__, __LINE__, M_ABORT, 0, "Mutex unlock failure. ERR=%s\n",\
255            strerror(errstat)); \
256    } while(0)
257
258 #endif /* DEBUG_MUTEX */
259
260 /* These probably should be subroutines */
261 #define Pw(x) \
262    do { int errstat; if ((errstat=rwl_writelock(&(x)))) \
263       e_msg(__FILE__, __LINE__, M_ABORT, 0, "Write lock lock failure. ERR=%s\n",\
264            strerror(errstat)); \
265    } while(0)
266
267 #define Vw(x) \
268    do { int errstat; if ((errstat=rwl_writeunlock(&(x)))) \
269          e_msg(__FILE__, __LINE__, M_ABORT, 0, "Write lock unlock failure. ERR=%s\n",\
270            strerror(errstat)); \
271    } while(0)
272
273 #define LockRes()   b_LockRes(__FILE__, __LINE__)
274 #define UnlockRes() b_UnlockRes(__FILE__, __LINE__)
275
276
277 /*
278  * The digit following Dmsg and Emsg indicates the number of substitutions in
279  * the message string. We need to do this kludge because non-GNU compilers
280  * do not handle varargs #defines.
281  */
282 /* Debug Messages that are printed */
283 #ifdef DEBUG
284 #define Dmsg0(lvl, msg)             d_msg(__FILE__, __LINE__, lvl, msg)
285 #define Dmsg1(lvl, msg, a1)         d_msg(__FILE__, __LINE__, lvl, msg, a1)
286 #define Dmsg2(lvl, msg, a1, a2)     d_msg(__FILE__, __LINE__, lvl, msg, a1, a2)
287 #define Dmsg3(lvl, msg, a1, a2, a3) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3)
288 #define Dmsg4(lvl, msg, arg1, arg2, arg3, arg4) d_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4)
289 #define Dmsg5(lvl, msg, a1, a2, a3, a4, a5) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5)
290 #define Dmsg6(lvl, msg, a1, a2, a3, a4, a5, a6) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6)
291 #define Dmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7)
292 #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)
293 #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)
294 #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)
295 #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)
296 #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)
297 #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)
298 #else
299 #define Dmsg0(lvl, msg)
300 #define Dmsg1(lvl, msg, a1)
301 #define Dmsg2(lvl, msg, a1, a2)
302 #define Dmsg3(lvl, msg, a1, a2, a3)
303 #define Dmsg4(lvl, msg, arg1, arg2, arg3, arg4)
304 #define Dmsg5(lvl, msg, a1, a2, a3, a4, a5)
305 #define Dmsg6(lvl, msg, a1, a2, a3, a4, a5, a6)
306 #define Dmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7)
307 #define Dmsg8(lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8)
308 #define Dmsg11(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
309 #define Dmsg12(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
310 #define Dmsg13(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13)
311 #endif /* DEBUG */
312
313 #ifdef TRACE_FILE
314 #define Tmsg0(lvl, msg)             t_msg(__FILE__, __LINE__, lvl, msg)
315 #define Tmsg1(lvl, msg, a1)         t_msg(__FILE__, __LINE__, lvl, msg, a1)
316 #define Tmsg2(lvl, msg, a1, a2)     t_msg(__FILE__, __LINE__, lvl, msg, a1, a2)
317 #define Tmsg3(lvl, msg, a1, a2, a3) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3)
318 #define Tmsg4(lvl, msg, arg1, arg2, arg3, arg4) t_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4)
319 #define Tmsg5(lvl, msg, a1, a2, a3, a4, a5) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5)
320 #define Tmsg6(lvl, msg, a1, a2, a3, a4, a5, a6) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6)
321 #define Tmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7)
322 #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)
323 #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)
324 #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)
325 #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)
326 #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)
327 #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)
328 #else
329 #define Tmsg0(lvl, msg)
330 #define Tmsg1(lvl, msg, a1)
331 #define Tmsg2(lvl, msg, a1, a2)
332 #define Tmsg3(lvl, msg, a1, a2, a3)
333 #define Tmsg4(lvl, msg, arg1, arg2, arg3, arg4)
334 #define Tmsg5(lvl, msg, a1, a2, a3, a4, a5)
335 #define Tmsg6(lvl, msg, a1, a2, a3, a4, a5, a6)
336 #define Tmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7)
337 #define Tmsg8(lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8)
338 #define Tmsg11(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
339 #define Tmsg12(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
340 #define Tmsg13(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13)
341 #endif /* TRACE_FILE */
342
343
344
345 /* Messages that are printed (uses d_msg) */
346 #define Pmsg0(lvl, msg)             p_msg(__FILE__, __LINE__, lvl, msg)
347 #define Pmsg1(lvl, msg, a1)         p_msg(__FILE__, __LINE__, lvl, msg, a1)
348 #define Pmsg2(lvl, msg, a1, a2)     p_msg(__FILE__, __LINE__, lvl, msg, a1, a2)
349 #define Pmsg3(lvl, msg, a1, a2, a3) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3)
350 #define Pmsg4(lvl, msg, arg1, arg2, arg3, arg4) p_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4)
351 #define Pmsg5(lvl, msg, a1, a2, a3, a4, a5) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5)
352 #define Pmsg6(lvl, msg, a1, a2, a3, a4, a5, a6) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6)
353 #define Pmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7)
354 #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)
355 #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)
356 #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)
357 #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)
358 #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)
359 #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)
360 #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)
361
362        
363 /* Daemon Error Messages that are delivered according to the message resource */
364 #define Emsg0(typ, lvl, msg)             e_msg(__FILE__, __LINE__, typ, lvl, msg)
365 #define Emsg1(typ, lvl, msg, a1)         e_msg(__FILE__, __LINE__, typ, lvl, msg, a1)
366 #define Emsg2(typ, lvl, msg, a1, a2)     e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2)
367 #define Emsg3(typ, lvl, msg, a1, a2, a3) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3)
368 #define Emsg4(typ, lvl, msg, a1, a2, a3, a4) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4)
369 #define Emsg5(typ, lvl, msg, a1, a2, a3, a4, a5) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4, a5)
370 #define Emsg6(typ, lvl, msg, a1, a2, a3, a4, a5, a6) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4, a5, a6)
371
372 /* Job Error Messages that are delivered according to the message resource */
373 #define Jmsg0(jcr, typ, lvl, msg)             j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg)
374 #define Jmsg1(jcr, typ, lvl, msg, a1)         j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1)
375 #define Jmsg2(jcr, typ, lvl, msg, a1, a2)     j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2)
376 #define Jmsg3(jcr, typ, lvl, msg, a1, a2, a3) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3)
377 #define Jmsg4(jcr, typ, lvl, msg, a1, a2, a3, a4) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4)
378 #define Jmsg5(jcr, typ, lvl, msg, a1, a2, a3, a4, a5) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5)
379 #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)
380
381 /* Queued Job Error Messages that are delivered according to the message resource */
382 #define Qmsg0(jcr, typ, lvl, msg)             q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg)
383 #define Qmsg1(jcr, typ, lvl, msg, a1)         q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1)
384 #define Qmsg2(jcr, typ, lvl, msg, a1, a2)     q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2)
385 #define Qmsg3(jcr, typ, lvl, msg, a1, a2, a3) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3)
386 #define Qmsg4(jcr, typ, lvl, msg, a1, a2, a3, a4) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4)
387 #define Qmsg5(jcr, typ, lvl, msg, a1, a2, a3, a4, a5) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5)
388 #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)
389
390
391 /* Memory Messages that are edited into a Pool Memory buffer */
392 #define Mmsg0(buf, msg)             m_msg(__FILE__, __LINE__, buf, msg)
393 #define Mmsg1(buf, msg, a1)         m_msg(__FILE__, __LINE__, buf, msg, a1)
394 #define Mmsg2(buf, msg, a1, a2)     m_msg(__FILE__, __LINE__, buf, msg, a1, a2)
395 #define Mmsg3(buf, msg, a1, a2, a3) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3)
396 #define Mmsg4(buf, msg, a1, a2, a3, a4) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4)
397 #define Mmsg5(buf, msg, a1, a2, a3, a4, a5) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4, a5)
398 #define Mmsg6(buf, msg, a1, a2, a3, a4, a5, a6) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4, a5, a6)
399 #define Mmsg7(buf, msg, a1, a2, a3, a4, a5, a6, a7) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4, a5, a6)
400 #define Mmsg8(buf,msg,a1,a2,a3,a4,a5,a6,a7,a8) m_msg(__FILE__,__LINE__,buf,msg,a1,a2,a3,a4,a5,a6)
401 #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)
402 #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)
403
404 /* Edit message into Pool Memory buffer -- no __FILE__ and __LINE__ */
405 int  Mmsg(POOLMEM **msgbuf, const char *fmt,...);
406
407
408 struct JCR;
409 void d_msg(const char *file, int line, int level, const char *fmt,...);
410 void p_msg(const char *file, int line, int level, const char *fmt,...);
411 void e_msg(const char *file, int line, int type, int level, const char *fmt,...);
412 void j_msg(const char *file, int line, JCR *jcr, int type, int level, const char *fmt,...);
413 void q_msg(const char *file, int line, JCR *jcr, int type, int level, const char *fmt,...);
414 int  m_msg(const char *file, int line, POOLMEM **msgbuf, const char *fmt,...);
415
416
417 /* Use our strdup with smartalloc */
418 #undef strdup
419 #define strdup(buf) bad_call_on_strdup_use_bstrdup(buf)
420
421 /* Use our fgets which handles interrupts */
422 #undef fgets
423 #define fgets(x,y,z) bfgets((x), (y), (z))
424
425 /* Use our sscanf, which is safer and works with known sizes */
426 #define sscanf bsscanf
427
428 #ifdef DEBUG
429 #define bstrdup(str) strcpy((char *)b_malloc(__FILE__,__LINE__,strlen((str))+1),(str))
430 #else
431 #define bstrdup(str) strcpy((char *)bmalloc(strlen((str))+1),(str))
432 #endif
433
434 #ifdef DEBUG
435 #define bmalloc(size) b_malloc(__FILE__, __LINE__, (size))
436 #endif
437
438 #ifdef __alpha__
439 #define OSF 1
440 #endif
441
442 #ifdef HAVE_SUN_OS
443    /* 
444     * On Solaris 2.5, threads are not timesliced by default, so we need to
445     * explictly increase the conncurrency level.
446     */
447 #include <thread.h>
448 #define set_thread_concurrency(x)  thr_setconcurrency(x)
449 extern int thr_setconcurrency(int);
450 #define SunOS 1
451
452 #else
453
454
455 /* Not needed on most systems */
456 #define set_thread_concurrency(x)
457
458 #endif
459
460 #ifdef HAVE_DARWIN_OS
461 /* Apparently someone forgot to wrap getdomainname as a C function */
462 extern "C" int getdomainname(char *name, int len);
463
464 /* Darwin lib fnmatch() doesn't work, so use our own */
465 #undef HAVE_FNMATCH
466 #endif
467
468 #ifdef HAVE_CYGWIN
469 /* They don't really have it */
470 #undef HAVE_GETDOMAINNAME
471 #endif
472
473 /* Define Winsock functions if we aren't on Windows */
474 #if (!defined HAVE_WIN32) || (defined HAVE_CYGWIN)
475 #define WSA_Init() 0 /* 0 = success */
476 #define WSACleanup() 0 /* 0 = success */
477 #endif
478
479 #ifdef HAVE_AIX_OS
480 #endif
481  
482 /* This probably should be done on a machine by machine basic, but it works */
483 #define ALIGN_SIZE (sizeof(double))
484 #define BALIGN(x) (((x) + ALIGN_SIZE - 1) & ~(ALIGN_SIZE -1))
485
486
487 /* Added by KES to deal with Win32 systems */
488 #ifndef S_ISWIN32
489 #define S_ISWIN32 020000
490 #endif
491
492 /*
493  * Replace codes needed in both file routines and non-file routines
494  * Job replace codes -- in "replace"   
495  */
496 #define REPLACE_ALWAYS   'a'
497 #define REPLACE_IFNEWER  'w'
498 #define REPLACE_NEVER    'n'
499 #define REPLACE_IFOLDER  'o'
500
501 #undef HAVE_SETLOCALE
502 #ifdef HAVE_SETLOCALE
503 #include <locale.h>
504 #else
505 #define setlocale(x, y) ("ANSI_X3.4-1968")
506 #endif
507 #ifdef HAVE_NL_LANGINFO
508 #include <langinfo.h>
509 #else 
510 #define nl_langinfo(x) ("ANSI_X3.4-1968")
511 #endif
512
513 #endif /* _BACONFIG_H */