Contributors: 23
Author Tokens Token Proportion Commits Commit Proportion
nixiaoming 160 44.94% 3 9.38%
Eric Dumazet 63 17.70% 1 3.12%
Christoph Hellwig 32 8.99% 1 3.12%
Art Haas 24 6.74% 1 3.12%
Linus Torvalds (pre-git) 17 4.78% 3 9.38%
Alexei Starovoitov 10 2.81% 2 6.25%
Eric W. Biedermann 8 2.25% 3 9.38%
Yang Ruirui 6 1.69% 1 3.12%
Peter Zijlstra 6 1.69% 2 6.25%
Cédric Le Goater 4 1.12% 1 3.12%
Matteo Croce 3 0.84% 1 3.12%
Dan Ballard 3 0.84% 1 3.12%
Dan Rosenberg 3 0.84% 1 3.12%
Petr Mladek 3 0.84% 1 3.12%
Linus Torvalds 2 0.56% 1 3.12%
Christian Ehrhardt 2 0.56% 1 3.12%
Joel Granados 2 0.56% 2 6.25%
Al Viro 2 0.56% 1 3.12%
Song Liu 2 0.56% 1 3.12%
Thomas Gleixner 1 0.28% 1 3.12%
Theodore Y. Ts'o 1 0.28% 1 3.12%
Andrew Morton 1 0.28% 1 3.12%
Chenbo Feng 1 0.28% 1 3.12%
Total 356 32


// SPDX-License-Identifier: GPL-2.0-only
/*
 * sysctl.c: General linux system control interface
 */

#include <linux/sysctl.h>
#include <linux/printk.h>
#include <linux/capability.h>
#include <linux/ratelimit.h>
#include "internal.h"

static const int ten_thousand = 10000;

static int proc_dointvec_minmax_sysadmin(const struct ctl_table *table, int write,
				void *buffer, size_t *lenp, loff_t *ppos)
{
	if (write && !capable(CAP_SYS_ADMIN))
		return -EPERM;

	return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
}

static struct ctl_table printk_sysctls[] = {
	{
		.procname	= "printk",
		.data		= &console_loglevel,
		.maxlen		= 4*sizeof(int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec,
	},
	{
		.procname	= "printk_ratelimit",
		.data		= &printk_ratelimit_state.interval,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec_jiffies,
	},
	{
		.procname	= "printk_ratelimit_burst",
		.data		= &printk_ratelimit_state.burst,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec,
	},
	{
		.procname	= "printk_delay",
		.data		= &printk_delay_msec,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec_minmax,
		.extra1		= SYSCTL_ZERO,
		.extra2		= (void *)&ten_thousand,
	},
	{
		.procname	= "printk_devkmsg",
		.data		= devkmsg_log_str,
		.maxlen		= DEVKMSG_STR_MAX_SIZE,
		.mode		= 0644,
		.proc_handler	= devkmsg_sysctl_set_loglvl,
	},
	{
		.procname	= "dmesg_restrict",
		.data		= &dmesg_restrict,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec_minmax_sysadmin,
		.extra1		= SYSCTL_ZERO,
		.extra2		= SYSCTL_ONE,
	},
	{
		.procname	= "kptr_restrict",
		.data		= &kptr_restrict,
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec_minmax_sysadmin,
		.extra1		= SYSCTL_ZERO,
		.extra2		= SYSCTL_TWO,
	},
};

void __init printk_sysctl_init(void)
{
	register_sysctl_init("kernel", printk_sysctls);
}