aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/poco/Foundation/src/SharedLibrary_VX.cpp
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:44:49 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:49 +0300
commit718c552901d703c502ccbefdfc3c9028d608b947 (patch)
tree46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/libs/poco/Foundation/src/SharedLibrary_VX.cpp
parente9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff)
downloadydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/poco/Foundation/src/SharedLibrary_VX.cpp')
-rw-r--r--contrib/libs/poco/Foundation/src/SharedLibrary_VX.cpp282
1 files changed, 141 insertions, 141 deletions
diff --git a/contrib/libs/poco/Foundation/src/SharedLibrary_VX.cpp b/contrib/libs/poco/Foundation/src/SharedLibrary_VX.cpp
index e9de60713d..d578b6eba4 100644
--- a/contrib/libs/poco/Foundation/src/SharedLibrary_VX.cpp
+++ b/contrib/libs/poco/Foundation/src/SharedLibrary_VX.cpp
@@ -1,141 +1,141 @@
-//
-// SharedLibrary_VX.cpp
-//
-// Library: Foundation
-// Package: SharedLibrary
-// Module: SharedLibrary
-//
-// Copyright (c) 2004-2011, Applied Informatics Software Engineering GmbH.
-// and Contributors.
-//
-// SPDX-License-Identifier: BSL-1.0
-//
-
-
-#include "Poco/SharedLibrary_VX.h"
-#include "Poco/Exception.h"
-#include "Poco/Format.h"
-#error #include <loadLib.h>
-#error #include <unldLib.h>
-#include <ioLib.h>
-#error #include <symLib.h>
-#error #include <sysSymTbl.h>
-#include <cstring>
-
-
-struct SymLookup
-{
- const char* name;
- int group;
- void* addr;
-};
-
-
-extern "C" bool lookupFunc(char* name, int val, SYM_TYPE type, int arg, UINT16 group)
-{
- SymLookup* symLookup = reinterpret_cast<SymLookup*>(arg);
- if (group == symLookup->group && std::strcmp(name, symLookup->name) == 0)
- {
- symLookup->addr = reinterpret_cast<void*>(val);
- return TRUE;
- }
- else return FALSE;
-}
-
-
-namespace Poco {
-
-
-FastMutex SharedLibraryImpl::_mutex;
-
-
-SharedLibraryImpl::SharedLibraryImpl():
- _moduleId(0)
-{
-}
-
-
-SharedLibraryImpl::~SharedLibraryImpl()
-{
-}
-
-
-void SharedLibraryImpl::loadImpl(const std::string& path, int /*flags*/)
-{
- FastMutex::ScopedLock lock(_mutex);
-
- if (_moduleId) throw LibraryAlreadyLoadedException(path);
- int fd = open(const_cast<char*>(path.c_str()), O_RDONLY, 0);
- if (fd)
- {
- _moduleId = loadModule(fd, LOAD_GLOBAL_SYMBOLS);
- if (!_moduleId)
- {
- int err = errno;
- close(fd);
- throw LibraryLoadException(Poco::format("error %d", err));
- }
- }
- else
- {
- int err = errno;
- throw LibraryLoadException(Poco::format("cannot open library (error %d)", err));
- }
- _path = path;
-}
-
-
-void SharedLibraryImpl::unloadImpl()
-{
- FastMutex::ScopedLock lock(_mutex);
-
- if (_moduleId)
- {
- unldByModuleId(_moduleId, 0);
- _moduleId = 0;
- }
-}
-
-
-bool SharedLibraryImpl::isLoadedImpl() const
-{
- return _moduleId != 0;
-}
-
-
-void* SharedLibraryImpl::findSymbolImpl(const std::string& name)
-{
- poco_assert (_moduleId != 0);
-
- FastMutex::ScopedLock lock(_mutex);
-
- MODULE_INFO mi;
- if (!moduleInfoGet(_moduleId, &mi)) return 0;
- SymLookup symLookup;
- symLookup.name = name.c_str();
- symLookup.group = mi.group;
- symLookup.addr = 0;
- symEach(sysSymTbl, reinterpret_cast<FUNCPTR>(lookupFunc), reinterpret_cast<int>(&symLookup));
- return symLookup.addr;
-}
-
-
-const std::string& SharedLibraryImpl::getPathImpl() const
-{
- return _path;
-}
-
-
-std::string SharedLibraryImpl::suffixImpl()
-{
- return ".out";
-}
-
-
-bool SharedLibraryImpl::setSearchPathImpl(const std::string&)
-{
- return false;
-}
-
-
-} // namespace Poco
+//
+// SharedLibrary_VX.cpp
+//
+// Library: Foundation
+// Package: SharedLibrary
+// Module: SharedLibrary
+//
+// Copyright (c) 2004-2011, Applied Informatics Software Engineering GmbH.
+// and Contributors.
+//
+// SPDX-License-Identifier: BSL-1.0
+//
+
+
+#include "Poco/SharedLibrary_VX.h"
+#include "Poco/Exception.h"
+#include "Poco/Format.h"
+#error #include <loadLib.h>
+#error #include <unldLib.h>
+#include <ioLib.h>
+#error #include <symLib.h>
+#error #include <sysSymTbl.h>
+#include <cstring>
+
+
+struct SymLookup
+{
+ const char* name;
+ int group;
+ void* addr;
+};
+
+
+extern "C" bool lookupFunc(char* name, int val, SYM_TYPE type, int arg, UINT16 group)
+{
+ SymLookup* symLookup = reinterpret_cast<SymLookup*>(arg);
+ if (group == symLookup->group && std::strcmp(name, symLookup->name) == 0)
+ {
+ symLookup->addr = reinterpret_cast<void*>(val);
+ return TRUE;
+ }
+ else return FALSE;
+}
+
+
+namespace Poco {
+
+
+FastMutex SharedLibraryImpl::_mutex;
+
+
+SharedLibraryImpl::SharedLibraryImpl():
+ _moduleId(0)
+{
+}
+
+
+SharedLibraryImpl::~SharedLibraryImpl()
+{
+}
+
+
+void SharedLibraryImpl::loadImpl(const std::string& path, int /*flags*/)
+{
+ FastMutex::ScopedLock lock(_mutex);
+
+ if (_moduleId) throw LibraryAlreadyLoadedException(path);
+ int fd = open(const_cast<char*>(path.c_str()), O_RDONLY, 0);
+ if (fd)
+ {
+ _moduleId = loadModule(fd, LOAD_GLOBAL_SYMBOLS);
+ if (!_moduleId)
+ {
+ int err = errno;
+ close(fd);
+ throw LibraryLoadException(Poco::format("error %d", err));
+ }
+ }
+ else
+ {
+ int err = errno;
+ throw LibraryLoadException(Poco::format("cannot open library (error %d)", err));
+ }
+ _path = path;
+}
+
+
+void SharedLibraryImpl::unloadImpl()
+{
+ FastMutex::ScopedLock lock(_mutex);
+
+ if (_moduleId)
+ {
+ unldByModuleId(_moduleId, 0);
+ _moduleId = 0;
+ }
+}
+
+
+bool SharedLibraryImpl::isLoadedImpl() const
+{
+ return _moduleId != 0;
+}
+
+
+void* SharedLibraryImpl::findSymbolImpl(const std::string& name)
+{
+ poco_assert (_moduleId != 0);
+
+ FastMutex::ScopedLock lock(_mutex);
+
+ MODULE_INFO mi;
+ if (!moduleInfoGet(_moduleId, &mi)) return 0;
+ SymLookup symLookup;
+ symLookup.name = name.c_str();
+ symLookup.group = mi.group;
+ symLookup.addr = 0;
+ symEach(sysSymTbl, reinterpret_cast<FUNCPTR>(lookupFunc), reinterpret_cast<int>(&symLookup));
+ return symLookup.addr;
+}
+
+
+const std::string& SharedLibraryImpl::getPathImpl() const
+{
+ return _path;
+}
+
+
+std::string SharedLibraryImpl::suffixImpl()
+{
+ return ".out";
+}
+
+
+bool SharedLibraryImpl::setSearchPathImpl(const std::string&)
+{
+ return false;
+}
+
+
+} // namespace Poco