2 Bacula® - The Network Backup Solution
4 Copyright (C) 2000-2010 Free Software Foundation Europe e.V.
6 The main author of Bacula is Kern Sibbald, with contributions from
7 many others, a complete list can be found in the file AUTHORS.
8 This program is Free Software; you can redistribute it and/or
9 modify it under the terms of version three of the GNU Affero General Public
10 License as published by the Free Software Foundation and included
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU Affero General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 Bacula® is a registered trademark of Kern Sibbald.
24 The licensor of Bacula is the Free Software Foundation Europe
25 (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
26 Switzerland, email:ftf@fsfeurope.org.
29 * General header file configurations that apply to
30 * all daemons. System dependent stuff goes here.
38 /* Bacula common configuration defines */
52 #define ETIME ETIMEDOUT
55 #ifdef HAVE_IOCTL_ULINT_REQUEST
56 #define ioctl_req_t unsigned long int
58 #define ioctl_req_t int
61 #define MANUAL_AUTH_URL "http://www.bacula.org/en/rel-manual/Bacula_Freque_Asked_Questi.html#SECTION003760000000000000000"
66 # define __PROTO(p) ()
70 #define ASSERT(x) if (!(x)) { \
72 Emsg1(M_ERROR, 0, _("Failed ASSERT: %s\n"), #x); \
73 Pmsg1(000, _("Failed ASSERT: %s\n"), #x); \
79 /* Allow printing of NULL pointers */
80 #define NPRT(x) (x)?(x):_("*None*")
81 #define NPRTB(x) (x)?(x):""
83 #if defined(HAVE_WIN32)
85 #define WIN32_REPARSE_POINT 1 /* Can be any number of "funny" directories except the next two */
86 #define WIN32_MOUNT_POINT 2 /* Directory link to Volume */
87 #define WIN32_JUNCTION_POINT 3 /* Directory link to a directory */
89 /* Reduce compiler warnings from Windows vss code */
92 void InitWinAPIWrapper();
94 #define OSDependentInit() InitWinAPIWrapper()
98 #define clear_thread_id(x) memset(&(x), 0, sizeof(x))
100 #if defined(BUILDING_DLL)
101 # define DLL_IMP_EXP _declspec(dllexport)
102 #elif defined(USING_DLL)
103 # define DLL_IMP_EXP _declspec(dllimport)
108 #if defined(USING_CATS)
109 # define CATS_IMP_EXP _declspec(dllimport)
111 # define CATS_IMP_EXP
114 #else /* HAVE_WIN32 */
116 #define clear_thread_id(x) x = 0
121 #define OSDependentInit()
123 #endif /* HAVE_WIN32 */
130 #define _(s) gettext((s))
135 #else /* !ENABLE_NLS */
139 #undef bindtextdomain
149 #define textdomain(d)
151 #ifndef bindtextdomain
152 #define bindtextdomain(p, d)
155 #define setlocale(p, d)
157 #endif /* ENABLE_NLS */
160 /* Use the following for strings not to be translated */
163 /* This should go away! ****FIXME***** */
164 #define MAXSTRING 500
166 /* Maximum length to edit time/date */
167 #define MAX_TIME_LENGTH 50
169 /* Maximum Name length including EOS */
170 #define MAX_NAME_LENGTH 128
172 /* Maximum escaped Name lenght including EOS 2*MAX_NAME_LENGTH+1 */
173 #define MAX_ESCAPE_NAME_LENGTH 257
175 /* Maximume number of user entered command args */
176 #define MAX_CMD_ARGS 30
178 /* All tape operations MUST be a multiple of this */
179 #define TAPE_BSIZE 1024
182 #define B_DEV_BSIZE DEV_BSIZE
185 #if !defined(B_DEV_BSIZE) & defined(BSIZE)
186 #define B_DEV_BSIZE BSIZE
190 #define B_DEV_BSIZE 512
194 * Set to time limit for other end to respond to
195 * authentication. Normally 10 minutes is *way*
196 * more than enough. The idea is to keep the Director
197 * from hanging because there is a dead connection on
200 #define AUTH_TIMEOUT 60 * 10
203 * Default network buffer size
205 #define DEFAULT_NETWORK_BUFFER_SIZE (64 * 1024)
208 * Tape label types -- stored in catalog
210 #define B_BACULA_LABEL 0
211 #define B_ANSI_LABEL 1
212 #define B_IBM_LABEL 2
215 * Actions on purge (bit mask)
217 #define ON_PURGE_TRUNCATE 1
219 /* Size of File Address stored in STREAM_SPARSE_DATA. Do NOT change! */
220 #define OFFSET_FADDR_SIZE (sizeof(uint64_t))
222 /* Size of crypto length stored at head of crypto buffer. Do NOT change! */
223 #define CRYPTO_LEN_SIZE ((int)sizeof(uint32_t))
227 * This is for dumb compilers/libraries like Solaris. Linux GCC
228 * does it correctly, so it might be worthwhile
229 * to remove the isascii(c) with ifdefs on such
232 #define B_ISSPACE(c) (isascii((int)(c)) && isspace((int)(c)))
233 #define B_ISALPHA(c) (isascii((int)(c)) && isalpha((int)(c)))
234 #define B_ISUPPER(c) (isascii((int)(c)) && isupper((int)(c)))
235 #define B_ISDIGIT(c) (isascii((int)(c)) && isdigit((int)(c)))
237 /** For multiplying by 10 with shift and addition */
238 #define B_TIMES10(d) ((d<<3)+(d<<1))
241 typedef void (HANDLER)();
242 typedef int (INTHANDLER)();
245 # define SETPGRP_ARGS(x, y) /* No arguments */
247 # define SETPGRP_ARGS(x, y) (x, y)
251 #define S_ISLNK(m) (((m) & S_IFM) == S_IFLNK)
254 /** Added by KES to deal with Win32 systems */
256 #define S_ISWIN32 020000
260 #define INADDR_NONE ((unsigned long) -1)
263 #ifdef TIME_WITH_SYS_TIME
264 # include <sys/time.h>
267 # ifdef HAVE_SYS_TIME_H
268 # include <sys/time.h>
286 #if defined(HAVE_WIN32)
287 typedef int64_t boffset_t;
288 #define caddr_t char *
290 typedef off_t boffset_t;
293 /* These probably should be subroutines */
295 do { int errstat; if ((errstat=rwl_writelock(&(x)))) \
296 e_msg(__FILE__, __LINE__, M_ABORT, 0, "Write lock lock failure. ERR=%s\n",\
297 strerror(errstat)); \
301 do { int errstat; if ((errstat=rwl_writeunlock(&(x)))) \
302 e_msg(__FILE__, __LINE__, M_ABORT, 0, "Write lock unlock failure. ERR=%s\n",\
303 strerror(errstat)); \
306 #define LockRes() b_LockRes(__FILE__, __LINE__)
307 #define UnlockRes() b_UnlockRes(__FILE__, __LINE__)
310 #define memset(a, v, n) b_memset(__FILE__, __LINE__, a, v, n)
311 void b_memset(const char *file, int line, void *mem, int val, size_t num);
316 * The digit following Dmsg and Emsg indicates the number of substitutions in
317 * the message string. We need to do this kludge because non-GNU compilers
318 * do not handle varargs #defines.
320 /** Debug Messages that are printed */
322 #define Dmsg0(lvl, msg) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg)
323 #define Dmsg1(lvl, msg, a1) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1)
324 #define Dmsg2(lvl, msg, a1, a2) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2)
325 #define Dmsg3(lvl, msg, a1, a2, a3) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3)
326 #define Dmsg4(lvl, msg, arg1, arg2, arg3, arg4) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4)
327 #define Dmsg5(lvl, msg, a1, a2, a3, a4, a5) if ((lvl)<=debug_level) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5)
328 #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)
329 #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)
330 #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)
331 #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)
332 #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)
333 #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)
334 #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)
335 #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)
337 #define Dmsg0(lvl, msg)
338 #define Dmsg1(lvl, msg, a1)
339 #define Dmsg2(lvl, msg, a1, a2)
340 #define Dmsg3(lvl, msg, a1, a2, a3)
341 #define Dmsg4(lvl, msg, arg1, arg2, arg3, arg4)
342 #define Dmsg5(lvl, msg, a1, a2, a3, a4, a5)
343 #define Dmsg6(lvl, msg, a1, a2, a3, a4, a5, a6)
344 #define Dmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7)
345 #define Dmsg8(lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8)
346 #define Dmsg11(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
347 #define Dmsg12(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
348 #define Dmsg13(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13)
352 #define Tmsg0(lvl, msg) t_msg(__FILE__, __LINE__, lvl, msg)
353 #define Tmsg1(lvl, msg, a1) t_msg(__FILE__, __LINE__, lvl, msg, a1)
354 #define Tmsg2(lvl, msg, a1, a2) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2)
355 #define Tmsg3(lvl, msg, a1, a2, a3) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3)
356 #define Tmsg4(lvl, msg, arg1, arg2, arg3, arg4) t_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4)
357 #define Tmsg5(lvl, msg, a1, a2, a3, a4, a5) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5)
358 #define Tmsg6(lvl, msg, a1, a2, a3, a4, a5, a6) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6)
359 #define Tmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7)
360 #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)
361 #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)
362 #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)
363 #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)
364 #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)
365 #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)
367 #define Tmsg0(lvl, msg)
368 #define Tmsg1(lvl, msg, a1)
369 #define Tmsg2(lvl, msg, a1, a2)
370 #define Tmsg3(lvl, msg, a1, a2, a3)
371 #define Tmsg4(lvl, msg, arg1, arg2, arg3, arg4)
372 #define Tmsg5(lvl, msg, a1, a2, a3, a4, a5)
373 #define Tmsg6(lvl, msg, a1, a2, a3, a4, a5, a6)
374 #define Tmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7)
375 #define Tmsg8(lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8)
376 #define Tmsg11(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)
377 #define Tmsg12(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
378 #define Tmsg13(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13)
379 #endif /* TRACE_FILE */
383 /** Messages that are printed (uses d_msg) */
384 #define Pmsg0(lvl, msg) p_msg(__FILE__, __LINE__, lvl, msg)
385 #define Pmsg1(lvl, msg, a1) p_msg(__FILE__, __LINE__, lvl, msg, a1)
386 #define Pmsg2(lvl, msg, a1, a2) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2)
387 #define Pmsg3(lvl, msg, a1, a2, a3) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3)
388 #define Pmsg4(lvl, msg, arg1, arg2, arg3, arg4) p_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4)
389 #define Pmsg5(lvl, msg, a1, a2, a3, a4, a5) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5)
390 #define Pmsg6(lvl, msg, a1, a2, a3, a4, a5, a6) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6)
391 #define Pmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7)
392 #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)
393 #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)
394 #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)
395 #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)
396 #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)
397 #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)
398 #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)
401 /** Daemon Error Messages that are delivered according to the message resource */
402 #define Emsg0(typ, lvl, msg) e_msg(__FILE__, __LINE__, typ, lvl, msg)
403 #define Emsg1(typ, lvl, msg, a1) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1)
404 #define Emsg2(typ, lvl, msg, a1, a2) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2)
405 #define Emsg3(typ, lvl, msg, a1, a2, a3) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3)
406 #define Emsg4(typ, lvl, msg, a1, a2, a3, a4) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4)
407 #define Emsg5(typ, lvl, msg, a1, a2, a3, a4, a5) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4, a5)
408 #define Emsg6(typ, lvl, msg, a1, a2, a3, a4, a5, a6) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4, a5, a6)
410 /** Job Error Messages that are delivered according to the message resource */
411 #define Jmsg0(jcr, typ, lvl, msg) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg)
412 #define Jmsg1(jcr, typ, lvl, msg, a1) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1)
413 #define Jmsg2(jcr, typ, lvl, msg, a1, a2) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2)
414 #define Jmsg3(jcr, typ, lvl, msg, a1, a2, a3) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3)
415 #define Jmsg4(jcr, typ, lvl, msg, a1, a2, a3, a4) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4)
416 #define Jmsg5(jcr, typ, lvl, msg, a1, a2, a3, a4, a5) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5)
417 #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)
419 /** Queued Job Error Messages that are delivered according to the message resource */
420 #define Qmsg0(jcr, typ, lvl, msg) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg)
421 #define Qmsg1(jcr, typ, lvl, msg, a1) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1)
422 #define Qmsg2(jcr, typ, lvl, msg, a1, a2) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2)
423 #define Qmsg3(jcr, typ, lvl, msg, a1, a2, a3) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3)
424 #define Qmsg4(jcr, typ, lvl, msg, a1, a2, a3, a4) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4)
425 #define Qmsg5(jcr, typ, lvl, msg, a1, a2, a3, a4, a5) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5)
426 #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)
429 /** Memory Messages that are edited into a Pool Memory buffer */
430 #define Mmsg0(buf, msg) m_msg(__FILE__, __LINE__, buf, msg)
431 #define Mmsg1(buf, msg, a1) m_msg(__FILE__, __LINE__, buf, msg, a1)
432 #define Mmsg2(buf, msg, a1, a2) m_msg(__FILE__, __LINE__, buf, msg, a1, a2)
433 #define Mmsg3(buf, msg, a1, a2, a3) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3)
434 #define Mmsg4(buf, msg, a1, a2, a3, a4) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4)
435 #define Mmsg5(buf, msg, a1, a2, a3, a4, a5) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4, a5)
436 #define Mmsg6(buf, msg, a1, a2, a3, a4, a5, a6) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4, a5, a6)
437 #define Mmsg7(buf, msg, a1, a2, a3, a4, a5, a6, a7) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4, a5, a6)
438 #define Mmsg8(buf,msg,a1,a2,a3,a4,a5,a6,a7,a8) m_msg(__FILE__,__LINE__,buf,msg,a1,a2,a3,a4,a5,a6)
439 #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)
440 #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)
443 /* Edit message into Pool Memory buffer -- no __FILE__ and __LINE__ */
444 int Mmsg(POOLMEM **msgbuf, const char *fmt,...);
445 int Mmsg(POOLMEM *&msgbuf, const char *fmt,...);
446 int Mmsg(POOL_MEM &msgbuf, const char *fmt,...);
450 void d_msg(const char *file, int line, int level, const char *fmt,...);
451 void p_msg(const char *file, int line, int level, const char *fmt,...);
452 void e_msg(const char *file, int line, int type, int level, const char *fmt,...);
453 void j_msg(const char *file, int line, JCR *jcr, int type, utime_t mtime, const char *fmt,...);
454 void q_msg(const char *file, int line, JCR *jcr, int type, utime_t mtime, const char *fmt,...);
455 int m_msg(const char *file, int line, POOLMEM **msgbuf, const char *fmt,...);
456 int m_msg(const char *file, int line, POOLMEM *&pool_buf, const char *fmt, ...);
459 /** Use our strdup with smartalloc */
460 #ifndef HAVE_WXCONSOLE
462 #define strdup(buf) bad_call_on_strdup_use_bstrdup(buf)
464 /* Groan, WxWidgets has its own way of doing NLS so cleanup */
469 #undef bindtextdomain
473 /** Use our fgets which handles interrupts */
475 #define fgets(x,y,z) bfgets((x), (y), (z))
477 /** Use our sscanf, which is safer and works with known sizes */
478 #define sscanf bsscanf
481 #define bstrdup(str) strcpy((char *)b_malloc(__FILE__,__LINE__,strlen((str))+1),(str))
483 #define bstrdup(str) strcpy((char *)bmalloc(strlen((str))+1),(str))
487 #define bmalloc(size) b_malloc(__FILE__, __LINE__, (size))
490 /** Macro to simplify free/reset pointers */
491 #define bfree_and_null(a) do{if(a){free(a); (a)=NULL;}} while(0)
494 * Replace codes needed in both file routines and non-file routines
495 * Job replace codes -- in "replace"
497 #define REPLACE_ALWAYS 'a'
498 #define REPLACE_IFNEWER 'w'
499 #define REPLACE_NEVER 'n'
500 #define REPLACE_IFOLDER 'o'
502 /** This probably should be done on a machine by machine basis, but it works */
503 /** This is critical for the smartalloc routines to properly align memory */
504 #define ALIGN_SIZE (sizeof(double))
505 #define BALIGN(x) (((x) + ALIGN_SIZE - 1) & ~(ALIGN_SIZE -1))
508 /* =============================================================
509 * OS Dependent defines
510 * =============================================================
512 #if defined (__digital__) && defined (__unix__)
513 /* Tru64 - it does have fseeko and ftello , but since ftell/fseek are also 64 bit */
514 /* take this 'shortcut' */
519 /* Bad news. This OS cannot handle 64 bit fseeks and ftells */
527 * On Solaris 2.5/2.6/7 and 8, threads are not timesliced by default,
528 * so we need to explictly increase the conncurrency level.
530 #ifdef USE_THR_SETCONCURRENCY
532 #define set_thread_concurrency(x) thr_setconcurrency(x)
533 extern int thr_setconcurrency(int);
536 #define set_thread_concurrency(x)
541 * Not needed on most systems
543 #define set_thread_concurrency(x)
547 #ifdef HAVE_DARWIN_OS
548 /* Apparently someone forgot to wrap getdomainname as a C function */
551 #endif /* __cplusplus */
552 int getdomainname(char *name, int len);
555 #endif /* __cplusplus */
556 #endif /* HAVE_DARWIN_OS */
558 #if defined(HAVE_WIN32)
562 #define DEFAULT_CONFIGDIR "C:\\Documents and Settings\\All Users\\Application Data\\Bacula"
563 #define PathSeparator '\\'
565 inline bool IsPathSeparator(int ch) { return ch == '/' || ch == '\\'; }
566 inline char *first_path_separator(char *path) { return strpbrk(path, "/\\"); }
567 inline const char *first_path_separator(const char *path) { return strpbrk(path, "/\\"); }
569 extern void pause_msg(const char *file, const char *func, int line, const char *msg);
570 #define pause(msg) if (debug_level) pause_msg(__FILE__, __func__, __LINE__, (msg))
576 #define PathSeparator '/'
577 /* Define Winsock functions if we aren't on Windows */
579 #define WSA_Init() 0 /* 0 = success */
580 #define WSACleanup() 0 /* 0 = success */
582 inline bool IsPathSeparator(int ch) { return ch == '/'; }
583 inline char *first_path_separator(char *path) { return strchr(path, '/'); }
584 inline const char *first_path_separator(const char *path) { return strchr(path, '/'); }
589 /** HP-UX 11 specific workarounds */
594 /** the {get,set}domainname() functions exist in HPUX's libc.
595 * the configure script detects that correctly.
596 * the problem is no system headers declares the prototypes for these functions
601 #endif /* __cplusplus */
602 int getdomainname(char *name, int namelen);
603 int setdomainname(char *name, int namelen);
606 #endif /* __cplusplus */
607 #endif /* HAVE_HPUX_OS */
613 #endif /* __cplusplus */
614 int fchdir(int filedes);
615 long gethostid(void);
616 int getdomainname(char *name, int len);
619 #endif /* __cplusplus */
620 #endif /* HAVE_OSF1_OS */
623 /** Disabled because it breaks internationalisation...
624 #undef HAVE_SETLOCALE
625 #ifdef HAVE_SETLOCALE
628 #define setlocale(x, y) ("ANSI_X3.4-1968")
630 #ifdef HAVE_NL_LANGINFO
631 #include <langinfo.h>
633 #define nl_langinfo(x) ("ANSI_X3.4-1968")
637 /** Determine endianes */
638 static inline bool bigendian() { return htonl(1) == 1L; }
640 #endif /* _BACONFIG_H */