tevent: try to fix the build on QNX qnx18 6.4.1 it doesn't have SA_RESTART defined
[ira/wip.git] / lib / tevent / testsuite.c
index faa18577a7acb3523520057ebe9176bbb9e00883..f9aca91aa1c39f2b6e3edc37115fac141ef4cc7a 100644 (file)
@@ -2,21 +2,25 @@
    Unix SMB/CIFS implementation.
 
    testing of the events subsystem
-   
-   Copyright (C) Stefan Metzmacher
-   
-   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 3 of the License, or
-   (at your option) any later version.
-   
-   This program is distributed in the hope that it will be useful,
+
+   Copyright (C) Stefan Metzmacher 2006-2009
+
+     ** NOTE! The following LGPL license applies to the tevent
+     ** library. This does NOT imply that all of Samba is released
+     ** under the LGPL
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 3 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   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, see <http://www.gnu.org/licenses/>.
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "includes.h"
@@ -62,7 +66,13 @@ static bool test_event_context(struct torture_context *test,
        const char *backend = (const char *)test_data;
        int alarm_count=0, info_count=0;
        struct tevent_fd *fde;
-       struct signal_event *se1, *se2, *se3;
+#ifdef SA_RESTART
+       struct tevent_signal *se1 = NULL;
+#endif
+       struct tevent_signal *se2 = NULL;
+#ifdef SA_SIGINFO
+       struct tevent_signal *se3 = NULL;
+#endif
        int finished=0;
        struct timeval t;
        char c = 0;
@@ -88,7 +98,9 @@ static bool test_event_context(struct torture_context *test,
        event_add_timed(ev_ctx, ev_ctx, timeval_current_ofs(2,0), 
                        finished_handler, &finished);
 
+#ifdef SA_RESTART
        se1 = event_add_signal(ev_ctx, ev_ctx, SIGALRM, SA_RESTART, count_handler, &alarm_count);
+#endif
        se2 = event_add_signal(ev_ctx, ev_ctx, SIGALRM, SA_RESETHAND, count_handler, &alarm_count);
 #ifdef SA_SIGINFO
        se3 = event_add_signal(ev_ctx, ev_ctx, SIGUSR1, SA_SIGINFO, count_handler, &info_count);
@@ -116,7 +128,9 @@ static bool test_event_context(struct torture_context *test,
 
        torture_comment(test, "Got %.2f pipe events/sec\n", fde_count/timeval_elapsed(&t));
 
+#ifdef SA_RESTART
        talloc_free(se1);
+#endif
 
        torture_assert_int_equal(test, alarm_count, 1+fde_count, "alarm count mismatch");