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()
79 #define OSDependentInit()
86 #define _(s) gettext((s))
91 #else /* !ENABLE_NLS */
101 #ifndef bindtextdomain
102 #define bindtextdomain(p, d)
105 #define setlocale(p, d)
107 #endif /* ENABLE_NLS */
108 /* Use the following for strings not to be translated */
111 /* This should go away! ****FIXME***** */
112 #define MAXSTRING 500
114 /* Maximum length to edit time/date */
115 #define MAX_TIME_LENGTH 50
117 /* Maximum Name length including EOS */
118 #define MAX_NAME_LENGTH 128
120 /* Maximume number of user entered command args */
121 #define MAX_CMD_ARGS 30
123 /* All tape operations MUST be a multiple of this */
124 #define TAPE_BSIZE 1024
127 #define B_DEV_BSIZE DEV_BSIZE
130 #if !defined(B_DEV_BSIZE) & defined(BSIZE)
131 #define B_DEV_BSIZE BSIZE
135 #define B_DEV_BSIZE 512
139 * Set to time limit for other end to respond to
140 * authentication. Normally 10 minutes is *way*
141 * more than enough. The idea is to keep the Director
142 * from hanging because there is a dead connection on
145 #define AUTH_TIMEOUT 60 * 10
148 * Default network buffer size
150 #define DEFAULT_NETWORK_BUFFER_SIZE (64 * 1024)
153 * Stream definitions. Once defined these must NEVER
154 * change as they go on the storage media.
155 * Note, the following streams are passed from the SD to the DIR
156 * so that they may be put into the catalog (actually only the
157 * stat packet part of the attr record is put in the catalog.
159 * STREAM_UNIX_ATTRIBUTES
160 * STREAM_UNIX_ATTRIBUTES_EX
163 * STREAM_SHA256_DIGEST
164 * STREAM_SHA512_DIGEST
166 #define STREAM_NONE 0 /* Reserved Non-Stream */
167 #define STREAM_UNIX_ATTRIBUTES 1 /* Generic Unix attributes */
168 #define STREAM_FILE_DATA 2 /* Standard uncompressed data */
169 #define STREAM_MD5_SIGNATURE 3 /* deprecated */
170 #define STREAM_MD5_DIGEST 3 /* MD5 digest for the file */
171 #define STREAM_GZIP_DATA 4 /* GZip compressed file data */
172 /* Extended Unix attributes with Win32 Extended data. Deprecated. */
173 #define STREAM_UNIX_ATTRIBUTES_EX 5 /* Extended Unix attr for Win32 EX */
174 #define STREAM_SPARSE_DATA 6 /* Sparse data stream */
175 #define STREAM_SPARSE_GZIP_DATA 7
176 #define STREAM_PROGRAM_NAMES 8 /* program names for program data */
177 #define STREAM_PROGRAM_DATA 9 /* Data needing program */
178 #define STREAM_SHA1_SIGNATURE 10 /* deprecated */
179 #define STREAM_SHA1_DIGEST 10 /* SHA1 digest for the file */
180 #define STREAM_WIN32_DATA 11 /* Win32 BackupRead data */
181 #define STREAM_WIN32_GZIP_DATA 12 /* Gzipped Win32 BackupRead data */
182 #define STREAM_MACOS_FORK_DATA 13 /* Mac resource fork */
183 #define STREAM_HFSPLUS_ATTRIBUTES 14 /* Mac OS extra attributes */
185 #define STREAM_UNIX_ATTRIBUTES_ACCESS_ACL 15 /* Standard ACL attributes on UNIX */
186 #define STREAM_UNIX_ATTRIBUTES_DEFAULT_ACL 16 /* Default ACL attributes on UNIX */
188 #define STREAM_SHA256_DIGEST 17 /* SHA-256 digest for the file */
189 #define STREAM_SHA512_DIGEST 18 /* SHA-512 digest for the file */
190 #define STREAM_SIGNED_DIGEST 19 /* Signed File Digest, ASN.1, DER Encoded */
191 #define STREAM_ENCRYPTED_FILE_DATA 20 /* Encrypted, uncompressed data */
192 #define STREAM_ENCRYPTED_WIN32_DATA 21 /* Encrypted, uncompressed Win32 BackupRead data */
193 #define STREAM_ENCRYPTED_SESSION_DATA 22 /* Encrypted Session Data, ASN.1, DER Encoded */
194 #define STREAM_ENCRYPTED_FILE_GZIP_DATA 23 /* Encrypted, compressed data */
195 #define STREAM_ENCRYPTED_WIN32_GZIP_DATA 24 /* Encrypted, compressed Win32 BackupRead data */
196 #define STREAM_ENCRYPTED_MACOS_FORK_DATA 25 /* Encrypted, uncompressed Mac resource fork */
200 * File type (Bacula defined).
201 * NOTE!!! These are saved in the Attributes record on the tape, so
202 * do not change them. If need be, add to them.
204 * This is stored as 32 bits on tape, but only FT_MASK bits are
205 * used for the file type. The upper bits are used to indicate
206 * additional optional fields in the attribute record.
208 #define FT_MASK 0xFFFF /* Bits used by FT (type) */
209 #define FT_LNKSAVED 1 /* hard link to file already saved */
210 #define FT_REGE 2 /* Regular file but empty */
211 #define FT_REG 3 /* Regular file */
212 #define FT_LNK 4 /* Soft Link */
213 #define FT_DIREND 5 /* Directory at end (saved) */
214 #define FT_SPEC 6 /* Special file -- chr, blk, fifo, sock */
215 #define FT_NOACCESS 7 /* Not able to access */
216 #define FT_NOFOLLOW 8 /* Could not follow link */
217 #define FT_NOSTAT 9 /* Could not stat file */
218 #define FT_NOCHG 10 /* Incremental option, file not changed */
219 #define FT_DIRNOCHG 11 /* Incremental option, directory not changed */
220 #define FT_ISARCH 12 /* Trying to save archive file */
221 #define FT_NORECURSE 13 /* No recursion into directory */
222 #define FT_NOFSCHG 14 /* Different file system, prohibited */
223 #define FT_NOOPEN 15 /* Could not open directory */
224 #define FT_RAW 16 /* Raw block device */
225 #define FT_FIFO 17 /* Raw fifo device */
226 /* This directory packet is sent to the FD file processing routine so
227 * that it can filter packets, but otherwise, it is not used
229 #define FT_DIRBEGIN 18 /* Directory at beginning (not saved) */
230 #define FT_INVALIDFS 19 /* File system not allowed for */
231 #define FT_INVALIDDT 20 /* Drive type not allowed for */
233 /* Definitions for upper part of type word (see above). */
234 #define AR_DATA_STREAM (1<<16) /* Data stream id present */
237 * Tape label types -- stored in catalog
239 #define B_BACULA_LABEL 0
240 #define B_ANSI_LABEL 1
241 #define B_IBM_LABEL 2
243 /* Size of File Address stored in STREAM_SPARSE_DATA. Do NOT change! */
244 #define SPARSE_FADDR_SIZE (sizeof(uint64_t))
247 /* This is for dumb compilers/libraries like Solaris. Linux GCC
248 * does it correctly, so it might be worthwhile
249 * to remove the isascii(c) with ifdefs on such
252 #define B_ISSPACE(c) (isascii((int)(c)) && isspace((int)(c)))
253 #define B_ISALPHA(c) (isascii((int)(c)) && isalpha((int)(c)))
254 #define B_ISUPPER(c) (isascii((int)(c)) && isupper((int)(c)))
255 #define B_ISDIGIT(c) (isascii((int)(c)) && isdigit((int)(c)))
257 /* For multiplying by 10 with shift and addition */
258 #define B_TIMES10(d) ((d<<3)+(d<<1))
261 typedef void (HANDLER)();
262 typedef int (INTHANDLER)();
265 # define SETPGRP_ARGS(x, y) /* No arguments */
267 # define SETPGRP_ARGS(x, y) (x, y)
271 #define S_ISLNK(m) (((m) & S_IFM) == S_IFLNK)
274 /* Added by KES to deal with Win32 systems */
276 #define S_ISWIN32 020000
280 #define INADDR_NONE ((unsigned long) -1)
283 #ifdef TIME_WITH_SYS_TIME
284 # include <sys/time.h>
287 # ifdef HAVE_SYS_TIME_H
288 # include <sys/time.h>
307 extern void _p(char *file, int line, pthread_mutex_t *m);
308 extern void _v(char *file, int line, pthread_mutex_t *m);
310 #define P(x) _p(__FILE__, __LINE__, &(x))
311 #define V(x) _v(__FILE__, __LINE__, &(x))
314 extern void _p(pthread_mutex_t *m);
315 extern void _v(pthread_mutex_t *m);
317 #define P(x) _p(&(x))
318 #define V(x) _v(&(x))
320 #endif /* DEBUG_MUTEX */
322 /* These probably should be subroutines */
324 do { int errstat; if ((errstat=rwl_writelock(&(x)))) \
325 e_msg(__FILE__, __LINE__, M_ABORT, 0, "Write lock lock failure. ERR=%s\n",\
326 strerror(errstat)); \
330 do { int errstat; if ((errstat=rwl_writeunlock(&(x)))) \
331 e_msg(__FILE__, __LINE__, M_ABORT, 0, "Write lock unlock failure. ERR=%s\n",\
332 strerror(errstat)); \
335 #define LockRes() b_LockRes(__FILE__, __LINE__)
336 #define UnlockRes() b_UnlockRes(__FILE__, __LINE__)
339 #define memset(a, v, n) b_memset(__FILE__, __LINE__, a, v, n)
340 void b_memset(const char *file, int line, void *mem, int val, size_t num);
345 * The digit following Dmsg and Emsg indicates the number of substitutions in
346 * the message string. We need to do this kludge because non-GNU compilers
347 * do not handle varargs #defines.
349 /* Debug Messages that are printed */
351 #define Dmsg0(lvl, msg) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg)
352 #define Dmsg1(lvl, msg, a1) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1)
353 #define Dmsg2(lvl, msg, a1, a2) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2)
354 #define Dmsg3(lvl, msg, a1, a2, a3) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3)
355 #define Dmsg4(lvl, msg, arg1, arg2, arg3, arg4) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4)
356 #define Dmsg5(lvl, msg, a1, a2, a3, a4, a5) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5)
357 #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)
358 #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)
359 #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)
360 #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)
361 #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)
362 #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)
363 #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)
364 #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)
366 #define Dmsg0(lvl, msg)
367 #define Dmsg1(lvl, msg, a1)
368 #define Dmsg2(lvl, msg, a1, a2)
369 #define Dmsg3(lvl, msg, a1, a2, a3)
370 #define Dmsg4(lvl, msg, arg1, arg2, arg3, arg4)
371 #define Dmsg5(lvl, msg, a1, a2, a3, a4, a5)
372 #define Dmsg6(lvl, msg, a1, a2, a3, a4, a5, a6)
373 #define Dmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7)
374 #define Dmsg8(lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8)
375 #define Dmsg11(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)
377 #define Dmsg13(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13)
381 #define Tmsg0(lvl, msg) t_msg(__FILE__, __LINE__, lvl, msg)
382 #define Tmsg1(lvl, msg, a1) t_msg(__FILE__, __LINE__, lvl, msg, a1)
383 #define Tmsg2(lvl, msg, a1, a2) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2)
384 #define Tmsg3(lvl, msg, a1, a2, a3) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3)
385 #define Tmsg4(lvl, msg, arg1, arg2, arg3, arg4) t_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4)
386 #define Tmsg5(lvl, msg, a1, a2, a3, a4, a5) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5)
387 #define Tmsg6(lvl, msg, a1, a2, a3, a4, a5, a6) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6)
388 #define Tmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7)
389 #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)
390 #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)
391 #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)
392 #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)
393 #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)
394 #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)
396 #define Tmsg0(lvl, msg)
397 #define Tmsg1(lvl, msg, a1)
398 #define Tmsg2(lvl, msg, a1, a2)
399 #define Tmsg3(lvl, msg, a1, a2, a3)
400 #define Tmsg4(lvl, msg, arg1, arg2, arg3, arg4)
401 #define Tmsg5(lvl, msg, a1, a2, a3, a4, a5)
402 #define Tmsg6(lvl, msg, a1, a2, a3, a4, a5, a6)
403 #define Tmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7)
404 #define Tmsg8(lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8)
405 #define Tmsg11(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)
407 #define Tmsg13(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13)
408 #endif /* TRACE_FILE */
412 /* Messages that are printed (uses d_msg) */
413 #define Pmsg0(lvl, msg) p_msg(__FILE__, __LINE__, lvl, msg)
414 #define Pmsg1(lvl, msg, a1) p_msg(__FILE__, __LINE__, lvl, msg, a1)
415 #define Pmsg2(lvl, msg, a1, a2) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2)
416 #define Pmsg3(lvl, msg, a1, a2, a3) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3)
417 #define Pmsg4(lvl, msg, arg1, arg2, arg3, arg4) p_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4)
418 #define Pmsg5(lvl, msg, a1, a2, a3, a4, a5) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5)
419 #define Pmsg6(lvl, msg, a1, a2, a3, a4, a5, a6) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6)
420 #define Pmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7)
421 #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)
422 #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)
423 #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)
424 #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)
425 #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)
426 #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)
427 #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)
430 /* Daemon Error Messages that are delivered according to the message resource */
431 #define Emsg0(typ, lvl, msg) e_msg(__FILE__, __LINE__, typ, lvl, msg)
432 #define Emsg1(typ, lvl, msg, a1) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1)
433 #define Emsg2(typ, lvl, msg, a1, a2) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2)
434 #define Emsg3(typ, lvl, msg, a1, a2, a3) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3)
435 #define Emsg4(typ, lvl, msg, a1, a2, a3, a4) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4)
436 #define Emsg5(typ, lvl, msg, a1, a2, a3, a4, a5) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4, a5)
437 #define Emsg6(typ, lvl, msg, a1, a2, a3, a4, a5, a6) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4, a5, a6)
439 /* Job Error Messages that are delivered according to the message resource */
440 #define Jmsg0(jcr, typ, lvl, msg) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg)
441 #define Jmsg1(jcr, typ, lvl, msg, a1) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1)
442 #define Jmsg2(jcr, typ, lvl, msg, a1, a2) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2)
443 #define Jmsg3(jcr, typ, lvl, msg, a1, a2, a3) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3)
444 #define Jmsg4(jcr, typ, lvl, msg, a1, a2, a3, a4) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4)
445 #define Jmsg5(jcr, typ, lvl, msg, a1, a2, a3, a4, a5) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5)
446 #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)
448 /* Queued Job Error Messages that are delivered according to the message resource */
449 #define Qmsg0(jcr, typ, lvl, msg) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg)
450 #define Qmsg1(jcr, typ, lvl, msg, a1) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1)
451 #define Qmsg2(jcr, typ, lvl, msg, a1, a2) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2)
452 #define Qmsg3(jcr, typ, lvl, msg, a1, a2, a3) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3)
453 #define Qmsg4(jcr, typ, lvl, msg, a1, a2, a3, a4) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4)
454 #define Qmsg5(jcr, typ, lvl, msg, a1, a2, a3, a4, a5) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5)
455 #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)
458 /* Memory Messages that are edited into a Pool Memory buffer */
459 #define Mmsg0(buf, msg) m_msg(__FILE__, __LINE__, buf, msg)
460 #define Mmsg1(buf, msg, a1) m_msg(__FILE__, __LINE__, buf, msg, a1)
461 #define Mmsg2(buf, msg, a1, a2) m_msg(__FILE__, __LINE__, buf, msg, a1, a2)
462 #define Mmsg3(buf, msg, a1, a2, a3) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3)
463 #define Mmsg4(buf, msg, a1, a2, a3, a4) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4)
464 #define Mmsg5(buf, msg, a1, a2, a3, a4, a5) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4, a5)
465 #define Mmsg6(buf, msg, a1, a2, a3, a4, a5, a6) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4, a5, a6)
466 #define Mmsg7(buf, msg, a1, a2, a3, a4, a5, a6, a7) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4, a5, a6)
467 #define Mmsg8(buf,msg,a1,a2,a3,a4,a5,a6,a7,a8) m_msg(__FILE__,__LINE__,buf,msg,a1,a2,a3,a4,a5,a6)
468 #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)
469 #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)
472 /* Edit message into Pool Memory buffer -- no __FILE__ and __LINE__ */
473 int Mmsg(POOLMEM **msgbuf, const char *fmt,...);
474 int Mmsg(POOLMEM *&msgbuf, const char *fmt,...);
475 int Mmsg(POOL_MEM &msgbuf, const char *fmt,...);
479 void d_msg(const char *file, int line, int level, const char *fmt,...);
480 void p_msg(const char *file, int line, int level, const char *fmt,...);
481 void e_msg(const char *file, int line, int type, int level, const char *fmt,...);
482 void j_msg(const char *file, int line, JCR *jcr, int type, time_t mtime, const char *fmt,...);
483 void q_msg(const char *file, int line, JCR *jcr, int type, time_t mtime, const char *fmt,...);
484 int m_msg(const char *file, int line, POOLMEM **msgbuf, const char *fmt,...);
485 int m_msg(const char *file, int line, POOLMEM *&pool_buf, const char *fmt, ...);
488 /* Use our strdup with smartalloc */
489 #ifndef HAVE_WXCONSOLE
491 #define strdup(buf) bad_call_on_strdup_use_bstrdup(buf)
494 /* Use our fgets which handles interrupts */
496 #define fgets(x,y,z) bfgets((x), (y), (z))
498 /* Use our sscanf, which is safer and works with known sizes */
499 #define sscanf bsscanf
502 #define bstrdup(str) strcpy((char *)b_malloc(__FILE__,__LINE__,strlen((str))+1),(str))
504 #define bstrdup(str) strcpy((char *)bmalloc(strlen((str))+1),(str))
508 #define bmalloc(size) b_malloc(__FILE__, __LINE__, (size))
512 * Replace codes needed in both file routines and non-file routines
513 * Job replace codes -- in "replace"
515 #define REPLACE_ALWAYS 'a'
516 #define REPLACE_IFNEWER 'w'
517 #define REPLACE_NEVER 'n'
518 #define REPLACE_IFOLDER 'o'
520 /* This probably should be done on a machine by machine basic, but it works */
521 /* This is critical for the smartalloc routines to properly align memory */
522 #define ALIGN_SIZE (sizeof(double))
523 #define BALIGN(x) (((x) + ALIGN_SIZE - 1) & ~(ALIGN_SIZE -1))
526 /* =============================================================
527 * OS Dependent defines
528 * =============================================================
532 /* Bad news. This OS cannot handle 64 bit fseeks and ftells */
537 #if defined (__digital__) && defined (__unix__)
538 /* Tru64 - it does have fseeko and ftello , but since ftell/fseek are also 64 bit */
539 /* take this 'shortcut' */
551 * On Solaris 2.5, threads are not timesliced by default, so we need to
552 * explictly increase the conncurrency level.
555 #define set_thread_concurrency(x) thr_setconcurrency(x)
556 extern int thr_setconcurrency(int);
562 /* Not needed on most systems */
563 #define set_thread_concurrency(x)
567 #if defined(HAVE_DARWIN_OS) || defined(HAVE_OSF1_OS)
568 /* Apparently someone forgot to wrap getdomainname as a C function */
569 extern "C" int getdomainname(char *name, int len);
573 extern "C" int mknod ( const char *path, int mode, dev_t device );
577 /* Define Winsock functions if we aren't on Windows */
578 #if !defined HAVE_WIN32
579 #define WSA_Init() 0 /* 0 = success */
580 #define WSACleanup() 0 /* 0 = success */
586 /* HP-UX 11 specific workarounds */
591 /* the {get,set}domainname() functions exist in HPUX's libc.
592 * the configure script detects that correctly.
593 * the problem is no system headers declares the prototypes for these functions
596 extern "C" int getdomainname(char *name, int namelen);
597 extern "C" int setdomainname(char *name, int namelen);
598 #define uLong unsigned long
599 #endif /* HAVE_HPUX_OS */
603 #undef HAVE_CHFLAGS /* chflags is incorrectly detected */
604 extern "C" int fchdir(int filedes);
605 extern "C" long gethostid(void);
609 /* Added by KES to deal with Win32 systems */
611 #define S_ISWIN32 020000
615 /* Disabled because it breaks internationalisation...
616 #undef HAVE_SETLOCALE
617 #ifdef HAVE_SETLOCALE
620 #define setlocale(x, y) ("ANSI_X3.4-1968")
622 #ifdef HAVE_NL_LANGINFO
623 #include <langinfo.h>
625 #define nl_langinfo(x) ("ANSI_X3.4-1968")
629 #endif /* _BACONFIG_H */