This patch make it possible to build the events library completely
[metze/samba/wip.git] / source / lib / events / events_signal.c
index 2f6d4993832354121b82dce1c4478c3031e3d6f8..5c74c47eddc649c38aa37b084ea8be9aa70800f4 100644 (file)
    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
 
@@ -217,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);
@@ -257,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);