Difference between revisions of "Operating Systems 2014F: Assignment 7"

From Soma-notes
Jump to navigation Jump to search
Line 14: Line 14:


# [2] What kind of errors do Linux kernel "Oops" messages report?  How can the kernel generate these errors (rather than just crashing)?  Be sure to give a specific example (with code) of something that would generate an Oops error.
# [2] What kind of errors do Linux kernel "Oops" messages report?  How can the kernel generate these errors (rather than just crashing)?  Be sure to give a specific example (with code) of something that would generate an Oops error.
# [2] What is the purpose of the ones_fops struct?  How are its values used?
# [2] What is the importance of the put_user() call in ones_read()?  If you omit it and instead just assign directly (e.g., "*buf++ = '1'"), does the module still work?  (Explain what happens if the module uses or doesn't use put_user() to store values to buf and how that relates to the importance of put_user()).
# [2] How do you change the code of the ones module so that /dev/ones is readable and writable by all users (without manually changing the permissions on the special file /dev/ones)?  Why does this code control the permissions of this file?  (To answer explain briefly when and how the code specifying the permission is called.)
# [2] How do you change the code of the ones module so that /dev/ones is readable and writable by all users (without manually changing the permissions on the special file /dev/ones)?  Why does this code control the permissions of this file?  (To answer explain briefly when and how the code specifying the permission is called.)
# [3] Modify the module to create a new device "/dev/onelines" that inserts a line break ('\n') every 78 characters.  Be sure to do the right thing when the output isn't divisible by 78, i.e., handle partial lines properly.  (Note the sysfs entries for oneslines should also appear in /sys/class/comp3000.)
# [3] Modify the module to create a new device "/dev/onelines" that inserts a line break ('\n') every 78 characters.  Be sure to do the right thing when the output isn't divisible by 78, i.e., handle partial lines properly.  (Note the sysfs entries for oneslines should also appear in /sys/class/comp3000.)
# [3] Modify the module to create a new device "/dev/repeatchar" that produces a character device that can input exactly one character.  (If more than one character is given to it, it only uses the first.)  It then outputs that character an unbounded number of times.  By default, it should output "1" so it behave exactly as "ones" did before.
# [3] Modify the module to create a new device "/dev/repeatchar" that produces a character device that can input exactly one character.  (If more than one character is given to it, it only uses the first.)  It then outputs that character an unbounded number of times.  By default, it should output "1" so it behave exactly as "ones" did before.

Revision as of 17:12, 13 November 2014

This assignment is not yet finalized.

Please submit the answers to the following questions via CULearn by midnight on Wednesday, November 19, 2014. There 10 points in 4 questions.

Submit your answers as a single text file named "<username>-comp3000-assign7.txt" (where username is your MyCarletonOne username). The first four lines of this file should be "COMP 3000 Assignment 7", your name, student number, and the date of submission. You may wish to format your answers in Markdown to improve their appearance.

No other formats will be accepted. Submitting in another format will likely result in your assignment not being graded and you receiving no marks for this assignment. In particular do not submit a zip file, MS Word, or OpenOffice file as your answers document!

You can turn in one source file (included in your text file) answering questions 3 and 4. Just make it clear what changes were made for answering each question either in the comments of the code or in separate explanatory text.

Don't forget to include what outside resources you used to complete each of your answers, including other students, man pages, and web resources. You do not need to list help from the instructor, TA, or information found in the textbook.

Note the following questions make reference to the code from Tutorial 7.

  1. [2] What kind of errors do Linux kernel "Oops" messages report? How can the kernel generate these errors (rather than just crashing)? Be sure to give a specific example (with code) of something that would generate an Oops error.
  2. [2] What is the purpose of the ones_fops struct? How are its values used?
  3. [2] What is the importance of the put_user() call in ones_read()? If you omit it and instead just assign directly (e.g., "*buf++ = '1'"), does the module still work? (Explain what happens if the module uses or doesn't use put_user() to store values to buf and how that relates to the importance of put_user()).
  4. [2] How do you change the code of the ones module so that /dev/ones is readable and writable by all users (without manually changing the permissions on the special file /dev/ones)? Why does this code control the permissions of this file? (To answer explain briefly when and how the code specifying the permission is called.)
  5. [3] Modify the module to create a new device "/dev/onelines" that inserts a line break ('\n') every 78 characters. Be sure to do the right thing when the output isn't divisible by 78, i.e., handle partial lines properly. (Note the sysfs entries for oneslines should also appear in /sys/class/comp3000.)
  6. [3] Modify the module to create a new device "/dev/repeatchar" that produces a character device that can input exactly one character. (If more than one character is given to it, it only uses the first.) It then outputs that character an unbounded number of times. By default, it should output "1" so it behave exactly as "ones" did before.