/* DF-2826 run-1 trigger: checkpoint file on fd 3 (>= 3).
 * elf_getfiles() error path drops the holdfp() reference =>
 * fdrop() panic "fdrop: invalid f_count 0" inside the syscall. */
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>

int
main(int argc, char **argv)
{
	const char *img = (argc > 1) ? argv[1] : "/root/df2826/df2826.ckpt";
	int fd = open(img, O_RDONLY);
	long rc;

	if (fd < 0) { perror("open"); return 1; }
	printf("trigger-fd3: fd=%d, CKPT_THAW...\n", fd);
	fflush(stdout);
	rc = syscall(467, 2 /*CKPT_THAW*/, fd, -1, 0);
	printf("trigger-fd3: returned rc=%ld errno-pending (unexpected)\n", rc);
	fflush(stdout);
	return 0;
}
