Commit 8120940 1 parent a3bbcb5 commit 8120940 Copy full SHA for 8120940
File tree 2 files changed +9
-1
lines changed
2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -276,6 +276,9 @@ struct process_io_request {
276
276
libvchan_t * vchan ;
277
277
struct buffer * stdin_buf ;
278
278
279
+ /* Note that stdin_fd, stdout_fd, and stderr_fd are named assuming a
280
+ * *local* process. For a *remote* process, stdin_fd is the standard
281
+ * *output*, stdout_fd is the standard *input*, and stderr_fd must be -1. */
279
282
// stderr_fd can be -1
280
283
int stdin_fd , stdout_fd , stderr_fd ;
281
284
// 0 if no child process
@@ -284,12 +287,14 @@ struct process_io_request {
284
287
/*
285
288
is_service true (this is a service):
286
289
- send local data as MSG_DATA_STDOUT
290
+ - send local stderr as MSG_DATA_STDERR, unless in dom0
287
291
- send exit code
288
292
- wait just for local end
289
293
- return local exit code
290
294
291
295
is_service false (this is a client):
292
296
- send local data as MSG_DATA_STDIN
297
+ - stderr_fd is always -1
293
298
- don't send exit code
294
299
- wait for local and remote end
295
300
- return remote exit code
Original file line number Diff line number Diff line change 19
19
*
20
20
*/
21
21
22
+ #include <assert.h>
22
23
#include <signal.h>
23
24
#include <sys/wait.h>
24
25
#include <sys/socket.h>
@@ -110,8 +111,10 @@ int process_io(const struct process_io_request *req) {
110
111
set_nonblock (stdin_fd );
111
112
if (stdout_fd != stdin_fd )
112
113
set_nonblock (stdout_fd );
113
- if (stderr_fd >= 0 )
114
+ if (stderr_fd >= 0 ) {
115
+ assert (is_service ); // if this is a client, stderr_fd is *always* -1
114
116
set_nonblock (stderr_fd );
117
+ }
115
118
116
119
/* Convenience macros that eliminate a ton of error-prone boilerplate */
117
120
#define close_stdin () do { \
You can’t perform that action at this time.
0 commit comments