Skip to content

Commit 8e5f04b

Browse files
committed
fork: mv threads-max into kernel/fork.c
make sysctl_max_threads static as it no longer needs to be exported into sysctl.c. This is part of a greater effort to move ctl tables into their respective subsystems which will reduce the merge conflicts in kernel/sysctl.c. Reviewed-by: Luis Chamberlain <[email protected]> Reviewed-by: Kees Cook <[email protected]> Signed-off-by: Joel Granados <[email protected]>
1 parent 9e2f403 commit 8e5f04b

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

include/linux/sysctl.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,4 @@ static inline bool sysctl_is_alias(char *param)
284284
}
285285
#endif /* CONFIG_SYSCTL */
286286

287-
int sysctl_max_threads(const struct ctl_table *table, int write, void *buffer,
288-
size_t *lenp, loff_t *ppos);
289-
290287
#endif /* _LINUX_SYSCTL_H */

kernel/fork.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3216,7 +3216,7 @@ int unshare_files(void)
32163216
return 0;
32173217
}
32183218

3219-
int sysctl_max_threads(const struct ctl_table *table, int write,
3219+
static int sysctl_max_threads(const struct ctl_table *table, int write,
32203220
void *buffer, size_t *lenp, loff_t *ppos)
32213221
{
32223222
struct ctl_table t;
@@ -3238,3 +3238,21 @@ int sysctl_max_threads(const struct ctl_table *table, int write,
32383238

32393239
return 0;
32403240
}
3241+
3242+
static const struct ctl_table fork_sysctl_table[] = {
3243+
{
3244+
.procname = "threads-max",
3245+
.data = NULL,
3246+
.maxlen = sizeof(int),
3247+
.mode = 0644,
3248+
.proc_handler = sysctl_max_threads,
3249+
},
3250+
};
3251+
3252+
static int __init init_fork_sysctl(void)
3253+
{
3254+
register_sysctl_init("kernel", fork_sysctl_table);
3255+
return 0;
3256+
}
3257+
3258+
subsys_initcall(init_fork_sysctl);

kernel/sysctl.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,13 +1630,6 @@ static const struct ctl_table kern_table[] = {
16301630
.proc_handler = proc_do_cad_pid,
16311631
},
16321632
#endif
1633-
{
1634-
.procname = "threads-max",
1635-
.data = NULL,
1636-
.maxlen = sizeof(int),
1637-
.mode = 0644,
1638-
.proc_handler = sysctl_max_threads,
1639-
},
16401633
{
16411634
.procname = "overflowuid",
16421635
.data = &overflowuid,

0 commit comments

Comments
 (0)