tools/perf/trace/beauty/socket.c
Source file repositories/reference/linux-study-clean/tools/perf/trace/beauty/socket.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/trace/beauty/socket.c- Extension
.c- Size
- 1459 bytes
- Lines
- 48
- 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.hsys/types.hsys/socket.htrace/beauty/generated/socket.c
Detected Declarations
function Copyrightfunction syscall_arg__scnprintf_socket_protocolfunction socket__scnprintf_levelfunction syscall_arg__scnprintf_socket_level
Annotated Snippet
// SPDX-License-Identifier: LGPL-2.1
/*
* trace/beauty/socket.c
*
* Copyright (C) 2018, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
*/
#include "trace/beauty/beauty.h"
#include <sys/types.h>
#include <sys/socket.h>
#include "trace/beauty/generated/socket.c"
static size_t socket__scnprintf_ipproto(int protocol, char *bf, size_t size, bool show_prefix)
{
static DEFINE_STRARRAY(socket_ipproto, "IPPROTO_");
return strarray__scnprintf(&strarray__socket_ipproto, bf, size, "%d", show_prefix, protocol);
}
size_t syscall_arg__scnprintf_socket_protocol(char *bf, size_t size, struct syscall_arg *arg)
{
int domain = syscall_arg__val(arg, 0);
if (domain == AF_INET || domain == AF_INET6)
return socket__scnprintf_ipproto(arg->val, bf, size, arg->show_string_prefix);
return syscall_arg__scnprintf_int(bf, size, arg);
}
static size_t socket__scnprintf_level(int level, char *bf, size_t size, bool show_prefix)
{
#if defined(__alpha__) || defined(__hppa__) || defined(__mips__) || defined(__sparc__)
const int sol_socket = 0xffff;
#else
const int sol_socket = 1;
#endif
if (level == sol_socket)
return scnprintf(bf, size, "%sSOCKET", show_prefix ? "SOL_" : "");
return strarray__scnprintf(&strarray__socket_level, bf, size, "%d", show_prefix, level);
}
size_t syscall_arg__scnprintf_socket_level(char *bf, size_t size, struct syscall_arg *arg)
{
return socket__scnprintf_level(arg->val, bf, size, arg->show_string_prefix);
}
Annotation
- Immediate include surface: `trace/beauty/beauty.h`, `sys/types.h`, `sys/socket.h`, `trace/beauty/generated/socket.c`.
- Detected declarations: `function Copyright`, `function syscall_arg__scnprintf_socket_protocol`, `function socket__scnprintf_level`, `function syscall_arg__scnprintf_socket_level`.
- 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.