Contributors: 22
Author Tokens Token Proportion Commits Commit Proportion
nixiaoming 163 45.66% 2 6.90%
Eric Dumazet 63 17.65% 1 3.45%
Christoph Hellwig 27 7.56% 1 3.45%
Art Haas 24 6.72% 1 3.45%
Linus Torvalds (pre-git) 20 5.60% 3 10.34%
Alexei Starovoitov 10 2.80% 2 6.90%
Eric W. Biedermann 9 2.52% 3 10.34%
Peter Zijlstra 6 1.68% 2 6.90%
Yang Ruirui 6 1.68% 1 3.45%
Hideaki Yoshifuji / 吉藤英明 5 1.40% 1 3.45%
Matteo Croce 3 0.84% 1 3.45%
Dan Ballard 3 0.84% 1 3.45%
Petr Mladek 3 0.84% 1 3.45%
Dan Rosenberg 3 0.84% 1 3.45%
Christian Ehrhardt 2 0.56% 1 3.45%
Al Viro 2 0.56% 1 3.45%
Linus Torvalds 2 0.56% 1 3.45%
Song Liu 2 0.56% 1 3.45%
Chenbo Feng 1 0.28% 1 3.45%
Thomas Gleixner 1 0.28% 1 3.45%
Andrew Morton 1 0.28% 1 3.45%
Theodore Y. Ts'o 1 0.28% 1 3.45%
Total 357 29


// 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(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);
}