Earn Higher Grades With Instant Assignment Help.Ask Question!

Computer Science
(5/5)

Modify cprintf function to save everything that kernel writes in internal buffer. From kmesg file we can read the context of that buffer. File needs to behave correctly while read is called multiple times.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Kmesg:

Modify cprintf function to save everything that kernel writes in internal buffer.

From kmesg file we can read the context of that buffer.

File needs to behave correctly while read is called multiple times.

And if more text is written than the buffer size, old context should not be overwritten.

 

Random:

Every time user press a key on a keyboard, scan code of that key and time when its pressed should somehow impact on next random number.

There is global variable "ticks" that can be used for time.

Reading from this file is filling buffer with random bytes and mutate so the next reading can give different value.

Writing into this file mutates buffer with value of written bytes and time when the writing happened.

 

Disk:

Reading and writing on this file directly operates with blocks on the disk avoiding file system.

 

System call lseek(int fd, int offset, int whence):

read() and write() on open files can add to intern offset of the file structure for that specified file, and in that process number of bytes which are successfully redden/written.

Whence can be:

SEEK_SET (file offset is set on absolute value of offset argument),

SEEK_CUR (file offset is summed with offset argument, negative value leads to going backwards) or

SEEK_END (file offset is set on sum of file size and offset argument).

System call write() should be changed to in case that file offset is set on value that is larger than real file length, space between old file context and where new data should be is filled with zeros.

 

User program dd:

if-input file (default is standard input)

of-output file (default is standard input)

bs-block size (default is 512)

count-number of blocks (default is till the end of input file)

skip-how many blocks should be skipped in input file (default is 0)

seek-how many blocks should be skipped in output file (default is 0)

Examples:

  1. dd if=/home/README of=/home/readme2

Copy README into readme2

  1. dd if=/home/README of=home/snippet skip=2 count=1

Copy 512B from README after 1KB

  1. dd if=/dev/random of=/home/keyfile bs=64 count=2

Generate random file that is 128 bytes

  1. dd if=/dev/random of=/test bs=8 count=1 seek=7

Generate file with 56 zeros and 8 random bytes

  1. dd if=/dev/random count=1

 

Attachments:
(5/5)

Related Questions

CSI 1420 Introduction to C Programming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two majorconstructs of the C programming language – Fu

The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Assignment To Be Done By Our ExpertsGet A+ Grade Solution Guaranteed

expert
joyComputer science
(4/5)
12 Answers Hire Me
expert
Robert DLaw
(4.8/5)
836 Answers Hire Me
expert
Dr Samuel BarberaStatistics
(5/5)
583 Answers Hire Me
expert
Tutor For YouEconomics
(5/5)
927 Answers Hire Me