Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should docs mention all possible errno values that a function can set? #4078

Closed
ardrabczyk opened this issue Nov 9, 2020 · 1 comment
Closed

Comments

@ardrabczyk
Copy link
Contributor

ardrabczyk commented Nov 9, 2020

Issue description

Currently docs do not mention than zmq_ctx_new() can set EMFILE and
that zmq_ctx_set_ext() can set EFAULT. The thing with zmq_ctx_new(),
and possibly other functions is that errno is not set explicitly in
libzmq code but is set by OS and therefore can be OS-specific.

Environment

  • libzmq version (commit hash if unreleased): v4.3.3-17-gb2a08420
  • OS: Slackware x64 -current

Minimal test code / Steps to reproduce the issue

#include <stdio.h>
#include <stdlib.h>
#include <zmq.h>

int main(void)
{
  void *context;
  for (int i = 0; i < 10000; i++)
    {
      context = zmq_ctx_new ();
      if (!context)
	{
	  if (errno)
	    perror("Reason");

	  fprintf(stderr, "zmq_ctx_new() failed at %d.\nExiting.\n", i);
	  return EXIT_FAILURE;
	}
    }

  return EXIT_SUCCESS;
}

What's the actual result? (include assertion message & call stack if applicable)

$ ./test
Reason: Too many open files
zmq_ctx_new() failed at 1020.
Exiting.

What's the expected result?

This could be documented in doc/zmq_ctx_new.txt but now it says:

No error values are defined for this function.

@bluca
Copy link
Member

bluca commented Nov 9, 2020

Feel free to send a PR to improve the docs

ardrabczyk added a commit to ardrabczyk/libzmq that referenced this issue Nov 9, 2020
Solution: document more possible errno values

Signed-off-by: Arkadiusz Drabczyk <[email protected]>
bluca added a commit that referenced this issue Nov 10, 2020
Problem: not all possible errno values were documented (#4078)
@bluca bluca closed this as completed Nov 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants