]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/berrno.h
- Add Version, ConfigDir, and WorkingDir as Python attributes
[bacula/bacula] / bacula / src / lib / berrno.h
index 88492e1772e160e31ad83602c880bdc08d21bb0c..e6b6923872de2fed476e176fcf9dc90f49f74a18 100644 (file)
  */
 
 #ifdef HAVE_WIN32
-#define b_errno_win32 (1<<29)         /* user reserved bit */
+#define b_errno_win32  (1<<29)        /* user reserved bit */
 #endif
+#define b_errno_exit   (1<<28)        /* child exited, exit code returned */
+#define b_errno_signal (1<<27)        /* child died, signal code returned */
 
 /*
  * A more generalized way of handling errno that works with Unix, Windows,
  *  and with Bacula bpipes.
  *
- * It works by picking up errno and creating a memory pool buffer 
+ * It works by picking up errno and creating a memory pool buffer
  *  for editing the message. strerror() does the actual editing, and
  *  it is thread safe.
  *
  * If bit 29 in berrno_ is set then it is a Win32 error, and we
  *  must to a GetLastError() to get the error code for formatting.
  * If bit 29 in berrno_ is not set, then it is a Unix errno.
+ *
  */
-class berrno {
+class berrno : public SMARTALLOC {
    POOLMEM *buf_;
    int berrno_;
 public:
    berrno(int pool=PM_EMSG);
    ~berrno();
    const char *strerror();
+   const char *strerror(int errnum);
    void set_errno(int errnum);
 };
 
 /* Constructor */
-inline berrno::berrno(int pool) 
+inline berrno::berrno(int pool)
 {
    berrno_ = errno;
    buf_ = get_pool_memory(pool);
 }
-   
+
 inline berrno::~berrno()
-{   
+{
    free_pool_memory(buf_);
 }
 
+inline const char *berrno::strerror(int errnum)
+{
+   berrno_ = errnum;
+   return berrno::strerror();
+}
+
+
 inline void berrno::set_errno(int errnum)
 {
    berrno_ = errnum;