Example #1
0
static void *second_flock_test_thread(void *arg) {
	int fd = *((int *) arg);

	test_emit('c');

	/* Try to non-blocking acquire busy lock */
	test_assert(-1 == flock(fd, LOCK_EX | LOCK_NB));
	test_assert(EWOULDBLOCK == errno);

	/* Acquire just unlocked by fftt exclusive lock */
	test_assert_zero(flock(fd, LOCK_EX));
	test_emit('e');

	/* Convert lock to shared */
	test_assert_zero(flock(fd, LOCK_SH));

	/* Acquire one more shared lock */
	test_assert_zero(flock(fd, LOCK_SH | LOCK_NB));

	/* Release first shared lock */
	test_assert_zero(flock(fd, LOCK_UN));

	/* Convert share to exclusive */
	test_assert_zero(flock(fd, LOCK_EX));

	/* Release second lock */
	test_assert_zero(flock(fd, LOCK_UN | LOCK_NB));

	test_emit('f');

	return NULL;
}
Example #2
0
static void *high_run(void *arg) {
	test_emit('e');
	semaphore_enter(&s);
	test_emit('g');
	semaphore_leave(&s);
	test_emit('h');
	return NULL;
}
Example #3
0
static void *mid_run(void *arg) {
	test_emit('c');
	semaphore_enter(&s);
	test_emit('d');
	test_assert_zero(thread_launch(high));
	test_emit('f');
	semaphore_leave(&s);
	test_emit('i');
	return NULL;
}
Example #4
0
static void *low_run(void *arg) {
	test_emit('a');
	semaphore_enter(&s);
	test_emit('b');
	test_assert_zero(thread_launch(mid));
	test_emit('j');
	semaphore_leave(&s);
	test_emit('k');
	return NULL;
}
Example #5
0
static void *first_flock_test_thread(void *arg) {
	int fd = *((int *) arg);

	test_emit('a');
	test_assert_zero(flock(fd, LOCK_EX));
	test_emit('b');
	test_assert_zero(thread_launch(sftt));
	test_emit('d');
	test_assert_zero(flock(fd, LOCK_UN));
	test_emit('g');

	return NULL;
}
int main (void)
{
  /* set this one here since we need to call a function */
  value03.s_addr = inet_addr("224.0.0.100");

  test_event_name_peek ();
  test_listener_failures ();
  test_emitter_failures ();

  test_emit ();
  test_emitto ();

  return 0;
}
Example #7
0
static void *sigchld_test_without_handler(void *arg) {
	run_wait_task(sigchld_test_child, NULL);
	test_emit('b');
	return NULL;
}
Example #8
0
static void *sigchld_test_child(void *arg) {
	test_emit('a');
	_exit(0);
}