// seek off_t doSeek(int64_t const p, int const whence) { off_t off = static_cast<off_t>(-1); while ( (off=fd->lseek(p,whence)) == static_cast<off_t>(-1) ) { int const error = errno; switch ( error ) { case EINTR: case EAGAIN: // try again break; default: { libmaus2::exception::LibMausException se; se.getStream() << "PosixInputOutputStreamBuffer::doSeek(): seek() failed: " << strerror(error) << std::endl; se.finish(); throw se; } } } return off; }
void init(bool const repos) { // set empty buffer setgchecked(buffer.end(), buffer.end(), buffer.end()); // seek if ( repos ) fd->lseek(symsread,SEEK_SET); }