Rev | Line | |
---|
[2] | 1 | #ifndef SERVICE_WRITE_H |
---|
| 2 | #define SERVICE_WRITE_H |
---|
| 3 | |
---|
| 4 | #include "../sim2os.h" |
---|
| 5 | |
---|
| 6 | namespace hierarchy_memory { |
---|
| 7 | namespace sim2os { |
---|
| 8 | |
---|
| 9 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[ service_write ]~~~~~ |
---|
| 10 | void * |
---|
| 11 | Sim2os :: |
---|
| 12 | service_write () |
---|
| 13 | { |
---|
| 14 | if (have_all_arguments(3) == false) |
---|
| 15 | { |
---|
| 16 | cerr << "<" << NAME << "> Usage : ssize_t write(int fd, void *buf, size_t count);" << endl; |
---|
| 17 | return NULL; |
---|
| 18 | } |
---|
| 19 | |
---|
| 20 | int fd = (int) arguments[1]; |
---|
| 21 | const void *buf = (const void *) convert_address(arguments[2]); |
---|
| 22 | ssize_t count = (ssize_t) arguments[3]; |
---|
| 23 | void * result = (void *) write(fd,buf,count); |
---|
| 24 | error = errno; |
---|
| 25 | |
---|
| 26 | // No swap -> because it's a char |
---|
| 27 | |
---|
| 28 | cout << "\n\t***** service : write *****" << endl; |
---|
| 29 | cout << "\tfd : " << (unsigned int) fd << endl; |
---|
| 30 | cout << "\tbuf : " << hex << (unsigned int) buf << endl; |
---|
| 31 | //cout << "\tbuf : " << dec << (char *) buf << endl; |
---|
| 32 | cout << "\tcount : " << dec << (unsigned int) count << endl; |
---|
| 33 | cout << "\tresult : " << (unsigned int) result << endl; |
---|
| 34 | cout << "\terrno : " << (unsigned int) error << endl; |
---|
| 35 | |
---|
| 36 | return result; |
---|
| 37 | } |
---|
| 38 | |
---|
| 39 | };}; |
---|
| 40 | #endif //SERVICE_WRITE_H |
---|
Note: See
TracBrowser
for help on using the repository browser.