Exemplo n.º 1
0
static int open_files(void)
{
	unsigned int i, nr_to_open;

	generate_filelist();

	if (files_in_index == 0) {
		/* Something bad happened. Crappy -V maybe? */
		panic(EXIT_NO_FILES);
		return FALSE;
	}

	nr_to_open = min(files_in_index, NR_FILE_FDS);

	if (fileindex == NULL)	/* this can happen if we ctrl-c'd */
		return FALSE;

	for (i = 0; i < nr_to_open; i++) {
		int fd;

		fd = open_file();

		shm->file_fds[i] = fd;
		nr_file_fds++;
	}
	return TRUE;
}
Exemplo n.º 2
0
static int open_files(void)
{
	unsigned int i, nr_to_open;

	generate_filelist();

	if (files_in_index == 0) {
		/* Something bad happened. Crappy -V maybe? */
		panic(EXIT_NO_FILES);
		return FALSE;
	}

	nr_to_open = min(files_in_index, NR_FILE_FDS);

	if (fileindex == NULL)	/* this can happen if we ctrl-c'd */
		return FALSE;

	for (i = 0; i < nr_to_open; i++) {
		struct object *obj;
		int fd;

		fd = open_file();

		obj = alloc_object();
		obj->filefd = fd;
		add_object(obj, OBJ_GLOBAL, OBJ_FD_FILE);
	}
	return TRUE;
}
Exemplo n.º 3
0
void setup_fds(void)
{
	/* If we have victim files, don't worry about sockets. */
	/*if (victim_path == NULL)
		open_sockets();*/

	//open_pipes();

	//open_perf_fds();

	//open_epoll_fds();

	//open_eventfd_fds();

	if (no_files == FALSE) {
		generate_filelist();
		if (files_in_index == 0)	/* Something bad happened. Crappy -V maybe? */
			return;			// FIXME: We should log something here probably.

		open_files();
	}
}