#
# This file is auto-generated. ***ANY*** changes here will be lost
#

package Errno;
our (@EXPORT_OK,%EXPORT_TAGS,@ISA,$VERSION,%errno,$AUTOLOAD);
use Exporter ();
use Config;
use strict;

"$Config{'archname'}-$Config{'osvers'}" eq
"x86-qnx-425" or
	die "Errno architecture (x86-qnx-425) does not match executable architecture ($Config{'archname'}-$Config{'osvers'})";

$VERSION = "1.09_00";
$VERSION = eval $VERSION;
@ISA = qw(Exporter);

@EXPORT_OK = qw(EPFNOSUPPORT EHOSTDOWN EPROTONOSUPPORT ENOREMOTE
	EPROGUNAVAIL ENONETQ ENO32BIT ENOTEMPTY ENONETMAN EBADFSYS ENOVPE
	ENOMEM EBADF EIDRM ENOLIC EADDRNOTAVAIL EDSTFAULT ENETUNREACH EMFILE
	ENOCSI EINTR ENOTDIR EMLINK ENOEXEC ELIBSCN EAFNOSUPPORT ECTRLTERM
	ENETDOWN EUNATCH ELIBMAX ESOCKTNOSUPPORT EPIPE ENOMSG ELNRNG ENETRESET
	ERANGE EALREADY EIO ENOLCK ELOOP ENOPROTOOPT ECHILD EADDRINUSE ECHRNG
	EPERM ENOENT ESRCH ENOSPC EINPROGRESS ENFILE ESTALE EDESTADDRREQ
	EEXIST ENOSYS ETOOMANYREFS EDOM ESPIPE ENOTSOCK EL3HLT EMORE EBUSY
	EFAULT EWOULDBLOCK EHOSTUNREACH EVIDBUF2BIG ENOTCONN EVIDBUF2SML
	EAGAIN ENONDP ENOTTY EOPNOTSUPP ENAMETOOLONG EOK EPROGMISMATCH
	ECONNRESET ELIBBAD ERPCMISMATCH EISCONN ETXTBSY ELIBEXEC EL3RST ENXIO
	EXDEV EPROTOTYPE ENOBUFS EACCES ELIBACC ENOTBLK EINVAL ECONNABORTED
	EDEADLK EFBIG EMSGSIZE ENODEV ETIMEDOUT EL2HLT E2BIG ESHUTDOWN
	ECONNREFUSED ENOTSUP EPROCUNAVAIL EBADRPC EISDIR EROFS EL2NSYNC
	EREMOTE);

%EXPORT_TAGS = (
    POSIX => [qw(
	E2BIG EACCES EADDRINUSE EADDRNOTAVAIL EAFNOSUPPORT EAGAIN EALREADY
	EBADF EBUSY ECHILD ECONNABORTED ECONNREFUSED ECONNRESET EDEADLK
	EDESTADDRREQ EDOM EEXIST EFAULT EFBIG EHOSTDOWN EHOSTUNREACH
	EINPROGRESS EINTR EINVAL EIO EISCONN EISDIR ELOOP EMFILE EMLINK
	EMSGSIZE ENAMETOOLONG ENETDOWN ENETRESET ENETUNREACH ENFILE ENOBUFS
	ENODEV ENOENT ENOEXEC ENOLCK ENOMEM ENOPROTOOPT ENOSPC ENOSYS ENOTBLK
	ENOTCONN ENOTDIR ENOTEMPTY ENOTSOCK ENOTTY ENXIO EOPNOTSUPP EPERM
	EPFNOSUPPORT EPIPE EPROTONOSUPPORT EPROTOTYPE ERANGE EREMOTE EROFS
	ESHUTDOWN ESOCKTNOSUPPORT ESPIPE ESRCH ESTALE ETIMEDOUT ETOOMANYREFS
	ETXTBSY EWOULDBLOCK EXDEV
    )]
);

