Replace namespace name to klay
authorJaemin Ryu <jm77.ryu@samsung.com>
Wed, 2 Jan 2019 02:09:59 +0000 (11:09 +0900)
committerJaemin Ryu <jm77.ryu@samsung.com>
Mon, 11 Feb 2019 04:47:37 +0000 (13:47 +0900)
Change-Id: I3db4e497a20b729883c01bc0272f420473c199da
Signed-off-by: Jaemin Ryu <jm77.ryu@samsung.com>
40 files changed:
include/klay/audit/audit-trail.h
include/klay/mainloop.h
include/klay/rmi/client.h
include/klay/rmi/message.h
include/klay/rmi/notification.h
include/klay/rmi/service.h
include/klay/rmi/socket.h
src/audit/audit-trail.cpp
src/auth/group.cpp
src/auth/user.cpp
src/cgroup.cpp
src/db/connection.cpp
src/db/statement.cpp
src/dbus/connection.cpp
src/dbus/introspection.cpp
src/eventfd.cpp
src/file-user.cpp
src/filesystem.cpp
src/namespace.cpp
src/netlink/netlink.cpp
src/pam.cpp
src/process.cpp
src/rmi/client.cpp
src/rmi/message.cpp
src/rmi/notification.cpp
src/rmi/service.cpp
src/rmi/socket.cpp
src/xml/document.cpp
src/xml/node.cpp
src/xml/parser.cpp
test/auth.cpp
test/database.cpp
test/dbus.cpp
test/eventfd.cpp
test/filesystem.cpp
test/logger.cpp
test/misc.cpp
test/proc.cpp
test/rmi.cpp
test/xml.cpp

index 850699fdb717e87a46736a528e733e98c78a3e47..22020cac863a8721368f8e48e4eab5292e2947e1 100644 (file)
@@ -34,11 +34,11 @@ public:
        void start();
        void stop();
 
-       void subscribe(const int fd, const runtime::Mainloop::Event events, runtime::Mainloop::Callback&& callback);
+       void subscribe(const int fd, const klay::Mainloop::Event events, klay::Mainloop::Callback&& callback);
        void unsubscribe(const int fd);
 
 private:
-       runtime::Mainloop mainloop;
+       klay::Mainloop mainloop;
        std::thread dispatcher;
 };
 
index 2557828ae51b2f5025aba9638df50c1d2aafb624..7550c565d6a8d8b65e8658ab24e48971504effc2 100644 (file)
@@ -53,7 +53,7 @@ private:
        Mutex mutex;
        int pollFd;
        std::atomic<bool> stopped;
-       runtime::EventFD wakeupSignal;
+       klay::EventFD wakeupSignal;
 
        void prepare();
 };
index 96e771649c96e81fd52cb321552b3d22ea86df2b..8401144b3b32df5071e76ae6f540540773c327e2 100644 (file)
@@ -57,7 +57,7 @@ public:
 private:
        std::string address;
        std::shared_ptr<Connection> connection;
-       runtime::Mainloop mainloop;
+       klay::Mainloop mainloop;
        std::thread dispatcher;
 };
 
@@ -72,7 +72,7 @@ RemoteAccessClient<ExceptionModel>::~RemoteAccessClient()
 {
        try {
                disconnect();
-       } catch (runtime::Exception& e) {}
+       } catch (klay::Exception& e) {}
 }
 
 template <typename ExceptionModel>
