errno - error indicator for function calls
Many functions in the HP-UX operating system indicate an error
condition by returning an otherwise out-of-range value (usually -1).
Most of these functions set the symbol errno, that is defined in
errno.h, to a nonzero code value that more specifically identifies the
particular error condition that was encountered.
All errors detected and the corresponding error code values stored in
errno are documented in the ERRORS section on manual pages for those
functions that set it.
The value of errno is zero immediately after a successful call to any
of the functions described by exec(2) and ptrace(2), but it is never
set to zero by any other HP-UX function. Functions for which the use
of errno is not described may nevertheless change its value to a
Since errno is not cleared on successful function calls, its value
should be checked or used only when an error has been indicated and
when the function's ERRORS section documents the error codes.
Applications should not attempt to take the address of errno. The
practice of defining errno as extern int errno is obsolescent.
The following is a complete list of the error codes. The numeric
values can be found in <errno.h> but they should not be used in an
application program because they can vary from system to system.
[E2BIG] Arg list too long. An argument and or environment list
longer than maximum supported size is presented to a
member of the exec() family. Other possibilities
include: message size or number of semaphores exceeds
system limit (msgop, semop), or too many privileged
groups have been set up (setprivgrp).
[EACCES] Permission denied. An attempt was made to access a
file or IPC object in a way forbidden by the protection
[EADDRINUSE] Address already in use. Only one usage of each address
is normally permitted.
Cannot assign requested address. Normally results from
an attempt to create a socket with an address not on
Hewlett-Packard Company - 1 - HP-UX Release 11i: November 2000
[EAFNOSUPPORT] Address family not supported by protocol family. An
address incompatible with the requested protocol was
used. For example, you should not necessarily expect
to be able to use PUP Internet addresses with ARPA
[EAGAIN] Resource temporarily unavailable. This is likely a
temporary condition, and later calls to the same
routine may complete normally.
[EALREADY] Operation already in progress. An operation was
attempted on a nonblocking object which already had an
operation in progress.
[EBADF] Bad file number. Either a file descriptor refers to no
open file, a read (respectively write) request is made
to a file which is open only for writing (respectively
reading), or the file descriptor is not in the legal
range of file descriptors.
[EBUSY] Device or resource busy. An attempt to mount a device
that was already mounted or an attempt was made to
dismount a device on which there is an active file
(open file, current directory, mounted-on file, active
text segment). It will also occur if an attempt is
made to enable accounting when it is already enabled.
The device or resource is currently unavailable, such
as when a nonsharable device file is in use.
[ECHILD] No child processes. A wait() was executed by a process
that had no existing or unwaited-for child processes.
[ECONNABORTED] Software caused connection abort. A connection abort
was caused internal to your host machine.
[ECONNREFUSED] Connection refused. No connection could be made
because the target machine actively refused it. This
usually results from trying to connect to a service
that is inactive on the foreign host.
[ECONNRESET] Connection reset by peer. A connection was forcibly
closed by a peer. This normally results from the peer
executing a shutdown() call (see shutdown(2)).
[EDEADLK] Resource deadlock would occur. A process which has
locked a system resource would have been put to sleep
while attempting to access another process' locked
Hewlett-Packard Company - 2 - HP-UX Release 11i: November 2000
[EDESTADDRREQ] Destination address required. A required address was
omitted from an operation on a socket.
[EDOM] Math argument. The argument of a function in the math
package (3M) is out of the domain of the function.
[EEXIST] File exists. An existing file was mentioned in an
inappropriate context; e.g., link().
[EFAULT] Bad address. The system encountered a hardware fault
in attempting to use an argument of a system call; can
also result from passing the wrong number of parameters
to a system call. The reliable detection of this error
is implementation dependent.
[EFBIG] File too large. The size of a file exceeded the
maximum file size (for the file system) or ULIMIT was
exceeded (see ulimit(2)), or a bad semaphore number in
a semop() call (see semop(2)).
[EHOSTDOWN] Host is down. A socket operation encountered a dead
host. Networking activity on the local host has not
[EHOSTUNREACH] No route to host. A socket operation was attempted to
an unreachable host.
[EIDRM] Identifier Removed. This error is returned to
processes that resume execution due to the removal of
an identifier from the file system's name space (see
msgctl(2), semctl(2), and shmctl(2)).
[EILSEQ] Illegal byte sequence. A wide character code has been
detected that does not correspond to a valid character,
or a byte sequence does not form a valid wide character
[EINPROGRESS] Operation now in progress. An operation that takes a
long time to complete was attempted on a nonblocking
object (see ioctl(2) and fcntl(2)).
[EINTR] Interrupted system call. An asynchronous signal (such
as interrupt or quit), which the user has elected to
catch, occurred during a system call. If execution is
resumed after processing the signal, it will appear as
if the interrupted system call returned this error
condition unless the system call is restarted (see
[EINVAL] Invalid argument. Some invalid argument (such as
unmounting a device that is not currently mounted,
Hewlett-Packard Company - 3 - HP-UX Release 11i: November 2000
mentioning an undefined signal in signal() or kill(),
or reading or writing a file for which lseek() has
generated a negative pointer). Also set by the math
functions described in the (3M) entries of this manual.
[EIO] I/O error - some physical I/O error. This error may in
some cases occur on a call following the one to which
it actually applies.
[EISCONN] Socket is already connected. A connect() request was
made on an already connected socket, or, a sendto() or
sendmsg() request on a connected socket specified a
destination other than the connected party.
[EISDIR] Is a directory. An attempt to open a directory for
[ELOOP] Too many levels of symbolic links. A path name search
involved more than MAXSYMLINKS symbolic links.
MAXSYMLINKS is defined in <sys/param.h>.
[EMFILE] Too many open files. No process may have more than a
system-defined number of file descriptors open at a
[EMLINK] Too many links. An attempt to make more than the
maximum number of links to a file.
[EMSGSIZE] Message too long. The socket requires that the message
be sent atomically, and the size of the message to be
sent made this impossible.
[ENAMETOOLONG] File name too long. A path specified exceeds the
maximum path length for the system. The maximum path
length is specified by PATH_MAX and is defined in
<limits.h>. PATH_MAX is guaranteed to be at least 1023
bytes. This error is also generated if the length of a
path name component exceeds NAME_MAX and the
_POSIX_NO_TRUNC option is in effect for the specified
path. Currently, _POSIX_NO_TRUNC is in effect only for
HFS file systems configured to allow path name
components up to 255 bytes long (see convertfs(1M)) and
therefore only path names referring to such file
systems can generate the error for this case. The
values of NAME_MAX, PATH_MAX, and _POSIX_NO_TRUNC for a
particular path name can be queried by using the
pathconf() system call (see pathconf(2)).
[ENETDOWN] Network is down. A socket operation encountered a dead
Hewlett-Packard Company - 4 - HP-UX Release 11i: November 2000
[ENETRESET] Network dropped connection on reset. The host you were
connected to crashed and rebooted.
[ENETUNREACH] Network is unreachable. A socket operation was
attempted to an unreachable network.
[ENFILE] File table overflow. The system's table of open files
is full, and temporarily no more open()s can be
[ENOBUFS] No buffer space available. An operation on a socket
was not performed because the system lacked sufficient
[ENODEV] No such device. An attempt was made to apply an
inappropriate system call to a device (such as read a
[ENOENT] No such file or directory. This error occurs when a
file name is specified and the file should exist but
does not, or when one of the directories in a path name
does not exist. It also occurs with msgget(),
semget(), and shmget() when key does not refer to any
object and the IPC_CREAT flag is not set.
[ENOEXEC] Exec format error. A request is made to execute a file
which, although it has the appropriate permissions,
does not start with a valid magic number (see
a.out(4)), or the file is too small to have a valid
executable file header.
[ENOLCK] System lock table is full. Too many files have file
locks on them, or there are too many record locks on
files, or there are too many instances of a reading or
writing process sleeping until an enforcement mode lock
clears. This error may also indicate system problems
in handling a lock request on a remote NFS file. This
error is also currently returned for all attempts to
perform locking operations on a remote NFS file that
has its locking enforcement mode bit set, since the
stateless nature of NFS prevents maintaining the
necessary lock information.
[ENOLINK] No connection. The link with the device has been
severed or disconnected.
[ENOMEM] Not enough space. During a system call such as exec(),
brk(), fork(), or sbrk(), a program asks for more space
than the system is able to supply. This may not be a
temporary condition; the maximum space size is a system
parameter. The error can also occur if there is not
Hewlett-Packard Company - 5 - HP-UX Release 11i: November 2000
enough swap space during a fork().
[ENOMSG] No message of desired type. An attempt was made to
receive a message of a type that does not exist on the
specified message queue; see msgop(2).
[ENOPROTOOPT] Protocol not available. A bad option was specified in
a getsockopt() or setsockopt() call (see
[ENOSPC] No space left on device. During a write() to an
ordinary file, there is no free space left on the
device; or no space in system table during msgget(),
semget(), or semop() while SEM_UNDO flag is set.
[ENOSYM] Symbol does not exist in executable. The dynamic
loader was unable to resolve a symbolic reference in a
shared library during a call to one of the dynamic
loader interface routines (see shl_load(3X). The
program may be in an inconsistent state and should be
[ENOSYS] Function is not available. The requested function or
operation is not implemented or not configured in the
[ENOTBLK] Block device required. A nonblock file was mentioned
where a block device was required, such as in mount().
[ENOTCONN] Socket is not connected. A request to send or receive
data was disallowed because the socket was not
[ENOTDIR] Not a directory. A nondirectory was specified where a
directory is required, such as in a path prefix or as
an argument to chdir().
[ENOTEMPTY] Directory not empty. An attempt was made to remove a
[ENOTSOCK] Socket operation on nonsocket. An operation was
attempted on something that is not a socket.
[ENOTTY] Not a typewriter. The (ioctl()) command is
inappropriate to the selected device type.
[ENXIO] No such device or address. I/O on a special file refers
to a subdevice that does not exist, or is beyond the
limits of the device. It can also occur when, for
example, a tape drive is not on line or no disk pack is
loaded on a drive.
Hewlett-Packard Company - 6 - HP-UX Release 11i: November 2000
[EOPNOTSUPP] Operation not supported. The requested operation on a
socket or NFS file is either invalid or unsupported.
For example, this might occur when an attempt to
accept() a connection on a datagram socket fails.
[EPERM] Not owner. Typically, this error indicates an attempt
to modify a file in some way forbidden except to its
owner or the superuser, such as to change its mode. It
is also returned for attempts by ordinary users to do
things for which they need, but lack, a special
[EPFNOSUPPORT] Protocol family not supported. The protocol family has
not been configured into the system or no
implementation for it exists. The socket is not
[EPIPE] Broken pipe. Data has been written to a pipe for which
the other (reading) end has been closed. This most
often occurs when the reading process exits before the
writing process. This condition also generates the
signal SIGPIPE; the error is returned if the signal is
Protocol not supported. The protocol has not been
configured into the system or no implementation for it
[EPROTOTYPE] Protocol wrong type for socket. A protocol was
specified that does not support the semantics of the
socket type requested. For example, ARPA Internet UDP
protocol cannot be used with type SOCK_STREAM.
[ERANGE] Result too large. The value of a function in the math
package (3M) is not representable within machine
precision, or a semop() call would cause either a
semaphore value or a semaphore adjust value to exceed
it system-imposed maximum.
[EROFS] Read-only file system. An attempt to modify a file or
directory was made on a device mounted read-only.
[ESHUTDOWN] Cannot send after socket shutdown. A request to send
data was disallowed because the socket had already been
shut down with a previous shutdown() call.
Socket type not supported. The support for the socket
type has not been configured into the system or no
implementation for it exists.
Hewlett-Packard Company - 7 - HP-UX Release 11i: November 2000
[ESPIPE] Illegal seek. An lseek() was issued to a pipe.
[ESRCH] No such process. No process can be found corresponding
to that specified by pid in kill(), rtprio(), or
ptrace(), or the process is not accessible.
[ETIMEDOUT] Connection timed out. A connect() request failed
because the connected party did not properly respond
after a period of time (timeout period varies,
depending on the communication protocol).
[ETXTBSY] Text file busy. An attempt to execute an executable
file which is currently open for writing (or reading).
Also, an attempt to open for writing an otherwise
writable file which is currently open for execution.
[EWOULDBLOCK] Operation would block. An operation which would cause
a process to block was attempted on an object in
nonblocking mode (see ioctl(2) and fcntl(2)).
[EXDEV] Cross-device link. A link to a file on another device
The following NFS errors are also defined:
[EREFUSED] The same error as ECONNREFUSED. The external
variable errno is defined as ECONNREFUSED for NFS
[EREMOTE] Too many levels of remote in path. An attempt was
made to remotely mount an NFS file system into a
path which already has a remotely mounted NFS file
[ESTALE] Stale NFS file handle. A client referenced an
open file, but the file was previously deleted.
errno: AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI
Hewlett-Packard Company - 8 - HP-UX Release 11i: November 2000