Best代写-最专业靠谱代写IT | CS | 留学生作业 | 编程代写Java | Python |C/C++ | PHP | Matlab | Assignment Project Homework代写

C语言代写 | CSC 452 – Project 2: Syscalls

C语言代写 | CSC 452 – Project 2: Syscalls


Project Description

We know from our description of the kernel that it provides fundamental operations that help us to
interact with resources. These system calls include things like read, write, open, close, and fork. With
access to the source code for the Linux kernel, we have the ability to extend the kernel’s standard
functionality with our own.
In this assignment we will be creating a simple interface for passing small text messages from one user
to another by way of the kernel.

How it Will Work

There will be a userspace application called osmsg that allows a user to send and receive short text
messages. To send a message the user will issue a command like:
osmsg -s jmisurda “Hello world”
which will queue up a message to be sent to the user jmisurda when they get their messages with the
following command:

osmsg -r

This would output something like the following:
abc123 said: “Hello world”
Notice that this is more like email than instant messages, due to the fact that the recipient needs to
explicitly request their messages. If there is more than one message waiting to be received, they will all
be displayed at once. A message is discarded from the system after it has been read.

Syscall Interface

The osmsg application will do the sending and receiving of messages via two new system calls, which
you will implement. The syscalls should look like the following:
asmlinkage long sys_csc452_send_msg(const char __user *to, const char __user

*msg, const char __user *from)

This function sends a single message given the three string parameters. The return value should be 0 for
success, and a negative number on error.

asmlinkage long sys_csc452_get_msg(const char __user *to, char __user *msg,
char __user *from)
This function takes the recipient’s username as an input, and then returns via the two other parameters
the message and sender. Notice that this only returns one message, but there may be many messages to
deliver. The return value should be used to indicate if there are more messages to receive: 1 means to
call the function again, 0 means that there are no more to deliver, and a negative number indicates an
error. The msg and from pointers need to be pointing to space allocated in the user program’s address