@@ -98,7 +98,7 @@ int RemoteAccessClient<ExceptionModel>::subscribe(const std::string& provider, c
        request.packParameters(name);
        connection->send(request);
 
-       runtime::FileDescriptor response;
+       klay::FileDescriptor response;
        Message reply = connection->dispatch();
        if (reply.isError()) {
                std::string klass;
@@ -134,7 +134,7 @@ int RemoteAccessClient<ExceptionModel>::subscribe(const std::string& provider, c
 
        std::shared_ptr<Socket> transport = std::make_shared<Socket>(id);
 
-       auto callback = [handler, transport, this](int fd, runtime::Mainloop::Event event) {
+       auto callback = [handler, transport, this](int fd, klay::Mainloop::Event event) {
                if ((event & EPOLLHUP) || (event & EPOLLRDHUP)) {
                        mainloop.removeEventSource(fd);
                        return;
index f0e606f78a1939a95407536ac628fbff3d84cef8..52d156907eb74ab324e795bc4e3b96b7c7093420 100644 (file)
@@ -149,7 +149,7 @@ private:
 
        MessageSignature signature;
        MessageComposer buffer;
-       std::deque<runtime::FileDescriptor> fileDescriptors;
+       std::deque<klay::FileDescriptor> fileDescriptors;
 
        static std::atomic<unsigned int> sequence;
 };
@@ -183,16 +183,16 @@ void Message::unpackParameters(F& first, R&... rest)
 template<typename DataType>
 void Message::enclose(DataType&& data)
 {
-       runtime::Serializer<MessageComposer> serializer(buffer);
-       runtime::SerializableArgument<DataType> arg(std::forward<DataType>(data));
+       klay::Serializer<MessageComposer> serializer(buffer);
+       klay::SerializableArgument<DataType> arg(std::forward<DataType>(data));
        arg.accept(serializer);
 }
 
 template<typename DataType>
 void Message::disclose(DataType& data)
 {
-       runtime::Deserializer<MessageComposer> deserializer(buffer);
-       runtime::DeserializableArgument<DataType> arg(data);
+       klay::Deserializer<MessageComposer> deserializer(buffer);
+       klay::DeserializableArgument<DataType> arg(data);
        arg.accept(deserializer);
 }
 
@@ -210,7 +210,7 @@ void Message::encode(const T& device) const
        device.write(buffer.begin(), header.length);
 
        int i = 0, fds[fileDescriptors.size()];
-       for (const runtime::FileDescriptor& fd : fileDescriptors) {
+       for (const klay::FileDescriptor& fd : fileDescriptors) {
                fds[i++] = fd.fileDescriptor;
        }
 
@@ -229,14 +229,14 @@ void Message::decode(const T& device)
 
        device.receiveFileDescriptors(fds, header.ancillary);
        for (unsigned int i = 0; i < header.ancillary; i++) {
-               fileDescriptors.emplace_back(runtime::FileDescriptor(fds[i]));
+               fileDescriptors.emplace_back(klay::FileDescriptor(fds[i]));
        }
 
        disclose(signature);
 }
 
-template<> void Message::enclose(runtime::FileDescriptor&& fd);
-template<> void Message::disclose(runtime::FileDescriptor& fd);
+template<> void Message::enclose(klay::FileDescriptor&& fd);
+template<> void Message::disclose(klay::FileDescriptor& fd);
 
 } // namespae rmi
 } // namespae klay
index b2bec9aa75a46b7a8d8a61d5154cb7e4b00019ac..ad46788fe6aa596f3f66fbae1f05b94d07b935bf 100644 (file)
@@ -65,7 +65,7 @@ void Notification::notify(Args&&... args)
        for (const std::shared_ptr<Socket>& subscriber : subscribers) {
                try {
                        msg.encode(*subscriber);
-               } catch (runtime::Exception& e) {
+               } catch (klay::Exception& e) {
                        ERROR(KSINK, e.what());
                }
        }
index 5fe27480e18279fec8eae1f473f1456cb22e3494..dc55c95e04fc2a8d1a4401a8fd7abb21caaf9047 100644 (file)
@@ -189,7 +189,7 @@ public:
                return processingContext.credentials.gid;
        }
 
-       runtime::Mainloop mainloop;
+       klay::Mainloop mainloop;
 
 private:
        struct ProcessingContext {
@@ -237,7 +237,7 @@ private:
 
        std::string address;
 
-       runtime::ThreadPool workqueue;
+       klay::ThreadPool workqueue;
        std::mutex stateLock;
        std::mutex notificationLock;
        std::mutex methodRegistryLock;
@@ -261,7 +261,7 @@ void Service::setMethodHandler(const std::string& privilege, const std::string&
        std::lock_guard<std::mutex> lock(methodRegistryLock);
 
        if (methodRegistry.count(method)) {
-               throw runtime::Exception("Method handler already registered");
+               throw klay::Exception("Method handler already registered");
        }
 
        methodRegistry[method] = std::make_shared<MethodContext>(privilege, dispatchMethod);
index 21208e88b232bc07129fec3ae5a6bf52ecf61a3a..e8812066c6cc287b56d521b2b52b222e637f967a 100644 (file)
@@ -23,9 +23,9 @@
 namespace klay {
 namespace rmi {
 
-class KLAY_EXPORT SocketException: public runtime::Exception {
+class KLAY_EXPORT SocketException: public klay::Exception {
 public:
-       SocketException(const std::string& msg) : runtime::Exception(msg) {}
+       SocketException(const std::string& msg) : klay::Exception(msg) {}
 };
 
 struct KLAY_EXPORT Credentials {
index 0de4ac20f2546e9d90cd1e0d225b84b5c8032537..1b6a606fc0d7731bf1b38c1f1a6c899d4e3e3b7b 100644 (file)
@@ -39,7 +39,7 @@ void AuditTrail::stop()
        }
 }
 
-void AuditTrail::subscribe(const int fd, const runtime::Mainloop::Event events, runtime::Mainloop::Callback&& callback)
+void AuditTrail::subscribe(const int fd, const klay::Mainloop::Event events, klay::Mainloop::Callback&& callback)
 {
        mainloop.addEventSource(fd, events, std::move(callback));
 }
index b61aaf29eeb716887c2588e7c53460cf1884b0d1..e65cf3bc59cb558cc17c2b1164107c0e94f8bedd 100644 (file)
@@ -48,9 +48,9 @@ Group::Group(const std::string& group)
        ret = ::getgrnam_r(group.c_str(), &grp, buf.get(), bufsize, &result);
        if (result == NULL) {
                if (ret == 0)
-                       throw runtime::Exception("Group doesn't exist");
+                       throw klay::Exception("Group doesn't exist");
                else
-                       throw runtime::Exception(runtime::GetSystemErrorMessage(ret));
+                       throw klay::Exception(klay::GetSystemErrorMessage(ret));
        }
 
        name = result->gr_name;
@@ -71,9 +71,9 @@ Group::Group(const gid_t group)
        ret = ::getgrgid_r(group, &grp, buf.get(), bufsize, &result);
        if (result == NULL) {
                if (ret == 0)
-                       throw runtime::Exception("Group doesn't exist");
+                       throw klay::Exception("Group doesn't exist");
                else
-                       throw runtime::Exception(runtime::GetSystemErrorMessage(ret));
+                       throw klay::Exception(klay::GetSystemErrorMessage(ret));
        }
 
        name = result->gr_name;
index 3e825f449c8ce174fac04f4ef54c6c24213f8ba9..8677759e89d4e9db772e33cb77fa9c219d25dbbd 100644 (file)
@@ -48,9 +48,9 @@ User::User(const std::string& user)
        ret = ::getpwnam_r(user.c_str(), &pwd, buf.get(), bufsize, &result);
        if (result == NULL) {
                if (ret == 0)
-                       throw runtime::Exception("User " + user + " doesn't exist");
+                       throw klay::Exception("User " + user + " doesn't exist");
                else
-                       throw runtime::Exception(runtime::GetSystemErrorMessage(ret));
+                       throw klay::Exception(klay::GetSystemErrorMessage(ret));
        }
 
        name = result->pw_name;
@@ -71,9 +71,9 @@ User::User(const uid_t user)
        ret = ::getpwuid_r(user, &pwd, buf.get(), bufsize, &result);
        if (result == NULL) {
                if (ret == 0)
-                       throw runtime::Exception("User " + std::to_string(user) + "doesn't exist");
+                       throw klay::Exception("User " + std::to_string(user) + "doesn't exist");
                else
-                       throw runtime::Exception(runtime::GetSystemErrorMessage(ret));
+                       throw klay::Exception(klay::GetSystemErrorMessage(ret));
        }
 
        name = result->pw_name;
index d643e69aac44fa5500d27dd7864e8c8d6c314f15..ef04aa34739b75a2c73f87895217ae150dc1ccd8 100644 (file)
@@ -39,15 +39,15 @@ bool Cgroup::existSubsystem(const std::string& name)
                        return false;
                }
        } catch (std::runtime_error &e) {
-               throw runtime::Exception("Unexpected regex error");
+               throw klay::Exception("Unexpected regex error");
        }
 
-       runtime::File dir("/sys/fs/cgroup/" + name);
+       klay::File dir("/sys/fs/cgroup/" + name);
        if (dir.exists()) {
                if (dir.isDirectory()) {
                        return true;
                }
-               throw runtime::Exception("Invalid subsystem name");
+               throw klay::Exception("Invalid subsystem name");
        }
 
        return false;
@@ -57,21 +57,21 @@ void Cgroup::createSubsystem(const std::string& name)
 {
        try {
                if (!std::regex_match(name, std::regex(NAME_PATTERN))) {
-                       throw runtime::Exception("Invalid subsystem name");
+                       throw klay::Exception("Invalid subsystem name");
                }
        } catch (std::runtime_error &e) {
-               throw runtime::Exception("Unexpected regex error");
+               throw klay::Exception("Unexpected regex error");
        }
 
        if (existSubsystem(name)) {
                return;
        }
 
-       runtime::File subsystem("/sys/fs/cgroup/" + name);
+       klay::File subsystem("/sys/fs/cgroup/" + name);
        if (::mount(NULL, "/sys/fs/cgroup/", NULL, MS_REMOUNT |
                        MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_STRICTATIME,
                        "mode=755")) {
-               throw runtime::Exception("Failed to remount cgroupfs as the writable");
+               throw klay::Exception("Failed to remount cgroupfs as the writable");
        }
 
        if (!subsystem.exists()) {
@@ -82,29 +82,29 @@ void Cgroup::createSubsystem(const std::string& name)
                        "cgroup", MS_NODEV | MS_NOSUID | MS_NOEXEC,
                        ("none,name=" + name).c_str())) {
                subsystem.remove(false);
-               throw runtime::Exception("Failed to mount cgroup subsystem");
+               throw klay::Exception("Failed to mount cgroup subsystem");
        }
 
        if (::mount(NULL, "/sys/fs/cgroup/", NULL, MS_REMOUNT | MS_RDONLY |
                        MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_STRICTATIME,
                        "mode=755")) {
-               throw runtime::Exception("Failed to remount cgroupfs as the read-only");
+               throw klay::Exception("Failed to remount cgroupfs as the read-only");
        }
 }
 
 void Cgroup::destroySubsystem(const std::string& name)
 {
        if (!existSubsystem(name)) {
-                throw runtime::Exception("No such subsystem");
+                throw klay::Exception("No such subsystem");
        }
 
        if (::mount(NULL, "/sys/fs/cgroup/", NULL, MS_REMOUNT |
                        MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_STRICTATIME,
                        "mode=755")) {
-               throw runtime::Exception("Failed to remount cgroupfs as the writable");
+               throw klay::Exception("Failed to remount cgroupfs as the writable");
        }
 
-       runtime::File subsystem("/sys/fs/cgroup/" + name);
+       klay::File subsystem("/sys/fs/cgroup/" + name);
        ::umount2(subsystem.getPath().c_str(), MNT_EXPIRE);
 
        subsystem.remove(false);
@@ -112,7 +112,7 @@ void Cgroup::destroySubsystem(const std::string& name)
        if (::mount(NULL, "/sys/fs/cgroup/", NULL, MS_REMOUNT | MS_RDONLY |
                        MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_STRICTATIME,
                        "mode=755")) {
-               throw runtime::Exception("Failed to remount cgroupfs as the read-only");
+               throw klay::Exception("Failed to remount cgroupfs as the read-only");
        }
 }
 
@@ -123,15 +123,15 @@ bool Cgroup::exist(const std::string& subsystem, const std::string& path)
                        return false;
                }
        } catch (std::runtime_error &e) {
-               throw runtime::Exception("Unexpected regex error");
+               throw klay::Exception("Unexpected regex error");
        }
 
-       runtime::File dir("/sys/fs/cgroup/" + subsystem + "/" + path);
+       klay::File dir("/sys/fs/cgroup/" + subsystem + "/" + path);
        if (dir.exists()) {
                if (dir.isDirectory()) {
                        return true;
                }
-               throw runtime::Exception("Invalid path");
+               throw klay::Exception("Invalid path");
        }
 
        return false;
@@ -141,34 +141,34 @@ void Cgroup::create(const std::string& subsystem, const std::string& path)
 {
        try {
                if (!std::regex_match(path, std::regex(PATH_PATTERN))) {
-                       throw runtime::Exception("Invalid path");
+                       throw klay::Exception("Invalid path");
                }
        } catch (std::runtime_error &e) {
-               throw runtime::Exception("Unexpected regex error");
+               throw klay::Exception("Unexpected regex error");
        }
 
        if (exist(subsystem, path)) {
                return;
        }
 
-       runtime::File dir("/sys/fs/cgroup/" + subsystem + "/" + path);
+       klay::File dir("/sys/fs/cgroup/" + subsystem + "/" + path);
        dir.makeDirectory(true);
 }
 
 void Cgroup::destroy(const std::string& subsystem, const std::string& path)
 {
        if (!exist(subsystem, path)) {
-               throw runtime::Exception("No such path in subsystem");
+               throw klay::Exception("No such path in subsystem");
        }
 
-       runtime::File dir("/sys/fs/cgroup/" + subsystem + "/" + path);
+       klay::File dir("/sys/fs/cgroup/" + subsystem + "/" + path);
        dir.remove(false);
 }
 
 void Cgroup::addProcess(const std::string& subsystem, const std::string& path, const pid_t pid)
 {
        if (!exist(subsystem, path)) {
-               throw runtime::Exception("No such path in subsystem");
+               throw klay::Exception("No such path in subsystem");
        }
 
        std::ofstream ofs("/sys/fs/cgroup/" + subsystem + "/" + path +
index e39255f78126639a848d0809474ef7f712f19b2d..d1af8aba0dce69686b41d6e0b5b918ac529b83b0 100644 (file)
@@ -25,7 +25,7 @@ Connection::Connection(const std::string& name, const int flags, bool integrityC
        handle(nullptr), filename(name)
 {
        if (::sqlite3_open_v2(filename.c_str(), &handle, flags, NULL)) {
-               throw runtime::Exception(getErrorMessage());
+               throw klay::Exception(getErrorMessage());
        }
 
        if (integrityCheck) {
@@ -45,7 +45,7 @@ Connection::Connection(const std::string& name, const int flags, bool integrityC
 
                if (!verified) {
                        ::sqlite3_close(handle);
-                       throw runtime::Exception("Malformed database");
+                       throw klay::Exception("Malformed database");
                }
        }
 }
@@ -58,7 +58,7 @@ Connection::~Connection()
 int Connection::exec(const std::string& query)
 {
        if (::sqlite3_exec(handle, query.c_str(), NULL, NULL, NULL) != SQLITE_OK) {
-               throw runtime::Exception(getErrorMessage());
+               throw klay::Exception(getErrorMessage());
        }
 
        return ::sqlite3_changes(handle);
index 9e03809a389d5d5b32e75b5bf7647d0aee15368c..a04efe0cef6d900d8450fc760bbf1b1c0819bb63 100644 (file)
@@ -35,7 +35,7 @@ Statement::Statement(const Connection& db, const std::string& query) :
                                                                                  query.size(),
                                                                                  &statement,
                                                                                  NULL)) {
-               throw runtime::Exception(db.getErrorMessage());
+               throw klay::Exception(db.getErrorMessage());
        }
 
        columnCount = sqlite3_column_count(statement);
@@ -49,14 +49,14 @@ Statement::~Statement()
 void Statement::reset()
 {
        if (::sqlite3_reset(statement) != SQLITE_OK) {
-               throw runtime::Exception(getErrorMessage());
+               throw klay::Exception(getErrorMessage());
        }
 }
 
 void Statement::clearBindings()
 {
        if (::sqlite3_clear_bindings(statement) != SQLITE_OK) {
-               throw runtime::Exception(getErrorMessage());
+               throw klay::Exception(getErrorMessage());
        }
 }
 
@@ -91,7 +91,7 @@ int Statement::exec()
 Column Statement::getColumn(const int index)
 {
        if (!validRow || (index >= columnCount)) {
-               throw runtime::Exception(getErrorMessage(SQLITE_RANGE));
+               throw klay::Exception(getErrorMessage(SQLITE_RANGE));
        }
 
        return Column(*this, index);
@@ -100,7 +100,7 @@ Column Statement::getColumn(const int index)
 bool Statement::isNullColumn(const int index) const
 {
        if (!validRow || (index >= columnCount)) {
-               throw runtime::Exception(getErrorMessage(SQLITE_RANGE));
+               throw klay::Exception(getErrorMessage(SQLITE_RANGE));
        }
 
        return (SQLITE_NULL == sqlite3_column_type(statement, index));
@@ -109,7 +109,7 @@ bool Statement::isNullColumn(const int index) const
 std::string Statement::getColumnName(const int index) const
 {
        if (index >= columnCount) {
-               throw runtime::Exception(getErrorMessage(SQLITE_RANGE));
+               throw klay::Exception(getErrorMessage(SQLITE_RANGE));
        }
 
        return sqlite3_column_name(statement, index);
@@ -119,28 +119,28 @@ std::string Statement::getColumnName(const int index) const
 void Statement::bind(const int index, const int& value)
 {
        if (SQLITE_OK != ::sqlite3_bind_int(statement, index, value)) {
-               throw runtime::Exception(getErrorMessage());
+               throw klay::Exception(getErrorMessage());
        }
 }
 
 void Statement::bind(const int index, const sqlite3_int64& value)
 {
        if (SQLITE_OK != ::sqlite3_bind_int64(statement, index, value)) {
-               throw runtime::Exception(getErrorMessage());
+               throw klay::Exception(getErrorMessage());
        }
 }
 
 void Statement::bind(const int index, const double& value)
 {
        if (SQLITE_OK != ::sqlite3_bind_double(statement, index, value)) {
-               throw runtime::Exception(getErrorMessage());
+               throw klay::Exception(getErrorMessage());
        }
 }
 
 void Statement::bind(const int index, const char* value)
 {
        if (SQLITE_OK != ::sqlite3_bind_text(statement, index, value, -1, SQLITE_TRANSIENT)) {
-               throw runtime::Exception(getErrorMessage());
+               throw klay::Exception(getErrorMessage());
        }
 }
 
@@ -148,21 +148,21 @@ void Statement::bind(const int index, const std::string& value)
 {
        if (SQLITE_OK != ::sqlite3_bind_text(statement, index, value.c_str(),
                                                                                 static_cast<int>(value.size()), SQLITE_TRANSIENT)) {
-               throw runtime::Exception(getErrorMessage());
+               throw klay::Exception(getErrorMessage());
        }
 }
 
 void Statement::bind(const int index, const void* value, const int size)
 {
        if (SQLITE_OK != ::sqlite3_bind_blob(statement, index, value, size, SQLITE_TRANSIENT)) {
-               throw runtime::Exception(getErrorMessage());
+               throw klay::Exception(getErrorMessage());
        }
 }
 
 void Statement::bind(const int index)
 {
        if (SQLITE_OK != ::sqlite3_bind_null(statement, index)) {
-               throw runtime::Exception(getErrorMessage());
+               throw klay::Exception(getErrorMessage());
        }
 }
 
@@ -170,7 +170,7 @@ void Statement::bind(const std::string& name, const int& value)
 {
        int index = sqlite3_bind_parameter_index(statement, name.c_str());
        if (SQLITE_OK != sqlite3_bind_int(statement, index, value)) {
-               throw runtime::Exception(getErrorMessage());
+               throw klay::Exception(getErrorMessage());
        }
 }
 
@@ -178,7 +178,7 @@ void Statement::bind(const std::string& name, const sqlite3_int64& value)
 {
        int index = sqlite3_bind_parameter_index(statement, name.c_str());
        if (SQLITE_OK != ::sqlite3_bind_int64(statement, index, value)) {
-               throw runtime::Exception(getErrorMessage());
+               throw klay::Exception(getErrorMessage());
        }
 }
 
@@ -186,7 +186,7 @@ void Statement::bind(const std::string& name, const double& value)
 {
        int index = sqlite3_bind_parameter_index(statement, name.c_str());
        if (SQLITE_OK != ::sqlite3_bind_double(statement, index, value)) {
-               throw runtime::Exception(getErrorMessage());
+               throw klay::Exception(getErrorMessage());
        }
 }
 
@@ -195,7 +195,7 @@ void Statement::bind(const std::string& name, const std::string& value)
        int index = sqlite3_bind_parameter_index(statement, name.c_str());
        if (SQLITE_OK != ::sqlite3_bind_text(statement, index, value.c_str(),
                                                                                 static_cast<int>(value.size()), SQLITE_TRANSIENT)) {
-               throw runtime::Exception(getErrorMessage());
+               throw klay::Exception(getErrorMessage());
        }
 }
 
@@ -203,7 +203,7 @@ void Statement::bind(const std::string& name, const char* value)
 {
        int index = sqlite3_bind_parameter_index(statement, name.c_str());
        if (SQLITE_OK != ::sqlite3_bind_text(statement, index, value, -1, SQLITE_TRANSIENT)) {
-               throw runtime::Exception(getErrorMessage());
+               throw klay::Exception(getErrorMessage());
        }
 }
 
@@ -211,7 +211,7 @@ void Statement::bind(const std::string& name, const void* value, const int size)
 {
        int index = sqlite3_bind_parameter_index(statement, name.c_str());
        if (SQLITE_OK != ::sqlite3_bind_blob(statement, index, value, size, SQLITE_TRANSIENT)) {
-               throw runtime::Exception(getErrorMessage());
+               throw klay::Exception(getErrorMessage());
        }
 }
 
@@ -219,7 +219,7 @@ void Statement::bind(const std::string& name)
 {
        int index = sqlite3_bind_parameter_index(statement, name.c_str());
        if (SQLITE_OK != ::sqlite3_bind_null(statement, index)) {
-               throw runtime::Exception(getErrorMessage());
+               throw klay::Exception(getErrorMessage());
        }
 }
 
index 9724830aa0086a6883d85e9c08280413b76c662c..9a4dc5b8b3efb5140b4adf769b4af8b5e0f8e8d7 100644 (file)
@@ -50,7 +50,7 @@ Connection::Connection(const std::string& address) :
        connection = g_dbus_connection_new_for_address_sync(address.c_str(), flags, NULL, NULL, &error);
        if (error) {
                ERROR(KSINK, error->message);
-               throw runtime::Exception(error->message);
+               throw klay::Exception(error->message);
        }
 }
 
@@ -130,7 +130,7 @@ Variant Connection::methodcall(const std::string& busName,
 
        if (error) {
                ERROR(KSINK, error->message);
-               throw runtime::Exception(error->message);
+               throw klay::Exception(error->message);
        }
 
        return result;
@@ -159,7 +159,7 @@ void Connection::emitSignal(const std::string& busName,
                                                                  &error);
        if (error) {
                ERROR(KSINK, error->message);
-               throw runtime::Exception(error->message);
+               throw klay::Exception(error->message);
        }
 }
 
@@ -192,7 +192,7 @@ Connection::ObjectId Connection::registerObject(const std::string& object,
        }
 
        if (error) {
-               throw runtime::Exception(error->message);
+               throw klay::Exception(error->message);
        }
 
        GDBusInterfaceInfo* inf = node->interfaces[0];
@@ -211,7 +211,7 @@ Connection::ObjectId Connection::registerObject(const std::string& object,
        g_dbus_node_info_unref(node);
     if (error) {
         ERROR(KSINK, error->message);
-        throw runtime::Exception(error->message);
+        throw klay::Exception(error->message);
     }
 
        return id;
@@ -300,7 +300,7 @@ void Connection::onMethodCall(GDBusConnection* connection,
        try {
                Variant variant = callbackSet.methodcall(objectPath, interface, method, Variant(parameters));
                g_dbus_method_invocation_return_value(invocation, &variant);
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
                ERROR(KSINK, "Error on metod handling");
                g_dbus_method_invocation_return_dbus_error(invocation, (interface + std::string(".Error")).c_str(), e.what());
        }
index 22f752e159ce0896752a473083680623f73931a1..36048a8e9325add45ed942369f5021abb57bdf3f 100644 (file)
@@ -52,12 +52,12 @@ Introspection::~Introspection(void)
 BusNode Introspection::getBusNode(const std::string &xmlData)
 {
        if (xmlData.empty())
-               throw runtime::Exception("Invalid argument.");
+               throw klay::Exception("Invalid argument.");
 
        dbus::Error error;
        auto busNode = ::g_dbus_node_info_new_for_xml(xmlData.c_str(), &error);
        if (busNode == nullptr || error)
-               throw runtime::Exception("Failed to get BusNode.");
+               throw klay::Exception("Failed to get BusNode.");
 
        return busNode;
 }
@@ -65,7 +65,7 @@ BusNode Introspection::getBusNode(const std::string &xmlData)
 Interface Introspection::getInterface(const std::string &name) const
 {
        if (name.empty())
-               throw runtime::Exception("Invalid argument.");
+               throw klay::Exception("Invalid argument.");
 
        return ::g_dbus_node_info_lookup_interface(busNode, name.c_str());
 }
@@ -75,7 +75,7 @@ Method Introspection::getMethod(const std::string &interfaceName,
 {
        auto interface = getInterface(interfaceName);
        if (interface == nullptr || methodName.empty())
-               throw runtime::Exception("Invalid argument.");
+               throw klay::Exception("Invalid argument.");
 
        return ::g_dbus_interface_info_lookup_method(interface, methodName.c_str());
 }
@@ -85,7 +85,7 @@ Signal Introspection::getSignal(const std::string &interfaceName,
 {
        auto interface = getInterface(interfaceName);
        if (interface == nullptr || signalName.empty())
-               throw runtime::Exception("Invalid argument.");
+               throw klay::Exception("Invalid argument.");
 
        return ::g_dbus_interface_info_lookup_signal(interface, signalName.c_str());
 }
@@ -95,7 +95,7 @@ Property Introspection::getProperty(const std::string &interfaceName,
 {
        auto interface = getInterface(interfaceName);
        if (interface == nullptr || propertyName.empty())
-               throw runtime::Exception("Invalid argument.");
+               throw klay::Exception("Invalid argument.");
 
        return ::g_dbus_interface_info_lookup_property(interface, propertyName.c_str());
 }
@@ -108,7 +108,7 @@ std::string Introspection::getXmlData(unsigned int indent)
                        ::g_string_free(ptr, TRUE);
                });
        if (buf == nullptr)
-               throw runtime::Exception("Out of memory.");
+               throw klay::Exception("Out of memory.");
 
        ::g_dbus_node_info_generate_xml(busNode, indent, buf.get());
        return std::string(buf->str);
@@ -116,7 +116,7 @@ std::string Introspection::getXmlData(unsigned int indent)
 
 std::string Introspection::createXmlDataFromFile(const std::string &path)
 {
-       runtime::File manifest(path);
+       klay::File manifest(path);
        if (!manifest.exists()) {
                manifest.create(0644);
                manifest.lock();
@@ -133,7 +133,7 @@ std::string Introspection::createXmlDataFromFile(const std::string &path)
 void Introspection::writeXmlDataToFile(const std::string &path,
                                                                           const std::string &xmlData)
 {
-       runtime::File manifest(path);
+       klay::File manifest(path);
        manifest.open(O_WRONLY | O_TRUNC);
        manifest.lock();
        manifest.write(xmlData.c_str(), xmlData.length());
@@ -143,11 +143,11 @@ void Introspection::writeXmlDataToFile(const std::string &path,
 void Introspection::addInterface(const std::string &name)
 {
        if (getInterface(name) != nullptr)
-               throw runtime::Exception("Interface is already exist:" + name);
+               throw klay::Exception("Interface is already exist:" + name);
 
        std::size_t offset = xmlData.find("</node>");
        if (offset == std::string::npos)
-               throw runtime::Exception("Failed to find </node>.");
+               throw klay::Exception("Failed to find </node>.");
 
        XmlProperties properties;
        properties.emplace_back(std::make_pair("name", name));
@@ -189,16 +189,16 @@ std::string Introspection::getXmlEndTag(const std::string &node) const
 void Introspection::checkDataFormat(const std::string &data) const
 {
        if (data.empty() || data.length() < 3)
-               throw runtime::Exception("Invalid argument.");
+               throw klay::Exception("Invalid argument.");
 
        const std::string beginChar = "<";
        if (data.compare(0, beginChar.length(), beginChar) != 0)
-               throw runtime::Exception("Xml data should be begin as: " + beginChar);
+               throw klay::Exception("Xml data should be begin as: " + beginChar);
 
        const std::string endChar = "/>";
        if (data.compare(data.length() - endChar.length(), endChar.length(), endChar) != 0 &&
                data.find("/") == std::string::npos)
-               throw runtime::Exception("Xml data should be contain '/' or end as: " + endChar);
+               throw klay::Exception("Xml data should be contain '/' or end as: " + endChar);
 }
 
 void Introspection::addMethod(const std::string &interfaceName,
@@ -257,7 +257,7 @@ void Introspection::addInternalData(const std::string &interfaceName,
        std::string iTemplate = getXmlBeginTag(INTERFACE_NODE, properties);
        std::size_t offset = xmlData.find(iTemplate);
        if (offset == std::string::npos)
-               throw runtime::Exception("Failed to find interface xml node: " + interfaceName);
+               throw klay::Exception("Failed to find interface xml node: " + interfaceName);
 
        xmlData.insert(offset + iTemplate.length() + 1, data);
        update();
index dd81c3889f2366036c5e00eee8feedfe23f16bed..1d937a93ae33e7ffb4286dfb5acb8610b07841c7 100644 (file)
@@ -29,7 +29,7 @@ EventFD::EventFD(unsigned int initval, int flags)
 {
        fd = ::eventfd(initval, flags);
        if (fd == -1) {
-               throw runtime::Exception(runtime::GetSystemErrorMessage());
+               throw klay::Exception(klay::GetSystemErrorMessage());
        }
 }
 
@@ -49,7 +49,7 @@ void EventFD::send()
 {
        const std::uint64_t val = 1;
        if (::write(fd, &val, sizeof(val)) == -1) {
-               throw runtime::Exception(runtime::GetSystemErrorMessage());
+               throw klay::Exception(klay::GetSystemErrorMessage());
        }
 }
 
@@ -57,7 +57,7 @@ void EventFD::receive()
 {
        std::uint64_t val;
        if (::read(fd, &val, sizeof(val)) == -1) {
-               throw runtime::Exception(runtime::GetSystemErrorMessage());
+               throw klay::Exception(klay::GetSystemErrorMessage());
        }
 }
 
index 038f05a89e88eb44722f730beb883003c160cc29..a2a9393f62b785448fd6e81a47bcff3b4b076ac0 100644 (file)
@@ -33,16 +33,16 @@ bool FileUser::isUsedAsFD(const std::string &filePath, const pid_t pid, bool isM
        try {
                File file(filePath);
 
-               for (runtime::DirectoryIterator iter(path), end; iter != end;) {
+               for (klay::DirectoryIterator iter(path), end; iter != end;) {
                        File cur(File((++iter)->getPath()).readlink());
                        try {
                                if ((cur.getInode() == file.getInode() || isMount) &&
                                                cur.getDevice() == file.getDevice()) {
                                        return true;
                                }
-                       } catch (runtime::Exception &e) {}
+                       } catch (klay::Exception &e) {}
                }
-       } catch (runtime::Exception &e) {}
+       } catch (klay::Exception &e) {}
 
        return false;
 }
@@ -72,7 +72,7 @@ bool FileUser::isUsedAsMap(const std::string &filePath, const pid_t pid, bool is
                                }
                        }
                }
-       } catch (runtime::Exception &e) {}
+       } catch (klay::Exception &e) {}
 
        return false;
 }
@@ -88,7 +88,7 @@ bool FileUser::isUsedAsCwd(const std::string &filePath, const pid_t pid, bool is
                                cwd.getDevice() == file.getDevice()) {
                        return true;
                }
-       } catch (runtime::Exception &e) {}
+       } catch (klay::Exception &e) {}
 
        return false;
 }
@@ -104,7 +104,7 @@ bool FileUser::isUsedAsRoot(const std::string &filePath, const pid_t pid, bool i
                                root.getDevice() == file.getDevice()) {
                        return true;
                }
-       } catch (runtime::Exception &e) {}
+       } catch (klay::Exception &e) {}
 
        return false;
 }
@@ -114,7 +114,7 @@ std::vector<pid_t> FileUser::getList(const std::string &path, bool isMount)
        pid_t currentPid = ::getpid();
        std::vector<pid_t> list;
 
-       for (runtime::DirectoryIterator iter("/proc"), end; iter != end;) {
+       for (klay::DirectoryIterator iter("/proc"), end; iter != end;) {
                const std::string name = iter->getName();
                if (!std::isdigit(name[0])) {
                        ++iter;
index fa8484c2297c5d26b0831a9aae8f53da2de28b71..a98c7cde69d0950c096c5d377fa16e9f0ddc03a2 100644 (file)
@@ -82,7 +82,7 @@ bool File::isLink() const
 {
        struct stat st;
        if (::lstat(path.c_str(), &st) != 0) {
-               throw runtime::Exception(runtime::GetSystemErrorMessage());
+               throw klay::Exception(klay::GetSystemErrorMessage());
        }
 
        return S_ISLNK(st.st_mode);
@@ -92,7 +92,7 @@ bool File::isFile() const
 {
        struct stat st;
        if (::lstat(path.c_str(), &st) != 0) {
-               throw runtime::Exception(runtime::GetSystemErrorMessage());
+               throw klay::Exception(klay::GetSystemErrorMessage());
        }
 
        return S_ISREG(st.st_mode);
@@ -102,7 +102,7 @@ bool File::isDirectory() const
 {
        struct stat st;
        if (::lstat(path.c_str(), &st) != 0) {
-               throw runtime::Exception(runtime::GetSystemErrorMessage());
+               throw klay::Exception(klay::GetSystemErrorMessage());
        }
 
        return S_ISDIR(st.st_mode);
@@ -112,7 +112,7 @@ bool File::isDevice() const
 {
        struct stat st;
        if (::lstat(path.c_str(), &st) != 0) {
-               throw runtime::Exception(runtime::GetSystemErrorMessage());
+               throw klay::Exception(klay::GetSystemErrorMessage());
        }
 
        return (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode));
@@ -122,7 +122,7 @@ mode_t File::getMode() const
 {
        struct stat st;
        if (::lstat(path.c_str(), &st) != 0) {
-               throw runtime::Exception(runtime::GetSystemErrorMessage());
+               throw klay::Exception(klay::GetSystemErrorMessage());
        }
 
        return st.st_mode;
@@ -132,7 +132,7 @@ uid_t File::getUid() const
 {
        struct stat st;
        if (::lstat(path.c_str(), &st) != 0) {
-               throw runtime::Exception(runtime::GetSystemErrorMessage());
+               throw klay::Exception(klay::GetSystemErrorMessage());
        }
 
        return st.st_uid;
@@ -142,7 +142,7 @@ gid_t File::getGid() const
 {
        struct stat st;
        if (::lstat(path.c_str(), &st) != 0) {
-               throw runtime::Exception(runtime::GetSystemErrorMessage());
+               throw klay::Exception(klay::GetSystemErrorMessage());
        }
 
        return st.st_gid;
@@ -152,7 +152,7 @@ ino_t File::getInode() const
 {
        struct stat st;
        if (::lstat(path.c_str(), &st) != 0) {
-               throw runtime::Exception(runtime::GetSystemErrorMessage());
+               throw klay::Exception(klay::GetSystemErrorMessage());
        }
 
        return st.st_ino;
@@ -162,7 +162,7 @@ dev_t File::getDevice() const
 {
        struct stat st;
        if (::lstat(path.c_str(), &st) != 0) {
-               throw runtime::Exception(runtime::GetSystemErrorMessage());
+               throw klay::Exception(klay::GetSystemErrorMessage());
        }
 
        return st.st_dev;
@@ -172,7 +172,7 @@ off_t File::size() const
 {
        struct stat st;
        if (::lstat(path.c_str(), &st) != 0) {
-               throw runtime::Exception(runtime::GetSystemErrorMessage());
+               throw klay::Exception(klay::GetSystemErrorMessage());
        }
 
        return st.st_size;
@@ -190,7 +190,7 @@ void File::create(mode_t mode)
                        if (errno == EINTR) {
                                continue;
                        }
-                       throw runtime::Exception(runtime::GetSystemErrorMessage());
+                       throw klay::Exception(klay::GetSystemErrorMessage());
                }
                return;
        }
@@ -208,7 +208,7 @@ void File::create(int flags, mode_t mode)
                        if (errno == EINTR) {
                                continue;
                        }
-                       throw runtime::Exception(runtime::GetSystemErrorMessage());
+                       throw klay::Exception(klay::GetSystemErrorMessage());
                }
                return;
        }
@@ -226,7 +226,7 @@ void File::open(int flags)
                        if (errno == EINTR) {
                                continue;
                        }
-                       throw runtime::Exception(runtime::GetSystemErrorMessage());
+                       throw klay::Exception(klay::GetSystemErrorMessage());
                }
                return;
        }
@@ -251,7 +251,7 @@ void File::read(void *buffer, const size_t size) const
                } else if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) {
                        continue;
                } else {
-                       throw runtime::Exception(runtime::GetSystemErrorMessage());
+                       throw klay::Exception(klay::GetSystemErrorMessage());
                }
        }
 }
@@ -267,7 +267,7 @@ void File::write(const void *buffer, const size_t size) const
                } else if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) {
                        continue;
                } else {
-                       throw runtime::Exception(runtime::GetSystemErrorMessage());
+                       throw klay::Exception(klay::GetSystemErrorMessage());
                }
        }
 }
@@ -275,7 +275,7 @@ void File::write(const void *buffer, const size_t size) const
 void File::lseek(off_t offset, int whence) const
 {
        if (::lseek(descriptor, offset, whence) == -1) {
-               throw runtime::Exception(runtime::GetSystemErrorMessage());
+               throw klay::Exception(klay::GetSystemErrorMessage());
        }
 }
 
@@ -303,7 +303,7 @@ File File::copyTo(const std::string& destDir)
                        ssize_t ret;
                        ret = ::sendfile(destFile.descriptor, descriptor, &s, size() - s);
                        if (ret < 0) {
-                               throw runtime::Exception(runtime::GetSystemErrorMessage());
+                               throw klay::Exception(klay::GetSystemErrorMessage());
                        }
                }
                destFile.close();
