aboutsummaryrefslogtreecommitdiff
path: root/daemon/opd_pipe.c
diff options
context:
space:
mode:
authorBen Cheng <bccheng@android.com>2010-09-02 21:48:01 -0700
committerBen Cheng <bccheng@android.com>2010-09-02 21:48:01 -0700
commit5bbbe460405564a1aed8a67a13c43e9356ffc656 (patch)
treeb46ca39ef816f5522cbd16023291657206751cc5 /daemon/opd_pipe.c
parentc4ad4bafe1bc1c9e92be1995c288ff89eb7b191e (diff)
downloadoprofile-5bbbe460405564a1aed8a67a13c43e9356ffc656.tar.gz
Port work-in-progress oprofile with Cortex-A9 support.
Change-Id: I26ecf3697c651dae31050081d6918ee5fc87915d
Diffstat (limited to 'daemon/opd_pipe.c')
-rw-r--r--daemon/opd_pipe.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/daemon/opd_pipe.c b/daemon/opd_pipe.c
index a5c334a..3c81979 100644
--- a/daemon/opd_pipe.c
+++ b/daemon/opd_pipe.c
@@ -22,6 +22,7 @@
#include <sys/stat.h>
static int fifo;
+static FILE * fifo_fd = NULL;
void opd_create_pipe(void)
{
@@ -48,6 +49,8 @@ void opd_open_pipe(void)
void opd_close_pipe(void)
{
+ if (fifo_fd)
+ fclose(fifo_fd);
close(fifo);
}
@@ -58,14 +61,14 @@ int is_jitconv_requested(void)
static long nr_drops = 0;
/* modulus to output only a few warnings to avoid flooding oprofiled.log */
static int mod_cnt_drops = 1;
- FILE * fd;
char line[256];
int i, ret = 0;
/* get a file descriptor to the pipe */
- fd = fdopen(fifo, "r");
+ if (!fifo_fd)
+ fifo_fd = fdopen(fifo, "r");
- if (fd == NULL) {
+ if (fifo_fd == NULL) {
perror("oprofiled: couldn't create file descriptor: ");
exit(EXIT_FAILURE);
}
@@ -73,7 +76,7 @@ int is_jitconv_requested(void)
/* read up to 99 lines to check for 'do_jitconv' */
for (i = 0; i < 99; i++) {
/* just break if no new line is found */
- if (fgets(line, 256, fd) == NULL)
+ if (fgets(line, 256, fifo_fd) == NULL)
break;
line[strlen(line) - 1] = '\0';