Back to index

glibc  2.9
Functions | Variables
ioseekoff.c File Reference
#include <stdlib.h>
#include <libioP.h>
#include <errno.h>

Go to the source code of this file.

Functions

_IO_off64_t _IO_seekoff_unlocked (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
_IO_off64_t _IO_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)

Variables

int errno

Function Documentation

_IO_off64_t _IO_seekoff ( _IO_FILE fp,
_IO_off64_t  offset,
int  dir,
int  mode 
)

Definition at line 76 of file ioseekoff.c.

{
  _IO_off64_t retval;

  _IO_acquire_lock (fp);
  retval = _IO_seekoff_unlocked (fp, offset, dir, mode);
  _IO_release_lock (fp);
  return retval;
}

Here is the call graph for this function:

_IO_off64_t _IO_seekoff_unlocked ( _IO_FILE fp,
_IO_off64_t  offset,
int  dir,
int  mode 
)

Definition at line 40 of file ioseekoff.c.

{
  if (dir != _IO_seek_cur && dir != _IO_seek_set && dir != _IO_seek_end)
    {
      __set_errno (EINVAL);
      return EOF;
    }

  /* If we have a backup buffer, get rid of it, since the __seekoff
     callback may not know to do the right thing about it.
     This may be over-kill, but it'll do for now. TODO */
  if (mode != 0 && ((_IO_fwide (fp, 0) < 0 && _IO_have_backup (fp))
                  || (_IO_fwide (fp, 0) > 0 && _IO_have_wbackup (fp))))
    {
      if (dir == _IO_seek_cur && _IO_in_backup (fp))
       {
         if (_IO_vtable_offset (fp) != 0 || fp->_mode <= 0)
           offset -= fp->_IO_read_end - fp->_IO_read_ptr;
         else
           abort ();
       }
      if (_IO_fwide (fp, 0) < 0)
       INTUSE(_IO_free_backup_area) (fp);
      else
       INTUSE(_IO_free_wbackup_area) (fp);
    }

  return _IO_SEEKOFF (fp, offset, dir, mode);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 22 of file sysdep.c.