Ignore:
File:
1 edited

Legend:

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

    r79ae36dd r47b7006  
    4444#include <io/klog.h>
    4545#include <vfs/vfs.h>
    46 #include <vfs/vfs_sess.h>
    4746#include <ipc/devmap.h>
    4847#include <adt/list.h>
    4948#include "../private/io.h"
    50 #include "../private/stdio.h"
    5149
    5250static void _ffillbuf(FILE *stream);
     
    5856        .eof = true,
    5957        .klog = false,
    60         .sess = NULL,
     58        .phone = -1,
    6159        .btype = _IONBF,
    6260        .buf = NULL,
     
    7270        .eof = false,
    7371        .klog = true,
    74         .sess = NULL,
     72        .phone = -1,
    7573        .btype = _IOLBF,
    7674        .buf = NULL,
     
    8684        .eof = false,
    8785        .klog = true,
    88         .sess = NULL,
     86        .phone = -1,
    8987        .btype = _IONBF,
    9088        .buf = NULL,
     
    175173                }
    176174                *flags = (O_APPEND | O_CREAT) | (plus ? O_RDWR : O_WRONLY);
    177                 break;
    178175        default:
    179176                errno = EINVAL;
     
    257254        stream->eof = false;
    258255        stream->klog = false;
    259         stream->sess = NULL;
     256        stream->phone = -1;
    260257        stream->need_sync = false;
    261258        _setvbuf(stream);
     
    279276        stream->eof = false;
    280277        stream->klog = false;
    281         stream->sess = NULL;
     278        stream->phone = -1;
    282279        stream->need_sync = false;
    283280        _setvbuf(stream);
     
    311308        stream->eof = false;
    312309        stream->klog = false;
    313         stream->sess = NULL;
     310        stream->phone = -1;
    314311        stream->need_sync = false;
    315312        _setvbuf(stream);
     
    326323        fflush(stream);
    327324       
    328         if (stream->sess != NULL)
    329                 async_hangup(stream->sess);
     325        if (stream->phone >= 0)
     326                async_hangup(stream->phone);
    330327       
    331328        if (stream->fd >= 0)
     
    734731        }
    735732       
    736         if ((stream->fd >= 0) && (stream->need_sync)) {
     733        if (stream->fd >= 0 && stream->need_sync) {
    737734                /**
    738735                 * Better than syncing always, but probably still not the
     
    772769}
    773770
    774 async_sess_t *fsession(exch_mgmt_t mgmt, FILE *stream)
     771int fphone(FILE *stream)
    775772{
    776773        if (stream->fd >= 0) {
    777                 if (stream->sess == NULL)
    778                         stream->sess = fd_session(mgmt, stream->fd);
    779                
    780                 return stream->sess;
    781         }
    782        
    783         return NULL;
     774                if (stream->phone < 0)
     775                        stream->phone = fd_phone(stream->fd);
     776               
     777                return stream->phone;
     778        }
     779       
     780        return -1;
    784781}
    785782
Note: See TracChangeset for help on using the changeset viewer.