nn_errno.adoc 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. nn_errno(3)
  2. ===========
  3. NAME
  4. ----
  5. nn_errno - retrieve the current errno
  6. SYNOPSIS
  7. --------
  8. *#include <nanomsg/nn.h>*
  9. *int nn_errno (void);*
  10. DESCRIPTION
  11. -----------
  12. Returns value of 'errno' for the current thread.
  13. On most systems, 'errno' can be accessed directly and this function is not
  14. needed. However, on Windows, there are multiple implementations of the CRT
  15. library (single-threaded, multi-threaded, release, debug) and each of them
  16. has its own instance of 'errno'. Thus, if nanomsg library and the application
  17. that uses it link with different versions of the CRT library, they don't share
  18. the same instance of 'errno'. Consequently, error codes set by nanomsg cannot be
  19. accessed by the application. To overcome this problem, application can use
  20. _nn_errno()_ function to retrieve nanomsg's value of 'errno'.
  21. RETURN VALUE
  22. ------------
  23. Returns value of 'errno' for the current thread.
  24. ERRORS
  25. ------
  26. No errors are defined.
  27. EXAMPLE
  28. -------
  29. ----
  30. rc = nn_send (s, "ABC", 3, 0);
  31. if (rc < 0)
  32. printf ("nn_send failed with error code %d\n", nn_errno ());
  33. ----
  34. SEE ALSO
  35. --------
  36. <<nn_strerror#,nn_strerror(3)>>
  37. <<nanomsg#,nanomsg(7)>>
  38. AUTHORS
  39. -------
  40. link:mailto:sustrik@250bpm.com[Martin Sustrik]