#!/usr/bin/perl -w

use POSIX;

my @tmp_files;
my $count = 50;
my $templ = "/tmp/aaa-fstest-";

my $creating = 0;

while (1) {

    if (rand(20) < 1.0) {
        $creating = not $creating;
	sleep (1);
    }

    if ($creating) {
	my $name;
	do {
	    $name = tmpnam();
	} until sysopen(FH, $name, O_RDWR|O_CREAT|O_EXCL, 0666);
	close FH;
	print "created $name\n";
	push @tmp_files, $name;
    } elsif (@tmp_files) {
	my $name = pop (@tmp_files);
	print "removing $name\n";
	unlink ($name);
    }
}
