Esempio n. 1
0
File: mmap1.c Progetto: kraj/ltp
static void run(void)
{
	pthread_t thid[2];
	int remaining = tst_timeout_remaining();
	int elapsed = 0;

	while (tst_timeout_remaining() > STOP_THRESHOLD) {
		int fd = mkfile(file_size);

		tst_atomic_store(0, &mapcnt);
		tst_atomic_store(0, &unmapcnt);

		SAFE_PTHREAD_CREATE(&thid[0], NULL, map_write_unmap, &fd);
		SAFE_PTHREAD_CREATE(&thid[1], NULL, read_mem, &fd);
		threads_spawned += 2;

		SAFE_PTHREAD_JOIN(thid[0], NULL);
		SAFE_PTHREAD_JOIN(thid[1], NULL);

		close(fd);

		if (remaining - tst_timeout_remaining() > PROGRESS_SEC) {
			remaining = tst_timeout_remaining();
			elapsed += PROGRESS_SEC;
			tst_res(TINFO, "[%d] mapped: %lu, sigsegv hit: %lu, "
				"threads spawned: %lu",	elapsed, map_count,
				mapped_sigsegv_count, threads_spawned);
			tst_res(TINFO, "[%d] repeated_reads: %ld, "
				"data_matched: %lu", elapsed, repeated_reads,
				data_matched);
		}
	}
	tst_res(TPASS, "System survived.");
}
Esempio n. 2
0
File: fcntl34.c Progetto: kraj/ltp
static void wait_threads(pthread_t *id)
{
	int i;

	tst_res(TINFO, "waiting for '%d' threads", thread_cnt);
	for (i = 0; i < thread_cnt; ++i)
		SAFE_PTHREAD_JOIN(id[i], NULL);
}
Esempio n. 3
0
static void do_test(void)
{
	int i;
	pthread_t id[thrd_num];

	for (i = 0; i < thrd_num; ++i)
		SAFE_PTHREAD_CREATE(id + i, NULL, thread_fn, NULL);

	for (i = 0; i < thrd_num; ++i)
		SAFE_PTHREAD_JOIN(id[i], NULL);

	tst_res(TPASS, "'make' successfully build and clean all targets");
}
Esempio n. 4
0
File: tgkill03.c Progetto: kraj/ltp
static void setup(void)
{
	sigset_t sigusr1;
	pthread_t defunct_thread;

	sigemptyset(&sigusr1);
	sigaddset(&sigusr1, SIGUSR1);
	pthread_sigmask(SIG_BLOCK, &sigusr1, NULL);

	parent_tgid = getpid();
	parent_tid = sys_gettid();

	SAFE_PTHREAD_CREATE(&child_thread, NULL, child_thread_func, NULL);

	TST_CHECKPOINT_WAIT(0);

	SAFE_PTHREAD_CREATE(&defunct_thread, NULL, defunct_thread_func, NULL);

	SAFE_PTHREAD_JOIN(defunct_thread, NULL);
}
Esempio n. 5
0
File: tgkill03.c Progetto: kraj/ltp
static void cleanup(void)
{
	TST_CHECKPOINT_WAKE(0);

	SAFE_PTHREAD_JOIN(child_thread, NULL);
}