ubase/freeramdisk.c

40 lines
588 B
C
Raw Normal View History

2014-06-26 15:16:15 +00:00
/* See LICENSE file for copyright and license details. */
#include <sys/ioctl.h>
#include <sys/mount.h>
#include <sys/types.h>
2014-06-30 18:03:41 +00:00
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
2014-06-26 15:16:15 +00:00
#include <unistd.h>
2014-06-30 18:03:41 +00:00
2014-06-26 15:16:15 +00:00
#include "util.h"
static void
usage(void)
{
eprintf("usage: %s\n", argv0);
}
int
main(int argc, char *argv[])
{
char *dev = "/dev/ram";
int fd;
ARGBEGIN {
default:
usage();
} ARGEND;
if (argc != 0)
usage();
if ((fd = open(dev, O_RDWR)) < 0)
eprintf("open: %s:", dev);
if (ioctl(fd, BLKFLSBUF, dev) < 0)
eprintf("BLKFLSBUF %s:", dev);
close(fd);
2014-10-02 22:45:25 +00:00
return 0;
2014-06-26 15:16:15 +00:00
}