Changes in uspace/lib/c/generic/io/io.c [6fa9a99d:3e6a98c5] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/io/io.c
r6fa9a99d r3e6a98c5 42 42 #include <malloc.h> 43 43 #include <async.h> 44 #include <io/k io.h>44 #include <io/klog.h> 45 45 #include <vfs/vfs.h> 46 46 #include <vfs/vfs_sess.h> … … 57 57 .error = true, 58 58 .eof = true, 59 .k io= false,59 .klog = false, 60 60 .sess = NULL, 61 61 .btype = _IONBF, … … 67 67 }; 68 68 69 static FILE stdout_k io= {69 static FILE stdout_klog = { 70 70 .fd = -1, 71 71 .error = false, 72 72 .eof = false, 73 .k io= true,73 .klog = true, 74 74 .sess = NULL, 75 75 .btype = _IOLBF, … … 81 81 }; 82 82 83 static FILE stderr_k io= {83 static FILE stderr_klog = { 84 84 .fd = -1, 85 85 .error = false, 86 86 .eof = false, 87 .k io= true,87 .klog = true, 88 88 .sess = NULL, 89 89 .btype = _IONBF, … … 113 113 stdout = fdopen(1, "w"); 114 114 } else { 115 stdout = &stdout_k io;115 stdout = &stdout_klog; 116 116 list_append(&stdout->link, &files); 117 117 } … … 120 120 stderr = fdopen(2, "w"); 121 121 } else { 122 stderr = &stderr_k io;122 stderr = &stderr_klog; 123 123 list_append(&stderr->link, &files); 124 124 } … … 192 192 } 193 193 194 /** Set stream buffer.195 *196 * When @p buf is NULL, the stream is set as unbuffered, otherwise197 * full buffering is enabled.198 */199 void setbuf(FILE *stream, void *buf)200 {201 if (buf == NULL) {202 setvbuf(stream, NULL, _IONBF, BUFSIZ);203 } else {204 setvbuf(stream, buf, _IOFBF, BUFSIZ);205 }206 }207 208 194 static void _setvbuf(FILE *stream) 209 195 { … … 267 253 stream->error = false; 268 254 stream->eof = false; 269 stream->k io= false;255 stream->klog = false; 270 256 stream->sess = NULL; 271 257 stream->need_sync = false; … … 289 275 stream->error = false; 290 276 stream->eof = false; 291 stream->k io= false;277 stream->klog = false; 292 278 stream->sess = NULL; 293 279 stream->need_sync = false; … … 314 300 315 301 if ((stream != &stdin_null) 316 && (stream != &stdout_k io)317 && (stream != &stderr_k io))302 && (stream != &stdout_klog) 303 && (stream != &stderr_klog)) 318 304 free(stream); 319 305 … … 382 368 ssize_t wr; 383 369 384 if (stream->k io)385 wr = k io_write(buf + done, left);370 if (stream->klog) 371 wr = klog_write(buf + done, left); 386 372 else 387 373 wr = write(stream->fd, buf + done, left); … … 705 691 _fflushbuf(stream); 706 692 707 if (stream->k io) {708 k io_update();693 if (stream->klog) { 694 klog_update(); 709 695 return EOK; 710 696 } … … 740 726 int fileno(FILE *stream) 741 727 { 742 if (stream->k io) {728 if (stream->klog) { 743 729 errno = EBADF; 744 730 return -1;
Note:
See TracChangeset
for help on using the changeset viewer.