Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932096AbbETTHL (ORCPT ); Wed, 20 May 2015 15:07:11 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:32876 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752268AbbETTHJ (ORCPT ); Wed, 20 May 2015 15:07:09 -0400 Message-ID: <555CDB52.9000901@fb.com> Date: Wed, 20 May 2015 15:06:58 -0400 From: Josef Bacik User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Steven Rostedt CC: , Subject: Re: [PATCH 3/5] trace-cmd: lookup syscall names in profile References: <1431113344-22579-1-git-send-email-jbacik@fb.com> <1431113344-22579-4-git-send-email-jbacik@fb.com> <20150520140029.2078359f@gandalf.local.home> <555CD0E7.4040701@fb.com> <20150520145617.1c15911f@gandalf.local.home> <20150520150133.76c2a08c@gandalf.local.home> In-Reply-To: <20150520150133.76c2a08c@gandalf.local.home> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.52.13] X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.14.151,1.0.33,0.0.0000 definitions=2015-05-20_05:2015-05-19,2015-05-20,1970-01-01 signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3679 Lines: 142 On 05/20/2015 03:01 PM, Steven Rostedt wrote: > On Wed, 20 May 2015 14:56:17 -0400 > Steven Rostedt wrote: > >> On Wed, 20 May 2015 14:22:31 -0400 >> Josef Bacik 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 > +#include > + > +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 > #include > #include > +#ifndef NO_AUDIT > #include > - > +#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); > } > Looks good to me, thanks, Josef -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/