<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1.2//EN"
  "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">

<!-- $Id$ -->

<refentry id="gfs-pio-seek.3">

<refentryinfo><date>20 Jun 2019</date></refentryinfo>

<refmeta>
<refentrytitle>gfs_pio_seek</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>Gfarm</refmiscinfo>
</refmeta>

<refnamediv id="name">
<refname>gfs_pio_seek</refname>
<refpurpose>reposition a stream</refpurpose>
</refnamediv>
<refsynopsisdiv id="synopsis">
<funcsynopsis>
<funcsynopsisinfo format="linespecific">
#include &lt;gfarm/gfarm.h&gt;
</funcsynopsisinfo>

<funcprototype>
  <funcdef><function moreinfo="none"><returnvalue>gfarm_error_t </returnvalue>gfs_pio_seek</function></funcdef>
    <paramdef>GFS_File <parameter moreinfo="none">gf</parameter></paramdef>
    <paramdef>gfarm_off_t <parameter moreinfo="none">offset</parameter></paramdef>
    <paramdef>int <parameter moreinfo="none">whence</parameter></paramdef>
    <paramdef>gfarm_off_t * <parameter moreinfo="none">result</parameter></paramdef>
</funcprototype>


</funcsynopsis>
</refsynopsisdiv>

<!-- body begins here -->

<refsect1 id="description"><title>DESCRIPTION</title>
<para>The <function moreinfo="none">gfs_pio_seek()</function> function sets the file position indicator for
the file <parameter moreinfo="none">gf</parameter>.  The new position, measured in bytes, is obtained
by adding <parameter moreinfo="none">offset</parameter> bytes to the position specified by
<parameter moreinfo="none">whence</parameter>.  If <parameter moreinfo="none">whence</parameter> is set to GFARM_SEEK_SET, GFARM_SEEK_CUR, or GFARM_SEEK_END, the offset is
relative to the start of the file, the current position indicator, or
end-of-file, respectively.  When <parameter moreinfo="none">result</parameter> is not NULL, the new
position returns to the address pointed by <parameter moreinfo="none">result</parameter>.</para>

</refsect1>

<refsect1 id="return-values"><title>RETURN VALUES</title>
<variablelist>
<varlistentry>
<term><constant>GFARM_ERR_NO_ERROR</constant></term>
<listitem>
<para>The function terminated successfully.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>GFARM_ERR_NO_MEMORY</constant></term>
<listitem>
<para>Insufficient memory was available.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>GFARM_ERR_INVALID_ARGUMENT</constant></term>
<listitem>
<para>Specified whence or offset is invalid.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Other</term>
<listitem>
<para>An error except the above occurred.  The reason is shown by
<citerefentry><refentrytitle>gfarm_error_string</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

<refsect1 id="see-also"><title>SEE ALSO</title>
<para>
<citerefentry><refentrytitle>gfs_pio_create</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>gfs_pio_open</refentrytitle><manvolnum>3</manvolnum></citerefentry>
</para>
</refsect1>
</refentry>

