Write a Wrapper function for open () , read()

  • davidron
  • Born
  • Born
  • No Avatar
  • Joined: Apr 08, 2012
  • Posts: 2
  • Status: Offline

Post April 8th, 2012, 2:00 am

Hi ,

I'm requested to write wrapper function for open() and read() in Linux .
I've tried to search the web regarding how to that, but couldn't find anything worthwhile .
So , can anyone please give me some hints how to do that ?

I need to use "errno" to the correct value , if the system call fail .
I've check the tutorial on your site , very nice , BTW , but still I'd appreciate any help.

Regards,
David
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post April 8th, 2012, 2:00 am

  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Joined: Sep 22, 2003
  • Posts: 6130
  • Loc: Seattle, WA
  • Status: Offline

Post April 9th, 2012, 12:23 pm

A little more info would be helpful here. What language are you using? What is the wrapper supposed to do?
The Beer Monocle. Classy.
  • davidron
  • Born
  • Born
  • No Avatar
  • Joined: Apr 08, 2012
  • Posts: 2
  • Status: Offline

Post April 15th, 2012, 7:04 am

spork wrote:
A little more info would be helpful here. What language are you using? What is the wrapper supposed to do?



I'm requested to implement wrapper functions for open(), read(), write(),
close() and fork() system calls.
If the system call failed, the wrapper should set the value of errno correctly.

The output should produce a static library (or archive) with a name-
libmywrapper.a.

I've written quite a lot in C and C++ in my courses , however I have no idea how to
do this task .

Please notice ,that I'm not asking you to solve my homework , what I'm asking for is
any information and/or directions that you can advise me with .


Furthermore , I cannot call the libc wrappers, i.e., I'm not allowed to call open(), read(),
write(), close(), fork(), syscall() or any other system call in my code (to be).

Much appreciated ,

David

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 108 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.