summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Olsa <Jiri Olsa jolsa@redhat.com>2011-10-18 09:05:32 +0200
committerJiri Olsa <Jiri Olsa jolsa@redhat.com>2011-10-18 09:56:07 +0200
commit2b765098b8a2ea759e24c9f31accbf6b40c44f17 (patch)
treec860df7d1121444ec072cb21c9a1b8be479eb308
parent3f8e3cf9c37545197537c743d3e2e315821b165f (diff)
downloadlatrace-2b765098b8a2ea759e24c9f31accbf6b40c44f17.tar.gz
latrace-2b765098b8a2ea759e24c9f31accbf6b40c44f17.tar.xz
latrace-2b765098b8a2ea759e24c9f31accbf6b40c44f17.zip
fifo: Using shared config in fifo functions
Switching to shared config structure for all fifo object functions.
-rw-r--r--src/audit.c10
-rw-r--r--src/config.h22
-rw-r--r--src/fifo.c14
-rw-r--r--src/run.c6
4 files changed, 26 insertions, 26 deletions
diff --git a/src/audit.c b/src/audit.c
index a0468b2..6f46e22 100644
--- a/src/audit.c
+++ b/src/audit.c
@@ -109,13 +109,13 @@ static int sym_entry(const char *symname, void *ptr,
int len;
if (!pipe_fd)
- pipe_fd = lt_fifo_create(&cfg, cfg.dir);
+ pipe_fd = lt_fifo_create(cfg.sh, cfg.dir);
- len = lt_fifo_msym_get(&cfg, buf, LT_FIFO_MTYPE_ENTRY, &tv,
+ len = lt_fifo_msym_get(cfg.sh, buf, LT_FIFO_MTYPE_ENTRY, &tv,
(char*) symname, lib_to, argbuf, argdbuf);
free_argbuf(argret, argbuf, argdbuf);
- return lt_fifo_send(&cfg, pipe_fd, buf, len);
+ return lt_fifo_send(cfg.sh, pipe_fd, buf, len);
}
indent_depth++;
@@ -159,11 +159,11 @@ static int sym_exit(const char *symname, void *ptr,
char buf[LT_FIFO_MSG_MAXLEN];
int len;
- len = lt_fifo_msym_get(&cfg, buf, LT_FIFO_MTYPE_EXIT, &tv,
+ len = lt_fifo_msym_get(cfg.sh, buf, LT_FIFO_MTYPE_EXIT, &tv,
(char*) symname, lib_to, argbuf, argdbuf);
free_argbuf(argret, argbuf, argdbuf);
- return lt_fifo_send(&cfg, pipe_fd, buf, len);
+ return lt_fifo_send(cfg.sh, pipe_fd, buf, len);
}
lt_out_exit(cfg.sh, &tv, syscall(SYS_gettid),
diff --git a/src/config.h b/src/config.h
index 09c253b..69bb337 100644
--- a/src/config.h
+++ b/src/config.h
@@ -336,17 +336,17 @@ int lt_config(struct lt_config_app *cfg, int argc, char **argv);
int lt_run(struct lt_config_app *cfg);
/* fifo */
-int lt_fifo_create(struct lt_config_audit *cfg, char *dir);
-int lt_fifo_open(struct lt_config_app *cfg, char *dir, char *name);
-int lt_fifo_notify_fd(struct lt_config_app *cfg, char *dir);
-int lt_fifo_send(struct lt_config_audit *cfg, int fd, char *buf, int len);
-int lt_fifo_recv(struct lt_config_app *cfg, struct lt_thread *t,
- void *buf, int bufsize);
-int lt_fifo_msym_get(struct lt_config_audit *cfg, char *buf, int type,
- struct timeval *tv, char *symname, char *libto,
- char *arg, char *argd);
-int lt_fifo_mtext_get(struct lt_config_audit *cfg, char *buf,
- struct timeval *tv, char *text);
+int lt_fifo_create(struct lt_config_shared *cfg, char *dir);
+int lt_fifo_open(struct lt_config_shared *cfg, char *dir, char *name);
+int lt_fifo_notify_fd(struct lt_config_shared *cfg, char *dir);
+int lt_fifo_send(struct lt_config_shared *cfg, int fd, char *buf, int len);
+int lt_fifo_recv(struct lt_config_shared *cfg, struct lt_thread *t,
+ void *buf, int bufsize);
+int lt_fifo_msym_get(struct lt_config_shared *cfg, char *buf, int type,
+ struct timeval *tv, char *symname, char *libto,
+ char *arg, char *argd);
+int lt_fifo_mtext_get(struct lt_config_shared *cfg, char *buf,
+ struct timeval *tv, char *text);
/* counts */
int lt_stats_init(struct lt_config_app *cfg);
diff --git a/src/fifo.c b/src/fifo.c
index 727af2e..899fb62 100644
--- a/src/fifo.c
+++ b/src/fifo.c
@@ -50,7 +50,7 @@ static char *get_notify_dir(char *dir)
return notify_dir;
}
-int lt_fifo_create(struct lt_config_audit *cfg, char *dir)
+int lt_fifo_create(struct lt_config_shared *cfg, char *dir)
{
int fd;
char fifo[100];
@@ -71,7 +71,7 @@ int lt_fifo_create(struct lt_config_audit *cfg, char *dir)
return fd;
}
-int lt_fifo_open(struct lt_config_app *cfg, char *dir, char *name)
+int lt_fifo_open(struct lt_config_shared *cfg, char *dir, char *name)
{
int fd;
char str_fifo[LT_MAXFILE];
@@ -86,7 +86,7 @@ int lt_fifo_open(struct lt_config_app *cfg, char *dir, char *name)
return fd;
}
-int lt_fifo_notify_fd(struct lt_config_app *cfg, char *dir)
+int lt_fifo_notify_fd(struct lt_config_shared *cfg, char *dir)
{
int fd;
char *notify_dir = get_notify_dir(dir);
@@ -123,7 +123,7 @@ int lt_fifo_notify_fd(struct lt_config_app *cfg, char *dir)
return fd;
}
-int lt_fifo_send(struct lt_config_audit *cfg, int fd, char *buf, int len)
+int lt_fifo_send(struct lt_config_shared *cfg, int fd, char *buf, int len)
{
static unsigned int written = 0;
@@ -138,7 +138,7 @@ int lt_fifo_send(struct lt_config_audit *cfg, int fd, char *buf, int len)
return 0;
}
-int lt_fifo_recv(struct lt_config_app *cfg, struct lt_thread *t, void *buf,
+int lt_fifo_recv(struct lt_config_shared *cfg, struct lt_thread *t, void *buf,
int bufsize)
{
static unsigned int red = 0;
@@ -174,7 +174,7 @@ int lt_fifo_recv(struct lt_config_app *cfg, struct lt_thread *t, void *buf,
return 0;
}
-int lt_fifo_msym_get(struct lt_config_audit *cfg, char *buf, int type,
+int lt_fifo_msym_get(struct lt_config_shared *cfg, char *buf, int type,
struct timeval *tv, char *symname, char *libto,
char *arg, char *argd)
{
@@ -210,7 +210,7 @@ int lt_fifo_msym_get(struct lt_config_audit *cfg, char *buf, int type,
return len;
}
-int lt_fifo_mtext_get(struct lt_config_audit *cfg, char *buf,
+int lt_fifo_mtext_get(struct lt_config_shared *cfg, char *buf,
struct timeval *tv, char *text)
{
struct lt_fifo_mtext *m = (struct lt_fifo_mtext*) buf;
diff --git a/src/run.c b/src/run.c
index 9903047..439be29 100644
--- a/src/run.c
+++ b/src/run.c
@@ -102,7 +102,7 @@ static int get_fifo(struct lt_config_app *cfg, int fd_notify,
PRINT_VERBOSE(cfg, 1, "thread id %d, got fifo: %s\n",
*pid, event->name);
- return lt_fifo_open(cfg, dir, event->name);
+ return lt_fifo_open(cfg->sh, dir, event->name);
}
static int process_fifo(struct lt_config_app *cfg, struct lt_thread *t)
@@ -112,7 +112,7 @@ static int process_fifo(struct lt_config_app *cfg, struct lt_thread *t)
struct lt_fifo_msym *msym = (struct lt_fifo_msym*) buf;
struct lt_fifo_mtext *mtext = (struct lt_fifo_mtext*) buf;
- if (-1 == lt_fifo_recv(cfg, t, mbase, LT_FIFO_MSG_MAXLEN))
+ if (-1 == lt_fifo_recv(cfg->sh, t, mbase, LT_FIFO_MSG_MAXLEN))
return -1;
if (lt_sh(cfg, counts)) {
@@ -348,7 +348,7 @@ static int run_setup(struct lt_config_app *cfg,
/* new thread notification descriptor */
if (lt_sh(cfg, pipe) &&
- (-1 == (pa->fd_notify = lt_fifo_notify_fd(cfg, pa->dir))))
+ (-1 == (pa->fd_notify = lt_fifo_notify_fd(cfg->sh, pa->dir))))
return -1;
/* tty master descriptor */