From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.devel Subject: Re: 1024 file descriptors should be enough for anyone Date: Thu, 05 May 2022 09:09:23 +0200 Message-ID: <87v8uk5ucc.fsf@gmail.com> References: <874k25726k.fsf@gmail.com> <87pmkslrwx.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5399"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu May 05 09:11:40 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nmVeG-0001D6-72 for ged-emacs-devel@m.gmane-mx.org; Thu, 05 May 2022 09:11:40 +0200 Original-Received: from localhost ([::1]:38968 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nmVeE-0005qO-Pr for ged-emacs-devel@m.gmane-mx.org; Thu, 05 May 2022 03:11:38 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nmVc8-0004sc-N8 for emacs-devel@gnu.org; Thu, 05 May 2022 03:09:30 -0400 Original-Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:38651) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nmVc6-00083i-9c for emacs-devel@gnu.org; Thu, 05 May 2022 03:09:27 -0400 Original-Received: by mail-wr1-x42e.google.com with SMTP id k2so4800016wrd.5 for ; Thu, 05 May 2022 00:09:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-transfer-encoding; bh=wOt0E+Fj+WEzxSaTTPUAc3KcA+lW6yrPIRxUQQeX2L8=; b=OgoEgT4/usv3s0paadbR8tUJD3Lb6MkMMAJWf8w5naiZ3kuVeIjoJE9r0WvNnppa2d ZQX+6BDxAR5BOOysGg/vqzkjTwGnK5WytOE/Npx9Z6+D5+FimFHZhD0Tf2/2AvKMzCzY dGDCZRkkc/FJLnNx6vK5rgxHXn8XHVG/IzWMi4RhWlfUZK0EGV22bUtCPcng8BagNtAG c4ayKHm0h9c3XaEUhsrRJ8OuAM0rGEk630G2Qv64bVfFAanDa52JMUUhQK9/c8+G4VSe wObNWIRxHyXf1rlPpLX9w8wOLmaOXpgwgxFJ4Hv80ce6nCWWeemQVjPhCu04IQmL/lk3 yVaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-transfer-encoding; bh=wOt0E+Fj+WEzxSaTTPUAc3KcA+lW6yrPIRxUQQeX2L8=; b=AFzqTfo87KBfwJhWOrEGMXyahGYIo5Ff5cMYBxNZPOGoftjzu2wIly6cMySJUNMCDL KU+bfek72OY52R1ujsb1bSqRQVaCeNK+g8xJTN4X6bA8UGlI/ZWSKTjjLsc1GBoBc/yx ojua1C5RfjqLCEDNR8GWiCxhrjhUpY4SPvfoHQaL659WourqZ44IeoK7dzV+F4UK9Dix LOYuXOBjFIXEbxeSXKl/lbQwg9TFl6urGln9ZKEmSMxNd+uPMOD1c18+OzKlJr66OIuQ KQjg6qXUidvLM8BjU7yHMNN32vexQHNwp9FM2Os9/iFYLwL3O3DdbxFVktkdFbhOYCnI UqLg== X-Gm-Message-State: AOAM532uY9UkGnJfq1h6VdNao1hgmVo3fB0t8OjdrUbsKk9SkFILCBqO aaBegVnvxm21c4fZY6XeQ69Gp6eSxitFvg== X-Google-Smtp-Source: ABdhPJxJAIuoKu8VbioHsCtX3GQHSoLHrTVLACE7g/eVUHdCnQkQuzbgwbz63vLmCO35PHGaZZSJlg== X-Received: by 2002:a05:6000:1809:b0:20a:cafc:fd39 with SMTP id m9-20020a056000180900b0020acafcfd39mr18909201wrh.255.1651734564453; Thu, 05 May 2022 00:09:24 -0700 (PDT) Original-Received: from rltb ([2a01:e0a:3f3:fb50:7623:b433:37be:1f20]) by smtp.gmail.com with ESMTPSA id n124-20020a1c2782000000b0039447beb28asm1623327wmn.23.2022.05.05.00.09.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 May 2022 00:09:23 -0700 (PDT) In-Reply-To: <87pmkslrwx.fsf@yahoo.com> (Po Lu's message of "Thu, 05 May 2022 08:55:10 +0800") Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=rpluim@gmail.com; helo=mail-wr1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:289227 Archived-At: >>>>> On Thu, 05 May 2022 08:55:10 +0800, Po Lu said: Po> Robert Pluim 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 pretend= s 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=CA=BCs possible, although the pattern for other similar includes is sys/h. Po> Some more comments below: >> + Does Emacs use poll()? ${USE_POL= L} >> +** 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 increa= sed >> +to 10xFD_SETSIZE (which is typically 1024). Note that there may be >> +ulimit or kernel limits that still restrict the number of simultane= ous >> +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 Foun= dation, 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_MAXSIZ= E 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=CA=BCll look at that. Of course, who opens a second display connection when they have 1024 file descriptors open? =F0=9F=98=88 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=CA=BCm 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 =F0=9F=98=89 Robert --=20