Rev 1536 | Rev 1653 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1536 | Rev 1610 | ||
|---|---|---|---|
| Line 62... | Line 62... | ||
| 62 | { |
62 | { |
| 63 | ipcarg_t r0,r1; |
63 | ipcarg_t r0,r1; |
| 64 | size_t i = 0; |
64 | size_t i = 0; |
| 65 | 65 | ||
| 66 | while (i < count) { |
66 | while (i < count) { |
| 67 | if (sync_send_2(streams[0].phone, CONSOLE_GETCHAR, 0, 0, &r0, &r1) < 0) { |
67 | if (async_req_2(streams[0].phone, CONSOLE_GETCHAR, 0, 0, &r0, &r1) < 0) { |
| 68 | return -1; |
68 | return -1; |
| 69 | } |
69 | } |
| 70 | ((char *)buf)[i++] = r0; |
70 | ((char *)buf)[i++] = r0; |
| 71 | } |
71 | } |
| 72 | return i; |
72 | return i; |
| Line 76... | Line 76... | ||
| 76 | { |
76 | { |
| 77 | int i; |
77 | int i; |
| 78 | ipcarg_t r0,r1; |
78 | ipcarg_t r0,r1; |
| 79 | 79 | ||
| 80 | for (i = 0; i < count; i++) |
80 | for (i = 0; i < count; i++) |
| 81 | send_call(streams[1].phone, CONSOLE_PUTCHAR, ((const char *)buf)[i]); |
81 | async_msg(streams[1].phone, CONSOLE_PUTCHAR, ((const char *)buf)[i]); |
| 82 | 82 | ||
| 83 | return count; |
83 | return count; |
| 84 | } |
84 | } |
| 85 | 85 | ||
| 86 | 86 | ||
| Line 128... | Line 128... | ||
| 128 | 128 | ||
| 129 | 129 | ||
| 130 | fd_t open(const char *fname, int flags) |
130 | fd_t open(const char *fname, int flags) |
| 131 | { |
131 | { |
| 132 | int c = 0; |
132 | int c = 0; |
| 133 | 133 | ||
| 134 | while (((streams[c].w) || (streams[c].r)) && (c < FDS)) |
134 | while (((streams[c].w) || (streams[c].r)) && (c < FDS)) |
| 135 | c++; |
135 | c++; |
| 136 | if (c == FDS) |
136 | if (c == FDS) |
| 137 | return EMFILE; |
137 | return EMFILE; |
| 138 | 138 | ||
| Line 157... | Line 157... | ||
| 157 | } |
157 | } |
| 158 | 158 | ||
| 159 | 159 | ||
| 160 | ssize_t write(int fd, const void *buf, size_t count) |
160 | ssize_t write(int fd, const void *buf, size_t count) |
| 161 | { |
161 | { |
| - | 162 | // __SYSCALL3(SYS_IO, 1, (sysarg_t)buf, (sysarg_t) count); |
|
| - | 163 | // return count; |
|
| 162 | if (fd < FDS) |
164 | if (fd < FDS) |
| 163 | return streams[fd].w(streams[fd].param, buf, count); |
165 | return streams[fd].w(streams[fd].param, buf, count); |
| 164 | 166 | ||
| 165 | return 0; |
167 | return 0; |
| 166 | } |
168 | } |