mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 05:35:07 +00:00
Add a simple /dev/random.
This commit is contained in:
parent
9528edab92
commit
05b088ee2f
5 changed files with 65 additions and 1 deletions
|
@ -6,6 +6,7 @@
|
|||
#include "ZeroDevice.h"
|
||||
#include "NullDevice.h"
|
||||
#include "FullDevice.h"
|
||||
#include "RandomDevice.h"
|
||||
#include <cstring>
|
||||
#include <AK/SimpleMalloc.h>
|
||||
#include <AK/kmalloc.h>
|
||||
|
@ -29,6 +30,9 @@ int main(int c, char** v)
|
|||
auto full = make<FullDevice>();
|
||||
vfs.registerCharacterDevice(1, 7, *full);
|
||||
|
||||
auto random = make<RandomDevice>();
|
||||
vfs.registerCharacterDevice(1, 8, *random);
|
||||
|
||||
if (!vfs.mountRoot(makeFileSystem(filename))) {
|
||||
printf("Failed to mount root :(\n");
|
||||
return 1;
|
||||
|
@ -187,7 +191,6 @@ int main(int c, char** v)
|
|||
byte buffer[512];
|
||||
for (;;) {
|
||||
nread = handle->read(buffer, sizeof(buffer));
|
||||
printf("read() returned %d\n", nread);
|
||||
if (nread <= 0)
|
||||
break;
|
||||
fwrite(buffer, 1, nread, stdout);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue