linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: socket(2) manpage - EMFILE ENFILE descriptions need swapped
       [not found]   ` <CAJYtZHn+jBqgty_jw9k8Djqw2O7RxvvJPOSMekYU9KggE1=Fkw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-12-27 16:13     ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; only message in thread
From: Michael Kerrisk (man-pages) @ 2015-12-27 16:13 UTC (permalink / raw)
  To: Paul Fee
  Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w, linux-man-u79uwXL29TY76Z2rM5mHXA

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-12-27 16:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAJYtZH=As454RY9Qo_DFQKDGGvCpyVWmBU4QtY_EGbaV_gQuXg@mail.gmail.com>
     [not found] ` <CAJYtZHn+jBqgty_jw9k8Djqw2O7RxvvJPOSMekYU9KggE1=Fkw@mail.gmail.com>
     [not found]   ` <CAJYtZHn+jBqgty_jw9k8Djqw2O7RxvvJPOSMekYU9KggE1=Fkw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-12-27 16:13     ` socket(2) manpage - EMFILE ENFILE descriptions need swapped Michael Kerrisk (man-pages)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).