@@ -324,11 +324,11 @@ void File::remove(bool recursive)
                        }
                }
                if (::rmdir(path.c_str()) != 0) {
-                       throw runtime::Exception(runtime::GetSystemErrorMessage());
+                       throw klay::Exception(klay::GetSystemErrorMessage());
                }
        } else {
                if (::unlink(path.c_str()) != 0) {
-                       throw runtime::Exception(runtime::GetSystemErrorMessage());
+                       throw klay::Exception(klay::GetSystemErrorMessage());
                }
        }
 }
@@ -345,11 +345,11 @@ void File::makeBaseDirectory(uid_t uid, gid_t gid)
                } else if (ret == 0) {
                        if ((uid | gid) != 0) {
                                if (::chown(substr.c_str(), uid, gid) == -1) {
-                                       throw runtime::Exception(runtime::GetSystemErrorMessage());
+                                       throw klay::Exception(klay::GetSystemErrorMessage());
                                }
                        }
                } else {
-                       throw runtime::Exception(runtime::GetSystemErrorMessage());
+                       throw klay::Exception(klay::GetSystemErrorMessage());
                }
        }
 }
@@ -361,7 +361,7 @@ void File::makeDirectory(bool recursive, uid_t uid, gid_t gid)
        }
 
        if (::mkdir(path.c_str(), 0777) == -1) {
-               throw runtime::Exception("mkdir failed in makeDirectory: " + path);
+               throw klay::Exception("mkdir failed in makeDirectory: " + path);
        }
 
        if ((uid | gid) != 0) {
@@ -372,7 +372,7 @@ void File::makeDirectory(bool recursive, uid_t uid, gid_t gid)
 void File::chown(uid_t uid, gid_t gid, bool recursive)
 {
        if (::chown(path.c_str(), uid, gid) != 0) {
-               throw runtime::Exception(runtime::GetSystemErrorMessage());
+               throw klay::Exception(klay::GetSystemErrorMessage());
        }
 
        if (recursive && isDirectory()) {
@@ -387,7 +387,7 @@ void File::chown(uid_t uid, gid_t gid, bool recursive)
 void File::chmod(mode_t mode, bool recursive)
 {
        if (::chmod(path.c_str(), mode) != 0) {
-               throw runtime::Exception(runtime::GetSystemErrorMessage());
+               throw klay::Exception(klay::GetSystemErrorMessage());
        }
 
        if (recursive && isDirectory()) {
@@ -404,7 +404,7 @@ const std::string File::readlink() const
        char buf[PATH_MAX + 1];
        ssize_t ret = ::readlink(path.c_str(), buf, PATH_MAX);
        if (ret == -1) {
-               throw runtime::Exception(runtime::GetSystemErrorMessage());
+               throw klay::Exception(klay::GetSystemErrorMessage());
        }
 
        buf[ret] = '\0';
@@ -414,14 +414,14 @@ const std::string File::readlink() const
 void File::lock() const
 {
        if (::flock(descriptor, LOCK_EX) == -1) {
-               throw runtime::Exception(runtime::GetSystemErrorMessage());
+               throw klay::Exception(klay::GetSystemErrorMessage());
        }
 }
 
 void File::unlock() const
 {
        if (::flock(descriptor, LOCK_UN) == -1) {
-               throw runtime::Exception(runtime::GetSystemErrorMessage());
+               throw klay::Exception(klay::GetSystemErrorMessage());
        }
 }
 
@@ -448,7 +448,7 @@ void DirectoryIterator::reset(const std::string& dir)
        basename = dir;
        directoryHandle = ::opendir(basename.c_str());
        if (directoryHandle == nullptr) {
-               throw runtime::Exception(runtime::GetSystemErrorMessage());
+               throw klay::Exception(klay::GetSystemErrorMessage());
        }
 
        next();
@@ -579,7 +579,7 @@ void Mount::mountEntry(const std::string& src, const std::string& dest, const st
                }
 
                if (ret) {
-                       throw runtime::Exception("failed to mount " + src + " on " + dest);
+                       throw klay::Exception("failed to mount " + src + " on " + dest);
                }
        }
 }
index 1b16ef1fef008d6a2420a0d5c5adf5cd0537e098..2890c6d21cc48b6931ecc6400655a53f03c8551f 100644 (file)
@@ -53,12 +53,12 @@ void Namespace::attach(const pid_t pid)
 
                if (fd == -1) {
                        if (errno != ENOENT) {
-                               throw runtime::Exception("Failed to open namesapce: " + nspath);
+                               throw klay::Exception("Failed to open namesapce: " + nspath);
                        }
                } else {
                        if (::setns(fd, ns.second)) {
                                ::close(fd);
-                               throw runtime::Exception("Failed to set namespace: " + nspath);
+                               throw klay::Exception("Failed to set namespace: " + nspath);
                        }
                        ::close(fd);
                }
@@ -68,12 +68,12 @@ void Namespace::attach(const pid_t pid)
 void Namespace::unshare(int flags)
 {
        if (::unshare(flags)) {
-               throw runtime::Exception("Failed to unshare namespace");
+               throw klay::Exception("Failed to unshare namespace");
        }
 
        if (flags & CLONE_NEWNS &&
                        ::mount(NULL, "/", NULL, MS_SLAVE | MS_REC, NULL) == -1) {
-               throw runtime::Exception("Failed to mount root filesystem");
+               throw klay::Exception("Failed to mount root filesystem");
        }
 }
 
index 9199d0acef4987aaf346a324408d0f77345aee55..ea67f5f296a67efed7fe42ce6b4e9ed9b9142eb8 100644 (file)
@@ -33,12 +33,12 @@ Netlink::Netlink(int protocol) :
 {
        fd = ::socket(PF_NETLINK, SOCK_RAW, protocol);
        if (fd < 0) {
-               throw runtime::Exception(runtime::GetSystemErrorMessage());
+               throw klay::Exception(klay::GetSystemErrorMessage());
        }
 
        if (::fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) {
                ::close(fd);
-               throw runtime::Exception(runtime::GetSystemErrorMessage());
+               throw klay::Exception(klay::GetSystemErrorMessage());
        }
 }
 
@@ -89,14 +89,14 @@ void Netlink::send(int type, const std::vector<char>& data)
        } while (ret < 0 && errno == EINTR);
 
        if (ret < 0) {
-               throw runtime::Exception("Failed to send a netlink message");
+               throw klay::Exception("Failed to send a netlink message");
        }
 
        if (recv(MSG_PEEK).first == NLMSG_ERROR) {
                auto reply = recv().second;
                auto err = (struct nlmsgerr*)reply.data();
                if (err->error)
-                       throw runtime::Exception("Netlink error: " +
+                       throw klay::Exception("Netlink error: " +
                                                                                std::to_string(err->error));
        } else {
                        WARN("Missing ack of netlink message");
@@ -114,7 +114,7 @@ Netlink::Message Netlink::recv(int options)
        } while (ret < 0 && errno == EINTR);
 
        if (ret < 0) {
-               throw runtime::Exception("Failed to get the size of netlink message");
+               throw klay::Exception("Failed to get the size of netlink message");
        }
 
        struct sockaddr_nl nladdr;
@@ -130,19 +130,19 @@ Netlink::Message Netlink::recv(int options)
        ::memcpy(msg.second.data(), NLMSG_DATA(buf), msg.second.size());
 
        if (ret < 0) {
-               throw runtime::Exception("Failed to receive audit packet");
+               throw klay::Exception("Failed to receive audit packet");
        }
 
        if (nladdrlen != sizeof(nladdr)) {
-               throw runtime::Exception("Bad address size in netlink socket");
+               throw klay::Exception("Bad address size in netlink socket");
        }
 
        if (nladdr.nl_pid) {
-               throw runtime::Exception("Spoofed packet received on netlink socket");
+               throw klay::Exception("Spoofed packet received on netlink socket");
        }
 
        return msg;
 }
 
-} // namespace runtime
+} // namespace klay
 } // namespace klay
