summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Olsa <Jiri Olsa jolsa@redhat.com>2010-04-29 13:21:40 +0200
committerJiri Olsa <Jiri Olsa jolsa@redhat.com>2010-04-29 13:21:40 +0200
commitac8317f173570794e8b95ea9986bbec73710746e (patch)
tree8de91733eadc33665c8a26e04fed101f45b38ca3
parent6185ff535959e371daf3f789ba2ac9af4a5698e9 (diff)
downloadlatrace-ac8317f173570794e8b95ea9986bbec73710746e.tar.gz
latrace-ac8317f173570794e8b95ea9986bbec73710746e.tar.xz
latrace-ac8317f173570794e8b95ea9986bbec73710746e.zip
refactoring sysdep configuration
-rw-r--r--.gitignore2
-rw-r--r--ChangeLog3
-rw-r--r--Makefile55
-rw-r--r--configure.ac1
-rw-r--r--etc/latrace.conf (renamed from etc/latrace.conf.in)3
-rw-r--r--etc/latrace.d/arch-arm.conf0
-rw-r--r--etc/latrace.d/arch-i686.conf0
-rw-r--r--etc/latrace.d/arch-x86_64.conf3
-rw-r--r--src/args.c12
-rw-r--r--src/config.h4
-rw-r--r--src/sysdeps/x86_64/args.h20
11 files changed, 61 insertions, 42 deletions
diff --git a/.gitignore b/.gitignore
index 4099c31..56c0984 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,8 +10,6 @@ doc/latrace.1
doc/latrace.html
doc/latrace.xml
-etc/latrace.conf
-
latrace
libltaudit.so.0.5.7
diff --git a/ChangeLog b/ChangeLog
index e3bcb40..ec5362b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2010-04-29 Jiri Olsa <olsajiri@gmail.com>
+ * refactoring sysdep configuration
+
-------------------------------------------------------------------------------
latrace 0.5.8
diff --git a/Makefile b/Makefile
index e076bf1..9c3ace2 100644
--- a/Makefile
+++ b/Makefile
@@ -19,7 +19,8 @@
-include src/autoconf.make
-confdir := $(sysconfdir)/latrace.d
+confdir := $(sysconfdir)/latrace.d
+confarch := $(sysconfdir)/latrace.d/sysdeps/$(CONFIG_SYSDEP_DIR)
# looks like DESTDIR is a standard, but prioritize ROOTDIR anyway
ifdef DESTDIR
@@ -47,54 +48,42 @@ ifndef V
QUIET_ASCIIDOC = @echo " ASCIIDOC" $@;
QUIET_XMLTO = @echo " XMLTO" $@;
QUIET_PKG = @echo -n " PKG ";
+ QUIET_INSTALL = @echo -n " INSTALL ";
+ QUIET_LN = @echo -n " LN ";
+ QUIET_RM = @echo -n " CLEAN ";
+ QUIET_MKDIR = @echo -n " MKDIR ";
+endif
-# install file quietly, arguments:
+# install file, arguments:
# 1 - file to install
# 2 - directory to install to
# 3 - permissions
-# 4 - bool - skip the install if the file does not exist
define install
- @if [ -n "$4" -a ! -e $1 ]; then \
- echo " SKIP $(ROOTDIR)$2/$(notdir $1)"; \
- else \
- echo -n " INSTALL " `echo $(ROOTDIR)$2/$(notdir $1) | sed 's:[/]\+:/:g'` ; \
- mkdir -p $(ROOTDIR)$2; \
- install -m $3 $1 $(ROOTDIR)$2; echo; \
- fi
-
+ $(QUIET_INSTALL) echo $(ROOTDIR)$2/$(notdir $1) | sed 's:[/]\+:/:g'; \
+ mkdir -p $(ROOTDIR)$2; \
+ install -m $3 $1 $(ROOTDIR)$2;
endef
-# install file quietly, arguments:
+
+# install link, arguments:
# 1 - source
-# 2 - destination
-# 3 - directory to install to
+# 2 - dest
define link
- @echo " LN " $(ROOTDIR)$3/$(notdir $2); $(RM) -f $(ROOTDIR)$3/$(notdir $2); \
+ $(QUIET_LN) echo $(ROOTDIR)$3/$(notdir $2) | sed 's:[/]\+:/:g'; \
+ $(RM) -f $(ROOTDIR)$3/$(notdir $2); \
ln -s $(ROOTDIR)$3/$(notdir $1) $(ROOTDIR)$3/$(notdir $2)
endef
+# remove file/dir
define remove
- @echo " CLEAN " $1; $(RM) -rf $1
-endef
-else
-define remove
- $(RM) -rf $1
-endef
-define install
- if [ -n "$4" -a ! -e $1 ]; then \
- echo " SKIP $(ROOTDIR)$2/$(notdir $1)"; \
- else \
- mkdir -p $(ROOTDIR)$2; \
- install -m $3 $1 $(ROOTDIR)$2; echo; \
- fi
+ $(QUIET_RM) echo $1; $(RM) -rf $1
endef
-endif
-
.PHONY: all clean tags install package .FORCE-LATRACE-CFLAGS
all::
install:: all
+ $(call install,etc/latrace.conf,$(sysconfdir),644)
$(call install,etc/latrace.d/ctype.conf,$(confdir),644)
$(call install,etc/latrace.d/inet.conf,$(confdir),644)
$(call install,etc/latrace.d/misc.conf,$(confdir),644)
@@ -127,10 +116,10 @@ install:: all
$(call install,etc/latrace.d/pthread.conf,$(confdir),644)
$(call install,etc/latrace.d/resource.conf,$(confdir),644)
$(call install,etc/latrace.d/mman.conf,$(confdir),644)
- $(call install,etc/latrace.d/arch-$(CONFIG_SYSDEP_DIR).conf,$(confdir),644)
- $(call install,etc/latrace.conf,$(sysconfdir),644)
ifeq ($(CONFIG_SYSDEP_DIR),x86_64)
- $(call install,etc/sysdeps/$(CONFIG_SYSDEP_DIR)/syscall.conf,$(confdir),644,1)
+ @mkdir -p $(ROOTDIR)/$(confarch)
+ $(call install,etc/sysdeps/$(CONFIG_SYSDEP_DIR)/latrace.conf,$(confarch),644)
+ $(call install,etc/sysdeps/$(CONFIG_SYSDEP_DIR)/syscall.conf,$(confarch),644)
endif
diff --git a/configure.ac b/configure.ac
index 2b964de..4f853d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -104,6 +104,5 @@ fi
AC_CONFIG_HEADER([src/autoconf.h])
AC_CONFIG_FILES([src/autoconf.make])
AC_CONFIG_FILES([doc/asciidoc.conf])
-AC_CONFIG_FILES([etc/latrace.conf])
AC_OUTPUT
diff --git a/etc/latrace.conf.in b/etc/latrace.conf
index b62cda5..11db4f7 100644
--- a/etc/latrace.conf.in
+++ b/etc/latrace.conf
@@ -1,7 +1,4 @@
-/* arch specific */
-#include "arch-@CONFIG_SYSDEP_DIR@.conf"
-
/* miscelaneous functions */
#include "misc.conf"
diff --git a/etc/latrace.d/arch-arm.conf b/etc/latrace.d/arch-arm.conf
deleted file mode 100644
index e69de29..0000000
--- a/etc/latrace.d/arch-arm.conf
+++ /dev/null
diff --git a/etc/latrace.d/arch-i686.conf b/etc/latrace.d/arch-i686.conf
deleted file mode 100644
index e69de29..0000000
--- a/etc/latrace.d/arch-i686.conf
+++ /dev/null
diff --git a/etc/latrace.d/arch-x86_64.conf b/etc/latrace.d/arch-x86_64.conf
deleted file mode 100644
index a132832..0000000
--- a/etc/latrace.d/arch-x86_64.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-
-/* /usr/include/bits/syscall.h */
-#include "syscall.conf"
diff --git a/src/args.c b/src/args.c
index b6866bf..e1efe4f 100644
--- a/src/args.c
+++ b/src/args.c
@@ -729,6 +729,18 @@ int lt_args_init(struct lt_config_shared *cfg)
ret = -1;
}
+#if defined(LT_ARGS_ARCH_CONF)
+ /* Some architectures provides specific
+ * configuration file. */
+ if (lt_args_buf_open(cfg, lt_args_arch_conf(cfg)))
+ return -1;
+
+ if (yyparse()) {
+ printf("failed to parse config file %s\n", file);
+ ret = -1;
+ }
+#endif
+
if (fclose(yyin)) {
perror("failed to close " LT_ARGS_DEF_CONF);
return -1;
diff --git a/src/config.h b/src/config.h
index bacc107..893381d 100644
--- a/src/config.h
+++ b/src/config.h
@@ -449,4 +449,8 @@ do { \
} while(0)
+#if defined(__x86_64)
+#include "sysdeps/x86_64/args.h"
+#endif
+
#endif // !CONFIG_H
diff --git a/src/sysdeps/x86_64/args.h b/src/sysdeps/x86_64/args.h
new file mode 100644
index 0000000..a215c07
--- /dev/null
+++ b/src/sysdeps/x86_64/args.h
@@ -0,0 +1,20 @@
+#ifndef ARGS_H
+#define ARGS_H
+
+#define LT_ARGS_ARCH_CONF 1
+
+struct lt_config_shared;
+
+static inline
+char* lt_args_arch_conf(struct lt_config_shared *cfg)
+{
+ static char buf[LT_MAXFILE];
+
+ sprintf(buf, "%s/%s",
+ LT_ARGS_DEF_DIR,
+ "sysdeps/x86_64/latrace.conf");
+
+ return buf;
+}
+
+#endif /* ARGS_H */