Create a ramdisk using 'ramdisk'.
This commit is contained in:
parent
1a7f7d6333
commit
34b1f1c738
@ -147,6 +147,7 @@ ALL = \
|
|||||||
proto \
|
proto \
|
||||||
pwd \
|
pwd \
|
||||||
pwdauth \
|
pwdauth \
|
||||||
|
ramdisk \
|
||||||
rarpd \
|
rarpd \
|
||||||
rcp \
|
rcp \
|
||||||
rawspeed \
|
rawspeed \
|
||||||
@ -643,6 +644,10 @@ pwdauth: pwdauth.c
|
|||||||
$(CCLD) -o $@ $?
|
$(CCLD) -o $@ $?
|
||||||
@install -S 4kw $@
|
@install -S 4kw $@
|
||||||
|
|
||||||
|
ramdisk: ramdisk.c
|
||||||
|
$(CCLD) -o $@ ramdisk.c
|
||||||
|
@install -S 4kw $@
|
||||||
|
|
||||||
rarpd: rarpd.c
|
rarpd: rarpd.c
|
||||||
$(CCLD) -o $@ rarpd.c
|
$(CCLD) -o $@ rarpd.c
|
||||||
@install -S 4kw $@
|
@install -S 4kw $@
|
||||||
@ -1029,6 +1034,7 @@ install: \
|
|||||||
/usr/bin/proto \
|
/usr/bin/proto \
|
||||||
/usr/bin/pwd \
|
/usr/bin/pwd \
|
||||||
/usr/lib/pwdauth \
|
/usr/lib/pwdauth \
|
||||||
|
/usr/bin/ramdisk \
|
||||||
/usr/bin/rarpd \
|
/usr/bin/rarpd \
|
||||||
/usr/bin/rcp \
|
/usr/bin/rcp \
|
||||||
/usr/bin/rawspeed \
|
/usr/bin/rawspeed \
|
||||||
@ -1472,6 +1478,9 @@ install: \
|
|||||||
/usr/lib/pwdauth: pwdauth
|
/usr/lib/pwdauth: pwdauth
|
||||||
install -cs -o root -m 4755 $? $@
|
install -cs -o root -m 4755 $? $@
|
||||||
|
|
||||||
|
/usr/bin/ramdisk: ramdisk
|
||||||
|
install -cs -o bin $? $@
|
||||||
|
|
||||||
/usr/bin/rarpd: rarpd
|
/usr/bin/rarpd: rarpd
|
||||||
install -cs -o bin $? $@
|
install -cs -o bin $? $@
|
||||||
|
|
||||||
|
38
commands/simple/ramdisk.c
Normal file
38
commands/simple/ramdisk.c
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
|
||||||
|
#include <minix/paths.h>
|
||||||
|
|
||||||
|
#include <sys/ioc_memory.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
signed long size;
|
||||||
|
if((fd=open(_PATH_RAMDISK, O_RDONLY)) < 0) {
|
||||||
|
perror(_PATH_RAMDISK);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(argc != 2) {
|
||||||
|
fprintf(stderr, "usage: %s <size in bytes>\n", argv[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
size = atol(argv[1]);
|
||||||
|
|
||||||
|
if(size <= 0) {
|
||||||
|
fprintf(stderr, "size should be positive.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ioctl(fd, MIOCRAMSIZE, &size) < 0) {
|
||||||
|
perror("MIOCRAMSIZE");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user