Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > E


HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


errno — error indicator for function calls


#include <errno.h>


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.

In most cases, the manpages for functions that set errno list those errno values and error descriptions in the ERRORS section of the manpages. However, failures in underlying functions, subsystems, and applications may return errno values that are not documented in the calling functions' manpages.

The value of errno is zero immediately after a successful call to any of the functions described by exec(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 nonzero value.

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.


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).


Permission denied. An attempt was made to access a file or IPC object in a way forbidden by the protection system.


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 this machine.


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 Internet protocols.


Resource temporarily unavailable. This is likely a temporary condition, and later calls to the same routine may complete normally.


Operation already in progress. An operation was attempted on a nonblocking object which already had an operation in progress.


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.


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.


No child processes. A wait() was executed by a process that had no existing or unwaited-for child processes.


Software caused connection abort. A connection abort was caused internal to your host machine.


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.


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)).


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 resource.


Destination address required. A required address was omitted from an operation on a socket.


Math argument. The argument of a function in the math package (3M) is out of the domain of the function.


File exists. An existing file was mentioned in an inappropriate context; e.g., link().


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.


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)).


Host is down. A socket operation encountered a dead host. Networking activity on the local host has not been initiated.


No route to host. A socket operation was attempted to an unreachable host.


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)).


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 code.


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)).


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 signal(5)).


Invalid argument. Some invalid argument (such as unmounting a device that is not currently mounted, 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.


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.


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.


Is a directory. An attempt to open a directory for writing.


Too many levels of symbolic links were encountered while resolving a path name. See fs_symlinks(5) for more information.


Too many open files. No process may have more than a system-defined number of file descriptors open at a time.


Too many links. An attempt to make more than the maximum number of links to a file.


Message too long. The socket requires that the message be sent atomically, and the size of the message to be sent made this impossible.


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)).


Network is down. A socket operation encountered a dead network.


Network dropped connection on reset. The host you were connected to crashed and rebooted.


Network is unreachable. A socket operation was attempted to an unreachable network.


File table overflow. The system's table of open files is full, and temporarily no more open()s can be accepted.


No buffer space available. An operation on a socket was not performed because the system lacked sufficient buffer space.


No such device. An attempt was made to apply an inappropriate system call to a device (such as read a write-only device).


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.


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.


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.


No connection. The link with the device has been severed or disconnected.


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 enough swap space during a fork().


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).


Protocol option not available. This may be returned for a getsockopt() or setsockopt() call (see getsockopt(2)) if the user specified an option that the local system does not support or for any system call that causes the local system to send a network protocol option that a remote system does not support, including a system call that operates on an NFS file.


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.


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 terminated immediately.


Function is not available. The requested function or operation is not implemented or not configured in the system.


Block device required. A nonblock file was mentioned where a block device was required, such as in mount().


Socket is not connected. A request to send or receive data was disallowed because the socket was not connected.


Not a directory. A nondirectory was specified where a directory is required, such as in a path prefix or as an argument to chdir().


Directory not empty. An attempt was made to remove a nonempty directory.


Socket operation on nonsocket. An operation was attempted on something that is not a socket.


Not a typewriter. The (ioctl()) command is inappropriate to the selected device type.


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.


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.


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 privilege.


Protocol family not supported. The protocol family has not been configured into the system or no implementation for it exists. The socket is not connected.


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 ignored.


Protocol not supported. The protocol has not been configured into the system or no implementation for it exists.


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.


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.


Read-only file system. An attempt to modify a file or directory was made on a device mounted read-only.


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.


Illegal seek. An lseek() was issued to a pipe.


No such process. No process can be found corresponding to that specified by pid in kill() or rtprio(), or the process is not accessible.


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).


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.


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)).


Cross-device link. A link to a file on another device was attempted.


The following NFS errors are also defined:


The same error as ECONNREFUSED. The external variable errno is defined as ECONNREFUSED for NFS compatibility.


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 system component.


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 C

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.