index 84cb6f3450e574db4a355713b6f6f89e3bb3378c..0ac705cf3da1b5eb256adb83b11c59d0a649dea1 100644 (file)
@@ -31,7 +31,7 @@ PAM::PAM(const std::string& service, const std::string& user)
 
        int error = ::pam_start(service.c_str(), user.c_str(), &pamc, &pamh);
        if (error != PAM_SUCCESS) {
-               throw runtime::Exception("PAM Error");
+               throw klay::Exception("PAM Error");
        }
 }
 
@@ -39,7 +39,7 @@ PAM::~PAM()
 {
        int error = ::pam_end(pamh, PAM_SUCCESS);
        if (error != PAM_SUCCESS) {
-               throw runtime::Exception("PAM Error");
+               throw klay::Exception("PAM Error");
        }
 }
 
@@ -47,7 +47,7 @@ void PAM::setData(const std::string &name, void* data, void (*cleanup)(pam_handl
 {
        int error = ::pam_set_data(pamh, name.c_str(), data, cleanup);
        if (error != PAM_SUCCESS) {
-               throw runtime::Exception("PAM Error");
+               throw klay::Exception("PAM Error");
        }
 }
 
@@ -56,7 +56,7 @@ const void* PAM::getData(const std::string &name) const
        const void* ret;
        int error = ::pam_get_data(pamh, name.c_str(), &ret);
        if (error != PAM_SUCCESS) {
-               throw runtime::Exception("PAM Error");
+               throw klay::Exception("PAM Error");
        }
        return ret;
 }
@@ -65,7 +65,7 @@ void PAM::setItem(int item, void* data)
 {
        int error = ::pam_set_item(pamh, item, data);
        if (error != PAM_SUCCESS) {
-               throw runtime::Exception("PAM Error");
+               throw klay::Exception("PAM Error");
        }
 }
 
@@ -74,7 +74,7 @@ const void* PAM::getItem(int item) const
        const void* ret;
        int error = ::pam_get_item(pamh, item, &ret);
        if (error != PAM_SUCCESS) {
-               throw runtime::Exception("PAM Error");
+               throw klay::Exception("PAM Error");
        }
        return ret;
 }
