#define _GNU_SOURCE
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>

#ifndef AT_FDCWD
#define AT_FDCWD -100
#endif

#if defined(__i386__)
#define __NR_revokeat	324
#else
#error unsupported arch
#endif

int revokeat(int dfd, const char *path)
{
	return syscall(__NR_revokeat, dfd, path);
}

static void panic(const char *s)
{
	perror(s);
	exit(1);
}

int main(int argc, char *argv[])
{
	int fd, err;

	fd = open(argv[1], O_RDWR);
	if (fd < 0)
		panic("open");

	err = revokeat(AT_FDCWD, argv[1]);
	if (err)
		panic("revokeat");

	err = close(fd);
	if (err)
		panic("close");

	printf("Test OK.\n");
	return 0;
}

