mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-27 20:14:27 +01:00
init_dev_kmsg
This commit is contained in:
@@ -16,6 +16,7 @@ These programs can also be compiled and used on host.
|
|||||||
1. inits
|
1. inits
|
||||||
1. [sleep_forever](sleep_forever.c)
|
1. [sleep_forever](sleep_forever.c)
|
||||||
1. [poweroff](poweroff.c)
|
1. [poweroff](poweroff.c)
|
||||||
|
1. [init_dev_kmsg](init_dev_kmsg.c)
|
||||||
1. [uio_read](uio_read.c)
|
1. [uio_read](uio_read.c)
|
||||||
1. Module tests
|
1. Module tests
|
||||||
1. [anonymous_inode](anonymous_inode.c)
|
1. [anonymous_inode](anonymous_inode.c)
|
||||||
|
|||||||
13
kernel_module/user/init_dev_kmsg.c
Normal file
13
kernel_module/user/init_dev_kmsg.c
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
/* https://stackoverflow.com/questions/12683169/measure-time-taken-for-linux-kernel-from-bootup-to-userpace/46517014#46517014 */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
FILE *fp;
|
||||||
|
fp = fopen("/dev/kmsg", "w");
|
||||||
|
fputs(__FILE__ "\n", fp);
|
||||||
|
fclose(fp);
|
||||||
|
while (1)
|
||||||
|
sleep(0xFFFFFFFF);
|
||||||
|
}
|
||||||
2
runqemu
2
runqemu
@@ -10,7 +10,7 @@ kgdb=false
|
|||||||
nographic=false
|
nographic=false
|
||||||
# norandmaps: Don't use address space randomization. Equivalent to echo 0 > /proc/sys/kernel/randomize_va_space.
|
# norandmaps: Don't use address space randomization. Equivalent to echo 0 > /proc/sys/kernel/randomize_va_space.
|
||||||
# printk.time=y: log in format: "[time ] msg" for all printk messages.
|
# printk.time=y: log in format: "[time ] msg" for all printk messages.
|
||||||
extra_append='norandmaps printk.time=y'
|
extra_append='norandmaps printk.devkmsg=on printk.time=y'
|
||||||
extra_flags=''
|
extra_flags=''
|
||||||
while getopts a:de:knqt: OPT; do
|
while getopts a:de:knqt: OPT; do
|
||||||
case "$OPT" in
|
case "$OPT" in
|
||||||
|
|||||||
Reference in New Issue
Block a user