diff options
| author | Eli Zaretskii | 2021-10-11 15:56:31 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2021-10-11 15:56:31 +0300 |
| commit | 1a1b206a8b33dc597fe2153a59fa30baacf1dcc8 (patch) | |
| tree | 1eb9391ef27fbdbb0fabc83ba3eadd17d1683eb3 /src | |
| parent | 7cb463792334d6f59cdfc89165bac2d7783e3913 (diff) | |
| download | emacs-1a1b206a8b33dc597fe2153a59fa30baacf1dcc8.tar.gz emacs-1a1b206a8b33dc597fe2153a59fa30baacf1dcc8.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32.c | 11 | ||||
| -rw-r--r-- | src/w32proc.c | 11 |
2 files changed, 11 insertions, 11 deletions
| @@ -39,6 +39,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 39 | #include <sys/time.h> | 39 | #include <sys/time.h> |
| 40 | #include <sys/utime.h> | 40 | #include <sys/utime.h> |
| 41 | #include <math.h> | 41 | #include <math.h> |
| 42 | #include <nproc.h> | ||
| 42 | 43 | ||
| 43 | /* Include (most) CRT headers *before* ms-w32.h. */ | 44 | /* Include (most) CRT headers *before* ms-w32.h. */ |
| 44 | #include <ms-w32.h> | 45 | #include <ms-w32.h> |
| @@ -1962,6 +1963,16 @@ w32_get_nproc (void) | |||
| 1962 | return num_of_processors; | 1963 | return num_of_processors; |
| 1963 | } | 1964 | } |
| 1964 | 1965 | ||
| 1966 | /* Emulate Gnulib's 'num_processors'. We cannot use the Gnulib | ||
| 1967 | version because it unconditionally calls APIs that aren't available | ||
| 1968 | on old MS-Windows versions. */ | ||
| 1969 | unsigned long | ||
| 1970 | num_processors (enum nproc_query query) | ||
| 1971 | { | ||
| 1972 | /* We ignore QUERY. */ | ||
| 1973 | return w32_get_nproc (); | ||
| 1974 | } | ||
| 1975 | |||
| 1965 | static void | 1976 | static void |
| 1966 | sample_system_load (ULONGLONG *idle, ULONGLONG *kernel, ULONGLONG *user) | 1977 | sample_system_load (ULONGLONG *idle, ULONGLONG *kernel, ULONGLONG *user) |
| 1967 | { | 1978 | { |
diff --git a/src/w32proc.c b/src/w32proc.c index 3b7d92a2aa8..360f45e9e11 100644 --- a/src/w32proc.c +++ b/src/w32proc.c | |||
| @@ -3878,15 +3878,6 @@ w32_compare_strings (const char *s1, const char *s2, char *locname, | |||
| 3878 | return val - 2; | 3878 | return val - 2; |
| 3879 | } | 3879 | } |
| 3880 | 3880 | ||
| 3881 | /* FIXME: Remove, merging any of its special features into num-processors. */ | ||
| 3882 | DEFUN ("w32-get-nproc", Fw32_get_nproc, | ||
| 3883 | Sw32_get_nproc, 0, 0, 0, | ||
| 3884 | doc: /* Return the number of system's processor execution units. */) | ||
| 3885 | (void) | ||
| 3886 | { | ||
| 3887 | return make_fixnum (w32_get_nproc ()); | ||
| 3888 | } | ||
| 3889 | |||
| 3890 | 3881 | ||
| 3891 | void | 3882 | void |
| 3892 | syms_of_ntproc (void) | 3883 | syms_of_ntproc (void) |
| @@ -3921,8 +3912,6 @@ syms_of_ntproc (void) | |||
| 3921 | defsubr (&Sw32_get_keyboard_layout); | 3912 | defsubr (&Sw32_get_keyboard_layout); |
| 3922 | defsubr (&Sw32_set_keyboard_layout); | 3913 | defsubr (&Sw32_set_keyboard_layout); |
| 3923 | 3914 | ||
| 3924 | defsubr (&Sw32_get_nproc); | ||
| 3925 | |||
| 3926 | DEFVAR_LISP ("w32-quote-process-args", Vw32_quote_process_args, | 3915 | DEFVAR_LISP ("w32-quote-process-args", Vw32_quote_process_args, |
| 3927 | doc: /* Non-nil enables quoting of process arguments to ensure correct parsing. | 3916 | doc: /* Non-nil enables quoting of process arguments to ensure correct parsing. |
| 3928 | Because Windows does not directly pass argv arrays to child processes, | 3917 | Because Windows does not directly pass argv arrays to child processes, |