Commit 3c1d3bc9 authored by Steffen Vogel's avatar Steffen Vogel 🎅🏼
Browse files

smaller fixups

parent 2e2aa196
......@@ -26,10 +26,6 @@
#pragma once
#ifndef V
#define V 2
#endif
#define PROJECT_VERSION_STR "@CMAKE_PROJECT_VERSION_STR@"
#define PROJECT_VERSION "@CMAKE_PROJECT_VERSION@"
#define PROJECT_MAJOR_VERSION @CMAKE_PROJECT_MAJOR_VERSION@
......@@ -52,6 +48,7 @@
#cmakedefine LIBCONFIG_FOUND
/* Paths */
#define PREFIX "@CMAKE_INSTALL_PREFIX@"
#define PLUGIN_PATH "@CMAKE_INSTALL_PREFIX@/share/villas/node/plugins"
#define WEB_PATH "@CMAKE_INSTALL_PREFIX@/share/villas/node/web"
#define SYSFS_PATH "/sys"
......
......@@ -191,10 +191,7 @@ public:
}
};
#endif
} // namespace villas
} // namespace utils
#include <fmt/format.h>
#endif
......@@ -74,9 +74,11 @@ public:
template<typename... Args>
JsonError(const json_error_t &err, const std::string &what, Args&&... args) :
std::runtime_error(fmt::format(what, std::forward<Args>(args)...))
{ }
{
(void) err;
}
virtual const char * what()
virtual const char * what() const noexcept
{
return fmt::format("{}: {} in {}:{}:{}",
std::runtime_error::what(),
......@@ -100,14 +102,14 @@ public:
setting(s)
{ }
std::string docUri()
std::string docUri() const
{
std::string baseUri = "https://villas.fein-aachen.org/doc/jump?";
return baseUri + id;
}
virtual const char * what()
virtual const char * what() const noexcept
{
std::stringstream ss;
......
......@@ -30,7 +30,8 @@ add_library(villas-common SHARED
hash_table.c
hist.c
kernel/kernel.c
kernel/rt.c
kernel/kernel.cpp
kernel/rt.cpp
list.c
log.cpp
log_legacy.cpp
......@@ -44,6 +45,7 @@ add_library(villas-common SHARED
utils.c
utils.cpp
cpuset.cpp
terminal.cpp
version.cpp
)
......
......@@ -34,7 +34,9 @@
#include <villas/kernel/kernel.hpp>
#include <villas/kernel/rt.hpp>
using villas::utils::CpuSet;
#ifdef __linux__
using villas::utils::CpuSet;
#endif /* __linux__ */
namespace villas {
namespace kernel {
......@@ -67,6 +69,8 @@ int init(int priority, int affinity)
lockMemory();
#else
logger->warn("This platform is not optimized for real-time execution");
(void) affinity;
(void) priority;
#endif
return 0;
......
......@@ -233,7 +233,7 @@ MemoryTranslation::operator+=(const MemoryTranslation& other)
this->dst = other.dst;
// the source stays the same and can only increase with merged translations
this->src = this->src;
//this->src = this->src;
if(otherSrcIsSmaller) {
// other mapping starts at lower addresses, so we actually arrive at
......
/** Terminal handling.
*
* @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
* @copyright 2018, Institute for Automation of Complex Power Systems, EONERC
* @license GNU General Public License (version 3)
*
* VILLAScommon
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
#include <unistd.h>
#include <villas/terminal.hpp>
#include <villas/exceptions.hpp>
#include <villas/log.hpp>
using namespace villas;
struct winsize Terminal::window;
Terminal::Terminal()
{
int ret;
isTty = isatty(fileno(stdin));
if (isTty) {
struct sigaction sa_resize;
sa_resize.sa_flags = SA_SIGINFO;
sa_resize.sa_sigaction = resize;
sigemptyset(&sa_resize.sa_mask);
ret = sigaction(SIGWINCH, &sa_resize, NULL);
if (ret)
throw new SystemError("Failed to register signal handler");
/* Try to get initial terminal dimensions */
ret = ioctl(STDERR_FILENO, TIOCGWINSZ, &window);
if (ret)
throw new SystemError("Failed to get terminal dimensions");
}
/* Fallback if for some reason we can not determine a prober window size */
if (window.ws_col == 0)
window.ws_col = 150;
if (window.ws_row == 0)
window.ws_row = 50;
}
void Terminal::resize(int, siginfo_t *, void *)
{
int ret;
ret = ioctl(STDERR_FILENO, TIOCGWINSZ, &window);
if (ret)
throw new SystemError("Failed to get terminal dimensions");
auto logger = logging.get("terminal");
logger->debug("New terminal size: {}x{}", window.ws_row, window.ws_col);
};
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment