F0 - Specification 📐

You will conceive of an idea for a novel character driver with the objective of designing something that is creative and non-trivial and will provide for an entertaining demonstration as part of someone’s final presentation.

With the knowledge that it is one of your colleagues who will be responsible for actually implementing your idea, you will write a specification of the behavior of each syscall that is precise and detailed enough for them to implement it correctly.

To further guide your colleague in implementing a driver that complies with your creative vision, you must write a userspace program that executes a suite of tests that a correct driver should pass.

Outcomes:

What to submit:

Procedure:

  1. Brainstorm some ideas with an eye for how the behavior can be implemented in a real character driver. Some entertaining ideas may be more feasible on paper than in practice, so get started early so that you don’t have to pick the first idea you can come up with right before the due date. As a source of inspiration, here are some categories of ideas that have proved viable in the past with examples of what previous students did.
  2. The most important system calls to figure out will be read, write and ioctl. Read and write are best at handling strings of text, while if you want to process numbers, ioctl is probably a better option. Ioctl can also be a catch all way to signal that the user wishes for something to happen and different commands can be passed to indicate different actions.

  3. Once you have designed the core functionality of the driver, consider how those functions will (or will not) interact with the file position value that the kernel stores for each open file and how lseek will fit into that picture. What if any types of repositioning should be supported? How will the other functions handle a file position that might be out of bounds?

  4. Finally you have to think about the life-cycle of a given file and the driver overall. Does some the state persist the whole time the driver is loaded? If so, what initial condition should it be in when the driver is first loaded. Does anything get reset or created in response to a call to open? If so do things need to be cleaned up in release when the file is closed?

  5. Write a plain-text specification for the open, read, write, close, ioctl, and lseek syscalls.
  6. You must test all of the system calls that your driver supports and write at least 25 tests in total. For the main system calls read, write and ioctl, you should have at least 5-7 tests.
  7. You will not have a driver implementation to run your test program against, however you can still verify that it is performing the right operations by pointing it at a dummy file like /dev/null or /dev/zero and verifying that it is making the right system calls with strace.

Submission Guidelines