Question: in C programming In this exercise, you shall add a device driver to the Minix operating system. a. This driver shall be called homework. One
in C programming
In this exercise, you shall add a device driver to the Minix operating system.
a. This driver shall be called homework. One of the nice things about Minix is it has the reincarnation server, so when your server is built and written, you do not have to reboot your system to start and test your driver. You can use the service commands as described above and in the Minix 3 developer site.
b. This shall be a driver for a character device which stores an integer stored in one of five slots when write() is called, and will return the integer when read() is called.
i. For now, if no integer has been written to the device, the read() call return whatever is in the slot (be sure to initialize the slots to 0). Future assignments will differentiate between the slot containing 0 and an uninitialized slot, so you may want to put that logic in now (see HIOCCLEARSLOT below).
c. Your driver will support the ioctl() call. Three ioctl commands should be supported:
i. HIOCSLOT shall tak an argument that specifies which slot should be used. Only integers between 0 and 4 (inclusive) should be accepted; if the argument is outside the range, print an error to the console and make sure the system call returns the proper error code.
ii. HIOCCLEARSLOT should set the current slot to invalid and set the value of the slot to 0.
iii. HIOCGETSLOT should return the current slot index (should be between 0 and 4). If the current slot is not valid, a return code of -1 should be issued.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
