Lines Matching refs:fp

98 _IO_old_file_init_internal (struct _IO_FILE_plus *fp)  in _IO_old_file_init_internal()  argument
103 fp->file._old_offset = _IO_pos_BAD; in _IO_old_file_init_internal()
104 fp->file._flags |= CLOSED_FILEBUF_FLAGS; in _IO_old_file_init_internal()
106 _IO_link_in (fp); in _IO_old_file_init_internal()
107 fp->file._vtable_offset = ((int) sizeof (struct _IO_FILE) in _IO_old_file_init_internal()
109 fp->file._fileno = -1; in _IO_old_file_init_internal()
111 if (&_IO_stdin_used != NULL || !_IO_legacy_file ((FILE *) fp)) in _IO_old_file_init_internal()
114 ((struct _IO_FILE_complete *) fp)->_mode = -1; in _IO_old_file_init_internal()
119 _IO_old_file_init (struct _IO_FILE_plus *fp) in _IO_old_file_init() argument
122 _IO_old_file_init_internal (fp); in _IO_old_file_init()
127 _IO_old_file_close_it (FILE *fp) in _IO_old_file_close_it() argument
130 if (!_IO_file_is_open (fp)) in _IO_old_file_close_it()
133 write_status = _IO_old_do_flush (fp); in _IO_old_file_close_it()
135 _IO_unsave_markers (fp); in _IO_old_file_close_it()
137 close_status = ((fp->_flags2 & _IO_FLAGS2_NOCLOSE) == 0 in _IO_old_file_close_it()
138 ? _IO_SYSCLOSE (fp) : 0); in _IO_old_file_close_it()
141 _IO_setb (fp, NULL, NULL, 0); in _IO_old_file_close_it()
142 _IO_setg (fp, NULL, NULL, NULL); in _IO_old_file_close_it()
143 _IO_setp (fp, NULL, NULL); in _IO_old_file_close_it()
145 _IO_un_link ((struct _IO_FILE_plus *) fp); in _IO_old_file_close_it()
146 fp->_flags = _IO_MAGIC|CLOSED_FILEBUF_FLAGS; in _IO_old_file_close_it()
147 fp->_fileno = -1; in _IO_old_file_close_it()
148 fp->_old_offset = _IO_pos_BAD; in _IO_old_file_close_it()
155 _IO_old_file_finish (FILE *fp, int dummy) in _IO_old_file_finish() argument
157 if (_IO_file_is_open (fp)) in _IO_old_file_finish()
159 _IO_old_do_flush (fp); in _IO_old_file_finish()
160 if (!(fp->_flags & _IO_DELETE_DONT_CLOSE)) in _IO_old_file_finish()
161 _IO_SYSCLOSE (fp); in _IO_old_file_finish()
163 _IO_default_finish (fp, 0); in _IO_old_file_finish()
168 _IO_old_file_fopen (FILE *fp, const char *filename, const char *mode) in _IO_old_file_fopen() argument
173 if (_IO_file_is_open (fp)) in _IO_old_file_fopen()
203 fp->_fileno = fdesc; in _IO_old_file_fopen()
204 _IO_mask_flags (fp, read_write,_IO_NO_READS+_IO_NO_WRITES+_IO_IS_APPENDING); in _IO_old_file_fopen()
206 if (_IO_SEEKOFF (fp, (off_t)0, _IO_seek_end, _IOS_INPUT|_IOS_OUTPUT) in _IO_old_file_fopen()
209 _IO_link_in ((struct _IO_FILE_plus *) fp); in _IO_old_file_fopen()
210 return fp; in _IO_old_file_fopen()
215 _IO_old_file_attach (FILE *fp, int fd) in _IO_old_file_attach() argument
217 if (_IO_file_is_open (fp)) in _IO_old_file_attach()
219 fp->_fileno = fd; in _IO_old_file_attach()
220 fp->_flags &= ~(_IO_NO_READS+_IO_NO_WRITES); in _IO_old_file_attach()
221 fp->_flags |= _IO_DELETE_DONT_CLOSE; in _IO_old_file_attach()
224 fp->_old_offset = _IO_pos_BAD; in _IO_old_file_attach()
225 if (_IO_SEEKOFF (fp, (off_t)0, _IO_seek_cur, _IOS_INPUT|_IOS_OUTPUT) in _IO_old_file_attach()
228 return fp; in _IO_old_file_attach()
233 _IO_old_file_setbuf (FILE *fp, char *p, ssize_t len) in _IO_old_file_setbuf() argument
235 if (_IO_default_setbuf (fp, p, len) == NULL) in _IO_old_file_setbuf()
238 fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end in _IO_old_file_setbuf()
239 = fp->_IO_buf_base; in _IO_old_file_setbuf()
240 _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base); in _IO_old_file_setbuf()
242 return fp; in _IO_old_file_setbuf()
252 _IO_old_do_write (FILE *fp, const char *data, size_t to_do) in _IO_old_do_write() argument
254 return (to_do == 0 || (size_t) old_do_write (fp, data, to_do) == to_do) in _IO_old_do_write()
260 old_do_write (FILE *fp, const char *data, size_t to_do) in old_do_write() argument
263 if (fp->_flags & _IO_IS_APPENDING) in old_do_write()
269 fp->_old_offset = _IO_pos_BAD; in old_do_write()
270 else if (fp->_IO_read_end != fp->_IO_write_base) in old_do_write()
273 = _IO_SYSSEEK (fp, fp->_IO_write_base - fp->_IO_read_end, 1); in old_do_write()
276 fp->_old_offset = new_pos; in old_do_write()
278 count = _IO_SYSWRITE (fp, data, to_do); in old_do_write()
279 if (fp->_cur_column && count) in old_do_write()
280 fp->_cur_column = _IO_adjust_column (fp->_cur_column - 1, data, count) + 1; in old_do_write()
281 _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base); in old_do_write()
282 fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_buf_base; in old_do_write()
283 fp->_IO_write_end = ((fp->_flags & (_IO_LINE_BUF | _IO_UNBUFFERED)) in old_do_write()
284 ? fp->_IO_buf_base : fp->_IO_buf_end); in old_do_write()
290 _IO_old_file_underflow (FILE *fp) in _IO_old_file_underflow() argument
295 if (fp->_flags & _IO_EOF_SEEN) in _IO_old_file_underflow()
298 if (fp->_flags & _IO_NO_READS) in _IO_old_file_underflow()
300 fp->_flags |= _IO_ERR_SEEN; in _IO_old_file_underflow()
304 if (fp->_IO_read_ptr < fp->_IO_read_end) in _IO_old_file_underflow()
305 return *(unsigned char *) fp->_IO_read_ptr; in _IO_old_file_underflow()
307 if (fp->_IO_buf_base == NULL) in _IO_old_file_underflow()
310 if (fp->_IO_save_base != NULL) in _IO_old_file_underflow()
312 free (fp->_IO_save_base); in _IO_old_file_underflow()
313 fp->_flags &= ~_IO_IN_BACKUP; in _IO_old_file_underflow()
315 _IO_doallocbuf (fp); in _IO_old_file_underflow()
320 if (fp->_flags & (_IO_LINE_BUF|_IO_UNBUFFERED)) in _IO_old_file_underflow()
323 _IO_switch_to_get_mode (fp); in _IO_old_file_underflow()
329 fp->_IO_read_base = fp->_IO_read_ptr = fp->_IO_buf_base; in _IO_old_file_underflow()
330 fp->_IO_read_end = fp->_IO_buf_base; in _IO_old_file_underflow()
331 fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end in _IO_old_file_underflow()
332 = fp->_IO_buf_base; in _IO_old_file_underflow()
334 count = _IO_SYSREAD (fp, fp->_IO_buf_base, in _IO_old_file_underflow()
335 fp->_IO_buf_end - fp->_IO_buf_base); in _IO_old_file_underflow()
339 fp->_flags |= _IO_EOF_SEEN; in _IO_old_file_underflow()
341 fp->_flags |= _IO_ERR_SEEN, count = 0; in _IO_old_file_underflow()
343 fp->_IO_read_end += count; in _IO_old_file_underflow()
346 if (fp->_old_offset != _IO_pos_BAD) in _IO_old_file_underflow()
347 _IO_pos_adjust (fp->_old_offset, count); in _IO_old_file_underflow()
348 return *(unsigned char *) fp->_IO_read_ptr; in _IO_old_file_underflow()
403 _IO_old_file_sync (FILE *fp) in _IO_old_file_sync() argument
409 if (fp->_IO_write_ptr > fp->_IO_write_base) in _IO_old_file_sync()
410 if (_IO_old_do_flush(fp)) return EOF; in _IO_old_file_sync()
411 delta = fp->_IO_read_ptr - fp->_IO_read_end; in _IO_old_file_sync()
415 if (_IO_in_backup (fp)) in _IO_old_file_sync()
418 off_t new_pos = _IO_SYSSEEK (fp, delta, 1); in _IO_old_file_sync()
420 fp->_IO_read_end = fp->_IO_read_ptr; in _IO_old_file_sync()
427 fp->_old_offset = _IO_pos_BAD; in _IO_old_file_sync()
435 _IO_old_file_seekoff (FILE *fp, off64_t offset, int dir, int mode) in _IO_old_file_seekoff() argument
442 int must_be_exact = (fp->_IO_read_base == fp->_IO_read_end in _IO_old_file_seekoff()
443 && fp->_IO_write_base == fp->_IO_write_ptr); in _IO_old_file_seekoff()
456 if (fp->_IO_write_ptr > fp->_IO_write_base || _IO_in_put_mode (fp)) in _IO_old_file_seekoff()
457 if (_IO_switch_to_get_mode (fp)) in _IO_old_file_seekoff()
460 if (fp->_IO_buf_base == NULL) in _IO_old_file_seekoff()
463 if (fp->_IO_read_base != NULL) in _IO_old_file_seekoff()
465 free (fp->_IO_read_base); in _IO_old_file_seekoff()
466 fp->_flags &= ~_IO_IN_BACKUP; in _IO_old_file_seekoff()
468 _IO_doallocbuf (fp); in _IO_old_file_seekoff()
469 _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base); in _IO_old_file_seekoff()
470 _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base); in _IO_old_file_seekoff()
477 offset -= fp->_IO_read_end - fp->_IO_read_ptr; in _IO_old_file_seekoff()
478 if (fp->_old_offset == _IO_pos_BAD) in _IO_old_file_seekoff()
481 offset += fp->_old_offset; in _IO_old_file_seekoff()
490 if (_IO_SYSSTAT (fp, &st) == 0 && S_ISREG (st.st_mode)) in _IO_old_file_seekoff()
506 if (fp->_old_offset != _IO_pos_BAD && fp->_IO_read_base != NULL in _IO_old_file_seekoff()
507 && !_IO_in_backup (fp)) in _IO_old_file_seekoff()
510 off_t rel_offset = (offset - fp->_old_offset in _IO_old_file_seekoff()
511 + (fp->_IO_read_end - fp->_IO_read_base)); in _IO_old_file_seekoff()
514 if (rel_offset <= fp->_IO_read_end - fp->_IO_read_base) in _IO_old_file_seekoff()
516 _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + rel_offset, in _IO_old_file_seekoff()
517 fp->_IO_read_end); in _IO_old_file_seekoff()
518 _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base); in _IO_old_file_seekoff()
520 _IO_mask_flags (fp, 0, _IO_EOF_SEEN); in _IO_old_file_seekoff()
526 if (_IO_have_markers (fp)) in _IO_old_file_seekoff()
529 - (fp->_IO_read_ptr - fp->_IO_read_base); in _IO_old_file_seekoff()
532 _IO_mask_flags (fp, 0, _IO_EOF_SEEN); in _IO_old_file_seekoff()
540 if (!_IO_in_backup (fp)) in _IO_old_file_seekoff()
541 _IO_switch_to_backup_area (fp); in _IO_old_file_seekoff()
542 gbump (fp->_IO_read_end + rel_offset - fp->_IO_read_ptr); in _IO_old_file_seekoff()
543 _IO_mask_flags (fp, 0, _IO_EOF_SEEN); in _IO_old_file_seekoff()
550 _IO_unsave_markers (fp); in _IO_old_file_seekoff()
553 if (fp->_flags & _IO_NO_READS) in _IO_old_file_seekoff()
557 new_offset = offset & ~(fp->_IO_buf_end - fp->_IO_buf_base - 1); in _IO_old_file_seekoff()
559 if (delta > fp->_IO_buf_end - fp->_IO_buf_base) in _IO_old_file_seekoff()
564 result = _IO_SYSSEEK (fp, new_offset, 0); in _IO_old_file_seekoff()
571 count = _IO_SYSREAD (fp, fp->_IO_buf_base, in _IO_old_file_seekoff()
573 ? delta : fp->_IO_buf_end - fp->_IO_buf_base)); in _IO_old_file_seekoff()
582 _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + delta, in _IO_old_file_seekoff()
583 fp->_IO_buf_base + count); in _IO_old_file_seekoff()
584 _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base); in _IO_old_file_seekoff()
585 fp->_old_offset = result + count; in _IO_old_file_seekoff()
586 _IO_mask_flags (fp, 0, _IO_EOF_SEEN); in _IO_old_file_seekoff()
590 _IO_unsave_markers (fp); in _IO_old_file_seekoff()
591 result = _IO_SYSSEEK (fp, offset, dir); in _IO_old_file_seekoff()
594 _IO_mask_flags (fp, 0, _IO_EOF_SEEN); in _IO_old_file_seekoff()
595 fp->_old_offset = result; in _IO_old_file_seekoff()
596 _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base); in _IO_old_file_seekoff()
597 _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base); in _IO_old_file_seekoff()
606 if (fp->_old_offset >= 0) in _IO_old_file_seekoff()
607 _IO_SYSSEEK (fp, fp->_old_offset, 0); in _IO_old_file_seekoff()