mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
From packit/rawhide-arm64 logs: Assertion 'limit >= INT_MAX || get_process_ppid(limit+1, NULL) == -ESRCH' failed at src/test/test-process-util.c:855, function test_get_process_ppid(). Aborting. ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― The kernel has a few different limits. In particular kernel.threads-max can be set to some lower value, and kernel.pid_max can be set to a higher value. This is nice because it reduces PID reuse, even if the number of threads that is allowed is limited. But the tests assumed that we cannot have a thread with PID above MIN(kernel.threads-max, kernel.pid_max-1), which is not valid. So let's rework the whole thing: let's expose the helpers to read kernel.threads-max and kernel.pid_max, and print what they return in tests. procfs_tasks_get_limit() was something that is only used in tests, and wasn't very well defined, so let's drop it. Fixes #21193.
22 lines
569 B
C
22 lines
569 B
C
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
#pragma once
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include "time-util.h"
|
|
|
|
int procfs_get_pid_max(uint64_t *ret);
|
|
int procfs_get_threads_max(uint64_t *ret);
|
|
|
|
int procfs_tasks_set_limit(uint64_t limit);
|
|
int procfs_tasks_get_current(uint64_t *ret);
|
|
|
|
int procfs_cpu_get_usage(nsec_t *ret);
|
|
|
|
int procfs_memory_get(uint64_t *ret_total, uint64_t *ret_used);
|
|
static inline int procfs_memory_get_used(uint64_t *ret) {
|
|
return procfs_memory_get(NULL, ret);
|
|
}
|
|
|
|
int convert_meminfo_value_to_uint64_bytes(const char *word, uint64_t *ret);
|