diff options
author | Jiri Olsa <Jiri Olsa jolsa@redhat.com> | 2010-02-28 23:29:40 +0100 |
---|---|---|
committer | Jiri Olsa <Jiri Olsa jolsa@redhat.com> | 2010-02-28 23:29:40 +0100 |
commit | e880de741678a4c5b174a4c002e19c38b5f7769f (patch) | |
tree | 791f0075ceb2edbf9d7384feaf7482d6850dfb1a | |
parent | 342c9b9142648cc2d2d00cd88591f584018ce7a2 (diff) | |
download | latrace-e880de741678a4c5b174a4c002e19c38b5f7769f.tar.gz latrace-e880de741678a4c5b174a4c002e19c38b5f7769f.tar.xz latrace-e880de741678a4c5b174a4c002e19c38b5f7769f.zip |
controled config bug fix
liberty controled by autoconf now
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | configure.ac | 11 | ||||
-rw-r--r-- | src/Makefile | 6 | ||||
-rw-r--r-- | src/audit-init.c | 18 | ||||
-rw-r--r-- | src/autoconf.h.in | 3 | ||||
-rw-r--r-- | src/autoconf.make.in | 2 | ||||
-rw-r--r-- | src/config.c | 6 | ||||
-rw-r--r-- | src/output.c | 4 |
8 files changed, 49 insertions, 5 deletions
@@ -1,3 +1,7 @@ +2010-02-28 Jiri Olsa <olsajiri@gmail.com> + * controled config bug fix + * liberty controled by autoconf now + 2010-02-13 Jiri Olsa <olsajiri@gmail.com> * controled config feature * disable auditing feature diff --git a/configure.ac b/configure.ac index 96e9ee3..33588df 100644 --- a/configure.ac +++ b/configure.ac @@ -83,6 +83,17 @@ elif test "$unamem" = "i686"; then AC_DEFINE(LT_ARCH_X86, 1, [The x86 arch.]) fi +CONFIG_LIBERTY=[] +AC_SEARCH_LIBS(cplus_demangle,iberty, + [iberty_found=yes], + [iberty_found=no],[]) +if test "$iberty_found" = "yes"; then + AC_DEFINE(LT_LIBERTY, 1, "Liberty found.") + CONFIG_LIBERTY=[-liberty] +fi + +AC_SUBST(CONFIG_LIBERTY) + AC_CONFIG_HEADER([src/autoconf.h]) AC_CONFIG_FILES([src/autoconf.make]) AC_CONFIG_FILES([doc/asciidoc.conf]) diff --git a/src/Makefile b/src/Makefile index bc625bf..54c7ec7 100644 --- a/src/Makefile +++ b/src/Makefile @@ -20,7 +20,8 @@ # libltaudit.so AUDIT_BIN=libltaudit.so.$(LT_VER) AUDIT_LDFLAGS="-Wl,-init=audit_init" "-Wl,-soname,$(AUDIT_BIN)" -fPIC -shared -AUDIT_LIBS=-liberty +AUDIT_LIBS=$(CONFIG_LIBERTY) + AUDIT_OBJS=\ src/audit.o \ src/audit-init.o \ @@ -44,7 +45,8 @@ install:: # latrace binary LATRACE_BIN=latrace LATRACE_CTL=latrace-ctl -LATRACE_LIB=-liberty +LATRACE_LIB= $(CONFIG_LIBERTY) + LATRACE_OBJS=\ src/latrace.o \ src/ctl.o \ diff --git a/src/audit-init.c b/src/audit-init.c index b5ad366..a3c0cf7 100644 --- a/src/audit-init.c +++ b/src/audit-init.c @@ -33,11 +33,17 @@ struct lt_config_audit cfg; -static int init_ctl_config(int fd) +static int init_ctl_config(char *file) { void *sh; int len; int page = sysconf(_SC_PAGE_SIZE); + int fd; + + if (-1 == (fd = open(file, O_RDWR))) { + perror("open failed"); + return -1; + } /* align the shared config length */ len = sizeof(struct lt_config_shared); @@ -69,7 +75,7 @@ static int read_config(char *dir) cfg.dir = dir; sprintf(file, "%s/config", dir); - if (-1 == (fd = open(file, O_RDWR))) { + if (-1 == (fd = open(file, O_RDONLY))) { perror("open failed"); return -1; } @@ -96,7 +102,13 @@ static int read_config(char *dir) cfg.sh = cfg.sh_storage.sh = &cfg.sh_storage; - if (lt_sh(&cfg, ctl_config) && init_ctl_config(fd)) + /* + * If we are not controled, we can close the file, + * since we read everything we needed. + */ + close(fd); + + if (lt_sh(&cfg, ctl_config) && init_ctl_config(file)) printf("ctl config failed, carring on with standard\n"); return 0; diff --git a/src/autoconf.h.in b/src/autoconf.h.in index efcc490..bf6ed9d 100644 --- a/src/autoconf.h.in +++ b/src/autoconf.h.in @@ -33,4 +33,7 @@ /* x86_64 define. */ #undef LT_ARCH_X86_64 +/* liberty */ +#undef LT_LIBERTY + #endif diff --git a/src/autoconf.make.in b/src/autoconf.make.in index c162165..eec759e 100644 --- a/src/autoconf.make.in +++ b/src/autoconf.make.in @@ -39,4 +39,6 @@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ CONFIG_SYSDEP_DIR = @CONFIG_SYSDEP_DIR@ +CONFIG_LIBERTY = @CONFIG_LIBERTY@ + LT_VER = @LT_VER@ diff --git a/src/config.c b/src/config.c index 7cb4672..a52a489 100644 --- a/src/config.c +++ b/src/config.c @@ -221,6 +221,12 @@ int lt_config(struct lt_config_app *cfg, int argc, char **argv) break; case 'd': + #ifndef LT_LIBERTY + printf("demangle support not compiled in," \ + " liberty not found\n"); + break; + #endif + lt_sh(cfg, demangle) = 1; break; diff --git a/src/output.c b/src/output.c index cadf3c6..5a569ae 100644 --- a/src/output.c +++ b/src/output.c @@ -56,6 +56,7 @@ do { \ /* libiberty external */ extern char* cplus_demangle(const char *mangled, int options); +#ifdef LT_LIBERTY #define DEMANGLE(sym, d) \ do { \ char *dem; \ @@ -65,6 +66,9 @@ do { \ d = 1; \ } \ } while(0) +#else +#define DEMANGLE(sym, d) +#endif int lt_out_entry(struct lt_config_shared *cfg, struct timeval *tv, |