sub EOK () { 0 }
sub EPERM () { 1 }
sub ENOENT () { 2 }
sub ESRCH () { 3 }
sub EINTR () { 4 }
sub EIO () { 5 }
sub ENXIO () { 6 }
sub E2BIG () { 7 }
sub ENOEXEC () { 8 }
sub EBADF () { 9 }
sub ECHILD () { 10 }
sub EWOULDBLOCK () { 11 }
sub EAGAIN () { 11 }
sub ENOMEM () { 12 }
sub EACCES () { 13 }
sub EFAULT () { 14 }
sub ENOTBLK () { 15 }
sub EALREADY () { 16 }
sub EBUSY () { 16 }
sub EEXIST () { 17 }
sub EXDEV () { 18 }
sub ENODEV () { 19 }
sub ENOTDIR () { 20 }
sub EISDIR () { 21 }
sub EINVAL () { 22 }
sub ENFILE () { 23 }
sub EMFILE () { 24 }
sub ENOTTY () { 25 }
sub ETXTBSY () { 26 }
sub EFBIG () { 27 }
sub ENOSPC () { 28 }
sub ESPIPE () { 29 }
sub EROFS () { 30 }
sub EMLINK () { 31 }
sub EPIPE () { 32 }
sub EDOM () { 33 }
sub ERANGE () { 34 }
sub ENOMSG () { 35 }
sub EIDRM () { 36 }
sub ECHRNG () { 37 }
sub EL2NSYNC () { 38 }
sub EL3HLT () { 39 }
sub EL3RST () { 40 }
sub ELNRNG () { 41 }
sub EUNATCH () { 42 }
sub ENOCSI () { 43 }
sub EL2HLT () { 44 }
sub EDEADLK () { 45 }
sub ENOLCK () { 46 }
sub ENOTSUP () { 77 }
sub ENAMETOOLONG () { 78 }
sub ELIBACC () { 83 }
sub ELIBBAD () { 84 }
sub ELIBSCN () { 85 }
sub ELIBMAX () { 86 }
sub ELIBEXEC () { 87 }
sub ENOSYS () { 89 }
sub ELOOP () { 90 }
sub ENOTEMPTY () { 93 }
sub EOPNOTSUPP () { 103 }
sub ESTALE () { 122 }
sub EINPROGRESS () { 236 }
sub ENOTSOCK () { 238 }
sub EDESTADDRREQ () { 239 }
sub EMSGSIZE () { 240 }
sub EPROTOTYPE () { 241 }
sub ENOPROTOOPT () { 242 }
sub EPROTONOSUPPORT () { 243 }
sub ESOCKTNOSUPPORT () { 244 }
sub EPFNOSUPPORT () { 246 }
sub EAFNOSUPPORT () { 247 }
sub EADDRINUSE () { 248 }
sub EADDRNOTAVAIL () { 249 }
sub ENETDOWN () { 250 }
sub ENETUNREACH () { 251 }
sub ENETRESET () { 252 }
sub ECONNABORTED () { 253 }
sub ECONNRESET () { 254 }
sub ENOBUFS () { 255 }
sub EISCONN () { 256 }
sub ENOTCONN () { 257 }
sub ESHUTDOWN () { 258 }
sub ETOOMANYREFS () { 259 }
sub ETIMEDOUT () { 260 }
sub ECONNREFUSED () { 261 }
sub EHOSTDOWN () { 264 }
sub EHOSTUNREACH () { 265 }
sub EREMOTE () { 271 }
sub EBADRPC () { 272 }
sub ERPCMISMATCH () { 273 }
sub EPROGUNAVAIL () { 274 }
sub EPROGMISMATCH () { 275 }
sub EPROCUNAVAIL () { 276 }
sub ENOREMOTE () { 1000 }
sub ENONDP () { 1001 }
sub EBADFSYS () { 1002 }
sub ENO32BIT () { 1003 }
sub ENOVPE () { 1004 }
sub ENONETQ () { 1005 }
sub ENONETMAN () { 1006 }
sub EVIDBUF2SML () { 1007 }
sub EVIDBUF2BIG () { 1008 }
sub EMORE () { 1009 }
sub ECTRLTERM () { 1010 }
sub ENOLIC () { 1011 }
sub EDSTFAULT () { 1012 }

sub TIEHASH { bless [] }

sub FETCH {
    my ($self, $errname) = @_;
    my $proto = prototype("Errno::$errname");
    my $errno = "";
    if (defined($proto) && $proto eq "") {
	no strict 'refs';
	$errno = &$errname;
        $errno = 0 unless $! == $errno;
    }
    return $errno;
}

sub STORE {
    require Carp;
    Carp::confess("ERRNO hash is read only!");
}

*CLEAR = \&STORE;
*DELETE = \&STORE;

sub NEXTKEY {
    my($k,$v);
    while(($k,$v) = each %Errno::) {
	my $proto = prototype("Errno::$k");
	last if (defined($proto) && $proto eq "");
    }
    $k
}

sub FIRSTKEY {
    my $s = scalar keys %Errno::;	# initialize iterator
    goto &NEXTKEY;
}

sub EXISTS {
    my ($self, $errname) = @_;
    my $proto = prototype($errname);
    defined($proto) && $proto eq "";
}

tie %!, __PACKAGE__;

1;
__END__

=head1 NAME

Errno - System errno constants

=head1 SYNOPSIS

    use Errno qw(EINTR EIO :POSIX);

=head1 DESCRIPTION

C<Errno> defines and conditionally exports all the error constants
defined in your system C<errno.h> include file. It has a single export
tag, C<:POSIX>, which will export all POSIX defined error numbers.

C<Errno> also makes C<%!> magic such that each element of C<%!> has a
non-zero value only if C<$!> is set to that value. For example:

    use Errno;

    unless (open(FH, "/fangorn/spouse")) {
        if ($!{ENOENT}) {
            warn "Get a wife!\n";
        } else {
            warn "This path is barred: $!";
        } 
    } 

If a specified constant C<EFOO> does not exist on the system, C<$!{EFOO}>
returns C<"">.  You may use C<exists $!{EFOO}> to check whether the
constant is available on the system.

=head1 CAVEATS

Importing a particular constant may not be very portable, because the
import will fail on platforms that do not have that constant.  A more
portable way to set C<$!> to a valid value is to use:

    if (exists &Errno::EFOO) {
        $! = &Errno::EFOO;
    }

=head1 AUTHOR

Graham Barr <gbarr@pobox.com>

=head1 COPYRIGHT

Copyright (c) 1997-8 Graham Barr. All rights reserved.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.

=cut

