Answered step by step
Verified Expert Solution
Question
1 Approved Answer
c program that does this: sample output what else do you need?? write a program in c that meets the following specifications After Hard Coded
c program that does this:
sample output
what else do you need??
write a program in c that meets the following specifications
After Hard Coded Pause Point 2 but before you have closed Descriptor I/O operations, reset the buffer offset to the beginning of the sequence of bytes for the original file specified via the command line. Using Descriptor I/O open a new randomly named file on the file system with read, write, and execute permissions set for the user. Note: Read the tempnam(3) man page. You may disregard the note to never use this function (for this assignment); you may disregard the compiler warning regarding tempnam() usage. Using Descriptor I/O copy the bytes from the original file specified via the command line to the new randomly named file. The original file specified will be an arbitrary length. Note: If you are confident of this feature specify your compiled program as the command line argument, then test by running the created copy. Implement at least the reading and writing steps as a function your program calls. $ ./lsHiding lsHiding # Part 2 Pause Point: File appears in ls listing AZ [1]+ Stopped s is i ./1shiding 2022 lsHiding s fg 1 ./lsHiding Pause Point: File does not appear in ls listing, but still open AZ [1]+ Stopped s is i ./lsHiding s fg 1 ./1sHiding $ echo $? S7 $ ./lsHiding lsHiding # Part 2 Pause Point: File appears in ls listing AZ [1]+ Stopped s is i ./1shiding 2022 lsHiding s fg 1 ./lsHiding Pause Point: File does not appear in ls listing, but still open AZ [1]+ Stopped s is i ./lsHiding s fg 1 ./1sHiding $ echo $? S7 Use Descriptor I/O operations to open the file specified as a command line argument and read at least one byte from the sequence of bytes before Hard Coded Pause Point 1. Use file system operations to remove the i-node entry for the file opened in between Hard Coded Pause Point 1 and Hard Coded Pause Point 2. You may assume the file specified on the command line will have an on disk reference count of 1. Close Descriptor 1/0 operations to the open file after Hard Coded Pause Point 2. Note: To correctly test this portion of the implementation you should perform the operations in (run your program from) a section of the file system that is not an NFS (Network File System); in a department UNIX lab environment your home directory and all subdirectories) are an NFS section of the file system. The /tmp/directory on any department environment is not an NFS section of the file system; /tmp/ is typically not an NFS section on any UNIX system. Any user can create files in /tmp/, the temporary directory Note: If you are successful, the file that you specified as a command line argument will no longer be in the file system on disk. You should test this feature with that in mind. 5./1shiding filel.xxx + Part 1 Pause Point: File appears in Is listing AZ /lsHiding [1] + Stopped $ ls -1 2022 filel.XXX $ fg 1 ./1sHiding Pause Point: File does not appear in ls listing, but still open Az [1]+ Stopped Ishiding s fg 1 ./1sHiding 5 echo 52 After Hard Coded Pause Point 2 but before you have closed Descriptor I/O operations, reset the buffer offset to the beginning of the sequence of bytes for the original file specified via the command line. Using Descriptor I/O open a new randomly named file on the file system with read, write, and execute permissions set for the user. Note: Read the tempnam(3) man page. You may disregard the note to never use this function (for this assignment); you may disregard the compiler warning regarding tempnam() usage. Using Descriptor I/O copy the bytes from the original file specified via the command line to the new randomly named file. The original file specified will be an arbitrary length. Note: If you are confident of this feature specify your compiled program as the command line argument, then test by running the created copy. Implement at least the reading and writing steps as a function your program calls. $ ./lsHiding lsHiding # Part 2 Pause Point: File appears in ls listing AZ [1]+ Stopped s is i ./1shiding 2022 lsHiding s fg 1 ./lsHiding Pause Point: File does not appear in ls listing, but still open AZ [1]+ Stopped s is i ./lsHiding s fg 1 ./1sHiding $ echo $? S7 $ ./lsHiding lsHiding # Part 2 Pause Point: File appears in ls listing AZ [1]+ Stopped s is i ./1shiding 2022 lsHiding s fg 1 ./lsHiding Pause Point: File does not appear in ls listing, but still open AZ [1]+ Stopped s is i ./lsHiding s fg 1 ./1sHiding $ echo $? S7 Use Descriptor I/O operations to open the file specified as a command line argument and read at least one byte from the sequence of bytes before Hard Coded Pause Point 1. Use file system operations to remove the i-node entry for the file opened in between Hard Coded Pause Point 1 and Hard Coded Pause Point 2. You may assume the file specified on the command line will have an on disk reference count of 1. Close Descriptor 1/0 operations to the open file after Hard Coded Pause Point 2. Note: To correctly test this portion of the implementation you should perform the operations in (run your program from) a section of the file system that is not an NFS (Network File System); in a department UNIX lab environment your home directory and all subdirectories) are an NFS section of the file system. The /tmp/directory on any department environment is not an NFS section of the file system; /tmp/ is typically not an NFS section on any UNIX system. Any user can create files in /tmp/, the temporary directory Note: If you are successful, the file that you specified as a command line argument will no longer be in the file system on disk. You should test this feature with that in mind. 5./1shiding filel.xxx + Part 1 Pause Point: File appears in Is listing AZ /lsHiding [1] + Stopped $ ls -1 2022 filel.XXX $ fg 1 ./1sHiding Pause Point: File does not appear in ls listing, but still open Az [1]+ Stopped Ishiding s fg 1 ./1sHiding 5 echo 52 Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started