var scope reduction
[trinity.git] / perf.c
blobfc0fc38863c1e181887a096946ebc9162d4cb507
1 #include <errno.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <string.h>
5 #include <unistd.h>
6 //#include <sys/syscall.h> /* For SYS_xxx definitions */
7 #include <asm/unistd.h>
9 #include "perf.h"
10 #include "shm.h"
11 #include "log.h"
12 #include "sanitise.h"
14 void open_perf_fds(void)
16 unsigned int i = 0;
18 while (i < MAX_PERF_FDS) {
19 int fd;
21 sanitise_perf_event_open(0);
22 fd = syscall(__NR_perf_event_open, shm->syscall[0].a1, shm->syscall[0].a2, shm->syscall[0].a3, shm->syscall[0].a4, shm->syscall[0].a5);
23 if (fd != -1) {
24 shm->perf_fds[i] = fd;
25 output(2, "fd[%d] = perf\n", shm->perf_fds[i]);
26 i++;
27 } else {
28 if (errno == ENOSYS)
29 return;