aboutsummaryrefslogtreecommitdiff
path: root/pa1_syscalls_lkms/modules
diff options
context:
space:
mode:
authorJack Sangdahl <[email protected]>2024-04-02 23:08:19 -0600
committerJack Sangdahl <[email protected]>2024-04-02 23:08:19 -0600
commit4b0d366a6665a70921dedb26c9ed5bdc7cd5c948 (patch)
treeb10db80f6dc3ef49a79a1bff83725d4b31f3b2da /pa1_syscalls_lkms/modules
downloadcsci3753-4b0d366a6665a70921dedb26c9ed5bdc7cd5c948.tar.gz
csci3753-4b0d366a6665a70921dedb26c9ed5bdc7cd5c948.zip
pa1
Diffstat (limited to 'pa1_syscalls_lkms/modules')
-rw-r--r--pa1_syscalls_lkms/modules/Makefile4
-rw-r--r--pa1_syscalls_lkms/modules/hellomodule.c20
2 files changed, 24 insertions, 0 deletions
diff --git a/pa1_syscalls_lkms/modules/Makefile b/pa1_syscalls_lkms/modules/Makefile
new file mode 100644
index 0000000..34b0157
--- /dev/null
+++ b/pa1_syscalls_lkms/modules/Makefile
@@ -0,0 +1,4 @@
+obj-m += hellomodule.o
+
+all:
+ make -C /lib/modules/`uname -r`/build M=`pwd`
diff --git a/pa1_syscalls_lkms/modules/hellomodule.c b/pa1_syscalls_lkms/modules/hellomodule.c
new file mode 100644
index 0000000..0d92e22
--- /dev/null
+++ b/pa1_syscalls_lkms/modules/hellomodule.c
@@ -0,0 +1,20 @@
+#include <linux/init.h>
+#include <linux/module.h>
+
+MODULE_AUTHOR("jasa7131");
+MODULE_LICENSE("GPL");
+
+int hello_init(void);
+void hello_exit(void);
+
+int hello_init(void) {
+ printk(KERN_ALERT "inside %s function\n", __FUNCTION__);
+ return 0;
+}
+
+void hello_exit(void) {
+ printk(KERN_ALERT "inside %s function\n", __FUNCTION__);
+}
+
+module_init(hello_init);
+module_exit(hello_exit);