示例#1
0
int main(int argc, char **argv)
{
	int pid[NUM_CHILDREN];
	int num_children = 1;
	int i;
	char *filename = argv[1];

    printf("Starting aio/dio append test...\n");

	for (i = 0; i < num_children; i++) {
		if ((pid[i] = fork()) == 0) {
			/* child */
			return read_eof(filename);
		} else if (pid[i] < 0) {
			/* error */
			perror("fork error");
			break;
		} else {
			/* Parent */
			continue;
		}
	}

	/*
	 * Parent appends to end of file using direct i/o
	 */

	aiodio_append(filename);

	for (i = 0; i < num_children; i++) {
		kill(pid[i], SIGTERM);
	}

    return 0;
}
示例#2
0
文件: read_checkzero.c 项目: 1587/ltp
int main(int argc, char **argv)
{
	if (argc < 2) {
		printf("You must pass a filename to the test \n");
		exit(1);
	}

	char *filename = argv[1];

	read_eof(filename);

	return 0;
}
示例#3
0
文件: dio_append.c 项目: kraj/ltp
int main(int argc, char **argv)
{
	char filename[PATH_MAX];
	int pid[NUM_CHILDREN];
	int num_children = 1;
	int i;

	snprintf(filename, sizeof(filename), "%s/aiodio/file",
		 getenv("TMP") ? getenv("TMP") : "/tmp");

	printf("Begin dio_append test...\n");

	for (i = 0; i < num_children; i++) {
		if ((pid[i] = fork()) == 0) {
			/* child */
			return read_eof(filename);
		} else if (pid[i] < 0) {
			/* error */
			perror("fork error");
			break;
		} else {
			/* Parent */
			continue;
		}
	}

	/*
	 * Parent appends to end of file using direct i/o
	 */

	dio_append(filename);

	for (i = 0; i < num_children; i++) {
		kill(pid[i], SIGTERM);
	}
	return 0;
}