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.

68 lines
1.8 KiB
C++
Raw Normal View History

/* Linux kernel related functions.
2018-08-27 11:11:28 +02:00
*
* Author: Steffen Vogel <post@steffenvogel.de>
* SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
* SPDX-License-Identifier: Apache-2.0
*/
2018-08-27 11:11:28 +02:00
#pragma once
2019-10-27 20:23:47 +01:00
#include <cstddef>
#include <cstdint>
2019-10-27 20:23:47 +01:00
2018-08-27 11:11:28 +02:00
#include <villas/version.hpp>
namespace villas {
namespace kernel {
// Get the version of the kernel
2018-08-27 11:11:28 +02:00
utils::Version getVersion();
// 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
2019-10-27 20:23:47 +01:00
int get_cpu_frequency(uint64_t *freq);
// Set SMP affinity of IRQ
int setIRQAffinity(unsigned irq, uintmax_t aff, uintmax_t *old);
2019-10-27 20:23:47 +01:00
} // namespace kernel
} // namespace villas