Changeset b917098 in mainline for libc/generic/io/stream.c
- Timestamp:
- 2006-06-02T16:33:42Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a805c24
- Parents:
- b1f51f0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libc/generic/io/stream.c
rb1f51f0 rb917098 40 40 #include <console.h> 41 41 #include <unistd.h> 42 #include <async.h> 42 43 43 44 #define FDS 32 … … 47 48 preadfn_t r; 48 49 void * param; 50 int phone; 49 51 } stream_t; 50 52 51 int console_phone = -1; 52 53 stream_t streams[FDS] = {{0, 0, 0}}; 53 static int console_phone = -1; 54 static stream_t streams[FDS] = {{0, 0, 0, -1}}; 54 55 55 56 static ssize_t write_stderr(void *param, const void *buf, size_t count) … … 64 65 65 66 while (i < count) { 66 if ( ipc_call_sync_2(console_phone, CONSOLE_GETCHAR, 0, 0, &r0, &r1) < 0) {67 if (sync_send_2(streams[0].phone, CONSOLE_GETCHAR, 0, 0, &r0, &r1) < 0) { 67 68 return -1; 68 69 } … … 78 79 79 80 for (i = 0; i < count; i++) 80 send_call( console_phone, CONSOLE_PUTCHAR, ((const char *)buf)[i]);81 send_call(streams[1].phone, CONSOLE_PUTCHAR, ((const char *)buf)[i]); 81 82 82 83 return count; … … 99 100 stream.r = read_stdin; 100 101 stream.param = 0; 102 stream.phone = console_phone; 103 101 104 return stream; 102 105 } … … 106 109 stream_t stream; 107 110 int res; 108 111 109 112 if (console_phone < 0) { 110 113 while ((console_phone = ipc_connect_me_to(PHONE_NS, SERVICE_CONSOLE, 0)) < 0) { … … 139 142 140 143 if (!strcmp(fname, "stdout")) { 141 //streams[c].w = write_stdout;142 //return c;143 144 streams[c] = open_stdout(); 144 145 return c; … … 172 173 } 173 174 175 int get_fd_phone(int fd) 176 { 177 if (fd >= FDS || fd < 0) 178 return -1; 179 return streams[fd].phone; 180 }
Note:
See TracChangeset
for help on using the changeset viewer.