Mercurial > hg > Game > Atoc
comparison tests/002_090722/002.c @ 0:42f240cc4bc6
From: 太田 篤志 <atoc@namikilab.tuat.ac.jp>
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 08 Sep 2009 13:44:18 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:42f240cc4bc6 |
---|---|
1 #include <stdio.h> | |
2 #include <stdint.h> | |
3 #include <sys/types.h> | |
4 #include <sys/stat.h> | |
5 #include <fcntl.h> | |
6 #include <unistd.h> | |
7 #include <sys/ioctl.h> | |
8 | |
9 #include "../../include/ioctl.h" | |
10 #include "../../include/spe_process.h" | |
11 | |
12 #define PROCESSES 100 | |
13 | |
14 | |
15 int main(int argc, char *argv[]) | |
16 { | |
17 int fd[PROCESSES]; | |
18 spe_process_context_write_data_t spe_write = { 0 }; | |
19 spe_process_context_read_data_t spe_read; | |
20 | |
21 int i; | |
22 | |
23 | |
24 for (i = 0; i < PROCESSES; i++) | |
25 { | |
26 fd[i] = open("/dev/spe_manager", O_RDWR); | |
27 | |
28 lseek(fd[i], 0, SEEK_SET); | |
29 write(fd[i], &spe_write, sizeof(spe_write)); | |
30 ioctl(fd[i], SPE_MANAGER_IOCTL_START_PROCESS); | |
31 } | |
32 | |
33 for (i = 0; i < PROCESSES; i++) | |
34 { | |
35 do | |
36 { | |
37 lseek(fd[i], 0, SEEK_SET); | |
38 read(fd[i], &spe_read, sizeof(spe_read)); | |
39 } | |
40 while (spe_read.status != SPE_PROCESS_CONTEXT_STATUS_NOT_RELEASED); | |
41 | |
42 close(fd[i]); | |
43 } | |
44 | |
45 return 0; | |
46 } |