aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorDmitry Gutov2024-06-09 02:51:47 +0300
committerDmitry Gutov2024-06-09 02:51:47 +0300
commit8cf6e311b87fabeba70d59647883a86c8c92b86f (patch)
tree143445c17eaf8874cae0d0496ee085555fee249b /src/process.c
parentbbc18031aff6f22a1f2b63355f18f294fbdeb797 (diff)
downloademacs-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/process.c')
-rw-r--r--src/process.c11
1 files changed, 5 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;