Changeset 41811af in mainline for uspace/lib/c/generic/io/io.c


Ignore:
Timestamp:
2011-06-10T10:14:26Z (14 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ab547063
Parents:
9536e6e (diff), 390d80d (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

File:
1 edited

Legend:

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

    r9536e6e r41811af  
    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,
     
    255257        stream->eof = false;
    256258        stream->klog = false;
    257         stream->phone = -1;
     259        stream->sess = NULL;
    258260        stream->need_sync = false;
    259261        _setvbuf(stream);
     
    277279        stream->eof = false;
    278280        stream->klog = false;
    279         stream->phone = -1;
     281        stream->sess = NULL;
    280282        stream->need_sync = false;
    281283        _setvbuf(stream);
     
    309311        stream->eof = false;
    310312        stream->klog = false;
    311         stream->phone = -1;
     313        stream->sess = NULL;
    312314        stream->need_sync = false;
    313315        _setvbuf(stream);
     
    324326        fflush(stream);
    325327       
    326         if (stream->phone >= 0)
    327                 async_hangup(stream->phone);
     328        if (stream->sess != NULL)
     329                async_hangup(stream->sess);
    328330       
    329331        if (stream->fd >= 0)
     
    732734        }
    733735       
    734         if (stream->fd >= 0 && stream->need_sync) {
     736        if ((stream->fd >= 0) && (stream->need_sync)) {
    735737                /**
    736738                 * Better than syncing always, but probably still not the
     
    770772}
    771773
    772 int fphone(FILE *stream)
     774async_sess_t *fsession(exch_mgmt_t mgmt, FILE *stream)
    773775{
    774776        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;
     777                if (stream->sess == NULL)
     778                        stream->sess = fd_session(mgmt, stream->fd);
     779               
     780                return stream->sess;
     781        }
     782       
     783        return NULL;
    782784}
    783785
Note: See TracChangeset for help on using the changeset viewer.