diff --git a/Scheduler/ReadHelper.ct b/Scheduler/ReadHelper.ct index 1be8a8df8b858dd443899e7513fa7951972eb29e..89375b196be55ab05cdec4987078aa716fcc5060 100644 --- a/Scheduler/ReadHelper.ct +++ b/Scheduler/ReadHelper.ct @@ -85,7 +85,7 @@ prefix_ void senf::ReadHelper<Handle>::process(Handle handle, } } catch (senf::SystemException const & ex) { - errno_ = ex.code(); + errno_ = ex.errorNumber(); done(); return; } diff --git a/Scheduler/WriteHelper.ct b/Scheduler/WriteHelper.ct index afc09c69f64582b5c34aeba1e5cb0da0fc8deba5..17d06f4de85ef7bd2e0cd9bb71c4349e22bb84e8 100644 --- a/Scheduler/WriteHelper.ct +++ b/Scheduler/WriteHelper.ct @@ -87,7 +87,7 @@ prefix_ void senf::WriteHelper<Handle>::process(Handle handle, } } catch (senf::SystemException const & ex) { - errno_ = ex.code(); + errno_ = ex.errorNumber(); done(); return; } diff --git a/Utils/Daemon/Daemon.cc b/Utils/Daemon/Daemon.cc index d008c384c060c4cfd1c7b206013e89c7fa0b4fe4..201fe37f8cbeed08dc7455ff37dc700b35a703a1 100644 --- a/Utils/Daemon/Daemon.cc +++ b/Utils/Daemon/Daemon.cc @@ -151,15 +151,15 @@ prefix_ void senf::Daemon::detach() namespace { /* Purposely *not* derived from std::exception */ - struct DaemonFailureException { - DaemonFailureException(unsigned c) : code(c) {} + struct DaemonExitException { + DaemonExitException(unsigned c) : code(c) {} unsigned code; }; } -prefix_ void senf::Daemon::fail(unsigned code) +prefix_ void senf::Daemon::exit(unsigned code) { - throw DaemonFailureException(code); + throw DaemonExitException(code); } prefix_ int senf::Daemon::start(int argc, char const ** argv) @@ -182,8 +182,8 @@ prefix_ int senf::Daemon::start(int argc, char const ** argv) main(); } - catch (DaemonFailureException & e) { - return e.code > 0 ? e.code : 1; + catch (DaemonExitException & e) { + return e.code; } #ifdef NDEBUG diff --git a/Utils/Daemon/Daemon.hh b/Utils/Daemon/Daemon.hh index dc3fb2942a67d36c5eda906b03a4cb13d1aedadc..3fb0018a3e45771ff229233071ff6d2e56052a75 100644 --- a/Utils/Daemon/Daemon.hh +++ b/Utils/Daemon/Daemon.hh @@ -156,7 +156,7 @@ namespace senf { int argc(); ///< Access command line parameter count char const ** argv(); ///< Access command line parameters - void fail(unsigned code=1); ///< Terminate daemon with failure + void exit(unsigned code=0); ///< Terminate daemon with failure ///\} diff --git a/Utils/Exception.cci b/Utils/Exception.cci index a601955235446e738d2765cfe4e8c63a48011b12..40d89a5f6106aff1326a4ac74c0a5c4800f1c5df 100644 --- a/Utils/Exception.cci +++ b/Utils/Exception.cci @@ -48,7 +48,7 @@ prefix_ char const * senf::SystemException::what() return buffer_.c_str(); } -prefix_ int senf::SystemException::code() +prefix_ int senf::SystemException::errorNumber() const { return code_; diff --git a/Utils/Exception.hh b/Utils/Exception.hh index 7162040d332c39c3bfc7f7fb833dc34f11dbf8a4..6b62b68163ac51b6bbaa0c676afe69be5f445974 100644 --- a/Utils/Exception.hh +++ b/Utils/Exception.hh @@ -109,12 +109,12 @@ namespace senf { public: virtual char const * what() const throw(); ///< Return verbose error description - int code() const; ///< Error code (\c errno number) + int errorNumber() const; ///< Error code (\c errno number) char const * description() const; ///< Error description (strerror() value) bool anyOf(int c0, int c1=0, int c2=0, int c3=0, int c4=0, int c5=0, int c6=0, int c7=0, int c8=0, int c9=0); - ///< \c true, if code() is one of \a c0 ... \a c9 + ///< \c true, if errorNumber() is one of \a c0 ... \a c9 virtual ~SystemException() throw(); diff --git a/Utils/Exception.test.cc b/Utils/Exception.test.cc index 50e3c97712a7e00afc4c696d7edd4e8e60356c77..bf40f0c13a17d963340f11060e6acadcb409e84f 100644 --- a/Utils/Exception.test.cc +++ b/Utils/Exception.test.cc @@ -54,7 +54,7 @@ BOOST_AUTO_UNIT_TEST(errnoException) } } catch (senf::SystemException & e) { - BOOST_CHECK_EQUAL( e.code(), ENOENT ); + BOOST_CHECK_EQUAL( e.errorNumber(), ENOENT ); BOOST_CHECK_EQUAL( e.what(), "::open(): (2) No such file or directory: x=1, y=2" ); } }