Files
RedBear-OS/recipes/tests/sys_epoll/epollet.c
T
vasilito b9874d0941 feat: USB storage read/write proof + full Red Bear OS tree sync
Add redbear-usb-storage-check in-guest binary that validates USB mass
storage read and write I/O: discovers /scheme/disk/ devices, writes a
test pattern to sector 2048, reads it back, verifies match, restores
original content. Updates test-usb-storage-qemu.sh with write-proof
verification step.

Includes all accumulated Red Bear OS work: kernel patches, relibc
patches, driver infrastructure, DRM/GPU, KDE recipes, firmware,
validation tooling, build system hardening, and documentation.
2026-05-03 23:03:24 +01:00

46 lines
1001 B
C

// test code found on dbus, currently hangs on redox
#include <sys/epoll.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#define _DBUS_ZERO(object) (memset (&(object), '\0', sizeof ((object))))
int
main (void)
{
struct epoll_event input;
struct epoll_event output;
int epfd = epoll_create1 (EPOLL_CLOEXEC);
int pipefds[2];
pipe(pipefds);
close(pipefds[1]);
int fd = pipefds[0];
int ret;
_DBUS_ZERO (input);
input.events = EPOLLHUP | EPOLLET;
ret = epoll_ctl (epfd, EPOLL_CTL_ADD, fd, &input);
printf ("ctl ADD: %d\n", ret);
ret = epoll_wait (epfd, &output, 1, -1);
printf ("wait for HUP, edge-triggered: %d\n", ret);
ret = epoll_wait (epfd, &output, 1, 100);
printf ("wait for HUP again: %d\n", ret);
input.events = EPOLLHUP;
ret = epoll_ctl (epfd, EPOLL_CTL_MOD, fd, &input);
printf ("ctl MOD: %d\n", ret);
ret = epoll_wait (epfd, &output, 1, -1);
printf ("wait for HUP: %d\n", ret);
close(fd);
close(epfd);
return 0;
}