/* * mysyscalls.c * * !!! this is a kernel file, and goes in LINUX_ROOT/kernel * !!! modify the Makefile in that directory to include the file * !!! in the kernel build. * * Implements an in-kernel ring buffer and logging, using syscalls. * * template 27 sep 2015 -burt * * student name: * revision history: */ #include #include #define RING_BUFFER_SIZE 8 #define RING_BUFFER_OP_IS_EMPTY 1 #define RING_BUFFER_OP_IS_FULL 2 struct RingBuffer { int next_in ; int next_out ; int is_full ; char buffer[RING_BUFFER_SIZE] ; } ; static struct RingBuffer ring_buffer ; asmlinkage long sys_my_syslog(const char * msg) { printk(KERN_ALERT "my_syslog: %s\n", msg) ; return 0 ; } asmlinkage long sys_rb_ioctl(unsigned int op) { /* code here */ return 0 ; } asmlinkage long sys_rb_enqueue(const char c) { /* code here */ return 0 ; } asmlinkage long sys_rb_dequeue(void) { /* code here */ return 0 ; }