void x_misc_setup(void)
{
    random_setup();
    loadbang_setup();
    namecanvas_setup();
    serial_setup();
    cputime_setup();
    realtime_setup();
}
Example #2
0
void x_misc_setup(void)
{
    random_setup();
    loadbang_setup();
    namecanvas_setup();
    cputime_setup();
    realtime_setup();
    oscparse_setup();
    oscformat_setup();
}
Example #3
0
int
main(int argc, char *argv[])
{
	char	*filename;
	size_t	size;
	int	oflags;
	int	fd;
	size_t	alignment;
	int	errors;

	filename = parseargs(argc, argv);
	if (! filename)
		return 1;

	/*
	 * Allocate a bitmap big enough to track the range of
	 * blocks we'll be dealing with.
	 */
	size = (filesize / blocksize) / 8 + 1;
	valid = malloc(size);
	if ((valid = malloc(size)) == NULL) {
		perror("malloc");
		return 1;
	}

	/* Lots of arguments affect how we open the file */
	oflags = test ? O_RDONLY : O_RDWR|O_CREAT;
	oflags |= preserve ? 0 : O_TRUNC;
	oflags |= wsync ? O_SYNC : 0;
	oflags |= direct ? O_DIRECT : 0;

	/*
	 * Open the file, write rand block in random places, read them all
	 * back to check for correctness, then close the file.
	 */
	if ((fd = open(filename, oflags, 0666)) < 0) {
		perror("open");
		return 1;
	}
	if (rt && realtime_setup(filename, fd))
		return 1;
	alignment = get_alignment(filename, fd);
	if (! alignment)
		return 1;

        printf("write%s\n", test ? " (skipped)" : "");
	writeblks(filename, fd, alignment);

        printf("readback\n");
	errors = readblks(fd, alignment);

	if (close(fd) < 0) {
		perror("close");
		return 1;
	}
	free(valid);

        if (errors) {
		printf("randholes: %d errors found during readback\n", errors);
		return 2;
        }

	printf("randholes: ok\n");

	return 0;
}