Requires(post): smack
BuildRequires: cmake
BuildRequires: zip
+BuildRequires: pkgconfig(capi-system-resource)
BuildRequires: pkgconfig(libsystemd)
BuildRequires: pkgconfig(libsmack)
BuildRequires: pkgconfig(cynara-commons)
%package -n libcynara-client
Summary: Cynara - client libraries
+BuildRequires: pkgconfig(capi-system-resource)
Obsoletes: libcynara-client-commons
Obsoletes: libcynara-client-async
)
ENDIF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
+IF (BUILD_COMMONS OR BUILD_SERVICE)
+SET(COMMON_DEPS
+ ${COMMON_DEPS}
+ capi-system-resource
+ )
+ENDIF (BUILD_COMMONS OR BUILD_SERVICE)
+
PKG_CHECK_MODULES(CYNARA_DEP
REQUIRED
${COMMON_DEPS}
*/
#include <cinttypes>
-#include <memory>
+#include <cpu-boosting.h>
+#include <unistd.h>
#include <cache/CapacityCache.h>
#include <common.h>
#include <config/PathConfig.h>
+#include <cpu-priority/cpu-priority.h>
#include <cynara-error.h>
#include <exceptions/Exception.h>
#include <exceptions/UnexpectedErrorException.h>
#include <plugins/NaiveInterpreter.h>
#include <protocol/Protocol.h>
#include <protocol/ProtocolClient.h>
-#include <request/MonitorEntriesPutRequest.h>
#include <request/CheckRequest.h>
+#include <request/MonitorEntriesPutRequest.h>
#include <request/pointers.h>
#include <request/SimpleCheckRequest.h>
#include <response/CheckResponse.h>
#include <response/pointers.h>
#include <response/SimpleCheckResponse.h>
#include <sockets/SocketClient.h>
+#include <utils/CallInDestructor.h>
#include <logic/Logic.h>
int Logic::check(const std::string &client, const ClientSession &session, const std::string &user,
const std::string &privilege) {
+
+ const auto tid = gettid();
+ if (resource_set_cpu_inheritance(tid, RESOURCE_CPU_DEST_NAME, 1000) != 0)
+ LOGE("resource_set_cpu_inheritance failed");
+
+ auto resourceCpuInheritanceClearer = CallInDestructor{[tid] {
+ if (resource_clear_cpu_inheritance(tid, RESOURCE_CPU_DEST_NAME) != 0)
+ LOGE("resource_clear_cpu_inheritance failed");
+ }};
+
if (!ensureConnection())
return CYNARA_API_SERVICE_NOT_AVAILABLE;
--- /dev/null
+/*
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * This file is licensed under the terms of MIT License or the Apache License
+ * Version 2.0 of your choice. See the LICENSE.MIT file for MIT license details.
+ * See the LICENSE file or the notice below for Apache License Version 2.0
+ * details.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file src/common/cpu-priority/cpu-priority.h
+ * @author Krzysztof MaĆysa <k.malysa@samsung.com>
+ * @version 1.0
+ * @brief This file is the header containing common cynara CPU boosting priority constants
+ */
+
+#pragma once
+
+namespace Cynara {
+
+inline constexpr auto RESOURCE_CPU_DEST_NAME = "CYNARA_DEST";
+
+} // namespace Cynara
*/
#include <cerrno>
+#include <cpu-boosting.h>
#include <cstdlib>
#include <exception>
#include <fcntl.h>
#endif
#include <common.h>
+#include <common/cpu-priority/cpu-priority.h>
#include <common/error/SafeStrError.h>
#include <log/log.h>
}
}
+ resource_pid_t self_data;
+ self_data.pid = getpid();
+ if (resource_register_cpu_inheritance_destination(Cynara::RESOURCE_CPU_DEST_NAME,
+ self_data) != 0)
+ LOGE("resource_register_cpu_inheritance_destination failed");
+
Cynara::Cynara cynara;
LOGI("Cynara service is starting ...");
cynara.init(openFdsLimit);
LOGD("Time to clean up.");
cynara.finalize();
LOGD("Cynara service is stopped");
+
+ if(resource_unregister_cpu_inheritance_destination(Cynara::RESOURCE_CPU_DEST_NAME) != 0)
+ LOGE("resource_unregister_cpu_inheritance_destination failed");
} catch (std::exception &e) {
LOGC("Cynara stoped because of unhandled exception: %s", e.what());
return EXIT_FAILURE;