Changeset 1564c4b in mainline for uspace/lib/c/generic/io/io.c


Ignore:
Timestamp:
2011-06-08T19:39:52Z (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:
2af29ed
Parents:
e686889c (diff), 0eff68e (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

    re686889c r1564c4b  
    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,
     
    173175                }
    174176                *flags = (O_APPEND | O_CREAT) | (plus ? O_RDWR : O_WRONLY);
     177                break;
    175178        default:
    176179                errno = EINVAL;
     
    254257        stream->eof = false;
    255258        stream->klog = false;
    256         stream->phone = -1;
     259        stream->sess = NULL;
    257260        stream->need_sync = false;
    258261        _setvbuf(stream);
     
    276279        stream->eof = false;
    277280        stream->klog = false;
    278         stream->phone = -1;
     281        stream->sess = NULL;
    279282        stream->need_sync = false;
    280283        _setvbuf(stream);
     
    308311        stream->eof = false;
    309312        stream->klog = false;
    310         stream->phone = -1;
     313        stream->sess = NULL;
    311314        stream->need_sync = false;
    312315        _setvbuf(stream);
     
    323326        fflush(stream);
    324327       
    325         if (stream->phone >= 0)
    326                 async_hangup(stream->phone);
     328        if (stream->sess != NULL)
     329                async_hangup(stream->sess);
    327330       
    328331        if (stream->fd >= 0)
     
    731734        }
    732735       
    733         if (stream->fd >= 0 && stream->need_sync) {
     736        if ((stream->fd >= 0) && (stream->need_sync)) {
    734737                /**
    735738                 * Better than syncing always, but probably still not the
     
    769772}
    770773
    771 int fphone(FILE *stream)
     774async_sess_t *fsession(exch_mgmt_t mgmt, FILE *stream)
    772775{
    773776        if (stream->fd >= 0) {
    774                 if (stream->phone < 0)
    775                         stream->phone = fd_phone(stream->fd);
    776                
    777                 return stream->phone;
    778         }
    779        
    780         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;
    781784}
    782785
Note: See TracChangeset for help on using the changeset viewer.