2010-02-21 14:23:28

by Dave Young

[permalink] [raw]
Subject: [PATCH -mm 03/17] sysctl extern cleanup - binfmts

Extern declarations in sysctl.c should be move to their own head file,
and then include them in relavant .c files.

Move core_uses_pid/core_pattern/core_pipe_limit extern declarations
to linux/binfmts.h
suid_dumpable is declared in binfmts.h already.

Signed-off-by: Dave Young <[email protected]>
---
include/linux/binfmts.h | 5 +++++
kernel/sysctl.c | 5 +----
2 files changed, 6 insertions(+), 4 deletions(-)

--- linux-2.6.32.orig/kernel/sysctl.c 2010-02-21 09:43:05.206481916 +0800
+++ linux-2.6.32/kernel/sysctl.c 2010-02-21 09:44:39.479806692 +0800
@@ -55,6 +55,7 @@
#include <linux/perf_event.h>
#include <linux/rcustring.h>
#include <linux/signal.h>
+#include <linux/binfmts.h>

#include <asm/uaccess.h>
#include <asm/processor.h>
@@ -70,10 +71,6 @@

/* External variables not in a header file. */
extern int max_threads;
-extern int core_uses_pid;
-extern int suid_dumpable;
-extern char *core_pattern;
-extern unsigned int core_pipe_limit;
extern int pid_max;
extern int min_free_kbytes;
extern int pid_max_min, pid_max_max;
--- linux-2.6.32.orig/include/linux/binfmts.h 2010-02-21 09:35:58.627357104 +0800
+++ linux-2.6.32/include/linux/binfmts.h 2010-02-21 09:45:32.279801314 +0800
@@ -20,6 +20,11 @@ struct pt_regs;
#ifdef __KERNEL__
#include <linux/list.h>

+/* for sysctl */
+extern int core_uses_pid;
+extern char *core_pattern;
+extern unsigned int core_pipe_limit;
+
#define CORENAME_MAX_SIZE 128

/*


2010-02-21 14:28:22

by Alexey Dobriyan

[permalink] [raw]
Subject: Re: [PATCH -mm 03/17] sysctl extern cleanup - binfmts

On Sun, Feb 21, 2010 at 10:23:03PM +0800, Dave Young wrote:
> --- linux-2.6.32.orig/include/linux/binfmts.h
> +++ linux-2.6.32/include/linux/binfmts.h
> @@ -20,6 +20,11 @@ struct pt_regs;
> #ifdef __KERNEL__
> #include <linux/list.h>
>
> +/* for sysctl */

This comment is neither accurate nor needed. :^)

In fact master sysctl table always was a big mess, so slight mess
caused by extern declarations is fine.

> +extern int core_uses_pid;
> +extern char *core_pattern;
> +extern unsigned int core_pipe_limit;

2010-02-21 14:36:32

by Alexey Dobriyan

[permalink] [raw]
Subject: Re: [PATCH -mm 03/17] sysctl extern cleanup - binfmts

On Sun, Feb 21, 2010 at 10:33:43PM +0800, Dave Young wrote:
> On Sun, Feb 21, 2010 at 10:28 PM, Alexey Dobriyan <[email protected]> wrote:
> > On Sun, Feb 21, 2010 at 10:23:03PM +0800, Dave Young wrote:
> >> --- linux-2.6.32.orig/include/linux/binfmts.h
> >> +++ linux-2.6.32/include/linux/binfmts.h
> >> @@ -20,6 +20,11 @@ struct pt_regs;
> >> ?#ifdef __KERNEL__
> >> ?#include <linux/list.h>
> >>
> >> +/* for sysctl */
> >
> > This comment is neither accurate nor needed. :^)
>
> Thanks, sounds good, but the there's no other file use the three vars.
>
> >
> > In fact master sysctl table always was a big mess, so slight mess
> > caused by extern declarations is fine.
> >
> >> +extern int core_uses_pid;
> >> +extern char *core_pattern;
> >> +extern unsigned int core_pipe_limit;

In fact coredump code should be moved out of fs/exec.c including headers,
so this movement is quite pointless.

2010-02-21 14:41:27

by Dave Young

[permalink] [raw]
Subject: Re: [PATCH -mm 03/17] sysctl extern cleanup - binfmts

On Sun, Feb 21, 2010 at 10:28 PM, Alexey Dobriyan <[email protected]> wrote:
> On Sun, Feb 21, 2010 at 10:23:03PM +0800, Dave Young wrote:
>> --- linux-2.6.32.orig/include/linux/binfmts.h
>> +++ linux-2.6.32/include/linux/binfmts.h
>> @@ -20,6 +20,11 @@ struct pt_regs;
>>  #ifdef __KERNEL__
>>  #include <linux/list.h>
>>
>> +/* for sysctl */
>
> This comment is neither accurate nor needed. :^)

Thanks, sounds good, but the there's no other file use the three vars.

>
> In fact master sysctl table always was a big mess, so slight mess
> caused by extern declarations is fine.
>
>> +extern int core_uses_pid;
>> +extern char *core_pattern;
>> +extern unsigned int core_pipe_limit;
>



--
Regards
dave