⬢ DragonFlyBSD Kernel Audit
DF-2769 / film_churn.c
← back to finding ↓ download raw
/*
 * DF-2769 film rig — "system churn" helper (runs as root, models ordinary
 * system activity: any login/sshd/cron pty allocation creates devfs nodes,
 * which bumps devfs's mnt_namecache_gen and invalidates stale negative
 * namecache entries).  Allocates one pty and closes it again.
 */
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int
main(void)
{
	int fd = posix_openpt(O_RDWR | O_NOCTTY);
	if (fd < 0) {
		perror("churn: posix_openpt");
		return 1;
	}
	close(fd);
	printf("[churn] a pty was allocated and released (devfs namecache gen bumped)\n");
	return 0;
}