mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-13 20:12:26 +00:00
- `dep.c` and `dep2.c`: `debugfs_create_u32` does not return anymore, not sure why: https://unix.stackexchange.com/questions/593983/creating-a-debugfs-file-that-is-used-to-read-write-u32-value/621282#621282 So just doing `debugfs_lookup` for now - vermagic.c:51161bfc66prevents its usage in v5.8. Just migrating to `init_utsname` for now - procfs.c: `struct file_operations` moved to a new `struct proc_ops` at:b567e07513- myprintk.c: `pr_warning` dropped for `pr_warn`:61ff72f401- `poll.c`: `kthread_func` is not defined in kernel, prefix with lkmc to avoid conflict Fix https://github.com/cirosantilli/linux-kernel-module-cheat/issues/136 Fix https://github.com/cirosantilli/linux-kernel-module-cheat/issues/137
43 lines
1.0 KiB
C
43 lines
1.0 KiB
C
/* https://cirosantilli.com/linux-kernel-module-cheat#vermagic */
|
|
|
|
#include <linux/module.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/utsname.h>
|
|
#if 0
|
|
#include <linux/vermagic.h> /* VERMAGIC_STRING */
|
|
#endif
|
|
|
|
static int myinit(void)
|
|
{
|
|
struct new_utsname *uts = init_utsname();
|
|
pr_info(
|
|
"sysname = %s\n"
|
|
"nodename = %s\n"
|
|
"release = %s\n"
|
|
"version = %s\n"
|
|
"machine = %s\n"
|
|
"domainname = %s\n",
|
|
uts->sysname,
|
|
uts->nodename,
|
|
uts->release,
|
|
uts->version,
|
|
uts->machine,
|
|
uts->domainname
|
|
);
|
|
|
|
#if 0
|
|
/* Possible before v5.8, but was buggy apparently, not sure why:
|
|
* https://github.com/cirosantilli/linux/commit/51161bfc66a68d21f13d15a689b3ea7980457790 */
|
|
pr_info("VERMAGIC_STRING = " VERMAGIC_STRING "\n");
|
|
#endif
|
|
/* Nice try, but it is not a member. */
|
|
/*pr_info("THIS_MODULE->vermagic = %s\n", THIS_MODULE->vermagic);*/
|
|
return 0;
|
|
}
|
|
|
|
static void myexit(void) {}
|
|
|
|
module_init(myinit)
|
|
module_exit(myexit)
|
|
MODULE_LICENSE("GPL");
|