4 #include <sys/ioc_memory.h>
10 main(int argc
, char *argv
[])
16 if(argc
< 2 || argc
> 3) {
17 fprintf(stderr
, "usage: %s <size in kB> [device]\n",
22 d
= argc
== 2 ? _PATH_RAMDISK
: argv
[2];
23 if((fd
=open(d
, O_RDONLY
)) < 0) {
29 size
= atol(argv
[1])*KFACTOR
;
32 fprintf(stderr
, "size should be non-negative.\n");
36 if(ioctl(fd
, MIOCRAMSIZE
, &size
) < 0) {
37 perror("MIOCRAMSIZE");
41 fprintf(stderr
, "size on %s set to %ldkB\n", d
, size
/KFACTOR
);