diff options
| author | Dmitry Gutov | 2024-06-09 02:51:47 +0300 |
|---|---|---|
| committer | Dmitry Gutov | 2024-06-09 02:51:47 +0300 |
| commit | 8cf6e311b87fabeba70d59647883a86c8c92b86f (patch) | |
| tree | 143445c17eaf8874cae0d0496ee085555fee249b /src | |
| parent | bbc18031aff6f22a1f2b63355f18f294fbdeb797 (diff) | |
| download | emacs-8cf6e311b87fabeba70d59647883a86c8c92b86f.tar.gz emacs-8cf6e311b87fabeba70d59647883a86c8c92b86f.zip | |
Remember the value of read_process_output_max when process is created
* src/process.h (Lisp_Process): Add field readmax.
* src/process.c (read_process_output): Use it.
(create_process): Save the value of read_process_output_max to
it when the process is created (bug#66020). Use for pipe size.
Diffstat (limited to 'src')
| -rw-r--r-- | src/process.c | 11 | ||||
| -rw-r--r-- | src/process.h | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/process.c b/src/process.c index 2e8dd758b3c..fd09bb98c60 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -2194,6 +2194,8 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 2194 | outchannel = p->open_fd[WRITE_TO_SUBPROCESS]; | 2194 | outchannel = p->open_fd[WRITE_TO_SUBPROCESS]; |
| 2195 | } | 2195 | } |
| 2196 | 2196 | ||
| 2197 | p->readmax = clip_to_bounds (1, read_process_output_max, INT_MAX); | ||
| 2198 | |||
| 2197 | /* Set up stdout for the child process. */ | 2199 | /* Set up stdout for the child process. */ |
| 2198 | if (ptychannel >= 0 && p->pty_out) | 2200 | if (ptychannel >= 0 && p->pty_out) |
| 2199 | { | 2201 | { |
| @@ -2210,11 +2212,8 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 2210 | #if defined(F_SETPIPE_SZ) && defined(F_GETPIPE_SZ) | 2212 | #if defined(F_SETPIPE_SZ) && defined(F_GETPIPE_SZ) |
| 2211 | /* If they requested larger reads than the default system pipe | 2213 | /* If they requested larger reads than the default system pipe |
| 2212 | capacity, try enlarging the capacity to match the request. */ | 2214 | capacity, try enlarging the capacity to match the request. */ |
| 2213 | if (read_process_output_max > fcntl (inchannel, F_GETPIPE_SZ)) | 2215 | if (p->readmax > fcntl (inchannel, F_GETPIPE_SZ)) |
| 2214 | { | 2216 | fcntl (inchannel, F_SETPIPE_SZ, p->readmax); |
| 2215 | int readmax = clip_to_bounds (1, read_process_output_max, INT_MAX); | ||
| 2216 | fcntl (inchannel, F_SETPIPE_SZ, readmax); | ||
| 2217 | } | ||
| 2218 | #endif | 2217 | #endif |
| 2219 | } | 2218 | } |
| 2220 | 2219 | ||
| @@ -6171,7 +6170,7 @@ read_process_output (Lisp_Object proc, int channel) | |||
| 6171 | eassert (0 <= channel && channel < FD_SETSIZE); | 6170 | eassert (0 <= channel && channel < FD_SETSIZE); |
| 6172 | struct coding_system *coding = proc_decode_coding_system[channel]; | 6171 | struct coding_system *coding = proc_decode_coding_system[channel]; |
| 6173 | int carryover = p->decoding_carryover; | 6172 | int carryover = p->decoding_carryover; |
| 6174 | ptrdiff_t readmax = clip_to_bounds (1, read_process_output_max, PTRDIFF_MAX); | 6173 | ptrdiff_t readmax = p->readmax; |
| 6175 | specpdl_ref count = SPECPDL_INDEX (); | 6174 | specpdl_ref count = SPECPDL_INDEX (); |
| 6176 | Lisp_Object odeactivate; | 6175 | Lisp_Object odeactivate; |
| 6177 | char *chars; | 6176 | char *chars; |
diff --git a/src/process.h b/src/process.h index 3f56b087084..f497a64c3d1 100644 --- a/src/process.h +++ b/src/process.h | |||
| @@ -153,6 +153,8 @@ struct Lisp_Process | |||
| 153 | unsigned int adaptive_read_buffering : 2; | 153 | unsigned int adaptive_read_buffering : 2; |
| 154 | /* Skip reading this process on next read. */ | 154 | /* Skip reading this process on next read. */ |
| 155 | bool_bf read_output_skip : 1; | 155 | bool_bf read_output_skip : 1; |
| 156 | /* Maximum number of bytes to read in a single chunk. */ | ||
| 157 | ptrdiff_t readmax; | ||
| 156 | /* True means kill silently if Emacs is exited. | 158 | /* True means kill silently if Emacs is exited. |
| 157 | This is the inverse of the `query-on-exit' flag. */ | 159 | This is the inverse of the `query-on-exit' flag. */ |
| 158 | bool_bf kill_without_query : 1; | 160 | bool_bf kill_without_query : 1; |