NAME
rb_ioctl, rb_enqueue, rb_dequeue -- syslog, and ring buffer
SYNOPSIS
rb_enqueue enqueues characters to a single, in-kernel ring buffer; re_dequeue
dequeues an enqueued character. rb_ioctl implements the control functions return
if the queue is empty or full, depending on the control argument.
DESCRIPTION
The rb_enqueue syscall takes a single character argument and returns the argument
if the character can be enqueued, -1 else. For instance, it will return -1 if the
ring buffer is full.
The rb_dequeue syscall takes no arguments are returns a single integer value, which
is the dequeued character, -1 else. For instance, if will return -1 if the ring
buffer is empty.
The rb_ioctl takes an integer argument giving the operation, as follows:
Argument value:
1 - return 1 if ring buffer is empty, 0 else.
2 - return 1 if ring buffer is full, 0 else.
On error, or an invalid argument value, return -1.
The ring buffer is of fixed size. The kernel needs to be rebuilt if the ring buffer
is to be of a different size. For this project, the size is 8.
HISTORY
Introduced as Project 2 in CSC 421 session 151.
BUGS
The code might not be thread safe; however see project 5 and 6.
-------------------
NAME
my_syslog -- kernel syslog system call
SYNOPSIS
takes a string argument, and kernel syslogs th string
DESCRIPTION
The my_syslog takes a string argument, and kernel syslogs the argument. It always
returns 0.
HISTORY
Introduced as Project 2 in CSC521 session 131.
BUGS
myringbuffer-test.c,
- mysyslog-test.c,
- mysyscall-test.h
.
Please refer to the adding a syscall page for an overview.
You will need to modify the following files:
KH/kernel/Makefile
KH/include/linux/syscalls.h
KH/arch/x86/syscalls/syscall_32.tbl
KH= /usr/src/linux-source-3.13.0/linux-source-3.13.0
In order that your Makefile record the changes that you made, first copy
each of these files to a file in the same directory, with the extension ".dist"
appended. For instance, copy KH/kernel/Makefile
to KH/kernel/Makefile.dist.
If this is done properly, (and the KH macro is corrected in the Make file), then
make kernel-diffs will give the kernel diffs that you must submit
for full credit for the project.
You kernel code will go into a new file KH/kernel/mysyscalls.c
in the kernel source tree.
The diff of syscall_32.tbl should be as follows:
+355 i386 my_syslog sys_my_syslog +356 i386 rb_ioctl sys_rb_ioctl +357 i386 rb_enqueue sys_rb_enqueue +358 i386 rb_dequeue sys_rb_dequeue
Making these changes, you should be able to build a kernel that proves itself
using make run-syslog.
kernel/mysyscalls.c to implement the ring buffer.
You have experience with the ring buffer, because of your previous assignment. In order not to deal with malloc in the kernel, the ring buffer struct, as well as the ring buffer buffer, will be static. That data structure and #define's are given to you in the template C file.
The files you will find in class/proj4, to serve as templates, are:

author: burton rosenberg
created: 27 sep 2015
update: 3 oct 2015