]> git.feebdaed.xyz Git - linuxyz.git/commitdiff
proc
authorseantywork <seantywork@gmail.com>
Wed, 19 Nov 2025 05:10:58 +0000 (05:10 +0000)
committerseantywork <seantywork@gmail.com>
Wed, 19 Nov 2025 05:10:58 +0000 (05:10 +0000)
kproc/Makefile
kproc/kproc.c
kproc/user/Makefile
kproc/user/user.c

index 96b2aa4936ae871ddb5ec3d4fdd450bd6f192734..57c0379f78ff9ce177c1340f8489c3d3f2930c54 100644 (file)
@@ -1,6 +1,8 @@
 obj-m := kproc.o
 
 all:
+       make -C user
        make -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) modules
 clean:
+       make -C user
        make -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) clean
\ No newline at end of file
index 701ed8ee4bb499ede7299b8102590c8d327f7729..8647557ac1ea73b82b083529ad2d9b4f75647ecc 100644 (file)
@@ -28,9 +28,9 @@ static void show_proc_context(char* buf){
     unsigned int uid;
     if(likely(in_task())){
         uid = from_kuid(&init_user_ns, current_uid());
-        snprintf(buf, KPROC_BUFF_LEN, "kproc: ctx: process: uid: %u: pid: %d\n", uid, task_pid_nr(current));
+        snprintf(buf, KPROC_BUFF_LEN, "kproc: ctx: process: uid: %u: pid: %d", uid, task_pid_nr(current));
     } else {
-        snprintf(buf, KPROC_BUFF_LEN, "kproc: ctx: interrupt\n");
+        snprintf(buf, KPROC_BUFF_LEN, "kproc: ctx: interrupt");
     }
 }
 
index 421d8199841721ea8efe1a70d08c890a00bab9f3..18ffa8afa341cbfa83467e814023228d0dcc349f 100644 (file)
@@ -1,2 +1,4 @@
 all:
-       gcc -g -o user.out user.c -lpthread
\ No newline at end of file
+       gcc -g -o user.out user.c -lpthread
+clean:
+       rm -rf *.out *.o
\ No newline at end of file
index f930ff356778bf246def6a1ceba340a607fd3e73..9009319104529d54dfbb4c81a6c32ce76534341e 100644 (file)
@@ -1,4 +1,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <pthread.h>
\ No newline at end of file
+#include <pthread.h>
+
+int main(){
+
+
+    return 0;
+}
\ No newline at end of file