lkml.org 
[lkml]   [2009]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/4] mqueue namespace: adapt sysctl
Quoting Andrew Morton (akpm@linux-foundation.org):
> On Wed, 25 Feb 2009 01:32:45 +0300
> Alexey Dobriyan <adobriyan@gmail.com> wrote:
>
> > > > +proc_handler *proc_mq_dointvec = NULL;
> > > > +proc_handler *proc_mq_dointvec_minmax = NULL;
> > > > +#endif
> > >
> > > looks odd. Was this
> > >
> > > --- a/ipc/mq_sysctl.c~mqueue-namespace-adapt-sysctl-update-fix
> > > +++ a/ipc/mq_sysctl.c
> > > @@ -52,8 +52,8 @@ static int proc_mq_dointvec_minmax(ctl_t
> > > lenp, ppos);
> > > }
> > > #else
> > > -proc_handler *proc_mq_dointvec = NULL;
> > > -proc_handler *proc_mq_dointvec_minmax = NULL;
> > > +#define proc_mq_dointvec NULL
> > > +#define proc_mq_dointvec_minmax NULL
> > > #endif
> >
> > I hope, not.
> >
> > "#define foo NULL" is the least intrusive thing.
>
> well the original code would have spat a warning at compile time
> then tried to execute code from BSS at runtime, methinks.
>
> But I can't be assed working out how to disable CONFIG_SYSCTL to
> test that. Gawd I hate `select'.

Yeah that's a pain... but so I tested it with the below userspace
program before sending the patch and the 'if (myhandler)' check (which
is analogous to the check in proc_sys_call_handler) worked as expected.

thanks,
-serge

#include <stdio.h>

typedef int proc_handler (int a, int b);

#ifdef FOO
int myhandler(int a, int b) {
printf("a was %d b was %d\n", a, b);
}
#else
proc_handler *myhandler = NULL;
#endif

int main()
{
if (myhandler)
myhandler(1, 2);
}


\
 
 \ /
  Last update: 2009-02-25 00:25    [from the cache]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog