Defining TEVENT_NUM_SIGNALS as (2 * SIGRTMIN) so that SIGNAL-based AIO handling on FreeBSD works

Richard Sharpe realrichardsharpe at gmail.com
Sat Dec 15 08:59:47 MST 2012


On Sat, Dec 15, 2012 at 5:30 AM, Timur I. Bakeyev <timur at com.bat.ru> wrote:
> Jeremy, in FreeBSD port we fix it with following patch. That make us sure
> that we have sane SIGRTMIN/MAX later on for the usage in tevent. And this
> patch is somewhat 3 years old. I've sent it to the list, but it never went
> through...

Perhaps I am confused here, but the problem does not seem to be that
SIGRTMIN is not defined!

The problem seems to be that the tevent code will not allow a signal
larger than TEVENT_NUM_SIGNALS to be registered, and:

#define TEVENT_NUM_SIGNALS 64

but that the various code does:

[rsharpe at localhost samba.master]$ grep SIGRTMIN source3/smbd/*.c
source3/smbd/oplock_linux.c:#define RT_SIGNAL_LEASE (SIGRTMIN+1)
[rsharpe at localhost samba.master]$ grep SIGRTMIN source3/modules/*.c
source3/modules/vfs_aio_posix.c:#define RT_SIGNAL_AIO	(SIGRTMIN+3)

and SIGRTMIN is defined as 64 on FreeBSD.


> --- ./lib/replace/system/wait.h.orig    2010-04-01 15:26:22.000000000 +0200
> +++ ./lib/replace/system/wait.h 2010-04-23 01:08:35.000000000 +0200
> @@ -32,6 +32,18 @@
>
>  #include <signal.h>
>
> +#ifndef SIGRTMIN
> +#      ifdef NSIG
> +#              define SIGRTMIN (NSIG+1)
> +#      else
> +#              define SIGRTMIN 33
> +#      endif
> +#endif
> +
> +#ifndef SIGRTMAX
> +#define SIGRTMAX (SIGRTMIN+64)
> +#endif
> +
>  #ifndef SIGCLD
>  #define SIGCLD SIGCHLD
>  #endif
>
>
>
> On Tue, Dec 4, 2012 at 6:10 PM, Jeremy Allison <jra at samba.org> wrote:
>
>> On Tue, Dec 04, 2012 at 08:20:11AM +0100, Stefan (metze) Metzmacher wrote:
>> > Am 03.12.2012 20:41, schrieb Jeremy Allison:
>> > > On Fri, Nov 30, 2012 at 03:06:18PM -0800, Richard Sharpe wrote:
>> > >> Hi folks,
>> > >>
>> > >> I am canvassing opinions on whether there is a better way to do this.
>> > >>
>> > >> Currently, the default AIO stuff in Samba does not work on FreeBSD
>> > >> because TEVENT_NUM_SIGNALS is set to 64 and there is a check to see
>> > >> that the signal number used by the AIO stuff does not exceed this
>> > >> number.
>> > >>
>> > >> However, if RT_SIGNAL_AIO Is not set, then:
>> > >>
>> > >> /* The signal we'll use to signify aio done. */
>> > >> #ifndef RT_SIGNAL_AIO
>> > >> #define RT_SIGNAL_AIO   (SIGRTMIN+3)
>> > >> #endif
>> > >>
>> > >> in source3/smbd/aio.c but on FreeBSD
>> > >>
>> > >> /usr/include/sys/signal.h:#define       SIGRTMIN        65
>> > >>
>> > >> So, things do not work.
>> > >>
>> > >> One solution is to define TEVENT_NUM_SIGNALS as 2 * SIGRTMIN ...
>> > >>
>> > >> On Linux SIGRTMIN is 32.
>> > >>
>> > >> Can anyone suggest a better fix?
>> > >
>> > > Took a quick look at this and at least on Linux there's
>> > >
>> > > #define SIGRTMAX
>> > >
>> > > which looks like it might be part of the POSIX-RT standard.
>> > >
>> > > Is this defined on *BSD ? If so, what is it defined to ?
>> >
>> > At least this doesn't work on Linux.
>> >
>> >
>> https://gitweb.samba.org/?p=metze/samba/wip.git;a=commitdiff;h=9a92ca3b637d41709ded56a5161ff9ff7505f677
>> >
>> > As SIGRTMAX is not a const value.
>>
>> Yes, I already discovered that :-). I'm still thinking
>> about how to fix this..
>>
>> Jeremy.
>>



-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)


More information about the samba-technical mailing list