Diffstat (limited to 'libopie2/opiecore/oprocess.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/oprocess.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libopie2/opiecore/oprocess.h b/libopie2/opiecore/oprocess.h index 1a2472d..eb56b03 100644 --- a/libopie2/opiecore/oprocess.h +++ b/libopie2/opiecore/oprocess.h | |||
@@ -22,49 +22,55 @@ _;:, .> :=|. This program is free software; you can | |||
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef OPROCESS_H | 31 | #ifndef OPROCESS_H |
32 | #define OPROCESS_H | 32 | #define OPROCESS_H |
33 | 33 | ||
34 | /* QT */ | 34 | /* QT */ |
35 | #include <qcstring.h> | 35 | #include <qcstring.h> |
36 | #include <qobject.h> | 36 | #include <qobject.h> |
37 | #include <qvaluelist.h> | 37 | #include <qvaluelist.h> |
38 | 38 | ||
39 | /* STD */ | 39 | /* STD */ |
40 | #include <sys/types.h> // for pid_t | 40 | #include <sys/types.h> // for pid_t |
41 | #include <sys/wait.h> | 41 | #include <sys/wait.h> |
42 | #include <signal.h> | 42 | #include <signal.h> |
43 | #include <unistd.h> | 43 | #include <unistd.h> |
44 | 44 | ||
45 | class QSocketNotifier; | 45 | class QSocketNotifier; |
46 | |||
47 | namespace Opie { | ||
48 | namespace Core { | ||
49 | namespace Private { | ||
50 | class OProcessController; | ||
46 | class OProcessPrivate; | 51 | class OProcessPrivate; |
52 | } | ||
47 | 53 | ||
48 | /** | 54 | /** |
49 | * Child process invocation, monitoring and control. | 55 | * Child process invocation, monitoring and control. |
50 | * | 56 | * |
51 | * @sect General usage and features | 57 | * @sect General usage and features |
52 | * | 58 | * |
53 | *This class allows a KDE and OPIE application to start child processes without having | 59 | *This class allows a KDE and OPIE application to start child processes without having |
54 | *to worry about UN*X signal handling issues and zombie process reaping. | 60 | *to worry about UN*X signal handling issues and zombie process reaping. |
55 | * | 61 | * |
56 | *@see KProcIO | 62 | *@see KProcIO |
57 | * | 63 | * |
58 | *Basically, this class distinguishes three different ways of running | 64 | *Basically, this class distinguishes three different ways of running |
59 | *child processes: | 65 | *child processes: |
60 | * | 66 | * |
61 | *@li OProcess::DontCare -- The child process is invoked and both the child | 67 | *@li OProcess::DontCare -- The child process is invoked and both the child |
62 | *process and the parent process continue concurrently. | 68 | *process and the parent process continue concurrently. |
63 | * | 69 | * |
64 | *Starting a DontCare child process means that the application is | 70 | *Starting a DontCare child process means that the application is |
65 | *not interested in any notification to determine whether the | 71 | *not interested in any notification to determine whether the |
66 | *child process has already exited or not. | 72 | *child process has already exited or not. |
67 | * | 73 | * |
68 | *@li OProcess::NotifyOnExit -- The child process is invoked and both the | 74 | *@li OProcess::NotifyOnExit -- The child process is invoked and both the |
69 | *child and the parent process run concurrently. | 75 | *child and the parent process run concurrently. |
70 | * | 76 | * |
@@ -376,48 +382,49 @@ public: | |||
376 | * had been specified in the call to @ref start(). | 382 | * had been specified in the call to @ref start(). |
377 | */ | 383 | */ |
378 | bool closeStdin(); | 384 | bool closeStdin(); |
379 | 385 | ||
380 | /** | 386 | /** |
381 | * This causes the stdout file descriptor of the child process to be | 387 | * This causes the stdout file descriptor of the child process to be |
382 | * closed. | 388 | * closed. |
383 | * | 389 | * |
384 | * @return @p false if no communication to the process's stdout | 390 | * @return @p false if no communication to the process's stdout |
385 | * had been specified in the call to @ref start(). | 391 | * had been specified in the call to @ref start(). |
386 | */ | 392 | */ |
387 | bool closeStdout(); | 393 | bool closeStdout(); |
388 | 394 | ||
389 | /** | 395 | /** |
390 | * This causes the stderr file descriptor of the child process to be | 396 | * This causes the stderr file descriptor of the child process to be |
391 | * closed. | 397 | * closed. |
392 | * | 398 | * |
393 | * @return @p false if no communication to the process's stderr | 399 | * @return @p false if no communication to the process's stderr |
394 | * had been specified in the call to @ref start(). | 400 | * had been specified in the call to @ref start(). |
395 | */ | 401 | */ |
396 | bool closeStderr(); | 402 | bool closeStderr(); |
397 | 403 | ||
398 | /** | 404 | /** |
399 | * Lets you see what your arguments are for debugging. | 405 | * Lets you see what your arguments are for debugging. |
406 | * \todo make const | ||
400 | */ | 407 | */ |
401 | 408 | ||
402 | const QValueList<QCString> &args() | 409 | const QValueList<QCString> &args() |
403 | { | 410 | { |
404 | return arguments; | 411 | return arguments; |
405 | } | 412 | } |
406 | 413 | ||
407 | /** | 414 | /** |
408 | * Controls whether the started process should drop any | 415 | * Controls whether the started process should drop any |
409 | * setuid/segid privileges or whether it should keep them | 416 | * setuid/segid privileges or whether it should keep them |
410 | * | 417 | * |
411 | * The default is @p false : drop privileges | 418 | * The default is @p false : drop privileges |
412 | */ | 419 | */ |
413 | void setRunPrivileged( bool keepPrivileges ); | 420 | void setRunPrivileged( bool keepPrivileges ); |
414 | 421 | ||
415 | /** | 422 | /** |
416 | * Returns whether the started process will drop any | 423 | * Returns whether the started process will drop any |
417 | * setuid/segid privileges or whether it will keep them | 424 | * setuid/segid privileges or whether it will keep them |
418 | */ | 425 | */ |
419 | bool runPrivileged() const; | 426 | bool runPrivileged() const; |
420 | 427 | ||
421 | /** | 428 | /** |
422 | * Modifies the environment of the process to be started. | 429 | * Modifies the environment of the process to be started. |
423 | * This function must be called before starting the process. | 430 | * This function must be called before starting the process. |
@@ -695,58 +702,60 @@ protected: | |||
695 | /** | 702 | /** |
696 | * Called by "slotChildOutput" this function copies data arriving from the | 703 | * Called by "slotChildOutput" this function copies data arriving from the |
697 | * child process's stdout to the respective buffer and emits the signal | 704 | * child process's stdout to the respective buffer and emits the signal |
698 | * "@ref receivedStderr". | 705 | * "@ref receivedStderr". |
699 | */ | 706 | */ |
700 | int childOutput( int fdno ); | 707 | int childOutput( int fdno ); |
701 | 708 | ||
702 | /** | 709 | /** |
703 | * Called by "slotChildOutput" this function copies data arriving from the | 710 | * Called by "slotChildOutput" this function copies data arriving from the |
704 | * child process's stdout to the respective buffer and emits the signal | 711 | * child process's stdout to the respective buffer and emits the signal |
705 | * "@ref receivedStderr" | 712 | * "@ref receivedStderr" |
706 | */ | 713 | */ |
707 | int childError( int fdno ); | 714 | int childError( int fdno ); |
708 | 715 | ||
709 | // information about the data that has to be sent to the child: | 716 | // information about the data that has to be sent to the child: |
710 | 717 | ||
711 | const char *input_data; // the buffer holding the data | 718 | const char *input_data; // the buffer holding the data |
712 | int input_sent; // # of bytes already transmitted | 719 | int input_sent; // # of bytes already transmitted |
713 | int input_total; // total length of input_data | 720 | int input_total; // total length of input_data |
714 | 721 | ||
715 | /** | 722 | /** |
716 | * @ref OProcessController is a friend of OProcess because it has to have | 723 | * @ref OProcessController is a friend of OProcess because it has to have |
717 | * access to various data members. | 724 | * access to various data members. |
718 | */ | 725 | */ |
719 | friend class OProcessController; | 726 | friend class Private::OProcessController; |
720 | 727 | ||
721 | private: | 728 | private: |
722 | /** | 729 | /** |
723 | * Searches for a valid shell. | 730 | * Searches for a valid shell. |
724 | * Here is the algorithm used for finding an executable shell: | 731 | * Here is the algorithm used for finding an executable shell: |
725 | * | 732 | * |
726 | * @li Try the executable pointed to by the "SHELL" environment | 733 | * @li Try the executable pointed to by the "SHELL" environment |
727 | * variable with white spaces stripped off | 734 | * variable with white spaces stripped off |
728 | * | 735 | * |
729 | * @li If your process runs with uid != euid or gid != egid, a shell | 736 | * @li If your process runs with uid != euid or gid != egid, a shell |
730 | * not listed in /etc/shells will not used. | 737 | * not listed in /etc/shells will not used. |
731 | * | 738 | * |
732 | * @li If no valid shell could be found, "/bin/sh" is used as a last resort. | 739 | * @li If no valid shell could be found, "/bin/sh" is used as a last resort. |
733 | */ | 740 | */ |
734 | QCString searchShell(); | 741 | QCString searchShell(); |
735 | 742 | ||
736 | /** | 743 | /** |
737 | * Used by @ref searchShell in order to find out whether the shell found | 744 | * Used by @ref searchShell in order to find out whether the shell found |
738 | * is actually executable at all. | 745 | * is actually executable at all. |
739 | */ | 746 | */ |
740 | bool isExecutable( const QCString &filename ); | 747 | bool isExecutable( const QCString &filename ); |
741 | 748 | ||
742 | // Disallow assignment and copy-construction | 749 | // Disallow assignment and copy-construction |
743 | OProcess( const OProcess& ); | 750 | OProcess( const OProcess& ); |
744 | OProcess& operator= ( const OProcess& ); | 751 | OProcess& operator= ( const OProcess& ); |
745 | 752 | ||
746 | private: | 753 | private: |
747 | void init ( ); | 754 | void init ( ); |
748 | OProcessPrivate *d; | 755 | Private::OProcessPrivate *d; |
749 | }; | 756 | }; |
757 | } | ||
758 | } | ||
750 | 759 | ||
751 | #endif | 760 | #endif |
752 | 761 | ||