'\" t
.\"     Title: nn_errno
.\"    Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.26
.\"      Date: 2021-02-08
.\"    Manual: NNG Reference Manual
.\"    Source: \ \&
.\"  Language: English
.\"
.TH "NN_ERRNO" "3compat" "2021-02-08" "\ \&" "NNG Reference Manual"
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.ss \n[.ss] 0
.nh
.ad l
.de URL
\fI\\$2\fP <\\$1>\\$3
..
.als MTO URL
.if \n[.g] \{\
.  mso www.tmac
.  am URL
.    ad l
.  .
.  am MTO
.    ad l
.  .
.  LINKSTYLE blue R < >
.\}
.SH "NAME"
nn_errno \- return most recent error (compatible API)
.SH "SYNOPSIS"
.sp
.if n .RS 4
.nf
.fam C
#include <nanomsg/nn.h>

int nn_errno(void);
.fam
.fi
.if n .RE
.SH "DESCRIPTION"
.sp
The \f(CRnn_errno()\fP function returns the error number corresponding to the
most recent failed operation by the calling thread.
.if n .sp
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
.B Note
.ps -1
.br
.sp
This function is provided for API
compatibility with legacy \fIlibnanomsg\fP.
Consider using the relevant modern API instead.
.sp .5v
.RE
.if n .sp
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
.B Important
.ps -1
.br
.sp
The error numbers returned from this function may include
errors caused by system functions, which overlap the usual \f(CRerrno\fP variable,
and this function simply returns the value of \f(CRerrno\fP.
However, the values returned may include numeric values that are not
defined by the system, but are unique to \fIlibnanomsg\fP, such as \f(CREFSM\fP.
.sp .5v
.RE
.sp
This library implements the following error numbers, in addition to any others
that might be set for \f(CRerrno\fP by the underlying system:
.SH "RETURN VALUES"
.sp
This function returns the value of \f(CRerrno\fP.
If no operation has failed, then this will be zero.
.SH "ERRORS"
.sp
\f(CREINTR\fP
.RS 4
Operation interrupted.
.RE
.sp
\f(CRENOMEM\fP
.RS 4
Insufficient memory.
.RE
.sp
\f(CREINVAL\fP
.RS 4
Invalid argument.
.RE
.sp
\f(CREBUSY\fP
.RS 4
Resource is busy.
.RE
.sp
\f(CRETIMEDOUT\fP
.RS 4
Operation timed out.
.RE
.sp
\f(CRECONNREFUSED\fP
.RS 4
Connection refused by peer.
.RE
.sp
\f(CREBADF\fP
.RS 4
Invalid or closed socket.
.RE
.sp
\f(CREAGAIN\fP
.RS 4
Operation would block.
.RE
.sp
\f(CRENOTSUP\fP
.RS 4
Protocol or option not supported.
.RE
.sp
\f(CREADDRINUSE\fP
.RS 4
Requested address is already in use.
.RE
.sp
\f(CREFSM\fP
.RS 4
Protocol state incorrect.
.RE
.sp
\f(CREPROTO\fP
.RS 4
Protocol error.
.RE
.sp
\f(CREHOSTUNREACH\fP
.RS 4
Remote peer is unreachable.
.RE
.sp
\f(CREADDRNOTAVAIL\fP
.RS 4
Requested address is not available.
.RE
.sp
\f(CREACCES\fP
.RS 4
Permission denied.
.RE
.sp
\f(CREMSGSIZE\fP
.RS 4
Message is too large.
.RE
.sp
\f(CRECONNABORTED\fP
.RS 4
Connection attempt aborted.
.RE
.sp
\f(CRECONNRESET\fP
.RS 4
Connection reset by peer.
.RE
.sp
\f(CREEXIST\fP
.RS 4
Resource already exists.
.RE
.sp
\f(CREMFILE\fP
.RS 4
Too many open files.
.RE
.sp
\f(CRENOSPC\fP
.RS 4
Insufficient persistent storage.
.RE
.SH "SEE ALSO"
.sp
nn_strerror(3compat),
nng_compat(3compat),
nng(7)