@@ -84,7 +84,7 @@ const std::string PAM::getUser(const std::string &prompt) const
        const char* user;
        int error = ::pam_get_user(pamh, &user, prompt.c_str());
        if (error != PAM_SUCCESS) {
-               throw runtime::Exception("PAM Error");
+               throw klay::Exception("PAM Error");
        }
        return std::string(user);
 }
@@ -93,7 +93,7 @@ void PAM::putEnv(const std::string &name_value)
 {
        int error = ::pam_putenv(pamh, name_value.c_str());
        if (error != PAM_SUCCESS) {
-               throw runtime::Exception("PAM Error");
+               throw klay::Exception("PAM Error");
        }
 }
 
@@ -101,7 +101,7 @@ const std::string PAM::getEnv(const std::string &name) const
 {
        const char* value = ::pam_getenv(pamh, name.c_str());
        if (value == NULL) {
-               throw runtime::Exception("PAM Error");
+               throw klay::Exception("PAM Error");
        }
        return value;
 }
@@ -111,7 +111,7 @@ const std::vector<std::string> PAM::getEnvList() const
        std::vector<std::string> ret;
        char** array = ::pam_getenvlist(pamh);
        if (array == NULL) {
-               throw runtime::Exception("PAM Error");
+               throw klay::Exception("PAM Error");
        }
        for (int i = 0; array[i] != NULL; i++) {
                ret.push_back(array[i]);
@@ -149,7 +149,7 @@ void PAM::openSession(int flags)
 {
        int error = ::pam_open_session(pamh, flags);
        if (error != PAM_SUCCESS) {
-               throw runtime::Exception("PAM Error");
+               throw klay::Exception("PAM Error");
        }
 }
 
@@ -157,7 +157,7 @@ void PAM::closeSession(int flags)
 {
        int error = ::pam_close_session(pamh, flags);
        if (error != PAM_SUCCESS) {
-               throw runtime::Exception("PAM Error");
+               throw klay::Exception("PAM Error");
        }
 }
 
index 9b2f583e0b8a0c3278c773dd94cc70bd79341006..dbb2e42a9777c12f6648d6797b2143a9ac85ef5b 100644 (file)
@@ -86,14 +86,14 @@ bool Process::isRunning() const
 void Process::kill()
 {
        if (::kill(pid, SIGKILL) == -1) {
-               throw runtime::Exception(runtime::GetSystemErrorMessage());
+               throw klay::Exception(klay::GetSystemErrorMessage());
        }
 }
 
 void Process::terminate()
 {
        if (::kill(pid, SIGINT) == -1) {
-               throw runtime::Exception(runtime::GetSystemErrorMessage());
+               throw klay::Exception(klay::GetSystemErrorMessage());
        }
 }
 
index d29c75a18d0be3546ec4bb361f541f9f93eab843..d40c5dfa62f8b2d17863dc57b477926be3abf8df 100644 (file)
@@ -22,23 +22,23 @@ namespace rmi {
 void DefaultExceptionModel::raise(const std::string& target, const std::string& msg)
 {
        if (target == "InvalidArgumentException")
-               throw runtime::InvalidArgumentException(msg);
+               throw klay::InvalidArgumentException(msg);
        else if (target == "NotImplementedException")
-               throw runtime::InvalidArgumentException(msg);
+               throw klay::InvalidArgumentException(msg);
        else if (target == "RangeException")
-               throw runtime::RangeException(msg);
+               throw klay::RangeException(msg);
        else if (target == "NotFoundException")
-               throw runtime::NotFoundException(msg);
+               throw klay::NotFoundException(msg);
        else if (target == "UnsupportedException")
-               throw runtime::UnsupportedException(msg);
+               throw klay::UnsupportedException(msg);
        else if (target == "NoPermissionException")
-               throw runtime::NoPermissionException(msg);
+               throw klay::NoPermissionException(msg);
        else if (target == "IOException")
-               throw runtime::IOException(msg);
+               throw klay::IOException(msg);
        else if (target == "OutOfMemoryException")
-               throw runtime::OutOfMemoryException(msg);
+               throw klay::OutOfMemoryException(msg);
        else
-               throw runtime::Exception(msg);
+               throw klay::Exception(msg);
 }
 
 } // namespace rmi
index e09329fc4e58214e183808a43f4ba483fc3b4611..e007e383794116d6d0bfb21fc9987f12ff32dfc5 100644 (file)
@@ -90,16 +90,16 @@ Message Message::createErrorMessage(const std::string& target, const std::string
        return error;
 }
 
-template<> void Message::enclose(runtime::FileDescriptor&& fd)
+template<> void Message::enclose(klay::FileDescriptor&& fd)
 {
        if (fd.fileDescriptor == -1) {
-               throw runtime::Exception("Invalid file descriptor");
+               throw klay::Exception("Invalid file descriptor");
        }
 
        fileDescriptors.push_back(std::move(fd));
 }
 
-template<> void Message::disclose(runtime::FileDescriptor& fd)
+template<> void Message::disclose(klay::FileDescriptor& fd)
 {
        if (!fileDescriptors.empty()) {
                fd.fileDescriptor = std::move(fileDescriptors.front()).fileDescriptor;
index f071777d88df30547896d111e75907109cb0b51f..7cc78b53b612c3f35df9e04e99783cde2d1b8eac 100644 (file)
@@ -43,7 +43,7 @@ SubscriptionId Notification::createSubscriber()
 {
        int fds[2] = {-1, -1};
        if (::socketpair(AF_UNIX, SOCK_STREAM, 0, fds) == -1) {
-               throw runtime::Exception("Failed to create socket pair");
+               throw klay::Exception("Failed to create socket pair");
        }
 
        std::lock_guard<std::mutex> lock(subscriberLock);
index 326529149edcd25c2eca823da77dd33fea0642fb..99a7e2673da01e5d24487b5dd4d30582dd946ebc 100644 (file)
@@ -50,7 +50,7 @@ Service::~Service()
 void Service::prepare(bool activation)
 {
        socket.reset(new Socket(Socket::create(address, activation)));
-       auto accept = [&](int fd, runtime::Mainloop::Event event) {
+       auto accept = [&](int fd, klay::Mainloop::Event event) {
                onNewConnection(std::make_shared<Connection>(socket->accept()));
        };
 
@@ -93,7 +93,7 @@ void Service::setAuditTrail(const AuditTrail& trail)
 void Service::setNewConnectionCallback(const ConnectionCallback& connectionCallback)
 {
        auto callback = [connectionCallback, this](const std::shared_ptr<Connection>& connection) {
-               auto handle = [&](int fd, runtime::Mainloop::Event event) {
+               auto handle = [&](int fd, klay::Mainloop::Event event) {
                        std::lock_guard<std::mutex> lock(stateLock);
 
                        auto iter = getConnectionIterator(fd);
@@ -142,7 +142,7 @@ void Service::createNotification(const std::string& name)
        std::lock_guard<std::mutex> lock(notificationLock);
 
        if (notificationRegistry.count(name)) {
-               throw runtime::Exception("Notification already registered");
+               throw klay::Exception("Notification already registered");
        }
 
        notificationRegistry.emplace(name, Notification(name));
@@ -150,7 +150,7 @@ void Service::createNotification(const std::string& name)
 
 int Service::subscribeNotification(const std::string& name)
 {
-       auto closeHandler = [&, name, this](int fd, runtime::Mainloop::Event event) {
+       auto closeHandler = [&, name, this](int fd, klay::Mainloop::Event event) {
                if ((event & EPOLLHUP) || (event & EPOLLRDHUP)) {
                        unsubscribeNotification(name, fd);
                        return;
@@ -170,7 +170,7 @@ int Service::subscribeNotification(const std::string& name)
                SubscriptionId slot = notification.createSubscriber();
                mainloop.addEventSource(slot.first, EPOLLHUP | EPOLLRDHUP, closeHandler);
                return slot.second;
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
                ERROR(KSINK, e.what());
                return -1;
        }
@@ -205,7 +205,7 @@ void Service::onMessageProcess(const std::shared_ptr<Connection>& connection)
        auto process = [&, connection](Message& request) {
                try {
                        if (!methodRegistry.count(request.target()))
-                               throw runtime::NotFoundException("Method not found");
+                               throw klay::NotFoundException("Method not found");
 
                        std::shared_ptr<MethodContext> methodContext = methodRegistry.at(request.target());
 
@@ -213,11 +213,11 @@ void Service::onMessageProcess(const std::shared_ptr<Connection>& connection)
                        bool allowed = onPrivilegeCheck(processingContext.credentials, methodContext->privilege);
                        onAuditTrail(processingContext.credentials, request.target(), allowed);
                        if (!allowed) {
-                               throw runtime::NoPermissionException("Permission denied");
+                               throw klay::NoPermissionException("Permission denied");
                        }
 
                        connection->send(methodContext->dispatcher(request));
-               } catch (runtime::Exception& e) {
+               } catch (klay::Exception& e) {
                        try {
                                // Forward the exception to the peer
                                connection->send(request.createErrorMessage(e.className(), e.what()));
index 3e2e3721e606c3068b3975e9a362efd3b336abfe..9889acbd652c4e185855ef667b8ca050d46f9530 100644 (file)
@@ -39,7 +39,7 @@ const int MAX_BACKLOG_SIZE = 100;
 void setCloseOnExec(int fd)
 {
        if (::fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) {
-               throw SocketException(runtime::GetSystemErrorMessage());
+               throw SocketException(klay::GetSystemErrorMessage());
        }
 }
 
@@ -50,11 +50,11 @@ Credentials getCredentials(int fd)
        struct ucred cred;
        socklen_t credsz = sizeof(cred);
        if (::getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cred, &credsz)) {
-               throw SocketException(runtime::GetSystemErrorMessage());
+               throw SocketException(klay::GetSystemErrorMessage());
        }
 
        if (::getsockopt(fd, SOL_SOCKET, SO_PEERSEC, buf, &length)) {
-               throw SocketException(runtime::GetSystemErrorMessage());
+               throw SocketException(klay::GetSystemErrorMessage());
        }
 
        return {cred.pid, cred.uid, cred.gid, buf};
@@ -85,7 +85,7 @@ Socket Socket::accept()
 {
        int sockfd = ::accept(socketFd, nullptr, nullptr);
        if (sockfd == -1) {
-               throw SocketException(runtime::GetSystemErrorMessage());
+               throw SocketException(klay::GetSystemErrorMessage());
        }
 
        setCloseOnExec(sockfd);
@@ -114,7 +114,7 @@ void Socket::read(void *buffer, const size_t size) const
                } else if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) {
                        continue;
                } else {
-                       throw SocketException(runtime::GetSystemErrorMessage());
+                       throw SocketException(klay::GetSystemErrorMessage());
                }
        }
 }
@@ -130,7 +130,7 @@ void Socket::write(const void *buffer, const size_t size) const
                } else if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) {
                        continue;
                } else {
-                       throw SocketException(runtime::GetSystemErrorMessage());
+                       throw SocketException(klay::GetSystemErrorMessage());
                }
        }
 }
@@ -170,7 +170,7 @@ void Socket::sendFileDescriptors(const int* fds, const size_t nr) const
                if (ret >= 0) {
                        written += ret;
                } else if ((errno != EAGAIN) && (errno != EWOULDBLOCK) && (errno != EINTR)) {
-                       throw SocketException(runtime::GetSystemErrorMessage());
+                       throw SocketException(klay::GetSystemErrorMessage());
                }
        }
 }
@@ -203,7 +203,7 @@ void Socket::receiveFileDescriptors(int* fds, const size_t nr) const
                        bytes += ret;
                } else {
                        if ((errno != EAGAIN) && (errno != EWOULDBLOCK) && (errno != EINTR)) {
-                               throw SocketException(runtime::GetSystemErrorMessage());
+                               throw SocketException(klay::GetSystemErrorMessage());
                        }
                }
        }
@@ -240,12 +240,12 @@ int Socket::createSystemdSocket(const std::string& path)
 int Socket::createRegularSocket(const std::string& path)
 {
        if (path.size() >= sizeof(sockaddr_un::sun_path)) {
-               throw SocketException(runtime::GetSystemErrorMessage(ENAMETOOLONG));
+               throw SocketException(klay::GetSystemErrorMessage(ENAMETOOLONG));
        }
 
        int sockfd = ::socket(AF_UNIX, SOCK_STREAM, 0);
        if (sockfd == -1) {
-               throw SocketException(runtime::GetSystemErrorMessage());
+               throw SocketException(klay::GetSystemErrorMessage());
        }
 
        setCloseOnExec(sockfd);
@@ -262,18 +262,18 @@ int Socket::createRegularSocket(const std::string& path)
 
        if (::bind(sockfd, reinterpret_cast<struct sockaddr *>(&addr), sizeof(struct sockaddr_un)) == -1) {
                ::close(sockfd);
-               throw SocketException(runtime::GetSystemErrorMessage());
+               throw SocketException(klay::GetSystemErrorMessage());
        }
 
        int optval = 1;
        if (::setsockopt(sockfd, SOL_SOCKET, SO_PASSCRED, &optval, sizeof(optval)) == -1) {
                ::close(sockfd);
-               throw SocketException(runtime::GetSystemErrorMessage());
+               throw SocketException(klay::GetSystemErrorMessage());
        }
 
        if (::listen(sockfd, MAX_BACKLOG_SIZE) == -1) {
                ::close(sockfd);
-               throw SocketException(runtime::GetSystemErrorMessage());
+               throw SocketException(klay::GetSystemErrorMessage());
        }
 
        return sockfd;
@@ -295,12 +295,12 @@ Socket Socket::create(const std::string& path, bool activation)
 Socket Socket::connect(const std::string& path)
 {
        if (path.size() >= sizeof(sockaddr_un::sun_path)) {
-               throw SocketException(runtime::GetSystemErrorMessage(ENAMETOOLONG));
+               throw SocketException(klay::GetSystemErrorMessage(ENAMETOOLONG));
        }
 
        int fd = ::socket(AF_UNIX, SOCK_STREAM, 0);
        if (fd == -1) {
-               throw SocketException(runtime::GetSystemErrorMessage());
+               throw SocketException(klay::GetSystemErrorMessage());
        }
 
        setCloseOnExec(fd);
@@ -315,7 +315,7 @@ Socket Socket::connect(const std::string& path)
 
        if (::connect(fd, reinterpret_cast<struct sockaddr *>(&addr), sizeof(struct sockaddr_un)) == -1) {
                ::close(fd);
-               throw SocketException(runtime::GetSystemErrorMessage());
+               throw SocketException(klay::GetSystemErrorMessage());
        }
 
        return Socket(fd);
index b49d7a780405ef9f5a74a08985ec3e0e3ce27b1b..4d9ab576274af73bbd60b50023a23b486d17cc1d 100644 (file)
@@ -29,7 +29,7 @@ Document::Document(const std::string& root, const std::string& version) :
        implementation(xmlNewDoc((const xmlChar*)version.c_str()))
 {
        if (implementation == nullptr) {
-               throw runtime::Exception("Failed to create document");
+               throw klay::Exception("Failed to create document");
        }
 
        implementation->_private = this;
@@ -60,7 +60,7 @@ Document::~Document()
 Node& Document::getRootNode()
 {
        if (rootNode == nullptr) {
-               throw runtime::Exception("Empty document");
+               throw klay::Exception("Empty document");
        }
 
        return *rootNode;
@@ -70,20 +70,20 @@ Node::NodeList Document::evaluate(const std::string& xpath)
 {
        auto ctxt = xmlXPathNewContext(implementation);
        if (ctxt == nullptr) {
-               throw runtime::Exception("Failed to create XPath context for " + xpath);
+               throw klay::Exception("Failed to create XPath context for " + xpath);
        }
 
        auto result = xmlXPathEval((const xmlChar*)xpath.c_str(), ctxt);
        if (result == nullptr) {
                xmlXPathFreeContext(ctxt);
-               throw runtime::Exception("Invalid XPath: " + xpath);
+               throw klay::Exception("Invalid XPath: " + xpath);
        }
 
        if (result ->type != XPATH_NODESET) {
                xmlXPathFreeObject(result);
                xmlXPathFreeContext(ctxt);
 
-               throw runtime::Exception("Only nodeset result types are supported");
+               throw klay::Exception("Only nodeset result types are supported");
        }
 
        auto nodeset = result->nodesetval;
@@ -128,7 +128,7 @@ void Document::write(const std::string& filename, const std::string& encoding, b
                                                                                        encoding.c_str(),
                                                                                        formatted);
        if (result == 0) {
-               throw runtime::Exception("Failed to write XML document");
+               throw klay::Exception("Failed to write XML document");
        }
 }
 
index a0055d041bdcf62f4a82814e9abb24d7e35ff64b..83b874230086458a0e8e6aefd0ce9dbb06047a45 100644 (file)
@@ -50,7 +50,7 @@ Node Node::addNewChild(const std::string& name)
 {
        xmlNode* nodePtr = xmlNewNode(NULL, xmlStrdup((const xmlChar*)name.c_str()));
        if (nodePtr == nullptr) {
-               throw runtime::Exception("Can not create a new node");
+               throw klay::Exception("Can not create a new node");
        }
        xmlAddChild(implementation, nodePtr);
 
@@ -86,7 +86,7 @@ void Node::setContent(const std::string& content)
 std::string Node::getProp(const std::string& name) const
 {
        if (implementation->type != XML_ELEMENT_NODE) {
-               throw runtime::Exception("This node type does not have properties");
+               throw klay::Exception("This node type does not have properties");
        }
 
        xmlChar* prop = xmlGetProp(implementation, (xmlChar*)name.c_str());
@@ -102,7 +102,7 @@ std::string Node::getProp(const std::string& name) const
 void Node::setProp(const std::string& name, const std::string& val)
 {
        if (implementation->type != XML_ELEMENT_NODE) {
-               throw runtime::Exception("Can not set properties for this node type");
+               throw klay::Exception("Can not set properties for this node type");
        }
 
        xmlSetProp(implementation, (xmlChar*)name.c_str(), (xmlChar*)val.c_str());
index ddae583adcfca1f8570745fffa9455f5588cc0ff..86ba1db8637572df5c780cfe84fb3868572531ef 100644 (file)
@@ -25,7 +25,7 @@ namespace xml {
 Document* Parser::parseContext(xmlParserCtxt* context, bool validate)
 {
        if (context == nullptr) {
-               throw runtime::Exception("Could not create parser context");
+               throw klay::Exception("Could not create parser context");
        }
 
        KeepBlanks(false);
@@ -42,7 +42,7 @@ Document* Parser::parseContext(xmlParserCtxt* context, bool validate)
 
        if (xmlParseDocument(context) < 0) {
                xmlFreeParserCtxt(context);
-               throw runtime::Exception("Parsing failed");
+               throw klay::Exception("Parsing failed");
        }
 
        xmlDoc* document = context->myDoc;
@@ -59,7 +59,7 @@ Document* Parser::parseFile(const std::string& filename, bool validate)
 {
        xmlParserCtxt* context = xmlCreateFileParserCtxt(filename.c_str());
        if (context == nullptr) {
-               throw runtime::Exception("Could not create parser context");
+               throw klay::Exception("Could not create parser context");
        }
 
        if (context->directory == nullptr) {
@@ -74,7 +74,7 @@ Document* Parser::parseString(const std::string& xml, bool validate)
        xmlParserCtxt* context = xmlCreateMemoryParserCtxt(xml.c_str(), xml.size() + 1);
 
        if (context == nullptr) {
-               throw runtime::Exception("Could not create parser context");
+               throw klay::Exception("Could not create parser context");
        }
 
        return parseContext(context, validate);
index 4df527f04f824b77f6c5790c17bdd7013c90ba9c..3a5c57449d84f1b55d525ebb6ab07370ef48f0d8 100644 (file)
@@ -28,9 +28,9 @@
 TESTCASE(GetGroupTest)
 {
        try {
-               runtime::Group group("users");
-               runtime::Group another(group);
-       } catch (runtime::Exception& e) {
+               klay::Group group("users");
+               klay::Group another(group);
+       } catch (klay::Exception& e) {
                TEST_FAIL(e.what());
        }
 }
@@ -38,9 +38,9 @@ TESTCASE(GetGroupTest)
 TESTCASE(GetUserTest)
 {
        try {
-               runtime::User user("root");
-               runtime::User another(user);
-       } catch (runtime::Exception& e) {
+               klay::User user("root");
+               klay::User another(user);
+       } catch (klay::Exception& e) {
                TEST_FAIL(e.what());
        }
 }
@@ -48,49 +48,49 @@ TESTCASE(GetUserTest)
 TESTCASE(GetGroupNegativeTest)
 {
        try {
-               runtime::Group group("invalid");
-       } catch (runtime::Exception& e) {
+               klay::Group group("invalid");
+       } catch (klay::Exception& e) {
        }
 }
 
 TESTCASE(GetGroupNegativeTest2)
 {
        try {
-               runtime::Group group(-1);
-       } catch (runtime::Exception& e) {
+               klay::Group group(-1);
+       } catch (klay::Exception& e) {
        }
 }
 
 TESTCASE(GetUserNegativetest)
 {
        try {
-               runtime::User user("invalid");
-       } catch (runtime::Exception& e) {
+               klay::User user("invalid");
+       } catch (klay::Exception& e) {
        }
 }
 
 TESTCASE(GetUserNegativetest2)
 {
        try {
-               runtime::User user(-1);
-       } catch (runtime::Exception& e) {
+               klay::User user(-1);
+       } catch (klay::Exception& e) {
        }
 }
 
 TESTCASE(GetCurrentGroupTest)
 {
        try {
-               runtime::Group group;
-               runtime::Group another(group.getGid());
-       } catch (runtime::Exception& e) {
+               klay::Group group;
+               klay::Group another(group.getGid());
+       } catch (klay::Exception& e) {
        }
 }
 
 TESTCASE(GetCurrentUserTest)
 {
        try {
-               runtime::User user;
-               runtime::User another(user.getUid());
-       } catch (runtime::Exception& e) {
+               klay::User user;
+               klay::User another(user.getUid());
+       } catch (klay::Exception& e) {
        }
 }
index 05b2b41bf32823ff8c6a9765de695ba80e0d6043..04bc332e52388f137c7769e4ddce06f1bb65114f 100644 (file)
@@ -45,7 +45,7 @@ TESTCASE(DatabaseTest)
        try {
                database::Connection db(TestbenchDataSource, database::Connection::ReadWrite | database::Connection::Create);
                db.exec(query);
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
                TEST_FAIL(e.what());
        }
 }
@@ -55,7 +55,7 @@ TESTCASE(InvalidStatementTest)
        try {
                database::Connection db(TestbenchDataSource, database::Connection::ReadWrite | database::Connection::Create);
                database::Statement stmt(db, "INVALID STATEMENT");
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
        }
 }
 
@@ -64,7 +64,7 @@ TESTCASE(InvalidStatementTest2)
        try {
                database::Connection db(TestbenchDataSource, database::Connection::ReadWrite | database::Connection::Create);
                db.exec("INVALID");
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
        }
 }
 
@@ -91,7 +91,7 @@ TESTCASE(ColumnBindTestWithIndex1)
                TEST_EXPECT(5, select.getColumnCount());
                stmt.clearBindings();
                stmt.reset();
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
                TEST_FAIL(e.what());
        }
 }
@@ -108,7 +108,7 @@ TESTCASE(ColumnBindTestWithIndex2)
                stmt.bind(3, false);
                stmt.bind(4, 5001);
                stmt.exec();
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
                TEST_FAIL(e.what());
        }
 }
@@ -125,7 +125,7 @@ TESTCASE(ColumnBindTestWithName1)
                stmt.bind(":IS_USED", true);
                stmt.bind(":USER", 5001);
                stmt.exec();
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
                TEST_FAIL(e.what());
        }
 }
@@ -139,7 +139,7 @@ TESTCASE(ColumnBindNullTest)
                database::Statement stmt(db, query);
                stmt.bind(":PKG");
                stmt.bind(2);
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
                TEST_FAIL(e.what());
        }
 }
@@ -162,7 +162,7 @@ TESTCASE(ColumnBindTestWithName2)
                stmt.bind(":IS_USED", used);
                stmt.bind(":USER", user);
                stmt.exec();
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
                TEST_FAIL(e.what());
        }
 }
@@ -191,7 +191,7 @@ TESTCASE(ColumnTest)
                        key.getName(); key.getText(); key.getType(); key.getBytes(); key.getBlob();
                        used.getName(); used.getInt(); used.getInt64(); used.getDouble(); used.getType(); used.getBytes();
                }
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
                TEST_FAIL(e.what());
        }
 }
