author | zecke <zecke> | 2002-10-15 00:33:13 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-15 00:33:13 (UTC) |
commit | b12b38a00c66ddc100f3fff75478539b8b797928 (patch) (unidiff) | |
tree | a28bafdaf00c2d89e1ef9680e6a31ff66bcc8bde /noncore | |
parent | 06330eede01fa5082ec382045b63454b2262bba6 (diff) | |
download | opie-b12b38a00c66ddc100f3fff75478539b8b797928.zip opie-b12b38a00c66ddc100f3fff75478539b8b797928.tar.gz opie-b12b38a00c66ddc100f3fff75478539b8b797928.tar.bz2 |
Temp disable the Error notifier this fixes the probs with exiting taking 90%+ of CPU time
-rw-r--r-- | noncore/apps/opie-console/MyPty.cpp | 22 | ||||
-rw-r--r-- | noncore/apps/opie-console/procctl.cpp | 2 |
2 files changed, 18 insertions, 6 deletions
diff --git a/noncore/apps/opie-console/MyPty.cpp b/noncore/apps/opie-console/MyPty.cpp index 10828b0..cacb4ce 100644 --- a/noncore/apps/opie-console/MyPty.cpp +++ b/noncore/apps/opie-console/MyPty.cpp | |||
@@ -82,6 +82,7 @@ | |||
82 | #include <pty.h> | 82 | #include <pty.h> |
83 | #endif | 83 | #endif |
84 | 84 | ||
85 | #include "procctl.h" | ||
85 | #include "MyPty.h" | 86 | #include "MyPty.h" |
86 | 87 | ||
87 | 88 | ||
@@ -113,11 +114,13 @@ void MyPty::donePty() | |||
113 | ::close(m_fd); | 114 | ::close(m_fd); |
114 | 115 | ||
115 | if (m_cpid) { | 116 | if (m_cpid) { |
117 | qWarning("killing!!!"); | ||
116 | kill(m_cpid, SIGHUP); | 118 | kill(m_cpid, SIGHUP); |
117 | waitpid(m_cpid, &status, 0); | 119 | waitpid(m_cpid, &status, 0); |
118 | } | 120 | } |
119 | 121 | ||
120 | emit done(status); | 122 | m_cpid = 0; |
123 | // emit done(status); | ||
121 | } | 124 | } |
122 | 125 | ||
123 | 126 | ||
@@ -129,6 +132,7 @@ const char* MyPty::deviceName() | |||
129 | 132 | ||
130 | void MyPty::error() | 133 | void MyPty::error() |
131 | { | 134 | { |
135 | qWarning("error"); | ||
132 | // This is code from the Qt DumbTerminal example | 136 | // This is code from the Qt DumbTerminal example |
133 | donePty(); | 137 | donePty(); |
134 | } | 138 | } |
@@ -182,9 +186,9 @@ int MyPty::run(const char* cmd, QStrList &, const char*, int) | |||
182 | 186 | ||
183 | // parent - continue as a widget | 187 | // parent - continue as a widget |
184 | QSocketNotifier* sn_r = new QSocketNotifier(m_fd,QSocketNotifier::Read,this); | 188 | QSocketNotifier* sn_r = new QSocketNotifier(m_fd,QSocketNotifier::Read,this); |
185 | QSocketNotifier* sn_e = new QSocketNotifier(m_fd,QSocketNotifier::Exception,this); | 189 | // QSocketNotifier* sn_e = new QSocketNotifier(m_fd,QSocketNotifier::Exception,this); |
186 | connect(sn_r,SIGNAL(activated(int)),this,SLOT(readPty())); | 190 | connect(sn_r,SIGNAL(activated(int)),this,SLOT(readPty())); |
187 | connect(sn_e,SIGNAL(activated(int)),this,SLOT(error())); | 191 | // connect(sn_e,SIGNAL(activated(int)),this,SLOT(error())); |
188 | 192 | ||
189 | return 0; | 193 | return 0; |
190 | } | 194 | } |
@@ -229,6 +233,7 @@ int MyPty::openPty() | |||
229 | MyPty::MyPty(const Profile&) : m_cpid(0) | 233 | MyPty::MyPty(const Profile&) : m_cpid(0) |
230 | { | 234 | { |
231 | m_fd = openPty(); | 235 | m_fd = openPty(); |
236 | ProcCtl* ctl = ProcCtl::self(); | ||
232 | } | 237 | } |
233 | 238 | ||
234 | /*! | 239 | /*! |
@@ -259,7 +264,7 @@ void MyPty::reload( const Profile& ) { | |||
259 | /*! sends len bytes through the line */ | 264 | /*! sends len bytes through the line */ |
260 | void MyPty::send(const QByteArray& ar) | 265 | void MyPty::send(const QByteArray& ar) |
261 | { | 266 | { |
262 | 267 | qWarning("sending!"); | |
263 | #ifdef VERBOSE_DEBUG | 268 | #ifdef VERBOSE_DEBUG |
264 | // verbose debug | 269 | // verbose debug |
265 | printf("sending bytes:\n"); | 270 | printf("sending bytes:\n"); |
@@ -274,16 +279,23 @@ void MyPty::send(const QByteArray& ar) | |||
274 | /*! indicates that a block of data is received */ | 279 | /*! indicates that a block of data is received */ |
275 | void MyPty::readPty() | 280 | void MyPty::readPty() |
276 | { | 281 | { |
282 | qWarning("read"); | ||
277 | QByteArray buf(4096); | 283 | QByteArray buf(4096); |
278 | 284 | ||
279 | int len = ::read( m_fd, buf.data(), 4096 ); | 285 | int len = ::read( m_fd, buf.data(), 4096 ); |
280 | 286 | ||
281 | if (len == -1) | 287 | if (len == -1 || len == 0) { |
288 | qWarning("donePty!!! now!"); | ||
282 | donePty(); | 289 | donePty(); |
290 | qWarning("return %s", sender()->className() ); | ||
291 | delete sender(); | ||
292 | return; | ||
293 | } | ||
283 | 294 | ||
284 | if (len < 0) | 295 | if (len < 0) |
285 | return; | 296 | return; |
286 | 297 | ||
298 | |||
287 | buf.resize(len); | 299 | buf.resize(len); |
288 | emit received(buf); | 300 | emit received(buf); |
289 | 301 | ||
diff --git a/noncore/apps/opie-console/procctl.cpp b/noncore/apps/opie-console/procctl.cpp index b0b6846..d1cfaf6 100644 --- a/noncore/apps/opie-console/procctl.cpp +++ b/noncore/apps/opie-console/procctl.cpp | |||
@@ -71,7 +71,7 @@ int ProcCtl::status(pid_t pid )const{ | |||
71 | return -1; | 71 | return -1; |
72 | } | 72 | } |
73 | void ProcCtl::signal_handler(int) { | 73 | void ProcCtl::signal_handler(int) { |
74 | qWarning("signal handler"); | 74 | qWarning("signal handler in ProcCtl"); |
75 | int status; | 75 | int status; |
76 | signal( SIGCHLD, signal_handler ); | 76 | signal( SIGCHLD, signal_handler ); |
77 | pid_t pi = waitpid( -1, &status, WNOHANG ); | 77 | pid_t pi = waitpid( -1, &status, WNOHANG ); |