emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 1024 file descriptors should be enough for anyone


From: Robert Pluim
Subject: Re: 1024 file descriptors should be enough for anyone
Date: Thu, 05 May 2022 09:09:23 +0200

>>>>> On Thu, 05 May 2022 08:55:10 +0800, Po Lu <luangruo@yahoo.com> said:

    Po> Robert Pluim <rpluim@gmail.com> writes:
    >> Attached an initial attempt at using poll() instead of select(), and
    >> bumping the open filed descriptor limit to 10240. It passes 'make
    >> check' on GNU/Linux, FreeBSD 13, and macOS, and M-x eww
    >> works. MS-Windows should still build with no change in functionality.

    Po> Great, thanks!  Though would prefer `syspoll.h' to be part of
    Po> `sysselect.h' instead, since it just defines a wrapper that pretends to
    Po> be `pselect'.  It also means we can get rid of the following
    Po> incantation:

    >> +#ifdef USE_POLL
    >> +#include "syspoll.h"
    >> +#endif

I guess thatʼs possible, although the pattern for other similar
includes is sys<name of feature/syscall>/h.

    Po> Some more comments below:

    >> +  Does Emacs use poll()?                                  ${USE_POLL}

    >> +** Emacs can now use poll() and larger file descriptor sets.
    >> +There is experimental support for using poll() instead of select() to
    >> +check file descriptor statuses, which can be requested by using the
    >> +'--with-poll' option to the 'configure' script.  As part of this
    >> +feature, the maximum number of open files supported has been increased
    >> +to 10xFD_SETSIZE (which is typically 1024).  Note that there may be
    >> +ulimit or kernel limits that still restrict the number of simultaneous
    >> +open files.  This feature is not supported on MS-Windows.

    Po> In here and various other places, "poll()" should be written `poll',
    Po> since it is not a function call without arguments.

Fixed

    >> diff --git a/src/xterm.c b/src/xterm.c
    >> index 01832d60c9..3576267626 100644
    >> --- a/src/xterm.c
    >> +++ b/src/xterm.c
    >> @@ -637,6 +637,9 @@ Copyright (C) 1989, 1993-2022 Free Software 
Foundation, Inc.
    >> #include "font.h"
    >> #include "xsettings.h"
    >> #include "sysselect.h"
    >> +#ifdef USE_POLL
    >> +#include "syspoll.h"
    >> +#endif
    >> #include "menu.h"
    >> #include "pdumper.h"

    Po> init_xterm must reject displays whose fds are larger than FD_MAXSIZE on
    Po> Lucid and Motif builds, since Xt uses pselect internally.  (I don't
    Po> remember if XtOpenDisplay does that for you anymore.)

OK. Iʼll look at that. Of course, who opens a second display connection
when they have 1024 file descriptors open? 😈

    Po> I would prefer that x_wait_for_event, XTflash and
    Po> x_next_event_from_any_display be rewritten to utilize poll directly
    Po> instead of going through the wrapper as well.

Iʼm not a great fan of flag days, especially in something as
fundamental as file descriptor handling.

    Po> Once again, thanks for making this happen!

What can I say? It all just seemed like fun 😉

Robert
-- 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]