Rev 4512 | Rev 4541 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4512 | Rev 4514 | ||
|---|---|---|---|
| Line 190... | Line 190... | ||
| 190 | list_append(&stream->link, &files); |
190 | list_append(&stream->link, &files); |
| 191 | 191 | ||
| 192 | return stream; |
192 | return stream; |
| 193 | } |
193 | } |
| 194 | 194 | ||
| - | 195 | FILE *fdopen(int fd, const char *mode) |
|
| - | 196 | { |
|
| - | 197 | /* Open file. */ |
|
| - | 198 | FILE *stream = malloc(sizeof(FILE)); |
|
| - | 199 | if (stream == NULL) { |
|
| - | 200 | errno = ENOMEM; |
|
| - | 201 | return NULL; |
|
| - | 202 | } |
|
| - | 203 | ||
| - | 204 | stream->fd = fd; |
|
| - | 205 | stream->error = false; |
|
| - | 206 | stream->eof = false; |
|
| - | 207 | stream->klog = false; |
|
| - | 208 | stream->phone = -1; |
|
| - | 209 | ||
| - | 210 | list_append(&stream->link, &files); |
|
| - | 211 | ||
| - | 212 | return stream; |
|
| - | 213 | } |
|
| - | 214 | ||
| 195 | FILE *fopen_node(fdi_node_t *node, const char *mode) |
215 | FILE *fopen_node(fdi_node_t *node, const char *mode) |
| 196 | { |
216 | { |
| 197 | int flags; |
217 | int flags; |
| 198 | if (!parse_mode(mode, &flags)) |
218 | if (!parse_mode(mode, &flags)) |
| 199 | return NULL; |
219 | return NULL; |
| Line 376... | Line 396... | ||
| 376 | stream->eof = false; |
396 | stream->eof = false; |
| 377 | 397 | ||
| 378 | return 0; |
398 | return 0; |
| 379 | } |
399 | } |
| 380 | 400 | ||
| - | 401 | void rewind(FILE *stream) |
|
| - | 402 | { |
|
| - | 403 | (void) fseek(stream, 0, SEEK_SET); |
|
| - | 404 | } |
|
| - | 405 | ||
| 381 | int fflush(FILE *stream) |
406 | int fflush(FILE *stream) |
| 382 | { |
407 | { |
| 383 | if (stream->klog) { |
408 | if (stream->klog) { |
| 384 | klog_update(); |
409 | klog_update(); |
| 385 | return EOK; |
410 | return EOK; |