author | chicken <chicken> | 2004-03-01 15:44:36 (UTC) |
---|---|---|
committer | chicken <chicken> | 2004-03-01 15:44:36 (UTC) |
commit | c50e4c32d34a0550f167480b6306aac632fb201c (patch) (unidiff) | |
tree | a0795fa171d7410624717f120d1bd17f6c8f3224 /libopie/oprocctrl.cpp | |
parent | 01abceaeb00bc35fa9bf5792eb51aa70b68f110d (diff) | |
download | opie-c50e4c32d34a0550f167480b6306aac632fb201c.zip opie-c50e4c32d34a0550f167480b6306aac632fb201c.tar.gz opie-c50e4c32d34a0550f167480b6306aac632fb201c.tar.bz2 |
fix includes
-rw-r--r-- | libopie/oprocctrl.cpp | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/libopie/oprocctrl.cpp b/libopie/oprocctrl.cpp index e7db622..df8da1e 100644 --- a/libopie/oprocctrl.cpp +++ b/libopie/oprocctrl.cpp | |||
@@ -1,90 +1,89 @@ | |||
1 | /* This file is part of the KDE libraries | 1 | /* This file is part of the KDE libraries |
2 | Copyright (C) 1997 Christian Czezakte (e9025461@student.tuwien.ac.at) | 2 | Copyright (C) 1997 Christian Czezakte (e9025461@student.tuwien.ac.at) |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public | 5 | modify it under the terms of the GNU Library General Public |
6 | License as published by the Free Software Foundation; either | 6 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. | 7 | version 2 of the License, or (at your option) any later version. |
8 | 8 | ||
9 | This library is distributed in the hope that it will be useful, | 9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. | 12 | Library General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 17 | Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | // | 19 | // |
20 | // KPROCESSCONTROLLER -- A helper class for KProcess | 20 | // KPROCESSCONTROLLER -- A helper class for KProcess |
21 | // | 21 | // |
22 | // version 0.3.1, Jan, 8th 1997 | 22 | // version 0.3.1, Jan, 8th 1997 |
23 | // | 23 | // |
24 | // (C) Christian Czezatke | 24 | // (C) Christian Czezatke |
25 | // e9025461@student.tuwien.ac.at | 25 | // e9025461@student.tuwien.ac.at |
26 | // Ported by Holger Freyther | 26 | // Ported by Holger Freyther |
27 | // | 27 | // |
28 | 28 | ||
29 | //#include <config.h> | 29 | //#include <config.h> |
30 | 30 | ||
31 | #include <sys/types.h> | 31 | #include <sys/types.h> |
32 | #include <sys/socket.h> | 32 | #include <sys/socket.h> |
33 | 33 | ||
34 | #include <errno.h> | 34 | #include <errno.h> |
35 | #include <fcntl.h> | 35 | #include <fcntl.h> |
36 | #include <stdio.h> | 36 | #include <stdio.h> |
37 | #include <string.h> | 37 | #include <string.h> |
38 | #include <unistd.h> | 38 | #include <unistd.h> |
39 | #include <assert.h> | 39 | #include <assert.h> |
40 | 40 | ||
41 | #include <qsocketnotifier.h> | 41 | #include <qsocketnotifier.h> |
42 | #include "oprocess.h" | ||
43 | #include "oprocctrl.h" | 42 | #include "oprocctrl.h" |
44 | 43 | ||
45 | OProcessController *OProcessController::theOProcessController = 0; | 44 | OProcessController *OProcessController::theOProcessController = 0; |
46 | 45 | ||
47 | struct sigaction OProcessController::oldChildHandlerData; | 46 | struct sigaction OProcessController::oldChildHandlerData; |
48 | bool OProcessController::handlerSet = false; | 47 | bool OProcessController::handlerSet = false; |
49 | 48 | ||
50 | OProcessController::OProcessController() | 49 | OProcessController::OProcessController() |
51 | { | 50 | { |
52 | assert( theOProcessController == 0 ); | 51 | assert( theOProcessController == 0 ); |
53 | 52 | ||
54 | if (0 > pipe(fd)) | 53 | if (0 > pipe(fd)) |
55 | printf(strerror(errno)); | 54 | printf(strerror(errno)); |
56 | 55 | ||
57 | notifier = new QSocketNotifier(fd[0], QSocketNotifier::Read); | 56 | notifier = new QSocketNotifier(fd[0], QSocketNotifier::Read); |
58 | notifier->setEnabled(true); | 57 | notifier->setEnabled(true); |
59 | QObject::connect(notifier, SIGNAL(activated(int)), | 58 | QObject::connect(notifier, SIGNAL(activated(int)), |
60 | this, SLOT(slotDoHousekeeping(int))); | 59 | this, SLOT(slotDoHousekeeping(int))); |
61 | connect( &delayedChildrenCleanupTimer, SIGNAL( timeout()), | 60 | connect( &delayedChildrenCleanupTimer, SIGNAL( timeout()), |
62 | SLOT( delayedChildrenCleanup())); | 61 | SLOT( delayedChildrenCleanup())); |
63 | 62 | ||
64 | theOProcessController = this; | 63 | theOProcessController = this; |
65 | 64 | ||
66 | setupHandlers(); | 65 | setupHandlers(); |
67 | } | 66 | } |
68 | 67 | ||
69 | 68 | ||
70 | void OProcessController::setupHandlers() | 69 | void OProcessController::setupHandlers() |
71 | { | 70 | { |
72 | if( handlerSet ) | 71 | if( handlerSet ) |
73 | return; | 72 | return; |
74 | struct sigaction act; | 73 | struct sigaction act; |
75 | act.sa_handler=theSigCHLDHandler; | 74 | act.sa_handler=theSigCHLDHandler; |
76 | sigemptyset(&(act.sa_mask)); | 75 | sigemptyset(&(act.sa_mask)); |
77 | sigaddset(&(act.sa_mask), SIGCHLD); | 76 | sigaddset(&(act.sa_mask), SIGCHLD); |
78 | // Make sure we don't block this signal. gdb tends to do that :-( | 77 | // Make sure we don't block this signal. gdb tends to do that :-( |
79 | sigprocmask(SIG_UNBLOCK, &(act.sa_mask), 0); | 78 | sigprocmask(SIG_UNBLOCK, &(act.sa_mask), 0); |
80 | 79 | ||
81 | act.sa_flags = SA_NOCLDSTOP; | 80 | act.sa_flags = SA_NOCLDSTOP; |
82 | 81 | ||
83 | // CC: take care of SunOS which automatically restarts interrupted system | 82 | // CC: take care of SunOS which automatically restarts interrupted system |
84 | // calls (and thus does not have SA_RESTART) | 83 | // calls (and thus does not have SA_RESTART) |
85 | 84 | ||
86 | #ifdef SA_RESTART | 85 | #ifdef SA_RESTART |
87 | act.sa_flags |= SA_RESTART; | 86 | act.sa_flags |= SA_RESTART; |
88 | #endif | 87 | #endif |
89 | 88 | ||
90 | sigaction( SIGCHLD, &act, &oldChildHandlerData ); | 89 | sigaction( SIGCHLD, &act, &oldChildHandlerData ); |