<ppdoc>
<copyright>
Copyright (c) 2001 by Addison Wesley Longman, Inc. This material may
be distributed only subject to the terms and conditions set forth in
the Open Publication License, v1.0 or later (the latest version is
presently available at http://www.opencontent.org/openpub/).
<p/>
Distribution of substantively modified versions of this document is
prohibited without the explicit permission of the copyright holder.
<p/>
Distribution of the work or derivative of the work in any standard
(paper) book form is prohibited unless prior permission is obtained
from the copyright holder.
</copyright>
<class name="Errno" type="module" ref="xref-000001">
<p/>
  Ruby exception objects are subclasses of <classname>Exception</classname>. However,
  operating systems typically report errors using plain
  integers. Module <modulename>Errno</modulename> is created dynamically to map these
  operating system errors to Ruby classes, with each error number generating
  its own subclass of <exception>SystemCallError</exception>. As the subclass is created 
  in module <modulename>Errno</modulename>, its name will start <tt>Errno::</tt>.  
<p/>
  The names of the <modulename>Errno</modulename><tt>::</tt> classes depend on the environment in
  which Ruby runs. On a typical Unix or Windows platform, there are
  <modulename>Errno</modulename> classes such as <const>Errno::EACCES</const>,
  <const>Errno::EAGAIN</const>, <const>Errno::EINTR</const>, and so on.
<p/>
  The integer operating system error number corresponding to a
  particular error is available as the class constant
  <tt>Errno::</tt><em>error</em><tt>::Errno</tt>.
<p/>
<codefragment>
<fullcode><![CDATA[    Errno::EACCES::Errno
    Errno::EAGAIN::Errno
    Errno::EINTR::Errno
]]></fullcode><rubycode>
<tr>
  <td><tt>Errno::EACCES::Errno</tt></td>
  <td>&#187;</td>
  <td><tt>13</tt></td>
</tr>
<tr>
  <td><tt>Errno::EAGAIN::Errno</tt></td>
  <td>&#187;</td>
  <td><tt>11</tt></td>
</tr>
<tr>
  <td><tt>Errno::EINTR::Errno</tt></td>
  <td>&#187;</td>
  <td><tt>4</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
  The full list of operating system errors on your particular
  platform are available as the constants of <modulename>Errno</modulename>. 
<p/>
<codefragment>
<fullcode><![CDATA[!-      class Array
!-        def inspect
!-          s = self.to_a.collect{|i| i.to_s}.sort[0,7].join(', ')
!-          s.inspect.gsub('"', '') + ", ..."
!-        end
!-      end
    Errno.constants
]]></fullcode><rubycode>
<tr>
  <td><tt>Errno.constants</tt></td>
  <td>&#187;</td>
  <td><tt>E2BIG,<nbsp/>EACCES,<nbsp/>EADDRINUSE,<nbsp/>EADDRNOTAVAIL,<nbsp/>EADV,<nbsp/>EAFNOSUPPORT,<nbsp/>EAGAIN,<nbsp/>...</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
</class>
</ppdoc>
