6652830c87
Builds ok all the way back to these older distros: 1 almalinux:8 : Ok gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-20) , clang version 16.0.6 (Red Hat 16.0.6-2.module_el8.9.0+3621+df7f7146) flex 2.6.1 3 alpine:3.15 : Ok gcc (Alpine 10.3.1_git20211027) 10.3.1 20211027 , Alpine clang version 12.0.1 flex 2.6.4 15 debian:10 : Ok gcc (Debian 8.3.0-6) 8.3.0 , Debian clang version 11.0.1-2~deb10u1 flex 2.6.4 32 opensuse:15.4 : Ok gcc (SUSE Linux) 7.5.0 , clang version 15.0.7 flex 2.6.4 23 fedora:35 : Ok gcc (GCC) 11.3.1 20220421 (Red Hat 11.3.1-3) , clang version 13.0.1 (Fedora 13.0.1-1.fc35) flex 2.6.4 38 ubuntu:18.04 : Ok gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 flex 2.6.4 Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Link: https://lore.kernel.org/lkml/20240315204835.748716-4-acme@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
52 lines
1003 B
C
52 lines
1003 B
C
// SPDX-License-Identifier: LGPL-2.1
|
|
|
|
#include "trace/beauty/beauty.h"
|
|
#include <linux/kernel.h>
|
|
#include <linux/fcntl.h>
|
|
|
|
#ifndef LOCK_MAND
|
|
#define LOCK_MAND 32
|
|
#endif
|
|
|
|
#ifndef LOCK_READ
|
|
#define LOCK_READ 64
|
|
#endif
|
|
|
|
#ifndef LOCK_WRITE
|
|
#define LOCK_WRITE 128
|
|
#endif
|
|
|
|
#ifndef LOCK_RW
|
|
#define LOCK_RW 192
|
|
#endif
|
|
|
|
size_t syscall_arg__scnprintf_flock(char *bf, size_t size, struct syscall_arg *arg)
|
|
{
|
|
bool show_prefix = arg->show_string_prefix;
|
|
const char *prefix = "LOCK_";
|
|
int printed = 0, op = arg->val;
|
|
|
|
if (op == 0)
|
|
return scnprintf(bf, size, "NONE");
|
|
#define P_CMD(cmd) \
|
|
if ((op & LOCK_##cmd) == LOCK_##cmd) { \
|
|
printed += scnprintf(bf + printed, size - printed, "%s%s%s", printed ? "|" : "", show_prefix ? prefix : "", #cmd); \
|
|
op &= ~LOCK_##cmd; \
|
|
}
|
|
|
|
P_CMD(SH);
|
|
P_CMD(EX);
|
|
P_CMD(NB);
|
|
P_CMD(UN);
|
|
P_CMD(MAND);
|
|
P_CMD(RW);
|
|
P_CMD(READ);
|
|
P_CMD(WRITE);
|
|
#undef P_OP
|
|
|
|
if (op)
|
|
printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", op);
|
|
|
|
return printed;
|
|
}
|