@@ -203,7 +203,7 @@ TESTCASE(ColumnOutRange1)
                database::Statement select(db, "SELECT * FROM CLIENT");
                select.step();
                database::Column column = select.getColumn(32);
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
        }
 }
 
@@ -214,7 +214,7 @@ TESTCASE(ColumnOutRange2)
                database::Statement select(db, "SELECT * FROM CLIENT");
                select.step();
                select.isNullColumn(32);
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
        }
 }
 
@@ -225,7 +225,7 @@ TESTCASE(ColumnOutRange3)
                database::Statement select(db, "SELECT * FROM CLIENT");
                select.step();
                select.getColumnName(32);
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
        }
 }
 
@@ -238,46 +238,46 @@ TESTCASE(ColumnBindOutRange1)
                database::Statement stmt(db, query);
                try {
                        stmt.bind(":TPK", "TEST PACKAGE");
-               } catch (runtime::Exception& e) {
+               } catch (klay::Exception& e) {
                }
 
                try {
                        stmt.bind(":TPK", (int)10);
-               } catch (runtime::Exception& e) {
+               } catch (klay::Exception& e) {
                }
 
                try {
                        stmt.bind(":TPK", (sqlite3_int64)10);
-               } catch (runtime::Exception& e) {
+               } catch (klay::Exception& e) {
                }
 
                try {
                        stmt.bind(":TPK", (double)10);
-               } catch (runtime::Exception& e) {
+               } catch (klay::Exception& e) {
                }
 
                try {
                        stmt.bind(":TPK", "invalid");
-               } catch (runtime::Exception& e) {
+               } catch (klay::Exception& e) {
                }
 
                try {
                        stmt.bind(":TPK", std::string("invalid"));
-               } catch (runtime::Exception& e) {
+               } catch (klay::Exception& e) {
                }
 
                try {
                        stmt.bind(":TPK", (void *)NULL, 12);
-               } catch (runtime::Exception& e) {
+               } catch (klay::Exception& e) {
                }
 
                try {
                        stmt.bind(":TPK");
-               } catch (runtime::Exception& e) {
+               } catch (klay::Exception& e) {
                }
 
                stmt.exec();
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
        }
 }
 
