Changeset bee37cf in mainline for uspace/lib/c/generic/io/io.c


Ignore:
Timestamp:
2011-07-05T21:21:36Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5e2aa83, eb66f236
Parents:
3714e79 (diff), f7a55f9 (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

    r3714e79 rbee37cf  
    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)
     
    732731        }
    733732       
    734         if (stream->fd >= 0 && stream->need_sync) {
     733        if ((stream->fd >= 0) && (stream->need_sync)) {
    735734                /**
    736735                 * Better than syncing always, but probably still not the
     
    770769}
    771770
    772 int fphone(FILE *stream)
     771async_sess_t *fsession(exch_mgmt_t mgmt, FILE *stream)
    773772{
    774773        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;
     774                if (stream->sess == NULL)
     775                        stream->sess = fd_session(mgmt, stream->fd);
     776               
     777                return stream->sess;
     778        }
     779       
     780        return NULL;
    782781}
    783782
Note: See TracChangeset for help on using the changeset viewer.