1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-16 00:00:02 +01:00
VILLASnode/common/include/villas/kernel/kernel.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

85 lines
2.5 KiB
C++
Raw Normal View History

2018-08-27 11:11:28 +02:00
/** Linux kernel related functions.
*
* @file
* @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
2021-06-21 16:09:11 -04:00
* @copyright 2014-2021, Institute for Automation of Complex Power Systems, EONERC
2018-08-27 11:11:28 +02:00
* @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/>.
*********************************************************************************/
#pragma once
2019-10-27 20:23:47 +01:00
#include <cstddef>
2018-08-27 11:11:28 +02:00
#include <villas/version.hpp>
namespace villas {
namespace kernel {
/** Get the version of the kernel. */
utils::Version getVersion();
2019-10-27 20:23:47 +01:00
/** Get number of reserved hugepages. */
2021-05-20 06:08:12 -04:00
int getNrHugepages();
2019-10-27 20:23:47 +01:00
/** Set number of reserved hugepages. */
2021-05-20 06:08:12 -04:00
int setNrHugepages(int nr);
2019-10-27 20:23:47 +01:00
/** Get kernel cmdline parameter
*
* See https://www.kernel.org/doc/Documentation/kernel-parameters.txt
*
* @param param The cmdline parameter to look for.
* @param buf The string buffer to which the parameter value will be copied to.
* @param len The length of the buffer \p value
* @retval 0 Parameter \p key was found and value was copied to \p value
* @reval <>0 Kernel was not booted with parameter \p key
*/
2021-05-20 06:08:12 -04:00
int getCmdlineParam(const char *param, char *buf, size_t len);
2019-10-27 20:23:47 +01:00
/** Checks if a kernel module is loaded
*
* @param module the name of the module
* @retval 0 Module is loaded.
* @reval <>0 Module is not loaded.
*/
2021-05-20 06:08:12 -04:00
int isModuleLoaded(const char *module);
2019-10-27 20:23:47 +01:00
/** Load kernel module via modprobe */
2021-05-20 06:08:12 -04:00
int loadModule(const char *module);
2019-10-27 20:23:47 +01:00
/** Set parameter of loaded kernel module */
2021-05-20 06:08:12 -04:00
int setModuleParam(const char *module, const char *param, const char *value);
2019-10-27 20:23:47 +01:00
/** Get cacheline size in bytes */
2021-05-20 06:08:12 -04:00
int getCachelineSize();
2019-10-27 20:23:47 +01:00
/** Get the size of a standard page in bytes. */
2021-05-20 06:08:12 -04:00
int getPageSize();
2019-10-27 20:23:47 +01:00
/** Get the size of a huge page in bytes. */
2021-05-20 06:08:12 -04:00
int getHugePageSize();
2019-10-27 20:23:47 +01:00
/** Get CPU base frequency */
int get_cpu_frequency(uint64_t *freq);
/** Set SMP affinity of IRQ */
2021-05-20 06:08:12 -04:00
int setIRQAffinity(unsigned irq, uintmax_t aff , uintmax_t *old);
2019-10-27 20:23:47 +01:00
} /* namespace villas */
} /* namespace kernel */