diff options
| author | Sean Whitton | 2026-02-28 10:23:11 +0000 |
|---|---|---|
| committer | Sean Whitton | 2026-02-28 10:23:11 +0000 |
| commit | 3b223db8a7fc97e51dadd62da99650201a83e39e (patch) | |
| tree | e91c244b28eb23730ed41ca3d66815e6d241ffb9 /src | |
| parent | 58b195e5a3214d7f54d7f4481c3e3606bf4c7864 (diff) | |
| download | emacs-3b223db8a7fc97e51dadd62da99650201a83e39e.tar.gz emacs-3b223db8a7fc97e51dadd62da99650201a83e39e.zip | |
Initialize command-line-max-length with sysconf(3)
* lisp/subr.el (command-line-max-length): Move from here ...
* src/callproc.c (syms_of_callproc): <Vcommand_line_max_length>:
... to here. Initialize by calling sysconf(3) if possible.
Diffstat (limited to 'src')
| -rw-r--r-- | src/callproc.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/callproc.c b/src/callproc.c index 51b5a1c4074..abb944c3aad 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -2237,6 +2237,20 @@ the system. */); | |||
| 2237 | Vrcs2log_program_name = build_string ("librcs2log.so"); | 2237 | Vrcs2log_program_name = build_string ("librcs2log.so"); |
| 2238 | #endif /* !HAVE_ANDROID || ANDROID_STUBIFY */ | 2238 | #endif /* !HAVE_ANDROID || ANDROID_STUBIFY */ |
| 2239 | 2239 | ||
| 2240 | DEFVAR_LISP ("command-line-max-length", Vcommand_line_max_length, | ||
| 2241 | doc: /* Maximum length of a command and its arguments on this system. | ||
| 2242 | This is measured in characters. | ||
| 2243 | Used by `multiple-command-partition-arguments'. Other code calls that | ||
| 2244 | function for cases in which it's known to be safe to run the command | ||
| 2245 | multiple times on subsequent partitions of the list of arguments. | ||
| 2246 | (In a shell script, you might use the `xargs' utility.) */); | ||
| 2247 | #if defined _SC_ARG_MAX | ||
| 2248 | /* Divide it by 4 as a crude way to go bytes->characters. */ | ||
| 2249 | Vcommand_line_max_length = make_fixnum (sysconf (_SC_ARG_MAX) / 4); | ||
| 2250 | #else /* defined _SC_ARG_MAX */ | ||
| 2251 | Vcommand_line_max_length = make_fixnum (4096); | ||
| 2252 | #endif /* defined _SC_ARG_MAX */ | ||
| 2253 | |||
| 2240 | defsubr (&Scall_process); | 2254 | defsubr (&Scall_process); |
| 2241 | defsubr (&Sgetenv_internal); | 2255 | defsubr (&Sgetenv_internal); |
| 2242 | defsubr (&Scall_process_region); | 2256 | defsubr (&Scall_process_region); |