I should be able to do this:
bash$ echo test1 > /dev/cut1
bash$ echo test2 > /dev/cut2
bash$ cat < /dev/cut1
test1
bash$ cat < /bin/ls > /dev/cut3
bash$ cat < /dev/cut3 > /tmp/foo
bash$ chmod a+x /tmp/foo
bash$ /tmp/foo
file1 file2 file3 file4 file5 file6
bash$ cat < /dev/cut1
test1
Points | Task |
500 | Registers as a device |
500 | Can be read from |
300 | Can be written to |
200 | Read gives the last write |
800 | Can do ten devices |
100 | Knows the minor number |
300 | Allocates just the amount of ram needed |
200 | When unregistering, frees that ram |
700 | Has a /proc interface |
100 | /proc tells which slots have data |
100 | /proc tells the length of that data |
300 | Only the user who wrote the item can read it |
100 | It logs all unauthorized attempts |
-500 | Any memory leak |
-500 | Any dump |
-700 | Any crash of the kernel |
200 | Handles binary data |
700 | Multiple writes from the same open are concatenated |
700 | Multiple reads from the same open are consecutive |
1000 | Can handle more than 4K at once |
Hints:
You can allocate ram via kmalloc. Make sure you're allocating
the right kind of ram.
The command "cat" will do many reads to the same device on the same
open. "dd" can be commanded to do as many or as few reads as you
want.
To read the entire thing in one read, try "dd if=/dev/cut of=/tmp/foo
bs=10000000000000"
To write it in small chunks, try "dd if=/tmp/foo of=/dev/cut bs=10"