All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael Kerrisk (man-pages)" <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Paul Fee <paul.f.fee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: socket(2) manpage - EMFILE ENFILE descriptions need swapped
Date: Sun, 27 Dec 2015 17:13:58 +0100	[thread overview]
Message-ID: <56800E46.1050309@gmail.com> (raw)
In-Reply-To: <CAJYtZHn+jBqgty_jw9k8Djqw2O7RxvvJPOSMekYU9KggE1=Fkw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Hi Paul,

On 10/16/2015 02:37 PM, Paul Fee wrote:
> [Resending, hopefully as plain text this time for the benefit of
> vger.kernel.org]
> 
> Hi,
> 
> Here's the current text from the socket(2) manpage, ERRORS section:
> 
>        EMFILE Process file table overflow.
> 
>        ENFILE The system limit on the total number of open files has been
>               reached.
> 
> These appear to be the wrong way round.  Here's an extract from
> errno-base.h:
> 
> #define ENFILE          23      /* File table overflow */
> #define EMFILE          24      /* Too many open files */
> 
> In my test program, I see that errno is set to 24, with strerror()
> returning "Too many open files".  Therefore the comments in errno-base.h
> look correct and the manpage needs updating.

Well, both the man page and the comments could be better. I changed the 
man page to:

       EMFILE The  per-process  limit  on  the  number  of  open  file
              descriptors has been reached.

       ENFILE The  system-wide limit on the total number of open files
              has been reached.

EMFILE is caused by encountering the RLIMIT_NOFILE limit (see 
getrlimit(2)).

ENFILE is about encountering the /proc/sys/fs/file-max limit
(see proc(5)).

Thanks for the report!

Cheers,

Michael

> 
> Test code
> ==========
> #include <sys/socket.h>
> #include <stdio.h>
> #include <errno.h>
> #include <string.h>
> 
> int main(int argc, char* argv[])
> {
>   while(1)
>   {
>     int s = socket(AF_UNIX, SOCK_STREAM, 0);
>     printf("Created socket, fd: %d\n", s);
>     if (-1 == s)
>     {
>       printf("Error: %d: %s\n", errno, strerror(errno));
>       return 1;
>     }
>   }
>   return 0;
> }
> ==========
> 
> Thanks,
> Paul
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

           reply	other threads:[~2015-12-27 16:13 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <CAJYtZHn+jBqgty_jw9k8Djqw2O7RxvvJPOSMekYU9KggE1=Fkw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56800E46.1050309@gmail.com \
    --to=mtk.manpages-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=paul.f.fee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.