Rev | Line | |
---|
[2] | 1 | #ifndef SERVICE_OPEN_H |
---|
| 2 | #define SERVICE_OPEN_H |
---|
| 3 | |
---|
| 4 | #include "../sim2os.h" |
---|
| 5 | |
---|
| 6 | namespace hierarchy_memory { |
---|
| 7 | namespace sim2os { |
---|
| 8 | |
---|
| 9 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[ service_open ]~~~~~ |
---|
| 10 | void * |
---|
| 11 | Sim2os:: |
---|
| 12 | service_open () |
---|
| 13 | { |
---|
| 14 | if (have_all_arguments(3) == false) |
---|
| 15 | { |
---|
| 16 | cerr << "<" << NAME << "> Usage : int open(const char *pathname, int flags, mode_t mode);" << endl; |
---|
| 17 | return NULL; |
---|
| 18 | } |
---|
| 19 | |
---|
| 20 | const char *pathname = (const char *) convert_address(arguments[1]); |
---|
| 21 | int flags = (int) arguments[2]; |
---|
| 22 | mode_t mode = (mode_t) arguments[3]; |
---|
| 23 | void * result = (void *) open(pathname,flags,mode); |
---|
| 24 | error = errno; |
---|
| 25 | |
---|
| 26 | cout << "\n\t***** service : open *****" << endl; |
---|
| 27 | cout << "\tpathname : " << pathname << endl; |
---|
| 28 | cout << "\tflags /8 : " << oct << (unsigned int) flags << endl; |
---|
| 29 | cout << "\tflags /10 : " << dec << (unsigned int) flags << endl; |
---|
| 30 | cout << "\tflags /16 : " << hex << (unsigned int) flags << endl; |
---|
| 31 | cout << "\tmode /8 : " << oct << (unsigned int) mode << endl; |
---|
| 32 | cout << "\tmode /10 : " << dec << (unsigned int) mode << endl; |
---|
| 33 | cout << "\tmode /16 : " << hex << (unsigned int) mode << endl; |
---|
| 34 | cout << "\tresult : " << dec << (unsigned int) result << endl; |
---|
| 35 | cout << "\terrno : " << (unsigned int) error << endl; |
---|
| 36 | |
---|
| 37 | return result; |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | };}; |
---|
| 41 | #endif //SERVICE_OPEN_H |
---|
Note: See
TracBrowser
for help on using the repository browser.