⬢ DragonFlyBSD Kernel Audit
DF-5328 / race_fdchurn.c
← back to finding ↓ download raw
/* DF-5328 race helper: churn open/close on the ch device so the periph
 * refcount oscillates while another thread invalidates/rescans the LUN.
 */
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>

int
main(void)
{
	int fd, i;

	for (i = 0; i < 10; i++) {
		fd = open("/dev/ch0", O_RDWR);
		if (fd >= 0)
			close(fd);
	}
	return (0);
}