app-admin/ananicy-cpp: fix build with glibc-2.41 and clang-19

Closes: https://bugs.gentoo.org/960226
Signed-off-by: Takuya Wakazono <pastalian46@gmail.com>
This commit is contained in:
Takuya Wakazono
2026-01-09 22:52:52 +09:00
parent 45dba21afc
commit 58574b25fd
3 changed files with 152 additions and 2 deletions

View File

@@ -24,13 +24,13 @@ RDEPEND="
!app-admin/ananicy
>=dev-cpp/nlohmann_json-3.9
>=dev-libs/libfmt-8:=
>=dev-libs/spdlog-1.9
>=dev-libs/spdlog-1.9:=
bpf? (
dev-libs/elfutils
dev-libs/libbpf
dev-util/bpftool
)
systemd? ( sys-apps/systemd )
systemd? ( sys-apps/systemd:= )
"
DEPEND="
@@ -41,6 +41,8 @@ DEPEND="
PATCHES=(
"${FILESDIR}/${P}-remove-debug-flags.patch"
"${FILESDIR}/${P}-clang-19.patch"
"${FILESDIR}/${P}-glibc-2.41.patch"
)
pkg_setup() {

View File

@@ -0,0 +1,45 @@
https://gitlab.com/ananicy-cpp/ananicy-cpp/-/commit/b2589a9b1faa2ecf54aeede40ea781c33bfb09a8
From: John Titor <50095635+JohnRTitor@users.noreply.github.com>
Date: Fri, 27 Dec 2024 11:37:04 +0530
Subject: [PATCH] atomic-queue: fix build with clang 19
> error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
Co-authored-by: Reno Dakota <paparodeo@proton.me>
--- a/include/utility/atomic_queue/atomic_queue.h
+++ b/include/utility/atomic_queue/atomic_queue.h
@@ -393,13 +393,13 @@ class AtomicQueue2 : public AtomicQueueCommon<AtomicQueue2<T, SIZE, MINIMIZE_CON
T do_pop(unsigned tail) noexcept {
unsigned index = details::remap_index<SHUFFLE_BITS>(tail % size_);
- return Base::template do_pop_any(states_[index], elements_[index]);
+ return Base::template do_pop_any<T>(states_[index], elements_[index]);
}
template<class U>
void do_push(U&& element, unsigned head) noexcept {
unsigned index = details::remap_index<SHUFFLE_BITS>(head % size_);
- Base::template do_push_any(std::forward<U>(element), states_[index], elements_[index]);
+ Base::template do_push_any<U>(std::forward<U>(element), states_[index], elements_[index]);
}
public:
@@ -521,13 +521,13 @@ class AtomicQueueB2 : public AtomicQueueCommon<AtomicQueueB2<T, A, MAXIMIZE_THRO
T do_pop(unsigned tail) noexcept {
unsigned index = details::remap_index<SHUFFLE_BITS>(tail & (size_ - 1));
- return Base::template do_pop_any(states_[index], elements_[index]);
+ return Base::template do_pop_any<T>(states_[index], elements_[index]);
}
template<class U>
void do_push(U&& element, unsigned head) noexcept {
unsigned index = details::remap_index<SHUFFLE_BITS>(head & (size_ - 1));
- Base::template do_push_any(std::forward<U>(element), states_[index], elements_[index]);
+ Base::template do_push_any<U>(std::forward<U>(element), states_[index], elements_[index]);
}
public:
--
GitLab

View File

@@ -0,0 +1,103 @@
https://gitlab.com/ananicy-cpp/ananicy-cpp/-/commit/99e64815bacaf3baa28ad89d022e33ebede94fa9
From: Antoine Viallon <antoine@lesviallon.fr>
Date: Thu, 3 Apr 2025 14:24:10 +0200
Subject: [PATCH] [Platform/Linux] rename sched_*attr symbols to avoid
conflicts with newer GLibc versions
(cherry picked from commit 6748f23c5f1eaf6c15cb771a3804e3e527015903)
--- a/src/platform/linux/priority.cpp
+++ b/src/platform/linux/priority.cpp
@@ -185,12 +185,12 @@ std::string_view test_latnice_support() noexcept {
// Use this here instead of function,
// to suppress errors from function call.
- struct sched_attr attr = {
- .size = sizeof(struct sched_attr),
+ struct ananicy_sched_attr attr = {
+ .size = sizeof(struct ananicy_sched_attr),
.sched_flags = SCHED_FLAG_LATENCY_NICE | SCHED_FLAG_KEEP_PARAMS,
.sched_latency_nice = latency_nice,
};
- const std::int32_t err = sched_setattr(pid, &attr, 0);
+ const std::int32_t err = ananicy_sched_setattr(pid, &attr, 0);
bool is_supported{};
if (err == 0 && errno == 0) {
set_latnice(pid, saved_latnice);
--- a/src/platform/linux/process_info.cpp
+++ b/src/platform/linux/process_info.cpp
@@ -104,16 +104,16 @@ static std::string get_sched_policy_name(unsigned sched_policy) {
}
}
-static sched_attr get_sched_attributes(process_id_t pid) {
+static ananicy_sched_attr get_sched_attributes(process_id_t pid) {
- ::sched_attr attr{};
- sched_getattr(static_cast<pid_t>(pid), &attr, sizeof(attr), 0);
+ ::ananicy_sched_attr attr{};
+ ananicy_sched_getattr(static_cast<pid_t>(pid), &attr, sizeof(attr), 0);
return attr;
}
bool is_realtime(process_id_t pid) {
- const sched_attr attr = get_sched_attributes(pid);
+ const ananicy_sched_attr attr = get_sched_attributes(pid);
return attr.sched_priority > 0;
}
--- a/src/platform/linux/syscalls.h
+++ b/src/platform/linux/syscalls.h
@@ -69,7 +69,7 @@ static int ioprio_get(__priority_which_t _which, id_t _who) {
#define SCHED_FLAG_KEEP_POLICY 0x08
#endif
-struct [[gnu::packed]] sched_attr {
+struct [[gnu::packed]] ananicy_sched_attr {
uint32_t size;
uint32_t sched_policy; // SCHED_(FIFO,RR,DEADLINE,OTHER,BATCH,IDLE, etc.)
@@ -94,20 +94,20 @@ struct [[gnu::packed]] sched_attr {
int32_t sched_latency_nice;
};
-static int sched_setattr(pid_t pid, const struct sched_attr *attr,
+static int ananicy_sched_setattr(pid_t pid, const struct ananicy_sched_attr *attr,
unsigned int flags) {
return static_cast<int>(syscall(__NR_sched_setattr, pid, attr, flags));
}
-static int sched_getattr(pid_t pid, struct sched_attr *attr, unsigned int size,
+static int ananicy_sched_getattr(pid_t pid, struct ananicy_sched_attr *attr, unsigned int size,
unsigned int flags) {
return static_cast<int>(syscall(__NR_sched_getattr, pid, attr, size, flags));
}
static int get_latnice(pid_t pid) {
// pid==0 refers to calling thread
- struct sched_attr attr = { .size = sizeof(struct sched_attr) };
- if (sched_getattr(pid, &attr, sizeof(attr), 0) < 0) {
+ struct ananicy_sched_attr attr = { .size = sizeof(struct ananicy_sched_attr) };
+ if (ananicy_sched_getattr(pid, &attr, sizeof(attr), 0) < 0) {
std::perror("sched_getattr");
}
return attr.sched_latency_nice; // defaults to 0
@@ -115,12 +115,12 @@ static int get_latnice(pid_t pid) {
static int set_latnice(pid_t pid, int latency_nice) {
// pid==0 refers to calling thread
- struct sched_attr attr = {
- .size = sizeof(struct sched_attr),
+ struct ananicy_sched_attr attr = {
+ .size = sizeof(struct ananicy_sched_attr),
.sched_flags = SCHED_FLAG_LATENCY_NICE | SCHED_FLAG_KEEP_PARAMS,
.sched_latency_nice = latency_nice,
};
- const int err = sched_setattr(pid, &attr, 0);
+ const int err = ananicy_sched_setattr(pid, &attr, 0);
if (err < 0) {
// sched_setattr failed
if (errno == EINVAL) {
--
GitLab