diff options
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 18 |
1 files changed, 18 insertions, 0 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 | ||
| 8216 | DEFUN ("num-processors", Fnum_processors, Snum_processors, 0, 1, 0, | ||
| 8217 | doc: /* Return the number of processors, a positive integer. | ||
| 8218 | Each usable thread execution unit counts as a processor. | ||
| 8219 | By default, count the number of available processors, | ||
| 8220 | overridable via the OMP_NUM_THREADS environment variable. | ||
| 8221 | If optional argument QUERY is `current', ignore OMP_NUM_THREADS. | ||
| 8222 | If 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 | } |