Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/io/io.c

    r6fa9a99d r3e6a98c5  
    4242#include <malloc.h>
    4343#include <async.h>
    44 #include <io/kio.h>
     44#include <io/klog.h>
    4545#include <vfs/vfs.h>
    4646#include <vfs/vfs_sess.h>
     
    5757        .error = true,
    5858        .eof = true,
    59         .kio = false,
     59        .klog = false,
    6060        .sess = NULL,
    6161        .btype = _IONBF,
     
    6767};
    6868
    69 static FILE stdout_kio = {
     69static FILE stdout_klog = {
    7070        .fd = -1,
    7171        .error = false,
    7272        .eof = false,
    73         .kio = true,
     73        .klog = true,
    7474        .sess = NULL,
    7575        .btype = _IOLBF,
     
    8181};
    8282
    83 static FILE stderr_kio = {
     83static FILE stderr_klog = {
    8484        .fd = -1,
    8585        .error = false,
    8686        .eof = false,
    87         .kio = true,
     87        .klog = true,
    8888        .sess = NULL,
    8989        .btype = _IONBF,
     
    113113                stdout = fdopen(1, "w");
    114114        } else {
    115                 stdout = &stdout_kio;
     115                stdout = &stdout_klog;
    116116                list_append(&stdout->link, &files);
    117117        }
     
    120120                stderr = fdopen(2, "w");
    121121        } else {
    122                 stderr = &stderr_kio;
     122                stderr = &stderr_klog;
    123123                list_append(&stderr->link, &files);
    124124        }
     
    192192}
    193193
    194 /** Set stream buffer.
    195  *
    196  * When @p buf is NULL, the stream is set as unbuffered, otherwise
    197  * 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 
    208194static void _setvbuf(FILE *stream)
    209195{
     
    267253        stream->error = false;
    268254        stream->eof = false;
    269         stream->kio = false;
     255        stream->klog = false;
    270256        stream->sess = NULL;
    271257        stream->need_sync = false;
     
    289275        stream->error = false;
    290276        stream->eof = false;
    291         stream->kio = false;
     277        stream->klog = false;
    292278        stream->sess = NULL;
    293279        stream->need_sync = false;
     
    314300       
    315301        if ((stream != &stdin_null)
    316             && (stream != &stdout_kio)
    317             && (stream != &stderr_kio))
     302            && (stream != &stdout_klog)
     303            && (stream != &stderr_klog))
    318304                free(stream);
    319305       
     
    382368                ssize_t wr;
    383369               
    384                 if (stream->kio)
    385                         wr = kio_write(buf + done, left);
     370                if (stream->klog)
     371                        wr = klog_write(buf + done, left);
    386372                else
    387373                        wr = write(stream->fd, buf + done, left);
     
    705691        _fflushbuf(stream);
    706692       
    707         if (stream->kio) {
    708                 kio_update();
     693        if (stream->klog) {
     694                klog_update();
    709695                return EOK;
    710696        }
     
    740726int fileno(FILE *stream)
    741727{
    742         if (stream->kio) {
     728        if (stream->klog) {
    743729                errno = EBADF;
    744730                return -1;
Note: See TracChangeset for help on using the changeset viewer.