6 Copyright (C) 2004 Kern Sibbald and John Walker
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of
11 the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but 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 General Public
19 License along with this program; if not, write to the Free
20 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
23 Kern Sibbald, July MMIV
28 #define b_errno_win32 (1<<29) /* user reserved bit */
32 * A more generalized way of handling errno that works with Unix, Windows,
33 * and with Bacula bpipes.
35 * It works by picking up errno and creating a memory pool buffer
36 * for editing the message. strerror() does the actual editing, and
39 * If bit 29 in berrno_ is set then it is a Win32 error, and we
40 * must to a GetLastError() to get the error code for formatting.
41 * If bit 29 in berrno_ is not set, then it is a Unix errno.
47 berrno(int pool=PM_EMSG);
49 const char *strerror();
50 void set_errno(int errnum);
54 inline berrno::berrno(int pool)
57 buf_ = get_pool_memory(pool);
60 inline berrno::~berrno()
62 free_pool_memory(buf_);
65 inline void berrno::set_errno(int errnum)