2 * General header file configurations that apply to
3 * all daemons. System dependent stuff goes here.
8 Copyright (C) 2000-2005 Kern Sibbald
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.
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.
26 /* Bacula common configuration defines */
40 #define ETIME ETIMEDOUT
46 # define __PROTO(p) ()
50 #define ASSERT(x) if (!(x)) { \
52 Emsg1(M_ERROR, 0, _("Failed ASSERT: %s\n"), #x); \
58 /* Allow printing of NULL pointers */
59 #define NPRT(x) (x)?(x):_("*None*")
61 /* NLS not yet supported on Win32 */
69 #define _(s) gettext((s))
74 #else /* !ENABLE_NLS */
84 #ifndef bindtextdomain
85 #define bindtextdomain(p, d)
88 #define setlocale(p, d)
90 #endif /* ENABLE_NLS */
92 /* This should go away! ****FIXME***** */
95 /* Maximum length to edit time/date */
96 #define MAX_TIME_LENGTH 50
98 /* Maximum Name length including EOS */
99 #define MAX_NAME_LENGTH 128
101 /* Maximume number of user entered command args */
102 #define MAX_CMD_ARGS 30
104 /* All tape operations MUST be a multiple of this */
105 #define TAPE_BSIZE 1024
108 #define B_DEV_BSIZE DEV_BSIZE
111 #if !defined(B_DEV_BSIZE) & defined(BSIZE)
112 #define B_DEV_BSIZE BSIZE
116 #define B_DEV_BSIZE 512
120 * Set to time limit for other end to respond to
121 * authentication. Normally 10 minutes is *way*
122 * more than enough. The idea is to keep the Director
123 * from hanging because there is a dead connection on
126 #define AUTH_TIMEOUT 60 * 10
129 * Default network buffer size
131 #define DEFAULT_NETWORK_BUFFER_SIZE (32 * 1024)
134 * Stream definitions. Once defined these must NEVER
135 * change as they go on the storage media.
136 * Note, the following streams are passed from the SD to the DIR
137 * so that they may be put into the catalog (actually only the
138 * stat packet part of the attr record is put in the catalog.
140 * STREAM_UNIX_ATTRIBUTES
141 * STREAM_UNIX_ATTRIBUTES_EX
142 * STREAM_MD5_SIGNATURE
143 * STREAM_SHA1_SIGNATURE
145 #define STREAM_UNIX_ATTRIBUTES 1 /* Generic Unix attributes */
146 #define STREAM_FILE_DATA 2 /* Standard uncompressed data */
147 #define STREAM_MD5_SIGNATURE 3 /* MD5 signature for the file */
148 #define STREAM_GZIP_DATA 4 /* GZip compressed file data */
149 /* Extended Unix attributes with Win32 Extended data. Deprecated. */
150 #define STREAM_UNIX_ATTRIBUTES_EX 5 /* Extended Unix attr for Win32 EX */
151 #define STREAM_SPARSE_DATA 6 /* Sparse data stream */
152 #define STREAM_SPARSE_GZIP_DATA 7
153 #define STREAM_PROGRAM_NAMES 8 /* program names for program data */
154 #define STREAM_PROGRAM_DATA 9 /* Data needing program */
155 #define STREAM_SHA1_SIGNATURE 10 /* SHA1 signature for the file */
156 #define STREAM_WIN32_DATA 11 /* Win32 BackupRead data */
157 #define STREAM_WIN32_GZIP_DATA 12 /* Gzipped Win32 BackupRead data */
158 #define STREAM_MACOS_FORK_DATA 13 /* Mac resource fork */
159 #define STREAM_HFSPLUS_ATTRIBUTES 14 /* Mac OS extra attributes */
161 #define STREAM_UNIX_ATTRIBUTES_ACCESS_ACL 15 /* Standard ACL attributes on UNIX */
162 #define STREAM_UNIX_ATTRIBUTES_DEFAULT_ACL 16 /* Default ACL attributes on UNIX */
167 * File type (Bacula defined).
168 * NOTE!!! These are saved in the Attributes record on the tape, so
169 * do not change them. If need be, add to them.
171 * This is stored as 32 bits on tape, but only FT_MASK bits are
172 * used for the file type. The upper bits are used to indicate
173 * additional optional fields in the attribute record.
175 #define FT_MASK 0xFFFF /* Bits used by FT (type) */
176 #define FT_LNKSAVED 1 /* hard link to file already saved */
177 #define FT_REGE 2 /* Regular file but empty */
178 #define FT_REG 3 /* Regular file */
179 #define FT_LNK 4 /* Soft Link */
180 #define FT_DIREND 5 /* Directory at end (saved) */
181 #define FT_SPEC 6 /* Special file -- chr, blk, fifo, sock */
182 #define FT_NOACCESS 7 /* Not able to access */
183 #define FT_NOFOLLOW 8 /* Could not follow link */
184 #define FT_NOSTAT 9 /* Could not stat file */
185 #define FT_NOCHG 10 /* Incremental option, file not changed */
186 #define FT_DIRNOCHG 11 /* Incremental option, directory not changed */
187 #define FT_ISARCH 12 /* Trying to save archive file */
188 #define FT_NORECURSE 13 /* No recursion into directory */
189 #define FT_NOFSCHG 14 /* Different file system, prohibited */
190 #define FT_NOOPEN 15 /* Could not open directory */
191 #define FT_RAW 16 /* Raw block device */
192 #define FT_FIFO 17 /* Raw fifo device */
193 /* This directory packet is sent to the FD file processing routine so
194 * that it can filter packets, but otherwise, it is not used
196 #define FT_DIRBEGIN 18 /* Directory at beginning (not saved) */
197 #define FT_INVALIDFS 19 /* File system not allowed for */
199 /* Definitions for upper part of type word (see above). */
200 #define AR_DATA_STREAM (1<<16) /* Data stream id present */
203 * Internal code for Signature types
210 * Tape label types -- stored in catalog
212 #define B_BACULA_LABEL 0
213 #define B_ANSI_LABEL 1
214 #define B_IBM_LABEL 2
216 /* Size of File Address stored in STREAM_SPARSE_DATA. Do NOT change! */
217 #define SPARSE_FADDR_SIZE (sizeof(uint64_t))
220 /* This is for dumb compilers/libraries like Solaris. Linux GCC
221 * does it correctly, so it might be worthwhile
222 * to remove the isascii(c) with ifdefs on such
225 #define B_ISSPACE(c) (isascii((int)(c)) && isspace((int)(c)))
226 #define B_ISALPHA(c) (isascii((int)(c)) && isalpha((int)(c)))
227 #define B_ISUPPER(c) (isascii((int)(c)) && isupper((int)(c)))
228 #define B_ISDIGIT(c) (isascii((int)(c)) && isdigit((int)(c)))
230 /* For multiplying by 10 with shift and addition */
231 #define B_TIMES10(d) ((d<<3)+(d<<1))
234 typedef void (HANDLER)();
235 typedef int (INTHANDLER)();
238 # define SETPGRP_ARGS(x, y) /* No arguments */
240 # define SETPGRP_ARGS(x, y) (x, y)
244 #define S_ISLNK(m) (((m) & S_IFM) == S_IFLNK)
247 /* Added by KES to deal with Win32 systems */
249 #define S_ISWIN32 020000
253 #define INADDR_NONE ((unsigned long) -1)
256 #ifdef TIME_WITH_SYS_TIME
257 # include <sys/time.h>
260 # ifdef HAVE_SYS_TIME_H
261 # include <sys/time.h>
280 extern void _p(char *file, int line, pthread_mutex_t *m);
281 extern void _v(char *file, int line, pthread_mutex_t *m);
283 #define P(x) _p(__FILE__, __LINE__, &(x))
284 #define V(x) _v(__FILE__, __LINE__, &(x))
287 extern void _p(pthread_mutex_t *m);
288 extern void _v(pthread_mutex_t *m);
290 #define P(x) _p(&(x))
291 #define V(x) _v(&(x))
293 #endif /* DEBUG_MUTEX */
295 /* These probably should be subroutines */
297 do { int errstat; if ((errstat=rwl_writelock(&(x)))) \
298 e_msg(__FILE__, __LINE__, M_ABORT, 0, "Write lock lock failure. ERR=%s\n",\
299 strerror(errstat)); \
303 do { int errstat; if ((errstat=rwl_writeunlock(&(x)))) \
304 e_msg(__FILE__, __LINE__, M_ABORT, 0, "Write lock unlock failure. ERR=%s\n",\
305 strerror(errstat)); \
308 #define LockRes() b_LockRes(__FILE__, __LINE__)
309 #define UnlockRes() b_UnlockRes(__FILE__, __LINE__)
312 #define memset(a, v, n) b_memset(__FILE__, __LINE__, a, v, n)
313 void b_memset(const char *file, int line, void *mem, int val, size_t num);
318 * The digit following Dmsg and Emsg indicates the number of substitutions in
319 * the message string. We need to do this kludge because non-GNU compilers
320 * do not handle varargs #defines.
322 /* Debug Messages that are printed */
324 #define Dmsg0(lvl, msg) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg)
325 #define Dmsg1(lvl, msg, a1) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1)
326 #define Dmsg2(lvl, msg, a1, a2) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2)
327 #define Dmsg3(lvl, msg, a1, a2, a3) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3)
328 #define Dmsg4(lvl, msg, arg1, arg2, arg3, arg4) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4)
329 #define Dmsg5(lvl, msg, a1, a2, a3, a4, a5) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5)
330 #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)
331 #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)
332 #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)
333 #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)
334 #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)
335 #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)
336 #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)
337 #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)
339 #define Dmsg0(lvl, msg)
340 #define Dmsg1(lvl, msg, a1)
341 #define Dmsg2(lvl, msg, a1, a2)
342 #define Dmsg3(lvl, msg, a1, a2, a3)
343 #define Dmsg4(lvl, msg, arg1, arg2, arg3, arg4)
344 #define Dmsg5(lvl, msg, a1, a2, a3, a4, a5)
345 #define Dmsg6(lvl, msg, a1, a2, a3, a4, a5, a6)
346 #define Dmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7)
347 #define Dmsg8(lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8)
348 #define Dmsg11(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
349 #define Dmsg12(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
350 #define Dmsg13(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13)
354 #define Tmsg0(lvl, msg) t_msg(__FILE__, __LINE__, lvl, msg)
355 #define Tmsg1(lvl, msg, a1) t_msg(__FILE__, __LINE__, lvl, msg, a1)
356 #define Tmsg2(lvl, msg, a1, a2) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2)
357 #define Tmsg3(lvl, msg, a1, a2, a3) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3)
358 #define Tmsg4(lvl, msg, arg1, arg2, arg3, arg4) t_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4)
359 #define Tmsg5(lvl, msg, a1, a2, a3, a4, a5) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5)
360 #define Tmsg6(lvl, msg, a1, a2, a3, a4, a5, a6) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6)
361 #define Tmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7)
362 #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)
363 #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)
364 #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)
365 #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)
366 #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)
367 #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)
369 #define Tmsg0(lvl, msg)
370 #define Tmsg1(lvl, msg, a1)
371 #define Tmsg2(lvl, msg, a1, a2)
372 #define Tmsg3(lvl, msg, a1, a2, a3)
373 #define Tmsg4(lvl, msg, arg1, arg2, arg3, arg4)
374 #define Tmsg5(lvl, msg, a1, a2, a3, a4, a5)
375 #define Tmsg6(lvl, msg, a1, a2, a3, a4, a5, a6)
376 #define Tmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7)
377 #define Tmsg8(lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8)
378 #define Tmsg11(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
379 #define Tmsg12(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
380 #define Tmsg13(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13)
381 #endif /* TRACE_FILE */
385 /* Messages that are printed (uses d_msg) */
386 #define Pmsg0(lvl, msg) p_msg(__FILE__, __LINE__, lvl, msg)
387 #define Pmsg1(lvl, msg, a1) p_msg(__FILE__, __LINE__, lvl, msg, a1)
388 #define Pmsg2(lvl, msg, a1, a2) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2)
389 #define Pmsg3(lvl, msg, a1, a2, a3) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3)
390 #define Pmsg4(lvl, msg, arg1, arg2, arg3, arg4) p_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4)
391 #define Pmsg5(lvl, msg, a1, a2, a3, a4, a5) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5)
392 #define Pmsg6(lvl, msg, a1, a2, a3, a4, a5, a6) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6)
393 #define Pmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7)
394 #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)
395 #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)
396 #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)
397 #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)
398 #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)
399 #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)
400 #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)
403 /* Daemon Error Messages that are delivered according to the message resource */
404 #define Emsg0(typ, lvl, msg) e_msg(__FILE__, __LINE__, typ, lvl, msg)
405 #define Emsg1(typ, lvl, msg, a1) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1)
406 #define Emsg2(typ, lvl, msg, a1, a2) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2)
407 #define Emsg3(typ, lvl, msg, a1, a2, a3) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3)
408 #define Emsg4(typ, lvl, msg, a1, a2, a3, a4) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4)
409 #define Emsg5(typ, lvl, msg, a1, a2, a3, a4, a5) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4, a5)
410 #define Emsg6(typ, lvl, msg, a1, a2, a3, a4, a5, a6) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4, a5, a6)
412 /* Job Error Messages that are delivered according to the message resource */
413 #define Jmsg0(jcr, typ, lvl, msg) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg)
414 #define Jmsg1(jcr, typ, lvl, msg, a1) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1)
415 #define Jmsg2(jcr, typ, lvl, msg, a1, a2) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2)
416 #define Jmsg3(jcr, typ, lvl, msg, a1, a2, a3) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3)
417 #define Jmsg4(jcr, typ, lvl, msg, a1, a2, a3, a4) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4)
418 #define Jmsg5(jcr, typ, lvl, msg, a1, a2, a3, a4, a5) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5)
419 #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)
421 /* Queued Job Error Messages that are delivered according to the message resource */
422 #define Qmsg0(jcr, typ, lvl, msg) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg)
423 #define Qmsg1(jcr, typ, lvl, msg, a1) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1)
424 #define Qmsg2(jcr, typ, lvl, msg, a1, a2) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2)
425 #define Qmsg3(jcr, typ, lvl, msg, a1, a2, a3) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3)
426 #define Qmsg4(jcr, typ, lvl, msg, a1, a2, a3, a4) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4)
427 #define Qmsg5(jcr, typ, lvl, msg, a1, a2, a3, a4, a5) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5)
428 #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)
431 /* Memory Messages that are edited into a Pool Memory buffer */
432 #define Mmsg0(buf, msg) m_msg(__FILE__, __LINE__, buf, msg)
433 #define Mmsg1(buf, msg, a1) m_msg(__FILE__, __LINE__, buf, msg, a1)
434 #define Mmsg2(buf, msg, a1, a2) m_msg(__FILE__, __LINE__, buf, msg, a1, a2)
435 #define Mmsg3(buf, msg, a1, a2, a3) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3)
436 #define Mmsg4(buf, msg, a1, a2, a3, a4) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4)
437 #define Mmsg5(buf, msg, a1, a2, a3, a4, a5) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4, a5)
438 #define Mmsg6(buf, msg, a1, a2, a3, a4, a5, a6) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4, a5, a6)
439 #define Mmsg7(buf, msg, a1, a2, a3, a4, a5, a6, a7) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4, a5, a6)
440 #define Mmsg8(buf,msg,a1,a2,a3,a4,a5,a6,a7,a8) m_msg(__FILE__,__LINE__,buf,msg,a1,a2,a3,a4,a5,a6)
441 #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)
442 #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)
445 /* Edit message into Pool Memory buffer -- no __FILE__ and __LINE__ */
446 int Mmsg(POOLMEM **msgbuf, const char *fmt,...);
447 int Mmsg(POOLMEM *&msgbuf, const char *fmt,...);
448 int Mmsg(POOL_MEM &msgbuf, const char *fmt,...);
452 void d_msg(const char *file, int line, int level, const char *fmt,...);
453 void p_msg(const char *file, int line, int level, const char *fmt,...);
454 void e_msg(const char *file, int line, int type, int level, const char *fmt,...);
455 void j_msg(const char *file, int line, JCR *jcr, int type, time_t mtime, const char *fmt,...);
456 void q_msg(const char *file, int line, JCR *jcr, int type, time_t mtime, const char *fmt,...);
457 int m_msg(const char *file, int line, POOLMEM **msgbuf, const char *fmt,...);
458 int m_msg(const char *file, int line, POOLMEM *&pool_buf, const char *fmt, ...);
461 /* Use our strdup with smartalloc */
464 #define strdup(buf) bad_call_on_strdup_use_bstrdup(buf)
467 /* Use our fgets which handles interrupts */
469 #define fgets(x,y,z) bfgets((x), (y), (z))
471 /* Use our sscanf, which is safer and works with known sizes */
472 #define sscanf bsscanf
475 #define bstrdup(str) strcpy((char *)b_malloc(__FILE__,__LINE__,strlen((str))+1),(str))
477 #define bstrdup(str) strcpy((char *)bmalloc(strlen((str))+1),(str))
481 #define bmalloc(size) b_malloc(__FILE__, __LINE__, (size))
485 * Replace codes needed in both file routines and non-file routines
486 * Job replace codes -- in "replace"
488 #define REPLACE_ALWAYS 'a'
489 #define REPLACE_IFNEWER 'w'
490 #define REPLACE_NEVER 'n'
491 #define REPLACE_IFOLDER 'o'
493 /* This probably should be done on a machine by machine basic, but it works */
494 /* This is critical for the smartalloc routines to properly align memory */
495 #define ALIGN_SIZE (sizeof(double))
496 #define BALIGN(x) (((x) + ALIGN_SIZE - 1) & ~(ALIGN_SIZE -1))
499 /* =============================================================
500 * OS Dependent defines
501 * =============================================================
505 /* Bad news. This OS cannot handle 64 bit fseeks and ftells */
510 #if defined (__digital__) && defined (__unix__)
511 /* Tru64 - it does have fseeko and ftello , but since ftell/fseek are also 64 bit */
512 /* take this 'shortcut' */
524 * On Solaris 2.5, threads are not timesliced by default, so we need to
525 * explictly increase the conncurrency level.
528 #define set_thread_concurrency(x) thr_setconcurrency(x)
529 extern int thr_setconcurrency(int);
535 /* Not needed on most systems */
536 #define set_thread_concurrency(x)
540 #if defined(HAVE_DARWIN_OS) || defined(HAVE_OSF1_OS)
541 /* Apparently someone forgot to wrap getdomainname as a C function */
542 extern "C" int getdomainname(char *name, int len);
546 extern "C" int mknod ( const char *path, int mode, dev_t device );
550 /* They don't really have it */
551 #undef HAVE_GETDOMAINNAME
554 /* Define Winsock functions if we aren't on Windows */
555 #if (!defined HAVE_WIN32) || (defined HAVE_CYGWIN)
556 #define WSA_Init() 0 /* 0 = success */
557 #define WSACleanup() 0 /* 0 = success */
563 /* HP-UX 11 specific workarounds */
568 /* the {get,set}domainname() functions exist in HPUX's libc.
569 * the configure script detects that correctly.
570 * the problem is no system headers declares the prototypes for these functions
573 extern "C" int getdomainname(char *name, int namelen);
574 extern "C" int setdomainname(char *name, int namelen);
575 #define uLong unsigned long
576 #endif /* HAVE_HPUX_OS */
580 #undef HAVE_CHFLAGS /* chflags is incorrectly detected */
581 extern "C" int fchdir(int filedes);
582 extern "C" long gethostid(void);
586 /* Added by KES to deal with Win32 systems */
588 #define S_ISWIN32 020000
592 /* Disabled because it breaks internationalisation...
593 #undef HAVE_SETLOCALE
594 #ifdef HAVE_SETLOCALE
597 #define setlocale(x, y) ("ANSI_X3.4-1968")
599 #ifdef HAVE_NL_LANGINFO
600 #include <langinfo.h>
602 #define nl_langinfo(x) ("ANSI_X3.4-1968")
606 /* Fake entry points if regex does not exist */
608 #define regcomp(x, y, z) 1
610 #define regerror(rc, preg, prbuf, len) bstrncpy(prbuf, "REGEX not available on this system.", len)
612 #define regmatch_t char
615 #endif /* _BACONFIG_H */