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 ammended 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*"
63 #define _(s) gettext((s))
72 /* #define bindtextdomain(p, d) */
75 /* This should go away! ****FIXME***** */
78 /* Maximum length to edit time/date */
79 #define MAX_TIME_LENGTH 50
81 /* Maximum Name length including EOS */
82 #define MAX_NAME_LENGTH 128
84 /* Maximume number of user entered command args */
85 #define MAX_CMD_ARGS 30
87 /* All tape operations MUST be a multiple of this */
88 #define TAPE_BSIZE 1024
91 #define B_DEV_BSIZE DEV_BSIZE
94 #if !defined(B_DEV_BSIZE) & defined(BSIZE)
95 #define B_DEV_BSIZE BSIZE
99 #define B_DEV_BSIZE 512
103 * Set to time limit for other end to respond to
104 * authentication. Normally 10 minutes is *way*
105 * more than enough. The idea is to keep the Director
106 * from hanging because there is a dead connection on
109 #define AUTH_TIMEOUT 60 * 10
112 * Default network buffer size
114 #define DEFAULT_NETWORK_BUFFER_SIZE (32 * 1024)
117 * Stream definitions. Once defined these must NEVER
118 * change as they go on the storage media.
119 * Note, the following streams are passed from the SD to the DIR
120 * so that they may be put into the catalog (actually only the
121 * stat packet part of the attr record is put in the catalog.
123 * STREAM_UNIX_ATTRIBUTES
124 * STREAM_UNIX_ATTRIBUTES_EX
125 * STREAM_MD5_SIGNATURE
126 * STREAM_SHA1_SIGNATURE
128 #define STREAM_UNIX_ATTRIBUTES 1 /* Generic Unix attributes */
129 #define STREAM_FILE_DATA 2 /* Standard uncompressed data */
130 #define STREAM_MD5_SIGNATURE 3 /* MD5 signature for the file */
131 #define STREAM_GZIP_DATA 4 /* GZip compressed file data */
132 /* Extended Unix attributes with Win32 Extended data. Deprecated. */
133 #define STREAM_UNIX_ATTRIBUTES_EX 5 /* Extended Unix attr for Win32 EX */
134 #define STREAM_SPARSE_DATA 6 /* Sparse data stream */
135 #define STREAM_SPARSE_GZIP_DATA 7
136 #define STREAM_PROGRAM_NAMES 8 /* program names for program data */
137 #define STREAM_PROGRAM_DATA 9 /* Data needing program */
138 #define STREAM_SHA1_SIGNATURE 10 /* SHA1 signature for the file */
139 #define STREAM_WIN32_DATA 11 /* Win32 BackupRead data */
140 #define STREAM_WIN32_GZIP_DATA 12 /* Gzipped Win32 BackupRead data */
141 #define STREAM_MACOS_FORK_DATA 13 /* Mac resource fork */
142 #define STREAM_HFSPLUS_ATTRIBUTES 14 /* Mac OS extra attributes */
144 #define STREAM_UNIX_ATTRIBUTES_ACCESS_ACL 15 /* Standard ACL attributes on UNIX */
145 #define STREAM_UNIX_ATTRIBUTES_DEFAULT_ACL 16 /* Default ACL attributes on UNIX */
150 * File type (Bacula defined).
151 * NOTE!!! These are saved in the Attributes record on the tape, so
152 * do not change them. If need be, add to them.
154 * This is stored as 32 bits on tape, but only FT_MASK bits are
155 * used for the file type. The upper bits are used to indicate
156 * additional optional fields in the attribute record.
158 #define FT_MASK 0xFFFF /* Bits used by FT (type) */
159 #define FT_LNKSAVED 1 /* hard link to file already saved */
160 #define FT_REGE 2 /* Regular file but empty */
161 #define FT_REG 3 /* Regular file */
162 #define FT_LNK 4 /* Soft Link */
163 #define FT_DIREND 5 /* Directory at end (saved) */
164 #define FT_SPEC 6 /* Special file -- chr, blk, fifo, sock */
165 #define FT_NOACCESS 7 /* Not able to access */
166 #define FT_NOFOLLOW 8 /* Could not follow link */
167 #define FT_NOSTAT 9 /* Could not stat file */
168 #define FT_NOCHG 10 /* Incremental option, file not changed */
169 #define FT_DIRNOCHG 11 /* Incremental option, directory not changed */
170 #define FT_ISARCH 12 /* Trying to save archive file */
171 #define FT_NORECURSE 13 /* No recursion into directory */
172 #define FT_NOFSCHG 14 /* Different file system, prohibited */
173 #define FT_NOOPEN 15 /* Could not open directory */
174 #define FT_RAW 16 /* Raw block device */
175 #define FT_FIFO 17 /* Raw fifo device */
176 /* This directory packet is sent to the FD file processing routine so
177 * that it can filter packets, but otherwise, it is not used
179 #define FT_DIRBEGIN 18 /* Directory at beginning (not saved) */
180 #define FT_INVALIDFS 19 /* File system not allowed for */
182 /* Definitions for upper part of type word (see above). */
183 #define AR_DATA_STREAM (1<<16) /* Data stream id present */
186 * Internal code for Signature types
193 * Tape label types -- stored in catalog
195 #define B_BACULA_LABEL 0
196 #define B_ANSI_LABEL 1
197 #define B_IBM_LABEL 2
199 /* Size of File Address stored in STREAM_SPARSE_DATA. Do NOT change! */
200 #define SPARSE_FADDR_SIZE (sizeof(uint64_t))
203 /* This is for dumb compilers/libraries like Solaris. Linux GCC
204 * does it correctly, so it might be worthwhile
205 * to remove the isascii(c) with ifdefs on such
208 #define B_ISSPACE(c) (isascii((int)(c)) && isspace((int)(c)))
209 #define B_ISALPHA(c) (isascii((int)(c)) && isalpha((int)(c)))
210 #define B_ISUPPER(c) (isascii((int)(c)) && isupper((int)(c)))
211 #define B_ISDIGIT(c) (isascii((int)(c)) && isdigit((int)(c)))
213 /* For multiplying by 10 with shift and addition */
214 #define B_TIMES10(d) ((d<<3)+(d<<1))
217 typedef void (HANDLER)();
218 typedef int (INTHANDLER)();
221 # define SETPGRP_ARGS(x, y) /* No arguments */
223 # define SETPGRP_ARGS(x, y) (x, y)
227 #define S_ISLNK(m) (((m) & S_IFM) == S_IFLNK)
230 /* Added by KES to deal with Win32 systems */
232 #define S_ISWIN32 020000
236 #define INADDR_NONE ((unsigned long) -1)
239 #ifdef TIME_WITH_SYS_TIME
240 # include <sys/time.h>
243 # ifdef HAVE_SYS_TIME_H
244 # include <sys/time.h>
263 extern void _p(char *file, int line, pthread_mutex_t *m);
264 extern void _v(char *file, int line, pthread_mutex_t *m);
266 #define P(x) _p(__FILE__, __LINE__, &(x))
267 #define V(x) _v(__FILE__, __LINE__, &(x))
270 extern void _p(pthread_mutex_t *m);
271 extern void _v(pthread_mutex_t *m);
273 #define P(x) _p(&(x))
274 #define V(x) _v(&(x))
276 #endif /* DEBUG_MUTEX */
278 /* These probably should be subroutines */
280 do { int errstat; if ((errstat=rwl_writelock(&(x)))) \
281 e_msg(__FILE__, __LINE__, M_ABORT, 0, "Write lock lock failure. ERR=%s\n",\
282 strerror(errstat)); \
286 do { int errstat; if ((errstat=rwl_writeunlock(&(x)))) \
287 e_msg(__FILE__, __LINE__, M_ABORT, 0, "Write lock unlock failure. ERR=%s\n",\
288 strerror(errstat)); \
291 #define LockRes() b_LockRes(__FILE__, __LINE__)
292 #define UnlockRes() b_UnlockRes(__FILE__, __LINE__)
295 #define memset(a, v, n) b_memset(__FILE__, __LINE__, a, v, n)
296 void b_memset(const char *file, int line, void *mem, int val, size_t num);
301 * The digit following Dmsg and Emsg indicates the number of substitutions in
302 * the message string. We need to do this kludge because non-GNU compilers
303 * do not handle varargs #defines.
305 /* Debug Messages that are printed */
307 #define Dmsg0(lvl, msg) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg)
308 #define Dmsg1(lvl, msg, a1) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1)
309 #define Dmsg2(lvl, msg, a1, a2) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2)
310 #define Dmsg3(lvl, msg, a1, a2, a3) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3)
311 #define Dmsg4(lvl, msg, arg1, arg2, arg3, arg4) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4)
312 #define Dmsg5(lvl, msg, a1, a2, a3, a4, a5) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5)
313 #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)
314 #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)
315 #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)
316 #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)
317 #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)
318 #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)
319 #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)
320 #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)
322 #define Dmsg0(lvl, msg)
323 #define Dmsg1(lvl, msg, a1)
324 #define Dmsg2(lvl, msg, a1, a2)
325 #define Dmsg3(lvl, msg, a1, a2, a3)
326 #define Dmsg4(lvl, msg, arg1, arg2, arg3, arg4)
327 #define Dmsg5(lvl, msg, a1, a2, a3, a4, a5)
328 #define Dmsg6(lvl, msg, a1, a2, a3, a4, a5, a6)
329 #define Dmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7)
330 #define Dmsg8(lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8)
331 #define Dmsg11(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
332 #define Dmsg12(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
333 #define Dmsg13(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13)
337 #define Tmsg0(lvl, msg) t_msg(__FILE__, __LINE__, lvl, msg)
338 #define Tmsg1(lvl, msg, a1) t_msg(__FILE__, __LINE__, lvl, msg, a1)
339 #define Tmsg2(lvl, msg, a1, a2) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2)
340 #define Tmsg3(lvl, msg, a1, a2, a3) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3)
341 #define Tmsg4(lvl, msg, arg1, arg2, arg3, arg4) t_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4)
342 #define Tmsg5(lvl, msg, a1, a2, a3, a4, a5) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5)
343 #define Tmsg6(lvl, msg, a1, a2, a3, a4, a5, a6) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6)
344 #define Tmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7)
345 #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)
346 #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)
347 #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)
348 #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)
349 #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)
350 #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)
352 #define Tmsg0(lvl, msg)
353 #define Tmsg1(lvl, msg, a1)
354 #define Tmsg2(lvl, msg, a1, a2)
355 #define Tmsg3(lvl, msg, a1, a2, a3)
356 #define Tmsg4(lvl, msg, arg1, arg2, arg3, arg4)
357 #define Tmsg5(lvl, msg, a1, a2, a3, a4, a5)
358 #define Tmsg6(lvl, msg, a1, a2, a3, a4, a5, a6)
359 #define Tmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7)
360 #define Tmsg8(lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8)
361 #define Tmsg11(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
362 #define Tmsg12(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
363 #define Tmsg13(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13)
364 #endif /* TRACE_FILE */
368 /* Messages that are printed (uses d_msg) */
369 #define Pmsg0(lvl, msg) p_msg(__FILE__, __LINE__, lvl, msg)
370 #define Pmsg1(lvl, msg, a1) p_msg(__FILE__, __LINE__, lvl, msg, a1)
371 #define Pmsg2(lvl, msg, a1, a2) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2)
372 #define Pmsg3(lvl, msg, a1, a2, a3) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3)
373 #define Pmsg4(lvl, msg, arg1, arg2, arg3, arg4) p_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4)
374 #define Pmsg5(lvl, msg, a1, a2, a3, a4, a5) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5)
375 #define Pmsg6(lvl, msg, a1, a2, a3, a4, a5, a6) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6)
376 #define Pmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7)
377 #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)
378 #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)
379 #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)
380 #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)
381 #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)
382 #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)
383 #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)
386 /* Daemon Error Messages that are delivered according to the message resource */
387 #define Emsg0(typ, lvl, msg) e_msg(__FILE__, __LINE__, typ, lvl, msg)
388 #define Emsg1(typ, lvl, msg, a1) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1)
389 #define Emsg2(typ, lvl, msg, a1, a2) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2)
390 #define Emsg3(typ, lvl, msg, a1, a2, a3) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3)
391 #define Emsg4(typ, lvl, msg, a1, a2, a3, a4) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4)
392 #define Emsg5(typ, lvl, msg, a1, a2, a3, a4, a5) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4, a5)
393 #define Emsg6(typ, lvl, msg, a1, a2, a3, a4, a5, a6) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4, a5, a6)
395 /* Job Error Messages that are delivered according to the message resource */
396 #define Jmsg0(jcr, typ, lvl, msg) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg)
397 #define Jmsg1(jcr, typ, lvl, msg, a1) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1)
398 #define Jmsg2(jcr, typ, lvl, msg, a1, a2) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2)
399 #define Jmsg3(jcr, typ, lvl, msg, a1, a2, a3) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3)
400 #define Jmsg4(jcr, typ, lvl, msg, a1, a2, a3, a4) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4)
401 #define Jmsg5(jcr, typ, lvl, msg, a1, a2, a3, a4, a5) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5)
402 #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)
404 /* Queued Job Error Messages that are delivered according to the message resource */
405 #define Qmsg0(jcr, typ, lvl, msg) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg)
406 #define Qmsg1(jcr, typ, lvl, msg, a1) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1)
407 #define Qmsg2(jcr, typ, lvl, msg, a1, a2) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2)
408 #define Qmsg3(jcr, typ, lvl, msg, a1, a2, a3) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3)
409 #define Qmsg4(jcr, typ, lvl, msg, a1, a2, a3, a4) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4)
410 #define Qmsg5(jcr, typ, lvl, msg, a1, a2, a3, a4, a5) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5)
411 #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)
414 /* Memory Messages that are edited into a Pool Memory buffer */
415 #define Mmsg0(buf, msg) m_msg(__FILE__, __LINE__, buf, msg)
416 #define Mmsg1(buf, msg, a1) m_msg(__FILE__, __LINE__, buf, msg, a1)
417 #define Mmsg2(buf, msg, a1, a2) m_msg(__FILE__, __LINE__, buf, msg, a1, a2)
418 #define Mmsg3(buf, msg, a1, a2, a3) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3)
419 #define Mmsg4(buf, msg, a1, a2, a3, a4) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4)
420 #define Mmsg5(buf, msg, a1, a2, a3, a4, a5) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4, a5)
421 #define Mmsg6(buf, msg, a1, a2, a3, a4, a5, a6) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4, a5, a6)
422 #define Mmsg7(buf, msg, a1, a2, a3, a4, a5, a6, a7) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4, a5, a6)
423 #define Mmsg8(buf,msg,a1,a2,a3,a4,a5,a6,a7,a8) m_msg(__FILE__,__LINE__,buf,msg,a1,a2,a3,a4,a5,a6)
424 #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)
425 #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)
428 /* Edit message into Pool Memory buffer -- no __FILE__ and __LINE__ */
429 int Mmsg(POOLMEM **msgbuf, const char *fmt,...);
430 int Mmsg(POOLMEM *&msgbuf, const char *fmt,...);
431 int Mmsg(POOL_MEM &msgbuf, const char *fmt,...);
435 void d_msg(const char *file, int line, int level, const char *fmt,...);
436 void p_msg(const char *file, int line, int level, const char *fmt,...);
437 void e_msg(const char *file, int line, int type, int level, const char *fmt,...);
438 void j_msg(const char *file, int line, JCR *jcr, int type, time_t mtime, const char *fmt,...);
439 void q_msg(const char *file, int line, JCR *jcr, int type, time_t mtime, const char *fmt,...);
440 int m_msg(const char *file, int line, POOLMEM **msgbuf, const char *fmt,...);
441 int m_msg(const char *file, int line, POOLMEM *&pool_buf, const char *fmt, ...);
444 /* Use our strdup with smartalloc */
447 #define strdup(buf) bad_call_on_strdup_use_bstrdup(buf)
450 /* Use our fgets which handles interrupts */
452 #define fgets(x,y,z) bfgets((x), (y), (z))
454 /* Use our sscanf, which is safer and works with known sizes */
455 #define sscanf bsscanf
458 #define bstrdup(str) strcpy((char *)b_malloc(__FILE__,__LINE__,strlen((str))+1),(str))
460 #define bstrdup(str) strcpy((char *)bmalloc(strlen((str))+1),(str))
464 #define bmalloc(size) b_malloc(__FILE__, __LINE__, (size))
468 * Replace codes needed in both file routines and non-file routines
469 * Job replace codes -- in "replace"
471 #define REPLACE_ALWAYS 'a'
472 #define REPLACE_IFNEWER 'w'
473 #define REPLACE_NEVER 'n'
474 #define REPLACE_IFOLDER 'o'
476 /* This probably should be done on a machine by machine basic, but it works */
477 /* This is critical for the smartalloc routines to properly align memory */
478 #define ALIGN_SIZE (sizeof(double))
479 #define BALIGN(x) (((x) + ALIGN_SIZE - 1) & ~(ALIGN_SIZE -1))
482 /* =============================================================
483 * OS Dependent defines
484 * =============================================================
488 /* Bad news. This OS cannot handle 64 bit fseeks and ftells */
493 #if defined (__digital__) && defined (__unix__)
494 /* Tru64 - it does have fseeko and ftello , but since ftell/fseek are also 64 bit */
495 /* take this 'shortcut' */
507 * On Solaris 2.5, threads are not timesliced by default, so we need to
508 * explictly increase the conncurrency level.
511 #define set_thread_concurrency(x) thr_setconcurrency(x)
512 extern int thr_setconcurrency(int);
518 /* Not needed on most systems */
519 #define set_thread_concurrency(x)
523 #ifdef HAVE_DARWIN_OS
524 /* Apparently someone forgot to wrap getdomainname as a C function */
525 extern "C" int getdomainname(char *name, int len);
529 /* They don't really have it */
530 #undef HAVE_GETDOMAINNAME
533 /* Define Winsock functions if we aren't on Windows */
534 #if (!defined HAVE_WIN32) || (defined HAVE_CYGWIN)
535 #define WSA_Init() 0 /* 0 = success */
536 #define WSACleanup() 0 /* 0 = success */
542 /* HP-UX 11 specific workarounds */
547 /* the {get,set}domainname() functions exist in HPUX's libc.
548 * the configure script detects that correctly.
549 * the problem is no system headers declares the prototypes for these functions
552 extern "C" int getdomainname(char *name, int namelen);
553 extern "C" int setdomainname(char *name, int namelen);
554 #define uLong unsigned long
555 #endif /* HAVE_HPUX_OS */
559 #undef HAVE_CHFLAGS /* chflags is incorrectly detected */
560 extern "C" int fchdir(int filedes);
561 extern "C" long gethostid(void);
565 /* Added by KES to deal with Win32 systems */
567 #define S_ISWIN32 020000
571 #undef HAVE_SETLOCALE
572 #ifdef HAVE_SETLOCALE
575 #define setlocale(x, y) ("ANSI_X3.4-1968")
577 #ifdef HAVE_NL_LANGINFO
578 #include <langinfo.h>
580 #define nl_langinfo(x) ("ANSI_X3.4-1968")
583 /* Fake entry points if regex does not exist */
585 #define regcomp(x, y, z) 1
587 #define regerror(rc, preg, prbuf, len) bstrncpy(prbuf, "REGEX not available on this system.", len)
589 #define regmatch_t char
592 #endif /* _BACONFIG_H */