tools/perf/trace/beauty/kcmp.c
Source file repositories/reference/linux-study-clean/tools/perf/trace/beauty/kcmp.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/trace/beauty/kcmp.c- Extension
.c- Size
- 1240 bytes
- Lines
- 44
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
trace/beauty/beauty.hlinux/kernel.hsys/types.hmachine.huapi/linux/kcmp.htrace/beauty/generated/kcmp_type_array.c
Detected Declarations
function Copyrightfunction kcmp__scnprintf_typefunction syscall_arg__scnprintf_kcmp_type
Annotated Snippet
// SPDX-License-Identifier: LGPL-2.1
/*
* trace/beauty/kcmp.c
*
* Copyright (C) 2017, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
*/
#include "trace/beauty/beauty.h"
#include <linux/kernel.h>
#include <sys/types.h>
#include <machine.h>
#include <uapi/linux/kcmp.h>
#include "trace/beauty/generated/kcmp_type_array.c"
size_t syscall_arg__scnprintf_kcmp_idx(char *bf, size_t size, struct syscall_arg *arg)
{
unsigned long fd = arg->val;
int type = syscall_arg__val(arg, 2);
pid_t pid;
if (type != KCMP_FILE)
return syscall_arg__scnprintf_long(bf, size, arg);
pid = syscall_arg__val(arg, arg->idx == 3 ? 0 : 1); /* idx1 -> pid1, idx2 -> pid2 */
return pid__scnprintf_fd(arg->trace, pid, fd, bf, size);
}
static size_t kcmp__scnprintf_type(int type, char *bf, size_t size, bool show_prefix)
{
static DEFINE_STRARRAY(kcmp_types, "KCMP_");
return strarray__scnprintf(&strarray__kcmp_types, bf, size, "%d", show_prefix, type);
}
size_t syscall_arg__scnprintf_kcmp_type(char *bf, size_t size, struct syscall_arg *arg)
{
unsigned long type = arg->val;
if (type != KCMP_FILE)
arg->mask |= (1 << 3) | (1 << 4); /* Ignore idx1 and idx2 */
return kcmp__scnprintf_type(type, bf, size, arg->show_string_prefix);
}
Annotation
- Immediate include surface: `trace/beauty/beauty.h`, `linux/kernel.h`, `sys/types.h`, `machine.h`, `uapi/linux/kcmp.h`, `trace/beauty/generated/kcmp_type_array.c`.
- Detected declarations: `function Copyright`, `function kcmp__scnprintf_type`, `function syscall_arg__scnprintf_kcmp_type`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.