mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-30 05:00:10 +01:00
When debug-logging for platform is enabled, every access to sysctl is cached (to log the last values). This cache can grow quite large if the system has a large number of interfaces (e.g. docker creating veth pairs for each container). We already used to clear the cache, when we were about to access sysctl *and* logging was disabled in the meantime. Now, when logging setup changes, immediately clear the cache. Having "nm-logging.c" call into platform code is a bit of a hack and a better design would be to have logging code emit a signal to which platform would subscribe. But that seems to involve much more code (especially, as no other users care about such a signal and because nm-logging is not a GObject). Also, log a warning when the cache grows large to inform the user about the cache and what he can do to clear it. The extra effort to clear the cache when changing logging setup is done so that we do what we tell the user: changing the logging level, will clear the cache -- right away, not some time later when the next message is logged.
55 lines
2.1 KiB
C
55 lines
2.1 KiB
C
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
|
/* nm-linux-platform.h - Linux kernel & udev network configuration layer
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
* any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
*
|
|
* Copyright (C) 2012 Red Hat, Inc.
|
|
*/
|
|
|
|
#ifndef __NETWORKMANAGER_LINUX_PLATFORM_H__
|
|
#define __NETWORKMANAGER_LINUX_PLATFORM_H__
|
|
|
|
#include "nm-platform.h"
|
|
|
|
#define NM_TYPE_LINUX_PLATFORM (nm_linux_platform_get_type ())
|
|
#define NM_LINUX_PLATFORM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_LINUX_PLATFORM, NMLinuxPlatform))
|
|
#define NM_LINUX_PLATFORM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_LINUX_PLATFORM, NMLinuxPlatformClass))
|
|
#define NM_IS_LINUX_PLATFORM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_LINUX_PLATFORM))
|
|
#define NM_IS_LINUX_PLATFORM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_LINUX_PLATFORM))
|
|
#define NM_LINUX_PLATFORM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_LINUX_PLATFORM, NMLinuxPlatformClass))
|
|
|
|
/******************************************************************/
|
|
|
|
struct _NMLinuxPlatformPrivate;
|
|
|
|
typedef struct {
|
|
NMPlatform parent;
|
|
|
|
struct _NMLinuxPlatformPrivate *priv;
|
|
} NMLinuxPlatform;
|
|
|
|
typedef struct {
|
|
NMPlatformClass parent;
|
|
} NMLinuxPlatformClass;
|
|
|
|
/******************************************************************/
|
|
|
|
GType nm_linux_platform_get_type (void);
|
|
|
|
void nm_linux_platform_setup (void);
|
|
|
|
void _nm_linux_platform_sysctl_clear_cache (void);
|
|
|
|
#endif /* __NETWORKMANAGER_LINUX_PLATFORM_H__ */
|