<?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-write.3">

<refentryinfo><date>27 Jun 2010</date></refentryinfo>

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

<refnamediv id="name">
<refname>gfs_pio_write</refname>
<refpurpose>write to a file</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_write</function></funcdef>
    <paramdef>GFS_File <parameter moreinfo="none">gf</parameter></paramdef>
    <paramdef>const void * <parameter moreinfo="none">buffer</parameter></paramdef>
    <paramdef>int <parameter moreinfo="none">size</parameter></paramdef>
    <paramdef>int * <parameter moreinfo="none">np</parameter></paramdef>
</funcprototype>

</funcsynopsis>
</refsynopsisdiv>

<!-- body begins here -->

<refsect1 id="description"><title>DESCRIPTION</title>
<para><function moreinfo="none">gfs_pio_write()</function> writes up to <parameter moreinfo="none">size</parameter> bytes to the file <parameter moreinfo="none">gf</parameter>
from the buffer starting at <parameter moreinfo="none">buffer</parameter>.  It returns the number of
bytes written to the address pointed by <parameter moreinfo="none">np</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_OPERATION_NOT_PERMITTED</constant></term>
<listitem>
<para><parameter moreinfo="none">gf</parameter> does not specify a regular file.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>GFARM_ERR_BAD_FILE_DESCRIPTOR</constant></term>
<listitem>
<para>The file descripter specified by <parameter moreinfo="none">gfp</parameter> is
not a valid or is not open for writing.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>GFARM_ERR_NO_SPACE</constant></term>
<listitem>
<para>The file system node has no room to store data</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>GFARM_ERR_NO_FILE_SYSTEM_NODE</constant></term>
<listitem>
<para>There is no available file system node.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>GFARM_ERR_NO_MEMORY</constant></term>
<listitem>
<para>Insufficient memory was available.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Others</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_flush</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>gfs_pio_open</refentrytitle><manvolnum>3</manvolnum></citerefentry>
</para>
</refsect1>
</refentry>
