The files files write example.c and files read example.c were used to
demonstrate the operations with files on UNIX.
Your task is to modify files write example.c so that it writes all the records
using only the last mmap based technique. It should not be too hard to do so.
The other two methods of access, i.e. using write and stdio functions should
not be used anymore. However, much of the logic remains the same.
What’s more, Linux provides the function mremap that can change the size
of the mapping after the file size changes. On the down side, other UNIX
versions including the Mac OS X do not, making it not portable. Your next
task will be to write a function that can extend the size of the mapping using
the ftruncate, msync munmap and mmap functions. On the other hand, this
approach is of course going to be less efficient.
ftruncate truncates the file to a specified size. It will also increase the size of
the file by filling it up with zeros to increase the size of the file if the specified
size is larger than the current size. For our purposes we will simply double the
size of the file each time we run out of space. The file will then be mapped
again to include the newly created free space. Once all the data is entered, you
will have to call ftruncate once more, this time to reduce the size of the file
to the actually used space.
While you are making changes, the code from files read example.c must
always be able to correctly read what your modified code writes. You can
use it to check whether your code is working properly.
8 freelancers are bidding on average $27 for this job
I have read job requirement carefully, please share project detail we will done this job on time, Thanks Relevant Skills and Experience Linux expert Proposed Milestones $35 USD - Task cost
I have 5+ years of working experience in C and Linux programming. I read the task details and I can do this task. Looking forward for a positive response from you.
Hello I saw your project detail and examples carefully Please contact me Best regards Relevant Skills and Experience Linux, Ubuntu, RedHat Proposed Milestones $25 USD - Finish
I will use all my skills as a computer engineer to satisfy you and within the time specified. Relevant Skills and Experience computer science engineer Proposed Milestones $25 USD - Initial milestone