This patch make it possible to build the events library completely
[metze/samba/wip.git] / source / lib / events / events_signal.c
index 2a75a0c0bdca32bf6d87a1070d15dcd3957f6c20..5c74c47eddc649c38aa37b084ea8be9aa70800f4 100644 (file)
@@ -7,7 +7,7 @@
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "includes.h"
+#include <signal.h>
+#include "replace.h"
 #include "system/filesys.h"
 #include "system/select.h"
-#include "system/wait.h"
-#include "lib/util/dlinklist.h"
-#include "lib/events/events.h"
-#include "lib/events/events_internal.h"
+#include "events.h"
+#include "events_internal.h"
 
 #define NUM_SIGNALS 64
 
@@ -218,8 +216,8 @@ struct signal_event *common_event_add_signal(struct event_context *ev,
                if (sig_state->pipe_hack[0] == 0 && 
                    sig_state->pipe_hack[1] == 0) {
                        pipe(sig_state->pipe_hack);
-                       set_blocking(sig_state->pipe_hack[0], False);
-                       set_blocking(sig_state->pipe_hack[1], False);
+                       ev_set_blocking(sig_state->pipe_hack[0], false);
+                       ev_set_blocking(sig_state->pipe_hack[1], false);
                }
                ev->pipe_fde = event_add_fd(ev, ev, sig_state->pipe_hack[0],
                                            EVENT_FD_READ, signal_pipe_handler, NULL);
@@ -258,7 +256,7 @@ int common_event_check_signal(struct event_context *ev)
                                for (j=0;j<count;j++) {
                                        /* note the use of the sig_info array as a
                                           ring buffer */
-                                       int ofs = (counter.count + j) % SA_INFO_QUEUE_COUNT;
+                                       int ofs = ((count-1) + j) % SA_INFO_QUEUE_COUNT;
                                        se->handler(ev, se, i, 1, 
                                                    (void*)&sig_state->sig_info[i][ofs], 
                                                    se->private_data);