int _IO_new_fsetpos (FILE *fp, const __fpos_t *posp) { int result; CHECK_FILE (fp, EOF); _IO_acquire_lock (fp); if (_IO_seekpos_unlocked (fp, posp->__pos, _IOS_INPUT|_IOS_OUTPUT) == _IO_pos_BAD) { /* ANSI explicitly requires setting errno to a positive value on failure. */ if (errno == 0) __set_errno (EIO); result = EOF; } else { result = 0; if (fp->_mode > 0 && __libio_codecvt_encoding (fp->_codecvt) < 0) /* This is a stateful encoding, restore the state. */ fp->_wide_data->_IO_state = posp->__state; } _IO_release_lock (fp); return result; }
_IO_off64_t _IO_seekpos (_IO_FILE *fp, _IO_off64_t pos, int mode) { _IO_off64_t retval; _IO_acquire_lock (fp); retval = _IO_seekpos_unlocked (fp, pos, mode); _IO_release_lock (fp); return retval; }
int attribute_compat_text_section _IO_old_fsetpos (_IO_FILE *fp, const _IO_fpos_t *posp) { int result; CHECK_FILE (fp, EOF); _IO_acquire_lock (fp); if (_IO_seekpos_unlocked (fp, posp->__pos, _IOS_INPUT|_IOS_OUTPUT) == _IO_pos_BAD) { /* ANSI explicitly requires setting errno to a positive value on failure. */ #ifdef EIO if (errno == 0) __set_errno (EIO); #endif result = EOF; } else result = 0; _IO_release_lock (fp); return result; }