Diffstat (limited to 'libopie2/opiecore/oprocess.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/oprocess.h | 152 |
1 files changed, 76 insertions, 76 deletions
diff --git a/libopie2/opiecore/oprocess.h b/libopie2/opiecore/oprocess.h index 8dd19b5..352485b 100644 --- a/libopie2/opiecore/oprocess.h +++ b/libopie2/opiecore/oprocess.h | |||
@@ -1,45 +1,49 @@ | |||
1 | /* This file is part of the KDE libraries | 1 | /* |
2 | Copyright (C) 1997 Christian Czezakte (e9025461@student.tuwien.ac.at) | 2 | This file is part of the Opie Project |
3 | 3 | Copyright (C) 2003-2004 Holger Freyther <zecke@handhelds.org> | |
4 | This library is free software; you can redistribute it and/or | 4 | Copyright (C) The Opie Team <opie-devel@handhelds.org> |
5 | modify it under the terms of the GNU Library General Public | 5 | =. Based on KProcess (C) 1997 Christian Czezatke (e9025461@student.tuwien.ac.at) |
6 | License as published by the Free Software Foundation; either | 6 | .=l. |
7 | version 2 of the License, or (at your option) any later version. | 7 | .>+-= |
8 | 8 | _;:, .> :=|. This program is free software; you can | |
9 | This library is distributed in the hope that it will be useful, | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | Library General Public License for more details. | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | 13 | ._= =} : or (at your option) any later version. | |
14 | You should have received a copy of the GNU Library General Public License | 14 | .%`+i> _;_. |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | Boston, MA 02111-1307, USA. | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
18 | */ | 29 | */ |
19 | // | ||
20 | // KPROCESS -- A class for handling child processes in KDE without | ||
21 | // having to take care of Un*x specific implementation details | ||
22 | // | ||
23 | // version 0.3.1, Jan 8th 1998 | ||
24 | // | ||
25 | // (C) Christian Czezatke | ||
26 | // e9025461@student.tuwien.ac.at | ||
27 | // Ported by Holger Freyther to the Open Palmtop Integrated Environment | ||
28 | // | ||
29 | |||
30 | #ifndef __kprocess_h__ | ||
31 | #define __kprocess_h__ | ||
32 | 30 | ||
31 | #ifndef OPROCESS_H | ||
32 | #define OPROCESS_H | ||
33 | |||
34 | /* QT */ | ||
35 | #include <qcstring.h> | ||
36 | #include <qobject.h> | ||
37 | #include <qvaluelist.h> | ||
38 | |||
39 | /* STD */ | ||
33 | #include <sys/types.h> // for pid_t | 40 | #include <sys/types.h> // for pid_t |
34 | #include <sys/wait.h> | 41 | #include <sys/wait.h> |
35 | #include <signal.h> | 42 | #include <signal.h> |
36 | #include <unistd.h> | 43 | #include <unistd.h> |
37 | #include <qvaluelist.h> | ||
38 | #include <qcstring.h> | ||
39 | #include <qobject.h> | ||
40 | 44 | ||
41 | class QSocketNotifier; | 45 | class QSocketNotifier; |
42 | class OProcessPrivate; | 46 | class OProcessPrivate; |
43 | 47 | ||
44 | /** | 48 | /** |
45 | * Child process invocation, monitoring and control. | 49 | * Child process invocation, monitoring and control. |
@@ -138,13 +142,13 @@ class OProcessPrivate; | |||
138 | *@li void @ref wroteStdin(OProcess *proc); | 142 | *@li void @ref wroteStdin(OProcess *proc); |
139 | *@li -- Indicates that all data that has been sent to the child process | 143 | *@li -- Indicates that all data that has been sent to the child process |
140 | *by a prior call to @ref writeStdin() has actually been transmitted to the | 144 | *by a prior call to @ref writeStdin() has actually been transmitted to the |
141 | *client . | 145 | *client . |
142 | * | 146 | * |
143 | *@author Christian Czezakte e9025461@student.tuwien.ac.at | 147 | *@author Christian Czezakte e9025461@student.tuwien.ac.at |
144 | * | 148 | *@author Holger Freyther (Opie Port) |
145 | * | 149 | * |
146 | **/ | 150 | **/ |
147 | class OProcess : public QObject | 151 | class OProcess : public QObject |
148 | { | 152 | { |
149 | Q_OBJECT | 153 | Q_OBJECT |
150 | 154 | ||
@@ -184,21 +188,21 @@ public: | |||
184 | */ | 188 | */ |
185 | Block }; | 189 | Block }; |
186 | 190 | ||
187 | /** | 191 | /** |
188 | * Constructor | 192 | * Constructor |
189 | */ | 193 | */ |
190 | OProcess(QObject *parent = 0, const char *name = 0); | 194 | OProcess( QObject *parent = 0, const char *name = 0 ); |
191 | /** | 195 | /** |
192 | * Constructor | 196 | * Constructor |
193 | */ | 197 | */ |
194 | OProcess(const QString &arg0, QObject *parent = 0, const char *name = 0); | 198 | OProcess( const QString &arg0, QObject *parent = 0, const char *name = 0 ); |
195 | /** | 199 | /** |
196 | * Constructor | 200 | * Constructor |
197 | */ | 201 | */ |
198 | OProcess(const QStringList &args, QObject *parent = 0, const char *name = 0); | 202 | OProcess( const QStringList &args, QObject *parent = 0, const char *name = 0 ); |
199 | 203 | ||
200 | /** | 204 | /** |
201 | *Destructor: | 205 | *Destructor: |
202 | * | 206 | * |
203 | * If the process is running when the destructor for this class | 207 | * If the process is running when the destructor for this class |
204 | * is called, the child process is killed with a SIGKILL, but | 208 | * is called, the child process is killed with a SIGKILL, but |
@@ -217,13 +221,13 @@ public: | |||
217 | Returns false if the process is currently running (in that | 221 | Returns false if the process is currently running (in that |
218 | case the executable remains unchanged.) | 222 | case the executable remains unchanged.) |
219 | 223 | ||
220 | @see operator<< | 224 | @see operator<< |
221 | 225 | ||
222 | */ | 226 | */ |
223 | bool setExecutable(const QString& proc); | 227 | bool setExecutable( const QString& proc ); |
224 | 228 | ||
225 | 229 | ||
226 | /** | 230 | /** |
227 | * Sets the executable and the command line argument list for this process. | 231 | * Sets the executable and the command line argument list for this process. |
228 | * | 232 | * |
229 | * For example, doing an "ls -l /usr/local/bin" can be achieved by: | 233 | * For example, doing an "ls -l /usr/local/bin" can be achieved by: |
@@ -231,27 +235,27 @@ public: | |||
231 | * OProcess p; | 235 | * OProcess p; |
232 | * ... | 236 | * ... |
233 | * p << "ls" << "-l" << "/usr/local/bin" | 237 | * p << "ls" << "-l" << "/usr/local/bin" |
234 | * </pre> | 238 | * </pre> |
235 | * | 239 | * |
236 | **/ | 240 | **/ |
237 | OProcess &operator<<(const QString& arg); | 241 | OProcess &operator<<( const QString& arg ); |
238 | /** | 242 | /** |
239 | * Similar to previous method, takes a char *, supposed to be in locale 8 bit already. | 243 | * Similar to previous method, takes a char *, supposed to be in locale 8 bit already. |
240 | */ | 244 | */ |
241 | OProcess &operator<<(const char * arg); | 245 | OProcess &operator<<( const char * arg ); |
242 | /** | 246 | /** |
243 | * Similar to previous method, takes a QCString, supposed to be in locale 8 bit already. | 247 | * Similar to previous method, takes a QCString, supposed to be in locale 8 bit already. |
244 | */ | 248 | */ |
245 | OProcess &operator<<(const QCString & arg); | 249 | OProcess &operator<<( const QCString & arg ); |
246 | 250 | ||
247 | /** | 251 | /** |
248 | * Sets the executable and the command line argument list for this process, | 252 | * Sets the executable and the command line argument list for this process, |
249 | * in a single method call, or add a list of arguments. | 253 | * in a single method call, or add a list of arguments. |
250 | **/ | 254 | **/ |
251 | OProcess &operator<<(const QStringList& args); | 255 | OProcess &operator<<( const QStringList& args ); |
252 | 256 | ||
253 | /** | 257 | /** |
254 | * Clear a command line argument list that has been set by using | 258 | * Clear a command line argument list that has been set by using |
255 | * the "operator<<". | 259 | * the "operator<<". |
256 | */ | 260 | */ |
257 | void clearArguments(); | 261 | void clearArguments(); |
@@ -275,22 +279,22 @@ public: | |||
275 | * no communication takes place and the respective communication | 279 | * no communication takes place and the respective communication |
276 | * signals will never get emitted. | 280 | * signals will never get emitted. |
277 | * | 281 | * |
278 | * @return true on success, false on error | 282 | * @return true on success, false on error |
279 | * (see above for error conditions) | 283 | * (see above for error conditions) |
280 | **/ | 284 | **/ |
281 | virtual bool start(RunMode runmode = NotifyOnExit, | 285 | virtual bool start( RunMode runmode = NotifyOnExit, |
282 | Communication comm = NoCommunication); | 286 | Communication comm = NoCommunication ); |
283 | 287 | ||
284 | /** | 288 | /** |
285 | * Stop the process (by sending it a signal). | 289 | * Stop the process (by sending it a signal). |
286 | * | 290 | * |
287 | * @param signoThe signal to send. The default is SIGTERM. | 291 | * @param signoThe signal to send. The default is SIGTERM. |
288 | * @return @p true if the signal was delivered successfully. | 292 | * @return @p true if the signal was delivered successfully. |
289 | */ | 293 | */ |
290 | virtual bool kill(int signo = SIGTERM); | 294 | virtual bool kill( int signo = SIGTERM ); |
291 | 295 | ||
292 | /** | 296 | /** |
293 | @return @p true if the process is (still) considered to be running | 297 | @return @p true if the process is (still) considered to be running |
294 | */ | 298 | */ |
295 | bool isRunning() const; | 299 | bool isRunning() const; |
296 | 300 | ||
@@ -330,13 +334,13 @@ public: | |||
330 | * Please use | 334 | * Please use |
331 | * @ref OProcess::normalExit() to check whether the process has exited | 335 | * @ref OProcess::normalExit() to check whether the process has exited |
332 | * cleanly (i.e., @ref OProcess::normalExit() returns @p true) before calling | 336 | * cleanly (i.e., @ref OProcess::normalExit() returns @p true) before calling |
333 | * this function because if the process did not exit normally, | 337 | * this function because if the process did not exit normally, |
334 | * it does not have a valid exit status. | 338 | * it does not have a valid exit status. |
335 | */ | 339 | */ |
336 | int exitStatus() const; | 340 | int exitStatus() const; |
337 | 341 | ||
338 | 342 | ||
339 | /** | 343 | /** |
340 | * Transmit data to the child process's stdin. | 344 | * Transmit data to the child process's stdin. |
341 | * | 345 | * |
342 | * OProcess::writeStdin may return false in the following cases: | 346 | * OProcess::writeStdin may return false in the following cases: |
@@ -357,13 +361,13 @@ public: | |||
357 | * | 361 | * |
358 | * Please note that you must not free "buffer" or call @ref writeStdin() | 362 | * Please note that you must not free "buffer" or call @ref writeStdin() |
359 | * again until either a @ref wroteStdin() signal indicates that the | 363 | * again until either a @ref wroteStdin() signal indicates that the |
360 | * data has been sent or a @ref processHasExited() signal shows that | 364 | * data has been sent or a @ref processHasExited() signal shows that |
361 | * the child process is no longer alive... | 365 | * the child process is no longer alive... |
362 | **/ | 366 | **/ |
363 | bool writeStdin(const char *buffer, int buflen); | 367 | bool writeStdin( const char *buffer, int buflen ); |
364 | 368 | ||
365 | void flushStdin(); | 369 | void flushStdin(); |
366 | 370 | ||
367 | /** | 371 | /** |
368 | * This causes the stdin file descriptor of the child process to be | 372 | * This causes the stdin file descriptor of the child process to be |
369 | * closed indicating an "EOF" to the child. | 373 | * closed indicating an "EOF" to the child. |
@@ -392,81 +396,82 @@ public: | |||
392 | bool closeStderr(); | 396 | bool closeStderr(); |
393 | 397 | ||
394 | /** | 398 | /** |
395 | * Lets you see what your arguments are for debugging. | 399 | * Lets you see what your arguments are for debugging. |
396 | */ | 400 | */ |
397 | 401 | ||
398 | const QValueList<QCString> &args() { return arguments; } | 402 | const QValueList<QCString> &args() |
403 | { | ||
404 | return arguments; | ||
405 | } | ||
399 | 406 | ||
400 | /** | 407 | /** |
401 | * Controls whether the started process should drop any | 408 | * Controls whether the started process should drop any |
402 | * setuid/segid privileges or whether it should keep them | 409 | * setuid/segid privileges or whether it should keep them |
403 | * | 410 | * |
404 | * The default is @p false : drop privileges | 411 | * The default is @p false : drop privileges |
405 | */ | 412 | */ |
406 | void setRunPrivileged(bool keepPrivileges); | 413 | void setRunPrivileged( bool keepPrivileges ); |
407 | 414 | ||
408 | /** | 415 | /** |
409 | * Returns whether the started process will drop any | 416 | * Returns whether the started process will drop any |
410 | * setuid/segid privileges or whether it will keep them | 417 | * setuid/segid privileges or whether it will keep them |
411 | */ | 418 | */ |
412 | bool runPrivileged() const; | 419 | bool runPrivileged() const; |
413 | 420 | ||
414 | /** | 421 | /** |
415 | * Modifies the environment of the process to be started. | 422 | * Modifies the environment of the process to be started. |
416 | * This function must be called before starting the process. | 423 | * This function must be called before starting the process. |
417 | */ | 424 | */ |
418 | void setEnvironment(const QString &name, const QString &value); | 425 | void setEnvironment( const QString &name, const QString &value ); |
419 | 426 | ||
420 | /** | 427 | /** |
421 | * Changes the current working directory (CWD) of the process | 428 | * Changes the current working directory (CWD) of the process |
422 | * to be started. | 429 | * to be started. |
423 | * This function must be called before starting the process. | 430 | * This function must be called before starting the process. |
424 | */ | 431 | */ |
425 | void setWorkingDirectory(const QString &dir); | 432 | void setWorkingDirectory( const QString &dir ); |
426 | 433 | ||
427 | /** | 434 | /** |
428 | * Specify whether to start the command via a shell or directly. | 435 | * Specify whether to start the command via a shell or directly. |
429 | * The default is to start the command directly. | 436 | * The default is to start the command directly. |
430 | * If @p useShell is true @p shell will be used as shell, or | 437 | * If @p useShell is true @p shell will be used as shell, or |
431 | * if shell is empty, the standard shell is used. | 438 | * if shell is empty, the standard shell is used. |
432 | * @p quote A flag indicating whether to quote the arguments. | 439 | * @p quote A flag indicating whether to quote the arguments. |
433 | * | 440 | * |
434 | * When using a shell, the caller should make sure that all filenames etc. | 441 | * When using a shell, the caller should make sure that all filenames etc. |
435 | * are properly quoted when passed as argument. | 442 | * are properly quoted when passed as argument. |
436 | * @see quote() | 443 | * @see quote() |
437 | */ | 444 | */ |
438 | void setUseShell(bool useShell, const char *shell = 0); | 445 | void setUseShell( bool useShell, const char *shell = 0 ); |
439 | 446 | ||
440 | /** | 447 | /** |
441 | * This function can be used to quote an argument string such that | 448 | * This function can be used to quote an argument string such that |
442 | * the shell processes it properly. This is e. g. necessary for | 449 | * the shell processes it properly. This is e. g. necessary for |
443 | * user-provided file names which may contain spaces or quotes. | 450 | * user-provided file names which may contain spaces or quotes. |
444 | * It also prevents expansion of wild cards and environment variables. | 451 | * It also prevents expansion of wild cards and environment variables. |
445 | */ | 452 | */ |
446 | static QString quote(const QString &arg); | 453 | static QString quote( const QString &arg ); |
447 | 454 | ||
448 | /** | 455 | /** |
449 | * Detaches OProcess from child process. All communication is closed. | 456 | * Detaches OProcess from child process. All communication is closed. |
450 | * No exit notification is emitted any more for the child process. | 457 | * No exit notification is emitted any more for the child process. |
451 | * Deleting the OProcess will no longer kill the child process. | 458 | * Deleting the OProcess will no longer kill the child process. |
452 | * Note that the current process remains the parent process of the | 459 | * Note that the current process remains the parent process of the |
453 | * child process. | 460 | * child process. |
454 | */ | 461 | */ |
455 | void detach(); | 462 | void detach(); |
456 | 463 | ||
457 | |||
458 | |||
459 | signals: | 464 | signals: |
460 | 465 | ||
461 | /** | 466 | /** |
462 | * Emitted after the process has terminated when | 467 | * Emitted after the process has terminated when |
463 | * the process was run in the @p NotifyOnExit (==default option to | 468 | * the process was run in the @p NotifyOnExit (==default option to |
464 | * @ref start()) or the @ref Block mode. | 469 | * @ref start()) or the @ref Block mode. |
465 | **/ | 470 | **/ |
466 | void processExited(OProcess *proc); | 471 | void processExited( OProcess *proc ); |
467 | 472 | ||
468 | 473 | ||
469 | /** | 474 | /** |
470 | * Emitted, when output from the child process has | 475 | * Emitted, when output from the child process has |
471 | * been received on stdout. | 476 | * been received on stdout. |
472 | * | 477 | * |
@@ -477,13 +482,13 @@ signals: | |||
477 | * @param buffer The data received. | 482 | * @param buffer The data received. |
478 | * @param buflen The number of bytes that are available. | 483 | * @param buflen The number of bytes that are available. |
479 | * | 484 | * |
480 | * You should copy the information contained in @p buffer to your private | 485 | * You should copy the information contained in @p buffer to your private |
481 | * data structures before returning from this slot. | 486 | * data structures before returning from this slot. |
482 | **/ | 487 | **/ |
483 | void receivedStdout(OProcess *proc, char *buffer, int buflen); | 488 | void receivedStdout( OProcess *proc, char *buffer, int buflen ); |
484 | 489 | ||
485 | /** | 490 | /** |
486 | * Emitted when output from the child process has | 491 | * Emitted when output from the child process has |
487 | * been received on stdout. | 492 | * been received on stdout. |
488 | * | 493 | * |
489 | * To actually get these signals, the respective communications link | 494 | * To actually get these signals, the respective communications link |
@@ -494,13 +499,13 @@ signals: | |||
494 | * to begin processing data from the child process's stdout. This is | 499 | * to begin processing data from the child process's stdout. This is |
495 | * to ensure that this signal is not emitted when no one is connected | 500 | * to ensure that this signal is not emitted when no one is connected |
496 | * to it, otherwise this signal will not be emitted. | 501 | * to it, otherwise this signal will not be emitted. |
497 | * | 502 | * |
498 | * The data still has to be read from file descriptor @p fd. | 503 | * The data still has to be read from file descriptor @p fd. |
499 | **/ | 504 | **/ |
500 | void receivedStdout(int fd, int &len); | 505 | void receivedStdout( int fd, int &len ); |
501 | 506 | ||
502 | 507 | ||
503 | /** | 508 | /** |
504 | * Emitted, when output from the child process has | 509 | * Emitted, when output from the child process has |
505 | * been received on stderr. | 510 | * been received on stderr. |
506 | * To actually get | 511 | * To actually get |
@@ -510,45 +515,44 @@ signals: | |||
510 | * @param buffer The data received. | 515 | * @param buffer The data received. |
511 | * @param buflen The number of bytes that are available. | 516 | * @param buflen The number of bytes that are available. |
512 | * | 517 | * |
513 | * You should copy the information contained in @p buffer to your private | 518 | * You should copy the information contained in @p buffer to your private |
514 | * data structures before returning from this slot. | 519 | * data structures before returning from this slot. |
515 | */ | 520 | */ |
516 | void receivedStderr(OProcess *proc, char *buffer, int buflen); | 521 | void receivedStderr( OProcess *proc, char *buffer, int buflen ); |
517 | 522 | ||
518 | /** | 523 | /** |
519 | * Emitted after all the data that has been | 524 | * Emitted after all the data that has been |
520 | * specified by a prior call to @ref writeStdin() has actually been | 525 | * specified by a prior call to @ref writeStdin() has actually been |
521 | * written to the child process. | 526 | * written to the child process. |
522 | **/ | 527 | **/ |
523 | void wroteStdin(OProcess *proc); | 528 | void wroteStdin( OProcess *proc ); |
524 | |||
525 | 529 | ||
526 | protected slots: | 530 | protected slots: |
527 | 531 | ||
528 | /** | 532 | /** |
529 | * This slot gets activated when data from the child's stdout arrives. | 533 | * This slot gets activated when data from the child's stdout arrives. |
530 | * It usually calls "childOutput" | 534 | * It usually calls "childOutput" |
531 | */ | 535 | */ |
532 | void slotChildOutput(int fdno); | 536 | void slotChildOutput( int fdno ); |
533 | 537 | ||
534 | /** | 538 | /** |
535 | * This slot gets activated when data from the child's stderr arrives. | 539 | * This slot gets activated when data from the child's stderr arrives. |
536 | * It usually calls "childError" | 540 | * It usually calls "childError" |
537 | */ | 541 | */ |
538 | void slotChildError(int fdno); | 542 | void slotChildError( int fdno ); |
539 | /* | 543 | /* |
540 | Slot functions for capturing stdout and stderr of the child | 544 | Slot functions for capturing stdout and stderr of the child |
541 | */ | 545 | */ |
542 | 546 | ||
543 | /** | 547 | /** |
544 | * Called when another bulk of data can be sent to the child's | 548 | * Called when another bulk of data can be sent to the child's |
545 | * stdin. If there is no more data to be sent to stdin currently | 549 | * stdin. If there is no more data to be sent to stdin currently |
546 | * available, this function must disable the QSocketNotifier "innot". | 550 | * available, this function must disable the QSocketNotifier "innot". |
547 | */ | 551 | */ |
548 | void slotSendData(int dummy); | 552 | void slotSendData( int dummy ); |
549 | 553 | ||
550 | protected: | 554 | protected: |
551 | 555 | ||
552 | /** | 556 | /** |
553 | * Sets up the environment according to the data passed via | 557 | * Sets up the environment according to the data passed via |
554 | * setEnvironment(...) | 558 | * setEnvironment(...) |
@@ -621,13 +625,13 @@ protected: | |||
621 | * was successful. | 625 | * was successful. |
622 | * | 626 | * |
623 | * The default implementation is to create UNIX STREAM sockets for the communication, | 627 | * The default implementation is to create UNIX STREAM sockets for the communication, |
624 | * but you could overload this function and establish a TCP/IP communication for | 628 | * but you could overload this function and establish a TCP/IP communication for |
625 | * network communication, for example. | 629 | * network communication, for example. |
626 | */ | 630 | */ |
627 | virtual int setupCommunication(Communication comm); | 631 | virtual int setupCommunication( Communication comm ); |
628 | 632 | ||
629 | /** | 633 | /** |
630 | * Called right after a (successful) fork on the parent side. This function | 634 | * Called right after a (successful) fork on the parent side. This function |
631 | * will usually do some communications cleanup, like closing the reading end | 635 | * will usually do some communications cleanup, like closing the reading end |
632 | * of the "stdin" communication channel. | 636 | * of the "stdin" communication channel. |
633 | * | 637 | * |
@@ -651,27 +655,27 @@ protected: | |||
651 | /** | 655 | /** |
652 | * Immediately called after a process has exited. This function normally | 656 | * Immediately called after a process has exited. This function normally |
653 | * calls commClose to close all open communication channels to this | 657 | * calls commClose to close all open communication channels to this |
654 | * process and emits the "processExited" signal (if the process was | 658 | * process and emits the "processExited" signal (if the process was |
655 | * not running in the "DontCare" mode). | 659 | * not running in the "DontCare" mode). |
656 | */ | 660 | */ |
657 | virtual void processHasExited(int state); | 661 | virtual void processHasExited( int state ); |
658 | 662 | ||
659 | /** | 663 | /** |
660 | * Should clean up the communication links to the child after it has | 664 | * Should clean up the communication links to the child after it has |
661 | * exited. Should be called from "processHasExited". | 665 | * exited. Should be called from "processHasExited". |
662 | */ | 666 | */ |
663 | virtual void commClose(); | 667 | virtual void commClose(); |
664 | 668 | ||
665 | 669 | ||
666 | /** | 670 | /** |
667 | * the socket descriptors for stdin/stdout/stderr. | 671 | * the socket descriptors for stdin/stdout/stderr. |
668 | */ | 672 | */ |
669 | int out[2]; | 673 | int out[ 2 ]; |
670 | int in[2]; | 674 | int in[ 2 ]; |
671 | int err[2]; | 675 | int err[ 2 ]; |
672 | 676 | ||
673 | /** | 677 | /** |
674 | * The socket notifiers for the above socket descriptors. | 678 | * The socket notifiers for the above socket descriptors. |
675 | */ | 679 | */ |
676 | QSocketNotifier *innot; | 680 | QSocketNotifier *innot; |
677 | QSocketNotifier *outnot; | 681 | QSocketNotifier *outnot; |
@@ -685,20 +689,20 @@ protected: | |||
685 | 689 | ||
686 | /** | 690 | /** |
687 | * Called by "slotChildOutput" this function copies data arriving from the | 691 | * Called by "slotChildOutput" this function copies data arriving from the |
688 | * child process's stdout to the respective buffer and emits the signal | 692 | * child process's stdout to the respective buffer and emits the signal |
689 | * "@ref receivedStderr". | 693 | * "@ref receivedStderr". |
690 | */ | 694 | */ |
691 | int childOutput(int fdno); | 695 | int childOutput( int fdno ); |
692 | 696 | ||
693 | /** | 697 | /** |
694 | * Called by "slotChildOutput" this function copies data arriving from the | 698 | * Called by "slotChildOutput" this function copies data arriving from the |
695 | * child process's stdout to the respective buffer and emits the signal | 699 | * child process's stdout to the respective buffer and emits the signal |
696 | * "@ref receivedStderr" | 700 | * "@ref receivedStderr" |
697 | */ | 701 | */ |
698 | int childError(int fdno); | 702 | int childError( int fdno ); |
699 | 703 | ||
700 | // information about the data that has to be sent to the child: | 704 | // information about the data that has to be sent to the child: |
701 | 705 | ||
702 | const char *input_data; // the buffer holding the data | 706 | const char *input_data; // the buffer holding the data |
703 | int input_sent; // # of bytes already transmitted | 707 | int input_sent; // # of bytes already transmitted |
704 | int input_total; // total length of input_data | 708 | int input_total; // total length of input_data |
@@ -706,13 +710,12 @@ protected: | |||
706 | /** | 710 | /** |
707 | * @ref OProcessController is a friend of OProcess because it has to have | 711 | * @ref OProcessController is a friend of OProcess because it has to have |
708 | * access to various data members. | 712 | * access to various data members. |
709 | */ | 713 | */ |
710 | friend class OProcessController; | 714 | friend class OProcessController; |
711 | 715 | ||
712 | |||
713 | private: | 716 | private: |
714 | /** | 717 | /** |
715 | * Searches for a valid shell. | 718 | * Searches for a valid shell. |
716 | * Here is the algorithm used for finding an executable shell: | 719 | * Here is the algorithm used for finding an executable shell: |
717 | * | 720 | * |
718 | * @li Try the executable pointed to by the "SHELL" environment | 721 | * @li Try the executable pointed to by the "SHELL" environment |
@@ -726,22 +729,19 @@ private: | |||
726 | QCString searchShell(); | 729 | QCString searchShell(); |
727 | 730 | ||
728 | /** | 731 | /** |
729 | * Used by @ref searchShell in order to find out whether the shell found | 732 | * Used by @ref searchShell in order to find out whether the shell found |
730 | * is actually executable at all. | 733 | * is actually executable at all. |
731 | */ | 734 | */ |
732 | bool isExecutable(const QCString &filename); | 735 | bool isExecutable( const QCString &filename ); |
733 | 736 | ||
734 | // Disallow assignment and copy-construction | 737 | // Disallow assignment and copy-construction |
735 | OProcess( const OProcess& ); | 738 | OProcess( const OProcess& ); |
736 | OProcess& operator= ( const OProcess& ); | 739 | OProcess& operator= ( const OProcess& ); |
737 | 740 | ||
738 | private: | 741 | private: |
739 | void init ( ); | 742 | void init ( ); |
740 | |||
741 | OProcessPrivate *d; | 743 | OProcessPrivate *d; |
742 | }; | 744 | }; |
743 | 745 | ||
744 | |||
745 | |||
746 | #endif | 746 | #endif |
747 | 747 | ||