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

Timur I. Bakeyev timur at com.bat.ru
Sat Dec 15 06:32:32 MST 2012


That what we use in FreeBSD port. Apparently, topic-starter just doesn't do
it right(tm).

--- ./lib/tevent/tevent_signal.c.orig   2010-04-01 15:26:22.000000000 +0200
+++ ./lib/tevent/tevent_signal.c        2010-04-23 01:08:35.000000000 +0200
@@ -30,7 +30,7 @@
 #include "tevent_internal.h"
 #include "tevent_util.h"

-#define TEVENT_NUM_SIGNALS 64
+#define TEVENT_NUM_SIGNALS (SIGRTMAX+1)

 /* maximum number of SA_SIGINFO signals to hold in the queue.
   NB. This *MUST* be a power of 2, in order for the ring buffer





On Mon, Dec 3, 2012 at 8:57 PM, Jeremy Allison <jra at samba.org> wrote:

> On Mon, Dec 03, 2012 at 11:55:03AM -0800, Richard Sharpe wrote:
> > On Mon, Dec 3, 2012 at 11:41 AM, Jeremy Allison <jra at samba.org> wrote:
> > > 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 ?
> >
> > /usr/include/sys/signal.h
> > ...
> > #define SIGRTMIN        65
> > #define SIGRTMAX        126
>
> Actually looks like using that instead of the hard-coded 64
> is the right decision (IMHO).
>
> Jeremy.
>


More information about the samba-technical mailing list