tools/testing/selftests/net/epoll_busy_poll.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/epoll_busy_poll.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/epoll_busy_poll.c- Extension
.c- Size
- 7962 bytes
- Lines
- 321
- 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
error.herrno.hinttypes.hlimits.hstdio.hstdlib.hstring.hunistd.hsys/capability.hsys/epoll.hsys/ioctl.hsys/socket.hkselftest_harness.h
Detected Declarations
struct epoll_params
Annotated Snippet
struct epoll_params {
uint32_t busy_poll_usecs;
uint16_t busy_poll_budget;
uint8_t prefer_busy_poll;
/* pad the struct to a multiple of 64bits */
uint8_t __pad;
};
#define EPOLL_IOC_TYPE 0x8A
#define EPIOCSPARAMS _IOW(EPOLL_IOC_TYPE, 0x01, struct epoll_params)
#define EPIOCGPARAMS _IOR(EPOLL_IOC_TYPE, 0x02, struct epoll_params)
#endif
FIXTURE(invalid_fd)
{
int invalid_fd;
struct epoll_params params;
};
FIXTURE_SETUP(invalid_fd)
{
int ret;
ret = socket(AF_UNIX, SOCK_DGRAM, 0);
EXPECT_NE(-1, ret)
TH_LOG("error creating unix socket");
self->invalid_fd = ret;
}
FIXTURE_TEARDOWN(invalid_fd)
{
int ret;
ret = close(self->invalid_fd);
EXPECT_EQ(0, ret);
}
TEST_F(invalid_fd, test_invalid_fd)
{
int ret;
ret = ioctl(self->invalid_fd, EPIOCGPARAMS, &self->params);
EXPECT_EQ(-1, ret)
TH_LOG("EPIOCGPARAMS on invalid epoll FD should error");
EXPECT_EQ(ENOTTY, errno)
TH_LOG("EPIOCGPARAMS on invalid epoll FD should set errno to ENOTTY");
memset(&self->params, 0, sizeof(struct epoll_params));
ret = ioctl(self->invalid_fd, EPIOCSPARAMS, &self->params);
EXPECT_EQ(-1, ret)
TH_LOG("EPIOCSPARAMS on invalid epoll FD should error");
EXPECT_EQ(ENOTTY, errno)
TH_LOG("EPIOCSPARAMS on invalid epoll FD should set errno to ENOTTY");
}
FIXTURE(epoll_busy_poll)
{
int fd;
struct epoll_params params;
struct epoll_params *invalid_params;
cap_t caps;
};
FIXTURE_SETUP(epoll_busy_poll)
{
int ret;
ret = epoll_create1(0);
EXPECT_NE(-1, ret)
TH_LOG("epoll_create1 failed?");
self->fd = ret;
self->caps = cap_get_proc();
EXPECT_NE(NULL, self->caps);
}
FIXTURE_TEARDOWN(epoll_busy_poll)
{
int ret;
ret = close(self->fd);
EXPECT_EQ(0, ret);
Annotation
- Immediate include surface: `error.h`, `errno.h`, `inttypes.h`, `limits.h`, `stdio.h`, `stdlib.h`, `string.h`, `unistd.h`.
- Detected declarations: `struct epoll_params`.
- 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.