emacs-diffs
[Top][All Lists]
Advanced

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

emacs-28 1a1b206: Adapt the recent 'num_processors' change to MS-Windows


From: Eli Zaretskii
Subject: emacs-28 1a1b206: Adapt the recent 'num_processors' change to MS-Windows
Date: Mon, 11 Oct 2021 08:57:11 -0400 (EDT)

branch: emacs-28
commit 1a1b206a8b33dc597fe2153a59fa30baacf1dcc8
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Adapt the recent 'num_processors' change to MS-Windows
    
    * nt/gnulib-cfg.mk (OMIT_GNULIB_MODULE_nproc): Omit nproc.
    
    * src/w32.c (num_processors): New function.
    * src/w32proc.c (Fw32_get_nproc): Remove.
---
 nt/gnulib-cfg.mk |  1 +
 src/w32.c        | 11 +++++++++++
 src/w32proc.c    | 11 -----------
 3 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/nt/gnulib-cfg.mk b/nt/gnulib-cfg.mk
index f1f4c4c..e9f00e7 100644
--- a/nt/gnulib-cfg.mk
+++ b/nt/gnulib-cfg.mk
@@ -73,3 +73,4 @@ OMIT_GNULIB_MODULE_lchmod = true
 OMIT_GNULIB_MODULE_futimens = true
 OMIT_GNULIB_MODULE_utimensat = true
 OMIT_GNULIB_MODULE_file-has-acl = true
+OMIT_GNULIB_MODULE_nproc = true
diff --git a/src/w32.c b/src/w32.c
index 0eb69d4..9fe698d 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -39,6 +39,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include <sys/time.h>
 #include <sys/utime.h>
 #include <math.h>
+#include <nproc.h>
 
 /* Include (most) CRT headers *before* ms-w32.h.  */
 #include <ms-w32.h>
@@ -1962,6 +1963,16 @@ w32_get_nproc (void)
   return num_of_processors;
 }
 
+/* Emulate Gnulib's 'num_processors'.  We cannot use the Gnulib
+   version because it unconditionally calls APIs that aren't available
+   on old MS-Windows versions.  */
+unsigned long
+num_processors (enum nproc_query query)
+{
+  /* We ignore QUERY.  */
+  return w32_get_nproc ();
+}
+
 static void
 sample_system_load (ULONGLONG *idle, ULONGLONG *kernel, ULONGLONG *user)
 {
diff --git a/src/w32proc.c b/src/w32proc.c
index 3b7d92a..360f45e 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -3878,15 +3878,6 @@ w32_compare_strings (const char *s1, const char *s2, 
char *locname,
   return val - 2;
 }
 
-/* FIXME: Remove, merging any of its special features into num-processors.  */
-DEFUN ("w32-get-nproc", Fw32_get_nproc,
-       Sw32_get_nproc, 0, 0, 0,
-       doc: /* Return the number of system's processor execution units.  */)
-  (void)
-{
-  return make_fixnum (w32_get_nproc ());
-}
-
 
 void
 syms_of_ntproc (void)
@@ -3921,8 +3912,6 @@ syms_of_ntproc (void)
   defsubr (&Sw32_get_keyboard_layout);
   defsubr (&Sw32_set_keyboard_layout);
 
-  defsubr (&Sw32_get_nproc);
-
   DEFVAR_LISP ("w32-quote-process-args", Vw32_quote_process_args,
               doc: /* Non-nil enables quoting of process arguments to ensure 
correct parsing.
 Because Windows does not directly pass argv arrays to child processes,



reply via email to

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