@@ -290,46 +290,46 @@ TESTCASE(ColumnBindOutRange2)
                database::Statement stmt(db, query);
                try {
                        stmt.bind(32, "TEST PACKAGE");
-               } catch (runtime::Exception& e) {
+               } catch (klay::Exception& e) {
                }
 
                try {
                        stmt.bind(32, (int)10);
-               } catch (runtime::Exception& e) {
+               } catch (klay::Exception& e) {
                }
 
                try {
                        stmt.bind(32, (sqlite3_int64)10);
-               } catch (runtime::Exception& e) {
+               } catch (klay::Exception& e) {
                }
 
                try {
                        stmt.bind(32, (double)10);
-               } catch (runtime::Exception& e) {
+               } catch (klay::Exception& e) {
                }
 
                try {
                        stmt.bind(32, "invalid");
-               } catch (runtime::Exception& e) {
+               } catch (klay::Exception& e) {
                }
 
                try {
                        stmt.bind(32, std::string("invalid"));
-               } catch (runtime::Exception& e) {
+               } catch (klay::Exception& e) {
                }
 
                try {
                        stmt.bind(32, (void *)NULL, 12);
-               } catch (runtime::Exception& e) {
+               } catch (klay::Exception& e) {
                }
 
                try {
                        stmt.bind(32);
-               } catch (runtime::Exception& e) {
+               } catch (klay::Exception& e) {
                }
 
                stmt.exec();
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
        }
 }
 
@@ -337,6 +337,6 @@ TESTCASE(InvalidDB)
 {
        try {
                database::Connection db("/tmp/invalid.db", database::Connection::ReadWrite);
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
        }
 }
