Changes in uspace/lib/c/generic/io/io.c [8ad496d:82582e4] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/io/io.c
r8ad496d r82582e4 44 44 #include <io/klog.h> 45 45 #include <vfs/vfs.h> 46 #include <vfs/vfs_sess.h>47 46 #include <ipc/devmap.h> 48 47 #include <adt/list.h> 49 48 #include "../private/io.h" 50 #include "../private/stdio.h"51 49 52 50 static void _ffillbuf(FILE *stream); … … 58 56 .eof = true, 59 57 .klog = false, 60 . sess = NULL,58 .phone = -1, 61 59 .btype = _IONBF, 62 60 .buf = NULL, … … 72 70 .eof = false, 73 71 .klog = true, 74 . sess = NULL,72 .phone = -1, 75 73 .btype = _IOLBF, 76 74 .buf = NULL, … … 86 84 .eof = false, 87 85 .klog = true, 88 . sess = NULL,86 .phone = -1, 89 87 .btype = _IONBF, 90 88 .buf = NULL, … … 127 125 void __stdio_done(void) 128 126 { 129 while (!list_empty(&files)) { 130 FILE *file = list_get_instance(list_first(&files), FILE, link); 127 link_t *link = files.next; 128 129 while (link != &files) { 130 FILE *file = list_get_instance(link, FILE, link); 131 131 fclose(file); 132 link = files.next; 132 133 } 133 134 } … … 254 255 stream->eof = false; 255 256 stream->klog = false; 256 stream-> sess = NULL;257 stream->phone = -1; 257 258 stream->need_sync = false; 258 259 _setvbuf(stream); … … 276 277 stream->eof = false; 277 278 stream->klog = false; 278 stream-> sess = NULL;279 stream->phone = -1; 279 280 stream->need_sync = false; 280 281 _setvbuf(stream); … … 308 309 stream->eof = false; 309 310 stream->klog = false; 310 stream-> sess = NULL;311 stream->phone = -1; 311 312 stream->need_sync = false; 312 313 _setvbuf(stream); … … 323 324 fflush(stream); 324 325 325 if (stream-> sess != NULL)326 async_hangup(stream-> sess);326 if (stream->phone >= 0) 327 async_hangup(stream->phone); 327 328 328 329 if (stream->fd >= 0) … … 714 715 off64_t ftell(FILE *stream) 715 716 { 716 _fflushbuf(stream);717 717 return lseek(stream->fd, 0, SEEK_CUR); 718 718 } … … 732 732 } 733 733 734 if ( (stream->fd >= 0) && (stream->need_sync)) {734 if (stream->fd >= 0 && stream->need_sync) { 735 735 /** 736 736 * Better than syncing always, but probably still not the … … 770 770 } 771 771 772 async_sess_t *fsession(exch_mgmt_t mgmt,FILE *stream)772 int fphone(FILE *stream) 773 773 { 774 774 if (stream->fd >= 0) { 775 if (stream-> sess == NULL)776 stream-> sess = fd_session(mgmt,stream->fd);777 778 return stream-> sess;779 } 780 781 return NULL;775 if (stream->phone < 0) 776 stream->phone = fd_phone(stream->fd); 777 778 return stream->phone; 779 } 780 781 return -1; 782 782 } 783 783
Note:
See TracChangeset
for help on using the changeset viewer.