Hi List, This is my first post on ToyBox community.
Please find the patches attached herewith for adding 3 new commands -
1. freeramdisk - If we unmount or detach the RAM disk based file system the
Linux Kernel
will not free the allocated memory associated with the RAM device. This
can be useful if
one wants to mount this device again: All data will be preserved.
If we need to free the memory back to the Kernel, one can use the
command: "toybox freeramdisk <RAM device>".
2. openvt - Successfully opens a new virtual terminal as mentioned with -c
option
otherwise search and open next available VT.
with -s option it switches to new VT
with -s -w option, it switch back successfully to originating VT.
3. deallocvt - Deallocate specified virtual teminal.
if no virtual terminal is specified, it deallocates all unused VT.
Please find the test log attached here for above 3 commands.
Your inputs are welcome.
Thanks.
Vivek
vbhagat@Leo:~/toybox$ sudo mke2fs /dev/ram0
[sudo] password for vbhagat:
mke2fs 1.41.11 (14-Mar-2010)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
16384 inodes, 65536 blocks
3276 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67108864
8 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 26 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
vbhagat@Leo:~/toybox$ sudo mkdir /mnt/ram0
vbhagat@Leo:~/toybox$ sudo mount /dev/ram0 /mnt/ram0/
vbhagat@Leo:~/toybox$ sudo dd if=/dev/ram0 bs=1k count=3072 of=/mnt/ram0/3mb
3072+0 records in
3072+0 records out
3145728 bytes (3.1 MB) copied, 0.0269973 s, 117 MB/s
vbhagat@Leo:~/toybox$ free -k
total used free shared buffers
cached
Mem: 1026460 451696 574764 0 90468 201452
-/+ buffers/cache: 159776 866684
Swap: 1128440 0 1128440
vbhagat@Leo:~/toybox$ sudo umount /dev/ram0
vbhagat@Leo:~/toybox$ free -k
total used free shared buffers
cached
Mem: 1026460 448340 578120 0 87140 198388
-/+ buffers/cache: 162812 863648
Swap: 1128440 0 1128440
vbhagat@Leo:~/toybox$ sudo ./toybox freeramdisk /dev/ram0
vbhagat@Leo:~/toybox$ free -k
total used free shared buffers
cached
Mem: 1026460 442884 583576 0 87148 198388
-/+ buffers/cache: 157348 869112
Swap: 1128440 0 1128440
vbhagat@Leo:~/toybox$
======================= openvt log
===================================================
vbhagat@Leo:~/toybox$ sudo ./toybox openvt -c 9 -s -w -- /bin/bash -c
"/bin/date; sleep 3; /bin/date"
# below command successfully switch to the new VT (/dev/tty9), print the date,
wait 5 seconds,
# print the new date, and switch back to the original VT.
vbhagat@Leo:~/toybox$ sudo ./toybox openvt -s -- /bin/bash -c "/bin/date; sleep
2; /bin/date"
#without -s option only, it switches to new VT and runs command over there.
# Also without -c option, it searches by itself for next available VT.
======================= deallocvt log
=================================================
vbhagat@Leo:~/toybox$ sudo ./toybox openvt -c 9 -s -w -- /bin/bash -c
"/bin/date; sleep 3; /bin/date"
vbhagat@Leo:~/toybox$ sudo ./toybox deallocvt 9
vbhagat@Leo:~/toybox$ sudo ./toybox openvt -c 10 -s -w -- /bin/bash -c
"/bin/date; sleep 3; /bin/date"
vbhagat@Leo:~/toybox$ sudo ./toybox deallocvt
#Above deallocvt command successfully cleans up /dev/tty9 and /dev/tty10
0001-Added-freeramdisk-command.patch
Description: Binary data
0002-Added-openvt-command.patch
Description: Binary data
0003-Added-deallocvt-command.patch
Description: Binary data
_______________________________________________ Toybox mailing list [email protected] http://lists.landley.net/listinfo.cgi/toybox-landley.net
