diff options
| author | Eli Zaretskii | 2012-12-15 13:04:14 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2012-12-15 13:04:14 +0200 |
| commit | d3d14b40f39c2e27d7b81218ceda414ea7847234 (patch) | |
| tree | f7740d0b9d7e6a80ca306eb00aec531045b5d1e9 /src | |
| parent | a5f74442196408f91cab24147b6322b3355b728d (diff) | |
| download | emacs-d3d14b40f39c2e27d7b81218ceda414ea7847234.tar.gz emacs-d3d14b40f39c2e27d7b81218ceda414ea7847234.zip | |
Improve and correct commentary to w32proc-related data and functions.
Diffstat (limited to 'src')
| -rw-r--r-- | src/callproc.c | 2 | ||||
| -rw-r--r-- | src/w32.c | 3 | ||||
| -rw-r--r-- | src/w32.h | 46 | ||||
| -rw-r--r-- | src/w32proc.c | 4 |
4 files changed, 40 insertions, 15 deletions
diff --git a/src/callproc.c b/src/callproc.c index 70e349d0d3a..e064dccd6d3 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -1274,7 +1274,7 @@ child_setup (int in, int out, int err, char **new_argv, bool set_pgrp, | |||
| 1274 | #ifdef WINDOWSNT | 1274 | #ifdef WINDOWSNT |
| 1275 | prepare_standard_handles (in, out, err, handles); | 1275 | prepare_standard_handles (in, out, err, handles); |
| 1276 | set_process_dir (SDATA (current_dir)); | 1276 | set_process_dir (SDATA (current_dir)); |
| 1277 | /* Spawn the child. (See ntproc.c:Spawnve). */ | 1277 | /* Spawn the child. (See w32proc.c:sys_spawnve). */ |
| 1278 | cpid = spawnve (_P_NOWAIT, new_argv[0], new_argv, env); | 1278 | cpid = spawnve (_P_NOWAIT, new_argv[0], new_argv, env); |
| 1279 | reset_standard_handles (in, out, err, handles); | 1279 | reset_standard_handles (in, out, err, handles); |
| 1280 | if (cpid == -1) | 1280 | if (cpid == -1) |
| @@ -6085,7 +6085,8 @@ sys_pipe (int * phandles) | |||
| 6085 | } | 6085 | } |
| 6086 | 6086 | ||
| 6087 | /* Function to do blocking read of one byte, needed to implement | 6087 | /* Function to do blocking read of one byte, needed to implement |
| 6088 | select. It is only allowed on sockets and pipes. */ | 6088 | select. It is only allowed on communication ports, sockets, or |
| 6089 | pipes. */ | ||
| 6089 | int | 6090 | int |
| 6090 | _sys_read_ahead (int fd) | 6091 | _sys_read_ahead (int fd) |
| 6091 | { | 6092 | { |
| @@ -68,17 +68,41 @@ enum { | |||
| 68 | a socket, the process handle in pi is NULL. */ | 68 | a socket, the process handle in pi is NULL. */ |
| 69 | typedef struct _child_process | 69 | typedef struct _child_process |
| 70 | { | 70 | { |
| 71 | int fd; | 71 | /* File descriptor for sockets and serial port connections, and for |
| 72 | int pid; | 72 | reading output from async subprocesses; otherwise -1. */ |
| 73 | HANDLE char_avail; | 73 | int fd; |
| 74 | HANDLE char_consumed; | 74 | /* PID for subprocess, either async or not; otherwise -1. */ |
| 75 | HANDLE thrd; | 75 | int pid; |
| 76 | HWND hwnd; | 76 | /* Handle to an event object that is signaled when a read operation |
| 77 | PROCESS_INFORMATION procinfo; | 77 | is completed, either successfully (in which case there're indeed |
| 78 | volatile int status; | 78 | "characters available") or not. Used by sys_select to wait for |
| 79 | char chr; | 79 | output from subprocesses or socket/serial connections. */ |
| 80 | OVERLAPPED ovl_read; | 80 | HANDLE char_avail; |
| 81 | OVERLAPPED ovl_write; | 81 | /* Handle to an event that is signaled to wake up the reader thread |
| 82 | and tell it to try reading more output from a subprocess. */ | ||
| 83 | HANDLE char_consumed; | ||
| 84 | /* Handle to the reader thread to read output from a subprocess or a | ||
| 85 | socket or a comm port. */ | ||
| 86 | HANDLE thrd; | ||
| 87 | /* Handle to the console window of a subprocess. Used to forcibly | ||
| 88 | terminate it by sys_kill. */ | ||
| 89 | HWND hwnd; | ||
| 90 | /* Information about subprocess returned by CreateProcess. Includes | ||
| 91 | handles to the subprocess and its primary thread, and the | ||
| 92 | corresponding process ID and thread ID numbers. The PID is | ||
| 93 | mirrored by the 'pid' member above. The process handle is used | ||
| 94 | to wait on it. */ | ||
| 95 | PROCESS_INFORMATION procinfo; | ||
| 96 | /* Status of subprocess/connection and of reading its output. For | ||
| 97 | values, see the enumeration above. */ | ||
| 98 | volatile int status; | ||
| 99 | /* Holds a single character read by _sys_read_ahead, when a | ||
| 100 | subprocess has some output ready. */ | ||
| 101 | char chr; | ||
| 102 | /* Used for async read operations on serial comm ports. */ | ||
| 103 | OVERLAPPED ovl_read; | ||
| 104 | /* Used for async write operations on serial comm ports. */ | ||
| 105 | OVERLAPPED ovl_write; | ||
| 82 | } child_process; | 106 | } child_process; |
| 83 | 107 | ||
| 84 | #define MAXDESC FD_SETSIZE | 108 | #define MAXDESC FD_SETSIZE |
diff --git a/src/w32proc.c b/src/w32proc.c index ddc6826df98..dd8d6eb856a 100644 --- a/src/w32proc.c +++ b/src/w32proc.c | |||
| @@ -1857,7 +1857,7 @@ sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, | |||
| 1857 | } | 1857 | } |
| 1858 | else | 1858 | else |
| 1859 | { | 1859 | { |
| 1860 | /* Child process and socket input */ | 1860 | /* Child process and socket/comm port input. */ |
| 1861 | cp = fd_info[i].cp; | 1861 | cp = fd_info[i].cp; |
| 1862 | if (cp) | 1862 | if (cp) |
| 1863 | { | 1863 | { |
| @@ -1870,7 +1870,7 @@ sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, | |||
| 1870 | /* Wake up the reader thread for this process */ | 1870 | /* Wake up the reader thread for this process */ |
| 1871 | cp->status = STATUS_READ_READY; | 1871 | cp->status = STATUS_READ_READY; |
| 1872 | if (!SetEvent (cp->char_consumed)) | 1872 | if (!SetEvent (cp->char_consumed)) |
| 1873 | DebPrint (("nt_select.SetEvent failed with " | 1873 | DebPrint (("sys_select.SetEvent failed with " |
| 1874 | "%lu for fd %ld\n", GetLastError (), i)); | 1874 | "%lu for fd %ld\n", GetLastError (), i)); |
| 1875 | } | 1875 | } |
| 1876 | 1876 | ||