Changeset d2cc7e1 in mainline for uspace/lib/libc/generic/io


Ignore:
Timestamp:
2009-03-21T11:26:31Z (16 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0a5116db
Parents:
5b8c75a
Message:

Buffer console output with line granularity. Makes esp. msim/ski console faster. EGA-fb needs fixing.

Location:
uspace/lib/libc/generic/io
Files:
2 edited

Legend:

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

    r5b8c75a rd2cc7e1  
    9898{
    9999        unsigned char c;
     100
     101        flush_stdout();
    100102        if (read_stdin((void *) &c, 1) == 1)
    101103                return c;
     
    104106}
    105107
     108int fflush(FILE *f)
     109{
     110        (void) f;
     111        return flush_stdout();
     112}
     113
    106114/** @}
    107115 */
  • uspace/lib/libc/generic/io/stream.c

    r5b8c75a rd2cc7e1  
    8181{
    8282        int cons_phone = console_phone_get(false);
     83        int left, rc;
    8384
    8485        if (cons_phone >= 0) {
    8586                int i;
    8687
    87                 for (i = 0; i < count; i++)
    88                         console_putchar(((const char *) buf)[i]);
     88                left = count;
     89                while (left > 0) {
     90                        rc = console_write(buf, left);
     91                        if (rc < 0)
     92                                break;
     93                        buf += rc;
     94                        left -= rc;
     95                }
    8996
    9097                return count;
    9198        } else
    9299                return __SYSCALL3(SYS_KLOG, 1, (sysarg_t) buf, count);
     100}
     101
     102int flush_stdout(void)
     103{
     104        console_flush();
     105        return 0;
    93106}
    94107
Note: See TracChangeset for help on using the changeset viewer.