summaryrefslogtreecommitdiff
path: root/pid2
diff options
context:
space:
mode:
authorGuillermo Ramos2011-08-10 22:43:05 +0200
committerGuillermo Ramos2011-08-10 22:43:05 +0200
commita722d196c465bae07075819a8bdfb9e9376d2651 (patch)
tree560016efba95aff18637c5c7ee8ce7b623cb931f /pid2
parent00d5bce9f24e2114316bd1165ebdad05644b7365 (diff)
downloadlkm-a722d196c465bae07075819a8bdfb9e9376d2651.tar.gz
AƱadidos pidevice y hang
Diffstat (limited to 'pid2')
-rw-r--r--pid2/Makefile7
-rw-r--r--pid2/loader.sh23
-rw-r--r--pid2/pid.c50
3 files changed, 0 insertions, 80 deletions
diff --git a/pid2/Makefile b/pid2/Makefile
deleted file mode 100644
index b9e7cfd..0000000
--- a/pid2/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-obj-m += pid.o
-
-all:
- make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
-
-clean:
- make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
diff --git a/pid2/loader.sh b/pid2/loader.sh
deleted file mode 100644
index 579acff..0000000
--- a/pid2/loader.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-module="pidevice"
-device="pidevice"
-mode="644"
-
-insmod ./$module.ko $* || exit -1
-
-rm -f /dev/${device}[0-4]
-
-major=$(cat /proc/devices | grep $module | cut -f 1)
-
-echo major
-exit -1
-
-for i in {0..3}; do
- mknod /dev/${device}$i c $major $i
-done
-
-group="staff"
-grep -q '^staff:' /etc/group || group="wheel"
-
-chgrp $group /dev/${device}[0-3]
-chmod $mode /dev/${device}[0-3]
diff --git a/pid2/pid.c b/pid2/pid.c
deleted file mode 100644
index 6362f82..0000000
--- a/pid2/pid.c
+++ /dev/null
@@ -1,50 +0,0 @@
-#include <linux/fs.h>
-#include <linux/init.h>
-#include <linux/kdev_t.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/sched.h>
-#include <linux/types.h>
-
-static char devname[] = "pidevice";
-static char modname[] = "pid.ko";
-static dev_t mydev;
-static struct task_struct *mytask;
-static struct task_struct *parent;
-
-static void show_processes(void)
-{
- mytask = current;
- parent = mytask->parent;
-
- while (mytask->pid != parent->pid) {
- printk(KERN_ALERT "current: %s (%d) - parent: %s (%d)\n",
- mytask->comm, mytask->pid, parent->comm, parent->pid);
- mytask = mytask->parent;
- parent = mytask->parent;
- }
-}
-
-static int __init init(void)
-{
- int err;
-
- printk(KERN_ALERT "%s loaded by %s (%d)\n",
- modname, mytask->comm, mytask->pid);
-
- if ((err = alloc_chrdev_region(&mydev, 0, 1, devname)))
- printk(KERN_ALERT "ERROR in alloc_chrdev_region: %d\n", err);
-
- return 0;
-}
-
-static void __exit exit(void)
-{
- unregister_chrdev_region(mydev, 1);
- printk(KERN_ALERT "%s unloaded\n", modname);
-}
-
-module_init(init);
-module_exit(exit);
-
-MODULE_LICENSE("GPL");