Skip to content

Commit 801b501

Browse files
imtangmengmcgrof
authored andcommitted
kernel/acct: move acct sysctls to its own file
kernel/sysctl.c is a kitchen sink where everyone leaves their dirty dishes, this makes it very difficult to maintain. To help with this maintenance let's start by moving sysctls to places where they actually belong. The proc sysctl maintainers do not want to know what sysctl knobs you wish to add for your own piece of code, we just care about the core logic. All filesystem syctls now get reviewed by fs folks. This commit follows the commit of fs, move the acct sysctl to its own file, kernel/acct.c. Signed-off-by: tangmeng <[email protected]> Signed-off-by: Luis Chamberlain <[email protected]>
1 parent 9df9186 commit 801b501

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

include/linux/acct.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
#ifdef CONFIG_BSD_PROCESS_ACCT
2323
struct pid_namespace;
24-
extern int acct_parm[]; /* for sysctl */
2524
extern void acct_collect(long exitcode, int group_dead);
2625
extern void acct_process(void);
2726
extern void acct_exit_ns(struct pid_namespace *);

kernel/acct.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,31 @@
7070
* Turned into sysctl-controllable parameters. AV, 12/11/98
7171
*/
7272

73-
int acct_parm[3] = {4, 2, 30};
73+
static int acct_parm[3] = {4, 2, 30};
7474
#define RESUME (acct_parm[0]) /* >foo% free space - resume */
7575
#define SUSPEND (acct_parm[1]) /* <foo% free space - suspend */
7676
#define ACCT_TIMEOUT (acct_parm[2]) /* foo second timeout between checks */
7777

78+
#ifdef CONFIG_SYSCTL
79+
static struct ctl_table kern_acct_table[] = {
80+
{
81+
.procname = "acct",
82+
.data = &acct_parm,
83+
.maxlen = 3*sizeof(int),
84+
.mode = 0644,
85+
.proc_handler = proc_dointvec,
86+
},
87+
{ }
88+
};
89+
90+
static __init int kernel_acct_sysctls_init(void)
91+
{
92+
register_sysctl_init("kernel", kern_acct_table);
93+
return 0;
94+
}
95+
late_initcall(kernel_acct_sysctls_init);
96+
#endif /* CONFIG_SYSCTL */
97+
7898
/*
7999
* External references and all of the globals.
80100
*/

kernel/sysctl.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,6 @@
8282
#ifdef CONFIG_SPARC
8383
#include <asm/setup.h>
8484
#endif
85-
#ifdef CONFIG_BSD_PROCESS_ACCT
86-
#include <linux/acct.h>
87-
#endif
8885
#ifdef CONFIG_RT_MUTEXES
8986
#include <linux/rtmutex.h>
9087
#endif
@@ -1856,15 +1853,6 @@ static struct ctl_table kern_table[] = {
18561853
.proc_handler = proc_dostring,
18571854
},
18581855
#endif
1859-
#ifdef CONFIG_BSD_PROCESS_ACCT
1860-
{
1861-
.procname = "acct",
1862-
.data = &acct_parm,
1863-
.maxlen = 3*sizeof(int),
1864-
.mode = 0644,
1865-
.proc_handler = proc_dointvec,
1866-
},
1867-
#endif
18681856
#ifdef CONFIG_MAGIC_SYSRQ
18691857
{
18701858
.procname = "sysrq",

0 commit comments

Comments
 (0)