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"
static int fde_count;
static void fde_handler(struct tevent_context *ev_ctx, struct tevent_fd *f,
- uint16_t flags, void *private)
+ uint16_t flags, void *private_data)
{
- int *fd = (int *)private;
+ int *fd = (int *)private_data;
char c;
#ifdef SA_SIGINFO
kill(getpid(), SIGUSR1);
}
static void finished_handler(struct tevent_context *ev_ctx, struct tevent_timer *te,
- struct timeval tval, void *private)
+ struct timeval tval, void *private_data)
{
- int *finished = (int *)private;
+ int *finished = (int *)private_data;
(*finished) = 1;
}
static void count_handler(struct tevent_context *ev_ctx, struct signal_event *te,
- int signum, int count, void *info, void *private)
+ int signum, int count, void *info, void *private_data)
{
- int *countp = (int *)private;
+ int *countp = (int *)private_data;
(*countp) += count;
}
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;
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);
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");