comparison libinterp/corefcn/oct-procbuf.cc @ 30129:041dbcd1f93b

maint: use "m_" prefix for member variables in class procbuf. * oct-procbuf.cc, oct-procbuf.h: use "m_" prefix for member variables in class procbuf.
author Rik <rik@octave.org>
date Mon, 06 Sep 2021 11:30:45 -0700
parents 3988112c7116
children 8dd5da409418
comparison
equal deleted inserted replaced
30128:fa65184b7c76 30129:041dbcd1f93b
88 if (! f) 88 if (! f)
89 return 0; 89 return 0;
90 90
91 // Oops... popen doesn't return the associated pid, so fake it for now 91 // Oops... popen doesn't return the associated pid, so fake it for now
92 92
93 proc_pid = 1; 93 m_proc_pid = 1;
94 94
95 open_p = true; 95 m_open_p = true;
96 96
97 if (mode & std::ios::out) 97 if (mode & std::ios::out)
98 ::setvbuf (f, nullptr, _IOLBF, BUFSIZ); 98 ::setvbuf (f, nullptr, _IOLBF, BUFSIZ);
99 99
100 return this; 100 return this;
122 { 122 {
123 parent_end = pipe_fds[1]; 123 parent_end = pipe_fds[1];
124 child_end = pipe_fds[0]; 124 child_end = pipe_fds[0];
125 } 125 }
126 126
127 proc_pid = ::fork (); 127 m_proc_pid = ::fork ();
128 128
129 if (proc_pid == 0) 129 if (m_proc_pid == 0)
130 { 130 {
131 octave_close_wrapper (parent_end); 131 octave_close_wrapper (parent_end);
132 132
133 if (child_end != child_std_end) 133 if (child_end != child_std_end)
134 { 134 {
144 { 144 {
145 std::fclose (fp); 145 std::fclose (fp);
146 fp = nullptr; 146 fp = nullptr;
147 } 147 }
148 148
149 procbuf_list = procbuf_list->next; 149 procbuf_list = procbuf_list->m_next;
150 } 150 }
151 151
152 execl (SHELL_PATH, "sh", "-c", command, static_cast<void *> (nullptr)); 152 execl (SHELL_PATH, "sh", "-c", command, static_cast<void *> (nullptr));
153 153
154 exit (127); 154 exit (127);
155 } 155 }
156 156
157 octave_close_wrapper (child_end); 157 octave_close_wrapper (child_end);
158 158
159 if (proc_pid < 0) 159 if (m_proc_pid < 0)
160 { 160 {
161 octave_close_wrapper (parent_end); 161 octave_close_wrapper (parent_end);
162 return nullptr; 162 return nullptr;
163 } 163 }
164 164
165 f = (::fdopen (parent_end, (mode & std::ios::in) ? "r" : "w")); 165 f = (::fdopen (parent_end, (mode & std::ios::in) ? "r" : "w"));
166 166
167 if (mode & std::ios::out) 167 if (mode & std::ios::out)
168 ::setvbuf (f, nullptr, _IOLBF, BUFSIZ); 168 ::setvbuf (f, nullptr, _IOLBF, BUFSIZ);
169 169
170 open_p = true; 170 m_open_p = true;
171 171
172 next = procbuf_list; 172 m_next = procbuf_list;
173 procbuf_list = this; 173 procbuf_list = this;
174 174
175 return this; 175 return this;
176 176
177 #else 177 #else
186 { 186 {
187 #if defined (__CYGWIN__) || defined (__MINGW32__) || defined (_MSC_VER) 187 #if defined (__CYGWIN__) || defined (__MINGW32__) || defined (_MSC_VER)
188 188
189 if (f) 189 if (f)
190 { 190 {
191 wstatus = octave::pclose (f); 191 m_wstatus = octave::pclose (f);
192 f = 0; 192 f = 0;
193 } 193 }
194 194
195 open_p = false; 195 m_open_p = false;
196 196
197 return this; 197 return this;
198 198
199 #elif defined (HAVE_UNISTD_H) 199 #elif defined (HAVE_UNISTD_H)
200 200
204 204
205 int status = -1; 205 int status = -1;
206 206
207 for (procbuf **ptr = &procbuf_list; 207 for (procbuf **ptr = &procbuf_list;
208 *ptr != nullptr; 208 *ptr != nullptr;
209 ptr = &(*ptr)->next) 209 ptr = &(*ptr)->m_next)
210 { 210 {
211 if (*ptr == this) 211 if (*ptr == this)
212 { 212 {
213 *ptr = (*ptr)->next; 213 *ptr = (*ptr)->m_next;
214 status = 0; 214 status = 0;
215 break; 215 break;
216 } 216 }
217 } 217 }
218 218
220 { 220 {
221 using namespace std; 221 using namespace std;
222 222
223 do 223 do
224 { 224 {
225 wait_pid = octave::sys::waitpid (proc_pid, &wstatus, 0); 225 wait_pid = octave::sys::waitpid (m_proc_pid, &m_wstatus, 0);
226 } 226 }
227 while (wait_pid == -1 && errno == EINTR); 227 while (wait_pid == -1 && errno == EINTR);
228 } 228 }
229 229
230 f = nullptr; 230 f = nullptr;
231 } 231 }
232 232
233 open_p = false; 233 m_open_p = false;
234 234
235 return this; 235 return this;
236 236
237 #else 237 #else
238 238