CSE130 Winter 2022 : Assignment 6
In this assignment you will use system calls to read and write files and explore directory structures.
This assignment is worth 5% of your final grade.
Late submissions will not be graded.
Setup
SSH in to one of the two CSE130 teaching servers using your CruzID Blue password:
$ ssh @noggin.soe.ucsc.edu ( use Putty http://www.putty.org/ if on Windows )
or $ ssh @nogbad.soe.ucsc.edu
or $ ssh @olaf.soe.ucsc.edu
or $ ssh @thor.soe.ucsc.edu
Authenticate with Kerberos: ( do this every time you log in )
$ kinit ( you will be prompted for your Blue CruzID password )
Authenticate with AFS: ( do this every time you log in )
$ aklog
Create a suitable place to work: ( only do this the first time you log in )
$ mkdir –p CSE130/Assignment6
$ cd CSE130/Assignment6
Install the lab environment: ( only do this once )
$ tar xvf /var/classes/CSE130/Assignment6.tar.gz
Build the starter code:
$ cd ~/CSE130/Assignment6 ( always work in this directory )
$ make
Then try:
$ make grade ( runs the required functional tests - see below )
( also tells you what grade you will get - see below )
Run the incomplete fileman executable:
$ ./fileman -b ( basic tests )
$ ./fileman -a ( advanced tests )
$ ./fileman -s ( stretch test )
$ ./fileman -e ( extreme test )
Additional Information
In this assignment you can make use of the Linux versions of the Pintos system calls you are implementing in
the second half of Lab 3. However, you can use any standard Linux utility you find useful.
University of California Santa Cruz Baskin School of Engineering CSE130 Winter 2022 Assignment 6 Copyright ? 2017-2022 David C. Harrison. All rights reserved.
Requirements
Basic: Read and write ASCII text files
Read Missing Return appropriate error code when asked to read a non-existent file.
Read Exists Read requested number of bytes from an existing file starting at the first byte of
the file and populating from the first byte of the supplied buffer.
Read File Offset Read requested number of bytes from an existing file starting at a given byte of
the file and populating from the first byte of the supplied buffer.
Read Buffer Offset Read requested number of bytes from an existing file starting at the first byte of
the file and populating from a given byte of the supplied buffer.
Read Both Offset Read requested number of bytes from an existing file starting at a given byte of
the file and populating from a given byte of the supplied buffer
Write Missing Create a file and write the requested number of bytes from the supplied buffer
starting at the first byte of the new file and the first byte of the supplied buffer.
Write Exists Return appropriate error code when asked to write to an existing file.
Write File Offset Create a file and write the requested number of bytes from the supplied buffer
starting at the requested byte of the new file and the first byte of the supplied
buffer.
Write Buffer Offset Create a file and write the requested number of bytes from the supplied buffer
starting at the first byte of the new file and the requested byte of the supplied
buffer.
Write Both Offset Create a file and write the requested number of bytes from the supplied buffer
starting at the requested byte of the new file and the requested byte of the
supplied buffer.
Advanced: Copy and append data to ASCII text files
Append Missing Return appropriate error code when asked to append to a non-existent file.
Append Exists Append the contents of a supplied buffer to an existing file.
Copy Missing Return appropriate error code when asked to copy from a non-existent file.
Copy Exists Copy the contents of an existing file to a new one.
Stretch: List a directory tree like so:
home
vkhqmgwsgd
agmugje
surxeb
dyjxfseur
wy
tcx
jbjfwbv
rnixyjz
Extreme: List a directory tree like so:
home
└── vkhqmgwsgd
├── agmugje
│ └── surxeb
│ ├── dyjxfseur
│ └── wy
└── tcx
└── jbjfwbv
└── rnixyjz
University of California Santa Cruz Baskin School of Engineering CSE130 Winter 2022 Assignment 6 Copyright ? 2017-2022 David C. Harrison. All rights reserved.
What steps should I take to tackle this?
This assignment is all about research. There are many ways to pass the tests, so find one that works. Using the
system calls you are becoming familiar with in Lab 3 may be an easy way to get started.
? Do not use the system() system call or any of the exec() family of system calls.
? Take great care to close() any files you open() or creat();
How much code will I need to write?
A model solution satisfying all requirements has approximately 100 lines of executable code.
Grading scheme
The following aspects will be assessed:
1. (100%) Does it work?
a. Basic Requirements (30%)
b. Advanced Requirements (25%)
c. Stretch Requirements (20%)
d. Extreme Requirements (15%)
e. Your implementation is free of compiler warnings and memory errors (10%)
2. (-100%) Did you use the system() system call or any of the exec() family of system calls?
Do not use these system calls. Instead, use system calls like open(), read(), and write().
3. (-100%) Did you give credit where credit is due?
a. Your submission is found to contain code segments copied from on-line resources and you failed to give
clear and unambiguous credit to the original author(s) in your source code (-100%). You will also be
subject to the university academic misconduct procedure as stated in the class academic integrity policy.
b. Your submission is determined to be a copy of a past or present student’s submission (-100%)
c. Your submission is found to contain code segments copied from on-line resources that you did give a
clear an unambiguous credit to in your source code, but the copied code constitutes too significant a
percentage of your submission:
o < 25% copied code No deduction
o 25% to 50% copied code (-50%)
o > 50% copied code (-100%)
What to submit
In a command prompt:
$ cd ~/CSE130/Assignment6
$ make submit