Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934049AbbDJQI0 (ORCPT ); Fri, 10 Apr 2015 12:08:26 -0400 Received: from mga02.intel.com ([134.134.136.20]:24250 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932308AbbDJQGP (ORCPT ); Fri, 10 Apr 2015 12:06:15 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,557,1422950400"; d="scan'208";a="554181782" From: Tom Zanussi To: rostedt@goodmis.org Cc: masami.hiramatsu.pt@hitachi.com, namhyung@kernel.org, andi@firstfloor.org, alexei.starovoitov@gmail.com, linux-kernel@vger.kernel.org, Tom Zanussi Subject: [PATCH v4 3/7] tracing: Add get_syscall_name() Date: Fri, 10 Apr 2015 11:05:54 -0500 Message-Id: <2a2dc0065d183debc3420204b8979a599c21d523.1428678702.git.tom.zanussi@linux.intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1647 Lines: 57 Add a utility function to grab the syscall name from the syscall metadata, given a syscall id. Signed-off-by: Tom Zanussi --- kernel/trace/trace.h | 5 +++++ kernel/trace/trace_syscalls.c | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 89dd87a..3d38c2e 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h @@ -1317,8 +1317,13 @@ int perf_ftrace_event_register(struct ftrace_event_call *call, #ifdef CONFIG_FTRACE_SYSCALLS void init_ftrace_syscalls(void); +const char *get_syscall_name(int syscall); #else static inline void init_ftrace_syscalls(void) { } +static inline const char *get_syscall_name(int syscall) +{ + return NULL; +} #endif #ifdef CONFIG_EVENT_TRACING diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c index f97f6e3..d137e0a 100644 --- a/kernel/trace/trace_syscalls.c +++ b/kernel/trace/trace_syscalls.c @@ -106,6 +106,17 @@ static struct syscall_metadata *syscall_nr_to_meta(int nr) return syscalls_metadata[nr]; } +const char *get_syscall_name(int syscall) +{ + struct syscall_metadata *entry; + + entry = syscall_nr_to_meta(syscall); + if (!entry) + return NULL; + + return entry->name; +} + static enum print_line_t print_syscall_enter(struct trace_iterator *iter, int flags, struct trace_event *event) -- 1.9.3 -- 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/