aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/poco/Foundation/src/Environment_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/Environment_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/Environment_VX.cpp')
-rw-r--r--contrib/libs/poco/Foundation/src/Environment_VX.cpp318
1 files changed, 159 insertions, 159 deletions
diff --git a/contrib/libs/poco/Foundation/src/Environment_VX.cpp b/contrib/libs/poco/Foundation/src/Environment_VX.cpp
index fa0469dc95..714e902b0f 100644
--- a/contrib/libs/poco/Foundation/src/Environment_VX.cpp
+++ b/contrib/libs/poco/Foundation/src/Environment_VX.cpp
@@ -1,159 +1,159 @@
-
-// Environment_VX.cpp
-//
-// Library: Foundation
-// Package: Core
-// Module: Environment
-//
-// Copyright (c) 2004-2011, Applied Informatics Software Engineering GmbH.
-// and Contributors.
-//
-// SPDX-License-Identifier: BSL-1.0
-//
-
-
-#include "Poco/Environment_VX.h"
-#include "Poco/Exception.h"
-#include "Poco/Buffer.h"
-#error #include <VxWorks.h>
-#error #include <envLib.h>
-#include <hostLib.h>
-#error #include <ifLib.h>
-#include <sockLib.h>
-#include <ioLib.h>
-#error #include <version.h>
-#include <cstring>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <net/if.h>
-#include <arpa/inet.h>
-#include <netinet/if_ether.h>
-#error #include <ifLib.h>
-#include <unistd.h>
-
-
-namespace Poco {
-
-
-EnvironmentImpl::StringMap EnvironmentImpl::_map;
-FastMutex EnvironmentImpl::_mutex;
-
-
-std::string EnvironmentImpl::getImpl(const std::string& name)
-{
- FastMutex::ScopedLock lock(_mutex);
-
- const char* val = getenv(name.c_str());
- if (val)
- return std::string(val);
- else
- throw NotFoundException(name);
-}
-
-
-bool EnvironmentImpl::hasImpl(const std::string& name)
-{
- FastMutex::ScopedLock lock(_mutex);
-
- return getenv(name.c_str()) != 0;
-}
-
-
-void EnvironmentImpl::setImpl(const std::string& name, const std::string& value)
-{
- FastMutex::ScopedLock lock(_mutex);
-
- std::string var = name;
- var.append("=");
- var.append(value);
- std::swap(_map[name], var);
- if (putenv((char*) _map[name].c_str()))
- {
- std::string msg = "cannot set environment variable: ";
- msg.append(name);
- throw SystemException(msg);
- }
-}
-
-
-std::string EnvironmentImpl::osNameImpl()
-{
- return runtimeName;
-}
-
-
-std::string EnvironmentImpl::osDisplayNameImpl()
-{
- return osNameImpl();
-}
-
-
-std::string EnvironmentImpl::osVersionImpl()
-{
- return runtimeVersion;
-}
-
-
-std::string EnvironmentImpl::osArchitectureImpl()
-{
-#if POCO_ARCH == POCO_ARCH_IA32
- return "i386";
-#elif POCO_ARCH == POCO_ARCH_MIPS
- return "mips";
-#elif POCO_ARCH == POCO_ARCH_PPC
- return "ppc";
-#elif POCO_ARCH == POCO_ARCH_ARM
- return "arm";
-#elif POCO_ARCH == POCO_ARCH_SH
- return "sh";
-#else
- return "unknown";
-#endif
-}
-
-
-std::string EnvironmentImpl::nodeNameImpl()
-{
- char buffer[64];
- if (gethostname(buffer, sizeof(buffer)) == OK)
- return buffer;
- else
- return "unknown";
-}
-
-
-unsigned EnvironmentImpl::processorCountImpl()
-{
- return 1;
-}
-
-
-void EnvironmentImpl::nodeIdImpl(NodeId& id)
-{
- std::memset(&id, 0, sizeof(id));
-
- int ifIndex = 1;
- char ifName[32];
- for (;;)
- {
- if (ifIndexToIfName(ifIndex, ifName) == OK)
- {
- struct ifnet* pIf = ifunit(ifName);
- if (pIf)
- {
- std::memcpy(&id, ((struct arpcom *) pIf)->ac_enaddr, sizeof(id));
- return;
- }
- }
- else break;
- ++ifIndex;
- }
- throw SystemException("cannot get Ethernet hardware address");
-}
-
-
-} // namespace Poco
+
+// Environment_VX.cpp
+//
+// Library: Foundation
+// Package: Core
+// Module: Environment
+//
+// Copyright (c) 2004-2011, Applied Informatics Software Engineering GmbH.
+// and Contributors.
+//
+// SPDX-License-Identifier: BSL-1.0
+//
+
+
+#include "Poco/Environment_VX.h"
+#include "Poco/Exception.h"
+#include "Poco/Buffer.h"
+#error #include <VxWorks.h>
+#error #include <envLib.h>
+#include <hostLib.h>
+#error #include <ifLib.h>
+#include <sockLib.h>
+#include <ioLib.h>
+#error #include <version.h>
+#include <cstring>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <net/if.h>
+#include <arpa/inet.h>
+#include <netinet/if_ether.h>
+#error #include <ifLib.h>
+#include <unistd.h>
+
+
+namespace Poco {
+
+
+EnvironmentImpl::StringMap EnvironmentImpl::_map;
+FastMutex EnvironmentImpl::_mutex;
+
+
+std::string EnvironmentImpl::getImpl(const std::string& name)
+{
+ FastMutex::ScopedLock lock(_mutex);
+
+ const char* val = getenv(name.c_str());
+ if (val)
+ return std::string(val);
+ else
+ throw NotFoundException(name);
+}
+
+
+bool EnvironmentImpl::hasImpl(const std::string& name)
+{
+ FastMutex::ScopedLock lock(_mutex);
+
+ return getenv(name.c_str()) != 0;
+}
+
+
+void EnvironmentImpl::setImpl(const std::string& name, const std::string& value)
+{
+ FastMutex::ScopedLock lock(_mutex);
+
+ std::string var = name;
+ var.append("=");
+ var.append(value);
+ std::swap(_map[name], var);
+ if (putenv((char*) _map[name].c_str()))
+ {
+ std::string msg = "cannot set environment variable: ";
+ msg.append(name);
+ throw SystemException(msg);
+ }
+}
+
+
+std::string EnvironmentImpl::osNameImpl()
+{
+ return runtimeName;
+}
+
+
+std::string EnvironmentImpl::osDisplayNameImpl()
+{
+ return osNameImpl();
+}
+
+
+std::string EnvironmentImpl::osVersionImpl()
+{
+ return runtimeVersion;
+}
+
+
+std::string EnvironmentImpl::osArchitectureImpl()
+{
+#if POCO_ARCH == POCO_ARCH_IA32
+ return "i386";
+#elif POCO_ARCH == POCO_ARCH_MIPS
+ return "mips";
+#elif POCO_ARCH == POCO_ARCH_PPC
+ return "ppc";
+#elif POCO_ARCH == POCO_ARCH_ARM
+ return "arm";
+#elif POCO_ARCH == POCO_ARCH_SH
+ return "sh";
+#else
+ return "unknown";
+#endif
+}
+
+
+std::string EnvironmentImpl::nodeNameImpl()
+{
+ char buffer[64];
+ if (gethostname(buffer, sizeof(buffer)) == OK)
+ return buffer;
+ else
+ return "unknown";
+}
+
+
+unsigned EnvironmentImpl::processorCountImpl()
+{
+ return 1;
+}
+
+
+void EnvironmentImpl::nodeIdImpl(NodeId& id)
+{
+ std::memset(&id, 0, sizeof(id));
+
+ int ifIndex = 1;
+ char ifName[32];
+ for (;;)
+ {
+ if (ifIndexToIfName(ifIndex, ifName) == OK)
+ {
+ struct ifnet* pIf = ifunit(ifName);
+ if (pIf)
+ {
+ std::memcpy(&id, ((struct arpcom *) pIf)->ac_enaddr, sizeof(id));
+ return;
+ }
+ }
+ else break;
+ ++ifIndex;
+ }
+ throw SystemException("cannot get Ethernet hardware address");
+}
+
+
+} // namespace Poco