2 * General header file configurations that apply to
3 * all daemons. System dependent stuff goes here.
8 Copyright (C) 2000-2006 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 */
34 #define MAX(a, b) ((a) > (b) ? (a) : (b))
37 #define MIN(a, b) ((a) < (b) ? (a) : (b))
47 #define ETIME ETIMEDOUT
53 # define __PROTO(p) ()
57 #define ASSERT(x) if (!(x)) { \
59 Emsg1(M_ERROR, 0, _("Failed ASSERT: %s\n"), #x); \
65 /* Allow printing of NULL pointers */
66 #define NPRT(x) (x)?(x):_("*None*")
68 #if defined(HAVE_WIN32)
69 void InitWinAPIWrapper();
71 #define OSDependentInit() InitWinAPIWrapper()
74 #if defined(BUILDING_DLL)
75 # define DLL_IMP_EXP _declspec(dllexport)
76 #elif defined(USING_DLL)
77 # define DLL_IMP_EXP _declspec(dllimport)
86 #define OSDependentInit()
87 #define tape_open open
88 #define tape_ioctl ioctl
89 #define tape_read read
90 #define tape_write write
91 #define tape_close ::close
99 #define _(s) gettext((s))
104 #else /* !ENABLE_NLS */
112 #define textdomain(d)
114 #ifndef bindtextdomain
115 #define bindtextdomain(p, d)
118 #define setlocale(p, d)
120 #endif /* ENABLE_NLS */
121 /* Use the following for strings not to be translated */
124 /* This should go away! ****FIXME***** */
125 #define MAXSTRING 500
127 /* Maximum length to edit time/date */
128 #define MAX_TIME_LENGTH 50
130 /* Maximum Name length including EOS */
131 #define MAX_NAME_LENGTH 128
133 /* Maximume number of user entered command args */
134 #define MAX_CMD_ARGS 30
136 /* All tape operations MUST be a multiple of this */
137 #define TAPE_BSIZE 1024
140 #define B_DEV_BSIZE DEV_BSIZE
143 #if !defined(B_DEV_BSIZE) & defined(BSIZE)
144 #define B_DEV_BSIZE BSIZE
148 #define B_DEV_BSIZE 512
152 * Set to time limit for other end to respond to
153 * authentication. Normally 10 minutes is *way*
154 * more than enough. The idea is to keep the Director
155 * from hanging because there is a dead connection on
158 #define AUTH_TIMEOUT 60 * 10
161 * Default network buffer size
163 #define DEFAULT_NETWORK_BUFFER_SIZE (64 * 1024)
166 * Stream definitions. Once defined these must NEVER
167 * change as they go on the storage media.
168 * Note, the following streams are passed from the SD to the DIR
169 * so that they may be put into the catalog (actually only the
170 * stat packet part of the attr record is put in the catalog.
172 * STREAM_UNIX_ATTRIBUTES
173 * STREAM_UNIX_ATTRIBUTES_EX
176 * STREAM_SHA256_DIGEST
177 * STREAM_SHA512_DIGEST
179 #define STREAM_NONE 0 /* Reserved Non-Stream */
180 #define STREAM_UNIX_ATTRIBUTES 1 /* Generic Unix attributes */
181 #define STREAM_FILE_DATA 2 /* Standard uncompressed data */
182 #define STREAM_MD5_SIGNATURE 3 /* deprecated */
183 #define STREAM_MD5_DIGEST 3 /* MD5 digest for the file */
184 #define STREAM_GZIP_DATA 4 /* GZip compressed file data */
185 /* Extended Unix attributes with Win32 Extended data. Deprecated. */
186 #define STREAM_UNIX_ATTRIBUTES_EX 5 /* Extended Unix attr for Win32 EX */
187 #define STREAM_SPARSE_DATA 6 /* Sparse data stream */
188 #define STREAM_SPARSE_GZIP_DATA 7
189 #define STREAM_PROGRAM_NAMES 8 /* program names for program data */
190 #define STREAM_PROGRAM_DATA 9 /* Data needing program */
191 #define STREAM_SHA1_SIGNATURE 10 /* deprecated */
192 #define STREAM_SHA1_DIGEST 10 /* SHA1 digest for the file */
193 #define STREAM_WIN32_DATA 11 /* Win32 BackupRead data */
194 #define STREAM_WIN32_GZIP_DATA 12 /* Gzipped Win32 BackupRead data */
195 #define STREAM_MACOS_FORK_DATA 13 /* Mac resource fork */
196 #define STREAM_HFSPLUS_ATTRIBUTES 14 /* Mac OS extra attributes */
198 #define STREAM_UNIX_ATTRIBUTES_ACCESS_ACL 15 /* Standard ACL attributes on UNIX */
199 #define STREAM_UNIX_ATTRIBUTES_DEFAULT_ACL 16 /* Default ACL attributes on UNIX */
201 #define STREAM_SHA256_DIGEST 17 /* SHA-256 digest for the file */
202 #define STREAM_SHA512_DIGEST 18 /* SHA-512 digest for the file */
203 #define STREAM_SIGNED_DIGEST 19 /* Signed File Digest, ASN.1, DER Encoded */
204 #define STREAM_ENCRYPTED_FILE_DATA 20 /* Encrypted, uncompressed data */
205 #define STREAM_ENCRYPTED_WIN32_DATA 21 /* Encrypted, uncompressed Win32 BackupRead data */
206 #define STREAM_ENCRYPTED_SESSION_DATA 22 /* Encrypted Session Data, ASN.1, DER Encoded */
207 #define STREAM_ENCRYPTED_FILE_GZIP_DATA 23 /* Encrypted, compressed data */
208 #define STREAM_ENCRYPTED_WIN32_GZIP_DATA 24 /* Encrypted, compressed Win32 BackupRead data */
209 #define STREAM_ENCRYPTED_MACOS_FORK_DATA 25 /* Encrypted, uncompressed Mac resource fork */
213 * File type (Bacula defined).
214 * NOTE!!! These are saved in the Attributes record on the tape, so
215 * do not change them. If need be, add to them.
217 * This is stored as 32 bits on tape, but only FT_MASK bits are
218 * used for the file type. The upper bits are used to indicate
219 * additional optional fields in the attribute record.
221 #define FT_MASK 0xFFFF /* Bits used by FT (type) */
222 #define FT_LNKSAVED 1 /* hard link to file already saved */
223 #define FT_REGE 2 /* Regular file but empty */
224 #define FT_REG 3 /* Regular file */
225 #define FT_LNK 4 /* Soft Link */
226 #define FT_DIREND 5 /* Directory at end (saved) */
227 #define FT_SPEC 6 /* Special file -- chr, blk, fifo, sock */
228 #define FT_NOACCESS 7 /* Not able to access */
229 #define FT_NOFOLLOW 8 /* Could not follow link */
230 #define FT_NOSTAT 9 /* Could not stat file */
231 #define FT_NOCHG 10 /* Incremental option, file not changed */
232 #define FT_DIRNOCHG 11 /* Incremental option, directory not changed */
233 #define FT_ISARCH 12 /* Trying to save archive file */
234 #define FT_NORECURSE 13 /* No recursion into directory */
235 #define FT_NOFSCHG 14 /* Different file system, prohibited */
236 #define FT_NOOPEN 15 /* Could not open directory */
237 #define FT_RAW 16 /* Raw block device */
238 #define FT_FIFO 17 /* Raw fifo device */
239 /* This directory packet is sent to the FD file processing routine so
240 * that it can filter packets, but otherwise, it is not used
242 #define FT_DIRBEGIN 18 /* Directory at beginning (not saved) */
243 #define FT_INVALIDFS 19 /* File system not allowed for */
244 #define FT_INVALIDDT 20 /* Drive type not allowed for */
246 /* Definitions for upper part of type word (see above). */
247 #define AR_DATA_STREAM (1<<16) /* Data stream id present */
250 * Tape label types -- stored in catalog
252 #define B_BACULA_LABEL 0
253 #define B_ANSI_LABEL 1
254 #define B_IBM_LABEL 2
256 /* Size of File Address stored in STREAM_SPARSE_DATA. Do NOT change! */
257 #define SPARSE_FADDR_SIZE (sizeof(uint64_t))
260 /* This is for dumb compilers/libraries like Solaris. Linux GCC
261 * does it correctly, so it might be worthwhile
262 * to remove the isascii(c) with ifdefs on such
265 #define B_ISSPACE(c) (isascii((int)(c)) && isspace((int)(c)))
266 #define B_ISALPHA(c) (isascii((int)(c)) && isalpha((int)(c)))
267 #define B_ISUPPER(c) (isascii((int)(c)) && isupper((int)(c)))
268 #define B_ISDIGIT(c) (isascii((int)(c)) && isdigit((int)(c)))
270 /* For multiplying by 10 with shift and addition */
271 #define B_TIMES10(d) ((d<<3)+(d<<1))
274 typedef void (HANDLER)();
275 typedef int (INTHANDLER)();
278 # define SETPGRP_ARGS(x, y) /* No arguments */
280 # define SETPGRP_ARGS(x, y) (x, y)
284 #define S_ISLNK(m) (((m) & S_IFM) == S_IFLNK)
287 /* Added by KES to deal with Win32 systems */
289 #define S_ISWIN32 020000
293 #define INADDR_NONE ((unsigned long) -1)
296 #ifdef TIME_WITH_SYS_TIME
297 # include <sys/time.h>
300 # ifdef HAVE_SYS_TIME_H
301 # include <sys/time.h>
320 extern void _p(char *file, int line, pthread_mutex_t *m);
321 extern void _v(char *file, int line, pthread_mutex_t *m);
323 #define P(x) _p(__FILE__, __LINE__, &(x))
324 #define V(x) _v(__FILE__, __LINE__, &(x))
327 extern void _p(pthread_mutex_t *m);
328 extern void _v(pthread_mutex_t *m);
330 #define P(x) _p(&(x))
331 #define V(x) _v(&(x))
333 #endif /* DEBUG_MUTEX */
335 /* These probably should be subroutines */
337 do { int errstat; if ((errstat=rwl_writelock(&(x)))) \
338 e_msg(__FILE__, __LINE__, M_ABORT, 0, "Write lock lock failure. ERR=%s\n",\
339 strerror(errstat)); \
343 do { int errstat; if ((errstat=rwl_writeunlock(&(x)))) \
344 e_msg(__FILE__, __LINE__, M_ABORT, 0, "Write lock unlock failure. ERR=%s\n",\
345 strerror(errstat)); \
348 #define LockRes() b_LockRes(__FILE__, __LINE__)
349 #define UnlockRes() b_UnlockRes(__FILE__, __LINE__)
352 #define memset(a, v, n) b_memset(__FILE__, __LINE__, a, v, n)
353 void b_memset(const char *file, int line, void *mem, int val, size_t num);
358 * The digit following Dmsg and Emsg indicates the number of substitutions in
359 * the message string. We need to do this kludge because non-GNU compilers
360 * do not handle varargs #defines.
362 /* Debug Messages that are printed */
364 #define Dmsg0(lvl, msg) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg)
365 #define Dmsg1(lvl, msg, a1) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1)
366 #define Dmsg2(lvl, msg, a1, a2) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2)
367 #define Dmsg3(lvl, msg, a1, a2, a3) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3)
368 #define Dmsg4(lvl, msg, arg1, arg2, arg3, arg4) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4)
369 #define Dmsg5(lvl, msg, a1, a2, a3, a4, a5) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5)
370 #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)
371 #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)
372 #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)
373 #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)
374 #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)
375 #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)
376 #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)
377 #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)
379 #define Dmsg0(lvl, msg)
380 #define Dmsg1(lvl, msg, a1)
381 #define Dmsg2(lvl, msg, a1, a2)
382 #define Dmsg3(lvl, msg, a1, a2, a3)
383 #define Dmsg4(lvl, msg, arg1, arg2, arg3, arg4)
384 #define Dmsg5(lvl, msg, a1, a2, a3, a4, a5)
385 #define Dmsg6(lvl, msg, a1, a2, a3, a4, a5, a6)
386 #define Dmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7)
387 #define Dmsg8(lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8)
388 #define Dmsg11(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
389 #define Dmsg12(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
390 #define Dmsg13(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13)
394 #define Tmsg0(lvl, msg) t_msg(__FILE__, __LINE__, lvl, msg)
395 #define Tmsg1(lvl, msg, a1) t_msg(__FILE__, __LINE__, lvl, msg, a1)
396 #define Tmsg2(lvl, msg, a1, a2) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2)
397 #define Tmsg3(lvl, msg, a1, a2, a3) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3)
398 #define Tmsg4(lvl, msg, arg1, arg2, arg3, arg4) t_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4)
399 #define Tmsg5(lvl, msg, a1, a2, a3, a4, a5) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5)
400 #define Tmsg6(lvl, msg, a1, a2, a3, a4, a5, a6) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6)
401 #define Tmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7)
402 #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)
403 #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)
404 #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)
405 #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)
406 #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)
407 #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)
409 #define Tmsg0(lvl, msg)
410 #define Tmsg1(lvl, msg, a1)
411 #define Tmsg2(lvl, msg, a1, a2)
412 #define Tmsg3(lvl, msg, a1, a2, a3)
413 #define Tmsg4(lvl, msg, arg1, arg2, arg3, arg4)
414 #define Tmsg5(lvl, msg, a1, a2, a3, a4, a5)
415 #define Tmsg6(lvl, msg, a1, a2, a3, a4, a5, a6)
416 #define Tmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7)
417 #define Tmsg8(lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8)
418 #define Tmsg11(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
419 #define Tmsg12(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
420 #define Tmsg13(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13)
421 #endif /* TRACE_FILE */
425 /* Messages that are printed (uses d_msg) */
426 #define Pmsg0(lvl, msg) p_msg(__FILE__, __LINE__, lvl, msg)
427 #define Pmsg1(lvl, msg, a1) p_msg(__FILE__, __LINE__, lvl, msg, a1)
428 #define Pmsg2(lvl, msg, a1, a2) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2)
429 #define Pmsg3(lvl, msg, a1, a2, a3) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3)
430 #define Pmsg4(lvl, msg, arg1, arg2, arg3, arg4) p_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4)
431 #define Pmsg5(lvl, msg, a1, a2, a3, a4, a5) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5)
432 #define Pmsg6(lvl, msg, a1, a2, a3, a4, a5, a6) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6)
433 #define Pmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7)
434 #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)
435 #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)
436 #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)
437 #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)
438 #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)
439 #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)
440 #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)
443 /* Daemon Error Messages that are delivered according to the message resource */
444 #define Emsg0(typ, lvl, msg) e_msg(__FILE__, __LINE__, typ, lvl, msg)
445 #define Emsg1(typ, lvl, msg, a1) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1)
446 #define Emsg2(typ, lvl, msg, a1, a2) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2)
447 #define Emsg3(typ, lvl, msg, a1, a2, a3) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3)
448 #define Emsg4(typ, lvl, msg, a1, a2, a3, a4) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4)
449 #define Emsg5(typ, lvl, msg, a1, a2, a3, a4, a5) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4, a5)
450 #define Emsg6(typ, lvl, msg, a1, a2, a3, a4, a5, a6) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4, a5, a6)
452 /* Job Error Messages that are delivered according to the message resource */
453 #define Jmsg0(jcr, typ, lvl, msg) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg)
454 #define Jmsg1(jcr, typ, lvl, msg, a1) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1)
455 #define Jmsg2(jcr, typ, lvl, msg, a1, a2) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2)
456 #define Jmsg3(jcr, typ, lvl, msg, a1, a2, a3) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3)
457 #define Jmsg4(jcr, typ, lvl, msg, a1, a2, a3, a4) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4)
458 #define Jmsg5(jcr, typ, lvl, msg, a1, a2, a3, a4, a5) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5)
459 #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)
461 /* Queued Job Error Messages that are delivered according to the message resource */
462 #define Qmsg0(jcr, typ, lvl, msg) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg)
463 #define Qmsg1(jcr, typ, lvl, msg, a1) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1)
464 #define Qmsg2(jcr, typ, lvl, msg, a1, a2) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2)
465 #define Qmsg3(jcr, typ, lvl, msg, a1, a2, a3) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3)
466 #define Qmsg4(jcr, typ, lvl, msg, a1, a2, a3, a4) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4)
467 #define Qmsg5(jcr, typ, lvl, msg, a1, a2, a3, a4, a5) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5)
468 #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)
471 /* Memory Messages that are edited into a Pool Memory buffer */
472 #define Mmsg0(buf, msg) m_msg(__FILE__, __LINE__, buf, msg)
473 #define Mmsg1(buf, msg, a1) m_msg(__FILE__, __LINE__, buf, msg, a1)
474 #define Mmsg2(buf, msg, a1, a2) m_msg(__FILE__, __LINE__, buf, msg, a1, a2)
475 #define Mmsg3(buf, msg, a1, a2, a3) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3)
476 #define Mmsg4(buf, msg, a1, a2, a3, a4) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4)
477 #define Mmsg5(buf, msg, a1, a2, a3, a4, a5) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4, a5)
478 #define Mmsg6(buf, msg, a1, a2, a3, a4, a5, a6) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4, a5, a6)
479 #define Mmsg7(buf, msg, a1, a2, a3, a4, a5, a6, a7) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4, a5, a6)
480 #define Mmsg8(buf,msg,a1,a2,a3,a4,a5,a6,a7,a8) m_msg(__FILE__,__LINE__,buf,msg,a1,a2,a3,a4,a5,a6)
481 #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)
482 #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)
485 /* Edit message into Pool Memory buffer -- no __FILE__ and __LINE__ */
486 int Mmsg(POOLMEM **msgbuf, const char *fmt,...);
487 int Mmsg(POOLMEM *&msgbuf, const char *fmt,...);
488 int Mmsg(POOL_MEM &msgbuf, const char *fmt,...);
492 void d_msg(const char *file, int line, int level, const char *fmt,...);
493 void p_msg(const char *file, int line, int level, const char *fmt,...);
494 void e_msg(const char *file, int line, int type, int level, const char *fmt,...);
495 void j_msg(const char *file, int line, JCR *jcr, int type, time_t mtime, const char *fmt,...);
496 void q_msg(const char *file, int line, JCR *jcr, int type, time_t mtime, const char *fmt,...);
497 int m_msg(const char *file, int line, POOLMEM **msgbuf, const char *fmt,...);
498 int m_msg(const char *file, int line, POOLMEM *&pool_buf, const char *fmt, ...);
501 /* Use our strdup with smartalloc */
502 #ifndef HAVE_WXCONSOLE
504 #define strdup(buf) bad_call_on_strdup_use_bstrdup(buf)
507 /* Use our fgets which handles interrupts */
509 #define fgets(x,y,z) bfgets((x), (y), (z))
511 /* Use our sscanf, which is safer and works with known sizes */
512 #define sscanf bsscanf
515 #define bstrdup(str) strcpy((char *)b_malloc(__FILE__,__LINE__,strlen((str))+1),(str))
517 #define bstrdup(str) strcpy((char *)bmalloc(strlen((str))+1),(str))
521 #define bmalloc(size) b_malloc(__FILE__, __LINE__, (size))
525 * Replace codes needed in both file routines and non-file routines
526 * Job replace codes -- in "replace"
528 #define REPLACE_ALWAYS 'a'
529 #define REPLACE_IFNEWER 'w'
530 #define REPLACE_NEVER 'n'
531 #define REPLACE_IFOLDER 'o'
533 /* This probably should be done on a machine by machine basic, but it works */
534 /* This is critical for the smartalloc routines to properly align memory */
535 #define ALIGN_SIZE (sizeof(double))
536 #define BALIGN(x) (((x) + ALIGN_SIZE - 1) & ~(ALIGN_SIZE -1))
539 /* =============================================================
540 * OS Dependent defines
541 * =============================================================
545 /* Bad news. This OS cannot handle 64 bit fseeks and ftells */
550 #if defined (__digital__) && defined (__unix__)
551 /* Tru64 - it does have fseeko and ftello , but since ftell/fseek are also 64 bit */
552 /* take this 'shortcut' */
564 * On Solaris 2.5, threads are not timesliced by default, so we need to
565 * explictly increase the conncurrency level.
568 #define set_thread_concurrency(x) thr_setconcurrency(x)
569 extern int thr_setconcurrency(int);
575 /* Not needed on most systems */
576 #define set_thread_concurrency(x)
580 #if defined(HAVE_DARWIN_OS) || defined(HAVE_OSF1_OS)
581 /* Apparently someone forgot to wrap getdomainname as a C function */
582 extern "C" int getdomainname(char *name, int len);
586 extern "C" int mknod ( const char *path, int mode, dev_t device );
590 /* Define Winsock functions if we aren't on Windows */
591 #if !defined HAVE_WIN32
592 #define WSA_Init() 0 /* 0 = success */
593 #define WSACleanup() 0 /* 0 = success */
599 /* HP-UX 11 specific workarounds */
604 /* the {get,set}domainname() functions exist in HPUX's libc.
605 * the configure script detects that correctly.
606 * the problem is no system headers declares the prototypes for these functions
609 extern "C" int getdomainname(char *name, int namelen);
610 extern "C" int setdomainname(char *name, int namelen);
611 #define uLong unsigned long
612 #endif /* HAVE_HPUX_OS */
616 #undef HAVE_CHFLAGS /* chflags is incorrectly detected */
617 extern "C" int fchdir(int filedes);
618 extern "C" long gethostid(void);
622 /* Added by KES to deal with Win32 systems */
624 #define S_ISWIN32 020000
628 /* Disabled because it breaks internationalisation...
629 #undef HAVE_SETLOCALE
630 #ifdef HAVE_SETLOCALE
633 #define setlocale(x, y) ("ANSI_X3.4-1968")
635 #ifdef HAVE_NL_LANGINFO
636 #include <langinfo.h>
638 #define nl_langinfo(x) ("ANSI_X3.4-1968")
642 #endif /* _BACONFIG_H */