aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGlenn Morris2021-10-11 08:04:57 -0700
committerGlenn Morris2021-10-11 08:04:57 -0700
commit8aceb37b47a8f97fc42caaaf021ac06dc9f67827 (patch)
tree64e2d073d3980d633a68349b8872b534a5427d59 /src
parent395273773cb7035358cdd7c87f9102af75e39915 (diff)
parent1a1b206a8b33dc597fe2153a59fa30baacf1dcc8 (diff)
downloademacs-8aceb37b47a8f97fc42caaaf021ac06dc9f67827.tar.gz
emacs-8aceb37b47a8f97fc42caaaf021ac06dc9f67827.zip
Merge from origin/emacs-28
1a1b206a8b Adapt the recent 'num_processors' change to MS-Windows 7cb4637923 Minor fix to clarify a sentence in emacs-lisp-intro ab60144ea3 ; Pacify recent shorthand unused lexarg warnings. e9df86004f Make tty-run-terminal-initialization load the .elc file (i... 07edc28bdb Fix ert errors when there's a test that binds `debug-on-er... 96278de8ac New function num-processors 575e626105 Add symbol property 'save-some-buffers-function' (bug#46374) a3e10af95c Keep reading when typed RET in read-char-from-minibuffer a... 013e3be832 * lisp/userlock.el (ask-user-about-supersession-threat): A... ae61d7a57d Fix point positioning on mouse clicks with non-zero line-h... 4c7e74c386 Complete shorthands to longhands for symbol-completing tables c2513c5d0d Add new failing test for bug#51089 1d1e96377c ; * lisp/emacs-lisp/shortdoc.el: Fix typo. 6bf29072e9 Avoid mapping file names through 'substring' bcce93f04c Update to Org 9.5-46-gb71474 5d408f1a24 Expanded testing of MH-E with multiple MH variants b497add971 Fix Seccomp filter for newer GNU/Linux systems (Bug#51073). 75d9fbec88 Tramp code cleanup # Conflicts: # etc/NEWS # test/lisp/progmodes/elisp-mode-tests.el
Diffstat (limited to 'src')
-rw-r--r--src/process.c18
-rw-r--r--src/w32.c11
-rw-r--r--src/w32proc.c10
-rw-r--r--src/xdisp.c2
4 files changed, 31 insertions, 10 deletions
diff --git a/src/process.c b/src/process.c
index 221d4c7f6c3..746cdc0428a 100644
--- a/src/process.c
+++ b/src/process.c
@@ -90,6 +90,7 @@ static struct rlimit nofile_limit;
90 90
91#include <c-ctype.h> 91#include <c-ctype.h>
92#include <flexmember.h> 92#include <flexmember.h>
93#include <nproc.h>
93#include <sig2str.h> 94#include <sig2str.h>
94#include <verify.h> 95#include <verify.h>
95 96
@@ -8212,6 +8213,20 @@ integer or floating point values.
8212 return system_process_attributes (pid); 8213 return system_process_attributes (pid);
8213} 8214}
8214 8215
8216DEFUN ("num-processors", Fnum_processors, Snum_processors, 0, 1, 0,
8217 doc: /* Return the number of processors, a positive integer.
8218Each usable thread execution unit counts as a processor.
8219By default, count the number of available processors,
8220overridable via the OMP_NUM_THREADS environment variable.
8221If optional argument QUERY is `current', ignore OMP_NUM_THREADS.
8222If QUERY is `all', also count processors not available. */)
8223 (Lisp_Object query)
8224{
8225 return make_uint (num_processors (EQ (query, Qall) ? NPROC_ALL
8226 : EQ (query, Qcurrent) ? NPROC_CURRENT
8227 : NPROC_CURRENT_OVERRIDABLE));
8228}
8229
8215#ifdef subprocesses 8230#ifdef subprocesses
8216/* Arrange to catch SIGCHLD if this hasn't already been arranged. 8231/* Arrange to catch SIGCHLD if this hasn't already been arranged.
8217 Invoke this after init_process_emacs, and after glib and/or GNUstep 8232 Invoke this after init_process_emacs, and after glib and/or GNUstep
@@ -8472,6 +8487,8 @@ syms_of_process (void)
8472 DEFSYM (Qpcpu, "pcpu"); 8487 DEFSYM (Qpcpu, "pcpu");
8473 DEFSYM (Qpmem, "pmem"); 8488 DEFSYM (Qpmem, "pmem");
8474 DEFSYM (Qargs, "args"); 8489 DEFSYM (Qargs, "args");
8490 DEFSYM (Qall, "all");
8491 DEFSYM (Qcurrent, "current");
8475 8492
8476 DEFVAR_BOOL ("delete-exited-processes", delete_exited_processes, 8493 DEFVAR_BOOL ("delete-exited-processes", delete_exited_processes,
8477 doc: /* Non-nil means delete processes immediately when they exit. 8494 doc: /* Non-nil means delete processes immediately when they exit.
@@ -8633,4 +8650,5 @@ amounts of data in one go. */);
8633 defsubr (&Sprocess_inherit_coding_system_flag); 8650 defsubr (&Sprocess_inherit_coding_system_flag);
8634 defsubr (&Slist_system_processes); 8651 defsubr (&Slist_system_processes);
8635 defsubr (&Sprocess_attributes); 8652 defsubr (&Sprocess_attributes);
8653 defsubr (&Snum_processors);
8636} 8654}
diff --git a/src/w32.c b/src/w32.c
index 0eb69d4b1d1..9fe698d28d7 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/>. */
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. */
1969unsigned long
1970num_processors (enum nproc_query query)
1971{
1972 /* We ignore QUERY. */
1973 return w32_get_nproc ();
1974}
1975
1965static void 1976static void
1966sample_system_load (ULONGLONG *idle, ULONGLONG *kernel, ULONGLONG *user) 1977sample_system_load (ULONGLONG *idle, ULONGLONG *kernel, ULONGLONG *user)
1967{ 1978{
diff --git a/src/w32proc.c b/src/w32proc.c
index 702ea122e65..360f45e9e11 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -3878,14 +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
3881DEFUN ("w32-get-nproc", Fw32_get_nproc,
3882 Sw32_get_nproc, 0, 0, 0,
3883 doc: /* Return the number of system's processor execution units. */)
3884 (void)
3885{
3886 return make_fixnum (w32_get_nproc ());
3887}
3888
3889 3881
3890void 3882void
3891syms_of_ntproc (void) 3883syms_of_ntproc (void)
@@ -3920,8 +3912,6 @@ syms_of_ntproc (void)
3920 defsubr (&Sw32_get_keyboard_layout); 3912 defsubr (&Sw32_get_keyboard_layout);
3921 defsubr (&Sw32_set_keyboard_layout); 3913 defsubr (&Sw32_set_keyboard_layout);
3922 3914
3923 defsubr (&Sw32_get_nproc);
3924
3925 DEFVAR_LISP ("w32-quote-process-args", Vw32_quote_process_args, 3915 DEFVAR_LISP ("w32-quote-process-args", Vw32_quote_process_args,
3926 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.
3927Because Windows does not directly pass argv arrays to child processes, 3917Because Windows does not directly pass argv arrays to child processes,
diff --git a/src/xdisp.c b/src/xdisp.c
index 9ddf0dd54b5..d8aff5084c4 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -10073,6 +10073,8 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos
10073 10073
10074 case MOVE_NEWLINE_OR_CR: 10074 case MOVE_NEWLINE_OR_CR:
10075 max_current_x = max (it->current_x, max_current_x); 10075 max_current_x = max (it->current_x, max_current_x);
10076 if (!IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
10077 it->override_ascent = -1;
10076 set_iterator_to_next (it, true); 10078 set_iterator_to_next (it, true);
10077 it->continuation_lines_width = 0; 10079 it->continuation_lines_width = 0;
10078 break; 10080 break;