Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754066AbbETTBi (ORCPT ); Wed, 20 May 2015 15:01:38 -0400 Received: from smtprelay0028.hostedemail.com ([216.40.44.28]:46974 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753212AbbETTBf (ORCPT ); Wed, 20 May 2015 15:01:35 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1543:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2693:3138:3139:3140:3141:3142:3354:3622:3865:3867:3868:3871:3872:3874:4250:4321:5007:6119:6261:7774:7875:7903:8660:9040:9592:10004:10400:10562:10848:10967:11026:11232:11473:11658:11914:12043:12296:12438:12517:12519:12555:12663:12740:13141:13148:13230:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: doll64_47f1304ccd434 X-Filterd-Recvd-Size: 4222 Date: Wed, 20 May 2015 15:01:33 -0400 From: Steven Rostedt To: Josef Bacik Cc: , Subject: Re: [PATCH 3/5] trace-cmd: lookup syscall names in profile Message-ID: <20150520150133.76c2a08c@gandalf.local.home> In-Reply-To: <20150520145617.1c15911f@gandalf.local.home> 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> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3353 Lines: 136 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); } -- 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/