index d7c985c065920d422e19bdb0952b0fd058fce9d2..14b97b5d4c2ac05b5507597b16309b9182118ab1 100644 (file)
@@ -97,13 +97,13 @@ TESTCASE(DbusRegisterObjectTest)
 {
        ScopedGMainLoop mainloop;
        mainloop.dispatch([&](){
-               runtime::Latch nameAcquired;
+               klay::Latch nameAcquired;
                auto handler = [](const std::string& objectPath,
                                                  const std::string& interface,
                                                  const std::string& methodName,
                                                  dbus::Variant parameters) {
                        if (objectPath != TESTSVC_OBJECT_PATH || interface != TESTSVC_INTERFACE) {
-                               throw runtime::Exception("Unknown Method");
+                               throw klay::Exception("Unknown Method");
                        }
                        if (methodName == TESTSVC_METHOD_NOOP) {
                                return dbus::Variant();
index 2401d750b9b2767087ddcdb084091f742d224037..7720551ac1ad9cf646ffebde75c5dfe22738c9a7 100644 (file)
 TESTCASE(EventFdHandleNegative)
 {
        try {
-               runtime::EventFD evtfd(0, -1);
-       } catch (runtime::Exception& e) {
+               klay::EventFD evtfd(0, -1);
+       } catch (klay::Exception& e) {
        }
 }
 
 TESTCASE(EventFdSendPositive)
 {
        try {
-               runtime::EventFD evtfd;
+               klay::EventFD evtfd;
                evtfd.send();
                evtfd.receive();
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
                TEST_FAIL(e.what());
        }
 }
@@ -46,20 +46,20 @@ TESTCASE(EventFdSendPositive)
 TESTCASE(EventFdSendNegative)
 {
        try {
-               runtime::EventFD evtfd;
+               klay::EventFD evtfd;
                evtfd.close();
                evtfd.send();
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
        }
 }
 
 TESTCASE(EventFdReceiveNegative)
 {
        try {
-               runtime::EventFD evtfd;
+               klay::EventFD evtfd;
                evtfd.close();
                evtfd.receive();
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
        }
 }
 
index 8789f010d153aaadff4f98804ac6f4a479fc0267..165de8d85b0a4e3828b5f6986f2b618d4ef66f11 100644 (file)
@@ -32,8 +32,8 @@
 
 TESTCASE(DirectoryIteration)
 {
-       runtime::DirectoryIterator iter("/dev");
-       runtime::DirectoryIterator end;
+       klay::DirectoryIterator iter("/dev");
+       klay::DirectoryIterator end;
 
        TEST_EXPECT(false, iter == end);
 
@@ -45,7 +45,7 @@ TESTCASE(DirectoryIteration)
 TESTCASE(FileIO)
 {
        char testbuf[100] = "Test Data";
-       runtime::File tmp("/tmp/test-file");
+       klay::File tmp("/tmp/test-file");
        try {
                tmp.create(0755);
                tmp.lock();
@@ -53,43 +53,43 @@ TESTCASE(FileIO)
                tmp.lseek(10, SEEK_SET);
                tmp.unlock();
                tmp.close();
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
                TEST_FAIL(e.what());
        }
 
        char readbuf[100];
        try {
-               runtime::File tmpFile("/tmp/test-file", O_RDWR);
+               klay::File tmpFile("/tmp/test-file", O_RDWR);
                tmpFile.read(readbuf, ::strlen(testbuf));
                tmpFile.close();
                tmpFile.remove();
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
                TEST_FAIL(e.what());
        }
 }
 
 TESTCASE(DirOperation)
 {
-       runtime::File testDir("/tmp/dpm-unit-test/dir");
+       klay::File testDir("/tmp/dpm-unit-test/dir");
        try {
                testDir.makeDirectory(true, ::getuid(), ::getgid());
                testDir.chown(::getuid(), ::getgid(), false);
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
                TEST_FAIL(e.what());
        }
 
-       runtime::File dir("/tmp/dpm-unit-test");
+       klay::File dir("/tmp/dpm-unit-test");
        try {
                dir.chmod(777, true);
                dir.remove(true);
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
                TEST_FAIL(e.what());
        }
 }
 
 TESTCASE(FileAttribute)
 {
-       runtime::File tmp("/tmp");
+       klay::File tmp("/tmp");
 
        TEST_EXPECT(true, tmp.exists());
        TEST_EXPECT(true, tmp.canRead());
@@ -111,7 +111,7 @@ TESTCASE(FileAttribute)
 TESTCASE(FileAttributeNegative)
 {
        try {
-               runtime::File tmp("/unknown");
+               klay::File tmp("/unknown");
 
                TEST_EXPECT(false, tmp.exists());
                TEST_EXPECT(false, tmp.canRead());
@@ -120,43 +120,43 @@ TESTCASE(FileAttributeNegative)
 
                try {
                        tmp.isLink();
-               } catch (runtime::Exception& e) {
+               } catch (klay::Exception& e) {
                }
 
                try {
                        tmp.isFile();
-               } catch (runtime::Exception& e) {
+               } catch (klay::Exception& e) {
                }
 
                try {
                        tmp.isDirectory();
-               } catch (runtime::Exception& e) {
+               } catch (klay::Exception& e) {
                }
 
                try {
                        tmp.isDevice();
-               } catch (runtime::Exception& e) {
+               } catch (klay::Exception& e) {
                }
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
        }
 }
 
 TESTCASE(FileDevice)
 {
-       runtime::File tmp("/dev/kmem");
+       klay::File tmp("/dev/kmem");
 
        TEST_EXPECT(true, tmp.isDevice());
 }
 
 TESTCASE(FileSymlinkTest)
 {
-       runtime::File tmp("/var");
+       klay::File tmp("/var");
 
        TEST_EXPECT(true, tmp.isLink());
 }
 
 TESTCASE(FileReferenceTest)
 {
-       runtime::File one("/tmp");
-       runtime::File two(one);
+       klay::File one("/tmp");
+       klay::File two(one);
 }
index 03633441055dfde89ed28bd2d70806eb585b87eb..b215f20b541ac8cd3a7d615b0ab3d89e858b84a5 100644 (file)
@@ -39,7 +39,7 @@ TESTCASE(LogSeverityTest)
 {
        try {
                audit::LogLevelToString((audit::LogLevel)-1);
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
        }
 }
 
index 16bf79acc431143717950febedbbcc706311c2ff..519d58d3629b094a0c39c7fb4abe3679a92a9537 100644 (file)
@@ -25,5 +25,5 @@
 
 TESTCASE(ErrorMessage)
 {
-       std::cout << "Error Message: " << runtime::GetSystemErrorMessage(EINTR) << std::endl;
+       std::cout << "Error Message: " << klay::GetSystemErrorMessage(EINTR) << std::endl;
 }
index 429ff431a8a42539bd4c1536c3387b46913af202..034e66615fe81187acf6055789e014881cc46fad 100644 (file)
@@ -30,61 +30,61 @@ TESTCASE(ProcWithArg)
                        "-l",
                        "-a"
                };
-               runtime::Process proc("/bin/ls > /dev/null", args);
+               klay::Process proc("/bin/ls > /dev/null", args);
                TEST_EXPECT(true, proc.execute() != -1);
                proc.waitForFinished();
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
        }
 }
 
 TESTCASE(ProcKill)
 {
        try {
-               runtime::Process proc("/opt/data/unittest-proc.sh");
+               klay::Process proc("/opt/data/unittest-proc.sh");
                TEST_EXPECT(true, proc.execute() != -1);
                if (proc.isRunning()) {
                        proc.kill();
                        proc.waitForFinished();
                }
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
        }
 }
 
 TESTCASE(ProcTerminate)
 {
        try {
-               runtime::Process proc("/opt/data/unittest-proc.sh");
+               klay::Process proc("/opt/data/unittest-proc.sh");
                TEST_EXPECT(true, proc.execute() != -1);
                if (proc.isRunning()) {
                        proc.terminate();
                        proc.waitForFinished();
                }
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
        }
 }
 
 TESTCASE(ProcInvalidProcess)
 {
        try {
-               runtime::Process proc(TEST_DATA_DIR "test-proc.sh");
+               klay::Process proc(TEST_DATA_DIR "test-proc.sh");
                TEST_EXPECT(true, proc.execute() != -1);
                proc.terminate();
                proc.waitForFinished();
                TEST_EXPECT(false, proc.isRunning());
                try {
                        proc.kill();
-               } catch (runtime::Exception& e) {
+               } catch (klay::Exception& e) {
                }
 
                try {
                        proc.terminate();
-               } catch (runtime::Exception& e) {
+               } catch (klay::Exception& e) {
                }
 
                try {
                        proc.waitForFinished();
-               } catch (runtime::Exception& e) {
+               } catch (klay::Exception& e) {
                }
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
        }
 }
index d8b0a3323cd041f6d4524c130173d0fbf3a755cd..b1563c200d466ac55e959ca03abe3e5a81822f60 100644 (file)
@@ -54,8 +54,8 @@ public:
                service->expose(this, "", (std::string)(TestServer::method3)(std::string, std::string, std::string));
                service->expose(this, "", (std::string)(TestServer::method4)(std::string, std::string, std::string, std::string));
 
-               service->expose(this, "", (runtime::FileDescriptor)(TestServer::signalProvider)(std::string));
-               service->expose(this, "", (runtime::FileDescriptor)(TestServer::policyNotificationProvider)(std::string));
+               service->expose(this, "", (klay::FileDescriptor)(TestServer::signalProvider)(std::string));
+               service->expose(this, "", (klay::FileDescriptor)(TestServer::policyNotificationProvider)(std::string));
 
                service->expose(this, "", (int)(TestServer::sendSignal)());
                service->expose(this, "", (int)(TestServer::sendPolicyChangeNotification)());
@@ -103,12 +103,12 @@ public:
                return 0;
        }
 
-       runtime::FileDescriptor signalProvider(const std::string& name)
+       klay::FileDescriptor signalProvider(const std::string& name)
        {
                return service->subscribeNotification(name);
        }
 
-       runtime::FileDescriptor policyNotificationProvider(const std::string& name)
+       klay::FileDescriptor policyNotificationProvider(const std::string& name)
        {
                return service->subscribeNotification(name);
        }
@@ -303,7 +303,7 @@ public:
                        TestClient client;
                        client.connect();
                        client.disconnect();
-               } catch (runtime::Exception& e) {
+               } catch (klay::Exception& e) {
                        ERROR(KSINK, e.what());
                }
        }
@@ -318,7 +318,7 @@ public:
                        client.requestPolicyChangeNotification();
 
                        client.disconnect();
-               } catch (runtime::Exception& e) {
+               } catch (klay::Exception& e) {
                        ERROR(KSINK, e.what());
                }
        }
@@ -343,7 +343,7 @@ public:
                        client.requestPolicyChangeNotification();
 
                        client.disconnect();
-               } catch (runtime::Exception& e) {
+               } catch (klay::Exception& e) {
                        ERROR(KSINK, e.what());
                }
        }
index b0812f447553592b40c5d18fa877f8d339c6b361..4de40f971e47b544531dbd479028503502b436ac 100644 (file)
@@ -45,7 +45,7 @@ TESTCASE(XPath)
                while (iter != nodes.end()) {
                        ++iter;
                }
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
                TEST_FAIL(e.what());
        }
 }
@@ -65,7 +65,7 @@ TESTCASE(XmlDomTree)
                while (iter != list.end()) {
                        ++iter;
                }
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
                TEST_FAIL(e.what());
        }
 }
@@ -88,7 +88,7 @@ TESTCASE(XmlGenerate)
                TEST_EXPECT("Value", node.getProp("Prop"));
 
                doc.write("/tmp/test.xml", "UTF-8", true);
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
                TEST_FAIL(e.what());
        }
 }
@@ -97,6 +97,6 @@ TESTCASE(XmlException)
 {
        try {
                xml::Parser::parseFile("Invalid Source");
-       } catch (runtime::Exception& e) {
+       } catch (klay::Exception& e) {
        }
 }