Changeset 6a44ee4 in mainline for uspace/lib/c/generic/io/io.c


Ignore:
Timestamp:
2011-07-20T15:26:21Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
efcebe1
Parents:
25bef0ff (diff), a701812 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

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

    r25bef0ff r6a44ee4  
    4444#include <io/klog.h>
    4545#include <vfs/vfs.h>
     46#include <vfs/vfs_sess.h>
    4647#include <ipc/devmap.h>
    4748#include <adt/list.h>
    4849#include "../private/io.h"
     50#include "../private/stdio.h"
    4951
    5052static void _ffillbuf(FILE *stream);
     
    5658        .eof = true,
    5759        .klog = false,
    58         .phone = -1,
     60        .sess = NULL,
    5961        .btype = _IONBF,
    6062        .buf = NULL,
     
    7072        .eof = false,
    7173        .klog = true,
    72         .phone = -1,
     74        .sess = NULL,
    7375        .btype = _IOLBF,
    7476        .buf = NULL,
     
    8486        .eof = false,
    8587        .klog = true,
    86         .phone = -1,
     88        .sess = NULL,
    8789        .btype = _IONBF,
    8890        .buf = NULL,
     
    125127void __stdio_done(void)
    126128{
    127         link_t *link = files.next;
    128        
    129         while (link != &files) {
    130                 FILE *file = list_get_instance(link, FILE, link);
     129        while (!list_empty(&files)) {
     130                FILE *file = list_get_instance(list_first(&files), FILE, link);
    131131                fclose(file);
    132                 link = files.next;
    133132        }
    134133}
     
    255254        stream->eof = false;
    256255        stream->klog = false;
    257         stream->phone = -1;
     256        stream->sess = NULL;
    258257        stream->need_sync = false;
    259258        _setvbuf(stream);
     
    277276        stream->eof = false;
    278277        stream->klog = false;
    279         stream->phone = -1;
     278        stream->sess = NULL;
    280279        stream->need_sync = false;
    281280        _setvbuf(stream);
     
    309308        stream->eof = false;
    310309        stream->klog = false;
    311         stream->phone = -1;
     310        stream->sess = NULL;
    312311        stream->need_sync = false;
    313312        _setvbuf(stream);
     
    324323        fflush(stream);
    325324       
    326         if (stream->phone >= 0)
    327                 async_hangup(stream->phone);
     325        if (stream->sess != NULL)
     326                async_hangup(stream->sess);
    328327       
    329328        if (stream->fd >= 0)
     
    715714off64_t ftell(FILE *stream)
    716715{
     716        _fflushbuf(stream);
    717717        return lseek(stream->fd, 0, SEEK_CUR);
    718718}
     
    732732        }
    733733       
    734         if (stream->fd >= 0 && stream->need_sync) {
     734        if ((stream->fd >= 0) && (stream->need_sync)) {
    735735                /**
    736736                 * Better than syncing always, but probably still not the
     
    770770}
    771771
    772 int fphone(FILE *stream)
     772async_sess_t *fsession(exch_mgmt_t mgmt, FILE *stream)
    773773{
    774774        if (stream->fd >= 0) {
    775                 if (stream->phone < 0)
    776                         stream->phone = fd_phone(stream->fd);
    777                
    778                 return stream->phone;
    779         }
    780        
    781         return -1;
     775                if (stream->sess == NULL)
     776                        stream->sess = fd_session(mgmt, stream->fd);
     777               
     778                return stream->sess;
     779        }
     780       
     781        return NULL;
    782782}
    783783
Note: See TracChangeset for help on using the changeset viewer.