1
0
mirror of https://github.com/systemd/systemd synced 2026-03-14 09:04:47 +01:00

Compare commits

..

No commits in common. "fd7d8bf105f122e5a6aa7b5dfff60e8a0b0f5b4e" and "f8eb41003df1a4eab59ff9bec67b2787c9368dbd" have entirely different histories.

3 changed files with 12 additions and 20 deletions

2
TODO
View File

@ -228,6 +228,8 @@ Features:
* systemd-analyze netif that explains predictable interface (or networkctl) * systemd-analyze netif that explains predictable interface (or networkctl)
* port selinux code from mallinfo() to mallinfo2() once added to glibc
* Add service setting to run a service within the specified VRF. i.e. do the * Add service setting to run a service within the specified VRF. i.e. do the
equivalent of "ip vrf exec". equivalent of "ip vrf exec".

View File

@ -555,7 +555,6 @@ foreach ident : [
#include <signal.h> #include <signal.h>
#include <sys/wait.h>'''], #include <sys/wait.h>'''],
['mallinfo', '''#include <malloc.h>'''], ['mallinfo', '''#include <malloc.h>'''],
['mallinfo2', '''#include <malloc.h>'''],
['execveat', '''#include <unistd.h>'''], ['execveat', '''#include <unistd.h>'''],
['close_range', '''#include <unistd.h>'''], ['close_range', '''#include <unistd.h>'''],
['epoll_pwait2', '''#include <sys/epoll.h>'''], ['epoll_pwait2', '''#include <sys/epoll.h>'''],

View File

@ -84,24 +84,15 @@ void mac_selinux_retest(void) {
} }
#if HAVE_SELINUX #if HAVE_SELINUX
# if HAVE_MALLINFO2 # if HAVE_MALLINFO
# define HAVE_GENERIC_MALLINFO 1 static struct mallinfo mallinfo_nowarn(void) {
typedef struct mallinfo2 generic_mallinfo; /* glibc has deprecated mallinfo(), but the replacement malloc_info() returns an XML blob ;=[ */
static generic_mallinfo generic_mallinfo_get(void) {
return mallinfo2();
}
# elif HAVE_MALLINFO
# define HAVE_GENERIC_MALLINFO 1
typedef struct mallinfo generic_mallinfo;
static generic_mallinfo generic_mallinfo_get(void) {
/* glibc has deprecated mallinfo(), let's suppress the deprecation warning if mallinfo2() doesn't
* exist yet. */
DISABLE_WARNING_DEPRECATED_DECLARATIONS DISABLE_WARNING_DEPRECATED_DECLARATIONS
return mallinfo(); return mallinfo();
REENABLE_WARNING REENABLE_WARNING
} }
# else # else
# define HAVE_GENERIC_MALLINFO 0 # warning "mallinfo() is missing, add mallinfo2() supported instead."
# endif # endif
static int open_label_db(void) { static int open_label_db(void) {
@ -109,8 +100,8 @@ static int open_label_db(void) {
usec_t before_timestamp, after_timestamp; usec_t before_timestamp, after_timestamp;
char timespan[FORMAT_TIMESPAN_MAX]; char timespan[FORMAT_TIMESPAN_MAX];
# if HAVE_GENERIC_MALLINFO # if HAVE_MALLINFO
generic_mallinfo before_mallinfo = generic_mallinfo_get(); struct mallinfo before_mallinfo = mallinfo_nowarn();
# endif # endif
before_timestamp = now(CLOCK_MONOTONIC); before_timestamp = now(CLOCK_MONOTONIC);
@ -119,10 +110,10 @@ static int open_label_db(void) {
return log_enforcing_errno(errno, "Failed to initialize SELinux labeling handle: %m"); return log_enforcing_errno(errno, "Failed to initialize SELinux labeling handle: %m");
after_timestamp = now(CLOCK_MONOTONIC); after_timestamp = now(CLOCK_MONOTONIC);
# if HAVE_GENERIC_MALLINFO # if HAVE_MALLINFO
generic_mallinfo after_mallinfo = generic_mallinfo_get(); struct mallinfo after_mallinfo = mallinfo_nowarn();
size_t l = LESS_BY((size_t) after_mallinfo.uordblks, (size_t) before_mallinfo.uordblks); int l = after_mallinfo.uordblks > before_mallinfo.uordblks ? after_mallinfo.uordblks - before_mallinfo.uordblks : 0;
log_debug("Successfully loaded SELinux database in %s, size on heap is %zuK.", log_debug("Successfully loaded SELinux database in %s, size on heap is %iK.",
format_timespan(timespan, sizeof(timespan), after_timestamp - before_timestamp, 0), format_timespan(timespan, sizeof(timespan), after_timestamp - before_timestamp, 0),
DIV_ROUND_UP(l, 1024)); DIV_ROUND_UP(l, 1024));
# else # else