b9874d0941
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.
31 lines
640 B
C
31 lines
640 B
C
#include <pthread.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
|
|
#include "test_helpers.h"
|
|
|
|
void prepare() {
|
|
puts("Hello from prepare");
|
|
}
|
|
void parent() {
|
|
// Make sure we print in the right order and also don't exit
|
|
// before the fork does.
|
|
int us_status = usleep(1000);
|
|
ERROR_IF(usleep, us_status, == -1);
|
|
UNEXP_IF(usleep, us_status, != 0);
|
|
|
|
puts("Hello from parent");
|
|
}
|
|
void child() {
|
|
puts("Hello from child");
|
|
}
|
|
|
|
int main(void) {
|
|
int status = pthread_atfork(prepare, parent, child);
|
|
ERROR_IF(pthread_atfork, status, == -1);
|
|
|
|
int pid = fork();
|
|
ERROR_IF(fork, pid, == -1);
|
|
}
|