tools/testing/selftests/net/af_unix/unix_connect.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/af_unix/unix_connect.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/af_unix/unix_connect.c- Extension
.c- Size
- 2532 bytes
- Lines
- 149
- 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
sched.hstddef.hstdio.hunistd.hsys/socket.hsys/un.hkselftest_harness.h
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
#define _GNU_SOURCE
#include <sched.h>
#include <stddef.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/un.h>
#include "kselftest_harness.h"
FIXTURE(unix_connect)
{
int server, client;
int family;
};
FIXTURE_VARIANT(unix_connect)
{
int type;
char sun_path[8];
int len;
int flags;
int err;
};
FIXTURE_VARIANT_ADD(unix_connect, stream_pathname)
{
.type = SOCK_STREAM,
.sun_path = "test",
.len = 4 + 1,
.flags = 0,
.err = 0,
};
FIXTURE_VARIANT_ADD(unix_connect, stream_abstract)
{
.type = SOCK_STREAM,
.sun_path = "\0test",
.len = 5,
.flags = 0,
.err = 0,
};
FIXTURE_VARIANT_ADD(unix_connect, stream_pathname_netns)
{
.type = SOCK_STREAM,
.sun_path = "test",
.len = 4 + 1,
.flags = CLONE_NEWNET,
.err = 0,
};
FIXTURE_VARIANT_ADD(unix_connect, stream_abstract_netns)
{
.type = SOCK_STREAM,
.sun_path = "\0test",
.len = 5,
.flags = CLONE_NEWNET,
.err = ECONNREFUSED,
};
FIXTURE_VARIANT_ADD(unix_connect, dgram_pathname)
{
.type = SOCK_DGRAM,
.sun_path = "test",
.len = 4 + 1,
.flags = 0,
.err = 0,
};
FIXTURE_VARIANT_ADD(unix_connect, dgram_abstract)
{
.type = SOCK_DGRAM,
.sun_path = "\0test",
.len = 5,
.flags = 0,
.err = 0,
};
FIXTURE_VARIANT_ADD(unix_connect, dgram_pathname_netns)
{
.type = SOCK_DGRAM,
.sun_path = "test",
.len = 4 + 1,
.flags = CLONE_NEWNET,
.err = 0,
Annotation
- Immediate include surface: `sched.h`, `stddef.h`, `stdio.h`, `unistd.h`, `sys/socket.h`, `sys/un.h`, `kselftest_harness.h`.
- 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.