Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9cb7cf86 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

perf trace beauty: Mask ignored fcntl 'arg' parameter

A series of fcntl cmds ignore the third argument, so mask it.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-6vtl3zq1tauamrhm8o380ptn@git.kernel.org


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 5ca55ab6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -661,7 +661,7 @@ static struct syscall_fmt {
	{ .name	    = "fchownat",   .errmsg = true,
	  .arg_scnprintf = { [0] = SCA_FDAT, /* fd */ }, },
	{ .name	    = "fcntl",	    .errmsg = true,
	  .arg_scnprintf = { [1] = SCA_STRARRAYS, /* cmd */ },
	  .arg_scnprintf = { [1] = SCA_FCNTL_CMD, /* cmd */ },
	  .arg_parm	 = { [1] = &strarrays__fcntl_cmds_arrays, /* cmd */ }, },
	{ .name	    = "fdatasync",  .errmsg = true, },
	{ .name	    = "flock",	    .errmsg = true,
+1 −0
Original line number Diff line number Diff line
libperf-y += fcntl.o
libperf-y += statx.o
+3 −0
Original line number Diff line number Diff line
@@ -18,6 +18,9 @@ struct syscall_arg {
size_t syscall_arg__scnprintf_strarrays(char *bf, size_t size, struct syscall_arg *arg);
#define SCA_STRARRAYS syscall_arg__scnprintf_strarrays

size_t syscall_arg__scnprintf_fcntl_cmd(char *bf, size_t size, struct syscall_arg *arg);
#define SCA_FCNTL_CMD syscall_arg__scnprintf_fcntl_cmd

size_t syscall_arg__scnprintf_statx_flags(char *bf, size_t size, struct syscall_arg *arg);
#define SCA_STATX_FLAGS syscall_arg__scnprintf_statx_flags

+23 −0
Original line number Diff line number Diff line
/*
 * trace/beauty/fcntl.c
 *
 *  Copyright (C) 2017, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
 *
 * Released under the GPL v2. (and only v2, not any later version)
 */

#include "trace/beauty/beauty.h"
#include <uapi/linux/fcntl.h>

size_t syscall_arg__scnprintf_fcntl_cmd(char *bf, size_t size, struct syscall_arg *arg)
{
	/*
	 * Some commands ignore the third fcntl argument, "arg", so mask it
	 */
	if (arg->val == F_GETFD	   || arg->val == F_GETFL     ||
	    arg->val == F_GETOWN   || arg->val == F_GET_SEALS ||
	    arg->val == F_GETLEASE || arg->val == F_GETSIG)
		arg->mask |= (1 << 2);

	return syscall_arg__scnprintf_strarrays(bf, size, arg);
}