view tests/002_090722/002.c @ 1:b4285b887e18 default tip

add document
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Sep 2009 17:33:34 +0900
parents 42f240cc4bc6
children
line wrap: on
line source

#include <stdio.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>

#include "../../include/ioctl.h"
#include "../../include/spe_process.h"

#define  PROCESSES 100


int main(int argc, char *argv[])
{
	int fd[PROCESSES];
	spe_process_context_write_data_t spe_write = { 0 };
	spe_process_context_read_data_t  spe_read;

	int i;


	for (i = 0; i < PROCESSES; i++)
	{
		fd[i] = open("/dev/spe_manager", O_RDWR);

		lseek(fd[i], 0, SEEK_SET);
		write(fd[i], &spe_write, sizeof(spe_write));
		ioctl(fd[i], SPE_MANAGER_IOCTL_START_PROCESS);
	}

	for (i = 0; i < PROCESSES; i++)
	{
		do
		{
			lseek(fd[i], 0, SEEK_SET);
			read(fd[i], &spe_read, sizeof(spe_read));
		}
		while (spe_read.status != SPE_PROCESS_CONTEXT_STATUS_NOT_RELEASED);

		close(fd[i]);
	}

	return 0;
}