source: trunk/IPs/systemC/Environment/Sim2OS/src/Sim2OS_service_open.cpp

Last change on this file was 88, checked in by rosiere, 18 years ago

Almost complete design
with Test and test platform

  • Property svn:keywords set to Id
File size: 1.6 KB
Line 
1#include "../include/Sim2OS.h"
2
3namespace environment {
4namespace sim2os {
5
6 void * Sim2OS::service_open (void)
7 {
8 if (have_all_arguments(3) == false)
9 {
10 std::cerr << "<" << name << "> Usage : int open(const char *pathname, int flags, mode_t mode);" << std::endl;
11 return NULL;
12 }
13
14 const char *pathname = (const char *) convert_address(arguments[1]);
15 int flags = static_cast<int >(reinterpret_cast<int64_t>(arguments[2]));
16 mode_t mode = static_cast<mode_t>(reinterpret_cast<int64_t>(arguments[3]));
17 void * result = (void *) open(pathname,flags,mode);
18 error = errno;
19
20 std::cout << "\n\t***** service : open *****" << std::endl;
21 std::cout << "\tpathname : " << pathname << std::endl;
22 std::cout << "\tflags /8 : " << std::oct << (unsigned int) flags << std::endl;
23 std::cout << "\tflags /10 : " << std::dec << (unsigned int) flags << std::endl;
24 std::cout << "\tflags /16 : " << std::hex << (unsigned int) flags << std::endl;
25 std::cout << "\tmode /8 : " << std::oct << (unsigned int) mode << std::endl;
26 std::cout << "\tmode /10 : " << std::dec << (unsigned int) mode << std::endl;
27 std::cout << "\tmode /16 : " << std::hex << (unsigned int) mode << std::endl;
28 std::cout << "\tresult : " << static_cast<int32_t>(reinterpret_cast<int64_t>(result)) << std::endl;
29 std::cout << "\terrno : " << (unsigned int) error << std::endl;
30
31 return result;
32 }
33
34};
35};
Note: See TracBrowser for help on using the repository browser.