From: Steven Rostedt <rostedt@goodmis.org>
To: Josef Bacik <jbacik@fb.com>
Cc: <linux-kernel@vger.kernel.org>, <kernel-team@fb.com>
Subject: Re: [PATCH 3/5] trace-cmd: lookup syscall names in profile
Date: Wed, 20 May 2015 15:01:33 -0400 [thread overview]
Message-ID: <20150520150133.76c2a08c@gandalf.local.home> (raw)
In-Reply-To: <20150520145617.1c15911f@gandalf.local.home>
On Wed, 20 May 2015 14:56:17 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:
> On Wed, 20 May 2015 14:22:31 -0400
> Josef Bacik <jbacik@fb.com> wrote:
>
> > > I'll keep this as is, but I'm going to add code to check for this
> > > library, and go back to the default raw numbers if it doesn't exist.
> > >
> >
> > Maybe we should think about autoconf at some point? Thanks,
>
> Egad no! I hate autoconf. And so do many others!
>
> A simple test works fine. I don't want to require libaudit. Just warn
> users that compile without it.
>
> I like to install trace-cmd on minimal setups (like embedded devices).
> autoconf will kill that.
>
Here's what I did to fix it:
-- Steve
diff --git a/Makefile b/Makefile
index 402f7114ab42..a8e63ad0c223 100644
--- a/Makefile
+++ b/Makefile
@@ -160,7 +160,7 @@ bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
plugin_dir_SQ = $(subst ','\'',$(plugin_dir))
python_dir_SQ = $(subst ','\'',$(python_dir))
-LIBS = -L. -ltracecmd -ldl -laudit
+LIBS = -L. -ltracecmd -ldl
LIB_FILE = libtracecmd.a
PACKAGES= gtk+-2.0 libxml-2.0 gthread-2.0
@@ -231,12 +231,25 @@ override CFLAGS += -D_GNU_SOURCE
ifndef NO_PTRACE
ifneq ($(call try-cc,$(SOURCE_PTRACE),),y)
NO_PTRACE = 1
- CFLAGS += -DWARN_NO_PTRACE
+ override CFLAGS += -DWARN_NO_PTRACE
endif
endif
ifdef NO_PTRACE
-CFLAGS += -DNO_PTRACE
+override CFLAGS += -DNO_PTRACE
+endif
+
+ifndef NO_AUDIT
+ifneq ($(call try-cc,$(SOURCE_AUDIT),-laudit),y)
+ NO_AUDIT = 1
+ override CFLAGS += -DWARN_NO_AUDIT
+endif
+endif
+
+ifdef NO_AUDIT
+override CFLAGS += -DNO_AUDIT
+else
+LIBS += -laudit
endif
# Append required CFLAGS
diff --git a/features.mk b/features.mk
index cb2e8bd897be..9c9d63c13a23 100644
--- a/features.mk
+++ b/features.mk
@@ -34,3 +34,21 @@ int main (void)
return ret;
}
endef
+
+define SOURCE_AUDIT
+#include <stdio.h>
+#include <libaudit.h>
+
+int main (void)
+{
+ char *name;
+ int ret;
+ ret = audit_detect_machine();
+ if (ret < 0)
+ return ret;
+ name = audit_syscall_to_name(1, ret);
+ if (!name)
+ return -1;
+ return ret;
+}
+endef
diff --git a/trace-profile.c b/trace-profile.c
index 24f989715f05..640dca822d46 100644
--- a/trace-profile.c
+++ b/trace-profile.c
@@ -23,11 +23,17 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#ifndef NO_AUDIT
#include <libaudit.h>
-
+#endif
#include "trace-local.h"
#include "trace-hash.h"
+#ifdef WARN_NO_AUDIT
+# warning "lib audit not found, using raw syscalls " \
+ "(install libaudit-devel and try again)"
+#endif
+
#define TASK_STATE_TO_CHAR_STR "RSDTtXZxKWP"
#define TASK_STATE_MAX 1024
@@ -848,6 +854,7 @@ static void func_print(struct trace_seq *s, struct event_hash *event_hash)
static void syscall_print(struct trace_seq *s, struct event_hash *event_hash)
{
+#ifndef NO_AUDIT
const char *name = NULL;
int machine;
@@ -860,6 +867,7 @@ static void syscall_print(struct trace_seq *s, struct event_hash *event_hash)
trace_seq_printf(s, "syscall:%s", name);
return;
fail:
+#endif
trace_seq_printf(s, "%s:%d", event_hash->event_data->event->name,
(int)event_hash->val);
}
next prev parent reply other threads:[~2015-05-20 19:01 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-08 19:28 [PATCH 0/5] trace-cmd profile enhancements Josef Bacik
2015-05-08 19:29 ` [PATCH 1/5] trace-cmd: add option to group like comms for profile Josef Bacik
2015-05-20 17:31 ` Steven Rostedt
2015-05-20 17:51 ` Josef Bacik
2015-05-08 19:29 ` [PATCH 2/5] trace-cmd: group schedule stacktraces together with --merge Josef Bacik
2015-05-20 17:36 ` Steven Rostedt
2015-05-20 17:54 ` Josef Bacik
2015-05-08 19:29 ` [PATCH 3/5] trace-cmd: lookup syscall names in profile Josef Bacik
2015-05-20 18:00 ` Steven Rostedt
2015-05-20 18:22 ` Josef Bacik
2015-05-20 18:56 ` Steven Rostedt
2015-05-20 19:01 ` Steven Rostedt [this message]
2015-05-20 19:06 ` Josef Bacik
2015-05-08 19:29 ` [PATCH 4/5] trace-cmd: sort the events in the profile output Josef Bacik
2015-05-08 19:29 ` [PATCH 5/5] trace-cmd: make trace-hist work with instances Josef Bacik
2015-05-08 20:13 ` [PATCH 0/5] trace-cmd profile enhancements Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150520150133.76c2a08c@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=jbacik@fb.com \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®