summaryrefslogtreecommitdiff
path: root/core/launcher/qprocess_unix.cpp
authormickeyl <mickeyl>2004-04-07 13:36:16 (UTC)
committer mickeyl <mickeyl>2004-04-07 13:36:16 (UTC)
commit4f1d28a25ce6180850c3d26bac9b638f0f25532b (patch) (side-by-side diff)
tree59b4879b1065086c9a2e28f16f7d48540c8a9456 /core/launcher/qprocess_unix.cpp
parent8af35b63a277ec14dcc4a0a6ca5bbe228e276b98 (diff)
downloadopie-4f1d28a25ce6180850c3d26bac9b638f0f25532b.zip
opie-4f1d28a25ce6180850c3d26bac9b638f0f25532b.tar.gz
opie-4f1d28a25ce6180850c3d26bac9b638f0f25532b.tar.bz2
use Opie debugging framework
Diffstat (limited to 'core/launcher/qprocess_unix.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/qprocess_unix.cpp93
1 files changed, 46 insertions, 47 deletions
diff --git a/core/launcher/qprocess_unix.cpp b/core/launcher/qprocess_unix.cpp
index 19a8c93..d62e4e6 100644
--- a/core/launcher/qprocess_unix.cpp
+++ b/core/launcher/qprocess_unix.cpp
@@ -19,6 +19,4 @@
**********************************************************************/
-//#include "qplatformdefs.h"
-
// Solaris redefines connect -> __xnet_connect with _XOPEN_SOURCE_EXTENDED.
#if defined(connect)
@@ -28,18 +26,21 @@
#include "qprocess.h"
-#ifndef QT_NO_PROCESS
+/* OPIE */
+#include <opie2/odebug.h>
+using namespace Opie::Core;
-#include "qapplication.h"
-#include "qqueue.h"
-#include "qlist.h"
-#include "qsocketnotifier.h"
-#include "qtimer.h"
-#include "qregexp.h"
+/* QT */
+#ifndef QT_NO_PROCESS
+#include <qapplication.h>
+#include <qqueue.h>
+#include <qlist.h>
+#include <qsocketnotifier.h>
+#include <qtimer.h>
+#include <qregexp.h>
#include "qcleanuphandler_p.h"
+/* STD */
#include <stdlib.h>
-
-// ### FOR Qt 2.3 compat
#include <unistd.h>
#include <signal.h>
@@ -48,11 +49,9 @@
#include <sys/wait.h>
#include <sys/fcntl.h>
-
+#include <sys/resource.h>
#include <errno.h>
-
#ifdef Q_OS_MACX
#include <sys/time.h>
#endif
-#include <sys/resource.h>
#ifdef __MIPSEL__
@@ -133,5 +132,5 @@ public:
{
#if defined(QT_QPROCESS_DEBUG)
- qDebug( "QProc: Constructor for pid %d and QProcess %p", pid, process );
+ odebug << "QProc: Constructor for pid " << pid << " and QProcess " << process << "" << oendl;
#endif
socketStdin = 0;
@@ -142,5 +141,5 @@ public:
{
#if defined(QT_QPROCESS_DEBUG)
- qDebug( "QProc: Destructor for pid %d and QProcess %p", pid, process );
+ odebug << "QProc: Destructor for pid " << pid << " and QProcess " << process << "" << oendl;
#endif
if ( process != 0 ) {
@@ -214,5 +213,5 @@ QProcessManager::QProcessManager()
} else {
#if defined(QT_QPROCESS_DEBUG)
- qDebug( "QProcessManager: install socket notifier (%d)", sigchldFd[1] );
+ odebug << "QProcessManager: install socket notifier (" << sigchldFd[1] << ")" << oendl;
#endif
QSocketNotifier *sn = new QSocketNotifier( sigchldFd[1],
@@ -227,5 +226,5 @@ QProcessManager::QProcessManager()
#if defined(QT_QPROCESS_DEBUG)
- qDebug( "QProcessManager: install a SIGCHLD handler" );
+ odebug << "QProcessManager: install a SIGCHLD handler" << oendl;
#endif
act.sa_handler = qt_C_sigchldHnd;
@@ -237,8 +236,8 @@ QProcessManager::QProcessManager()
#endif
if ( sigaction( SIGCHLD, &act, &oldactChld ) != 0 )
- qWarning( "Error installing SIGCHLD handler" );
+ owarn << "Error installing SIGCHLD handler" << oendl;
#if defined(QT_QPROCESS_DEBUG)
- qDebug( "QProcessManager: install a SIGPIPE handler (SIG_IGN)" );
+ odebug << "QProcessManager: install a SIGPIPE handler (SIG_IGN)" << oendl;
#endif
/*
@@ -253,5 +252,5 @@ QProcessManager::QProcessManager()
act.sa_flags = 0;
if ( sigaction( SIGPIPE, &act, &oldactPipe ) != 0 )
- qWarning( "Error installing SIGPIPE handler" );
+ owarn << "Error installing SIGPIPE handler" << oendl;
}
@@ -267,14 +266,14 @@ QProcessManager::~QProcessManager()
// restore SIGCHLD handler
#if defined(QT_QPROCESS_DEBUG)
- qDebug( "QProcessManager: restore old sigchild handler" );
+ odebug << "QProcessManager: restore old sigchild handler" << oendl;
#endif
if ( sigaction( SIGCHLD, &oldactChld, 0 ) != 0 )
- qWarning( "Error restoring SIGCHLD handler" );
+ owarn << "Error restoring SIGCHLD handler" << oendl;
#if defined(QT_QPROCESS_DEBUG)
- qDebug( "QProcessManager: restore old sigpipe handler" );
+ odebug << "QProcessManager: restore old sigpipe handler" << oendl;
#endif
if ( sigaction( SIGPIPE, &oldactPipe, 0 ) != 0 )
- qWarning( "Error restoring SIGPIPE handler" );
+ owarn << "Error restoring SIGPIPE handler" << oendl;
}
@@ -283,5 +282,5 @@ void QProcessManager::append( QProc *p )
procList->append( p );
#if defined(QT_QPROCESS_DEBUG)
- qDebug( "QProcessManager: append process (procList.count(): %d)", procList->count() );
+ odebug << "QProcessManager: append process (procList.count(): " << procList->count() << ")" << oendl;
#endif
}
@@ -291,5 +290,5 @@ void QProcessManager::remove( QProc *p )
procList->remove( p );
#if defined(QT_QPROCESS_DEBUG)
- qDebug( "QProcessManager: remove process (procList.count(): %d)", procList->count() );
+ odebug << "QProcessManager: remove process (procList.count(): " << procList->count() << ")" << oendl;
#endif
cleanup();
@@ -317,5 +316,5 @@ void QProcessManager::sigchldHnd( int fd )
::read( fd, &tmp, sizeof(tmp) );
#if defined(QT_QPROCESS_DEBUG)
- qDebug( "QProcessManager::sigchldHnd()" );
+ odebug << "QProcessManager::sigchldHnd()" << oendl;
#endif
QProc *proc;
@@ -330,5 +329,5 @@ void QProcessManager::sigchldHnd( int fd )
if ( !process->isRunning() ) {
#if defined(QT_QPROCESS_DEBUG)
- qDebug( "QProcessManager::sigchldHnd() (PID: %d): process exited (QProcess available)", proc->pid );
+ odebug << "QProcessManager::sigchldHnd() (PID: " << proc->pid << "): process exited (QProcess available)" << oendl;
#endif
// read pending data
@@ -336,5 +335,5 @@ void QProcessManager::sigchldHnd( int fd )
if ( ::ioctl(proc->socketStdout, FIONREAD, (char*)&nbytes)==0 && nbytes>0 ) {
#if defined(QT_QPROCESS_DEBUG)
- qDebug( "QProcessManager::sigchldHnd() (PID: %d): reading %d bytes of pending data on stdout", proc->pid, nbytes );
+ odebug << "QProcessManager::sigchldHnd() (PID: " << proc->pid << "): reading " << nbytes << " bytes of pending data on stdout" << oendl;
#endif
process->socketRead( proc->socketStdout );
@@ -343,5 +342,5 @@ void QProcessManager::sigchldHnd( int fd )
if ( ::ioctl(proc->socketStderr, FIONREAD, (char*)&nbytes)==0 && nbytes>0 ) {
#if defined(QT_QPROCESS_DEBUG)
- qDebug( "QProcessManager::sigchldHnd() (PID: %d): reading %d bytes of pending data on stderr", proc->pid, nbytes );
+ odebug << "QProcessManager::sigchldHnd() (PID: " << proc->pid << "): reading " << nbytes << " bytes of pending data on stderr" << oendl;
#endif
process->socketRead( proc->socketStderr );
@@ -357,5 +356,5 @@ void QProcessManager::sigchldHnd( int fd )
if ( ::waitpid( proc->pid, &status, WNOHANG ) == proc->pid ) {
#if defined(QT_QPROCESS_DEBUG)
- qDebug( "QProcessManager::sigchldHnd() (PID: %d): process exited (QProcess not available)", proc->pid );
+ odebug << "QProcessManager::sigchldHnd() (PID: " << proc->pid << "): process exited (QProcess not available)" << oendl;
#endif
removeProc = TRUE;
@@ -387,5 +386,5 @@ QProcessPrivate::QProcessPrivate()
{
#if defined(QT_QPROCESS_DEBUG)
- qDebug( "QProcessPrivate: Constructor" );
+ odebug << "QProcessPrivate: Constructor" << oendl;
#endif
stdinBufRead = 0;
@@ -404,5 +403,5 @@ QProcessPrivate::~QProcessPrivate()
{
#if defined(QT_QPROCESS_DEBUG)
- qDebug( "QProcessPrivate: Destructor" );
+ odebug << "QProcessPrivate: Destructor" << oendl;
#endif
@@ -600,5 +599,5 @@ bool QProcess::start( QStringList *env )
{
#if defined(QT_QPROCESS_DEBUG)
- qDebug( "QProcess::start()" );
+ odebug << "QProcess::start()" << oendl;
#endif
reset();
@@ -636,5 +635,5 @@ bool QProcess::start( QStringList *env )
arglist[i] = arglistQ[i];
#if defined(QT_QPROCESS_DEBUG)
- qDebug( "QProcess::start(): arg %d = %s", i, arglist[i] );
+ odebug << "QProcess::start(): arg " << i << " = " << arglist[i] << "" << oendl;
#endif
i++;
@@ -800,5 +799,5 @@ bool QProcess::start( QStringList *env )
error:
#if defined(QT_QPROCESS_DEBUG)
- qDebug( "QProcess::start(): error starting process" );
+ odebug << "QProcess::start(): error starting process" << oendl;
#endif
if ( d->procManager )
@@ -879,5 +878,5 @@ bool QProcess::isRunning() const
if ( d->exitValuesCalculated ) {
#if defined(QT_QPROCESS_DEBUG)
- qDebug( "QProcess::isRunning(): FALSE (already computed)" );
+ odebug << "QProcess::isRunning(): FALSE (already computed)" << oendl;
#endif
return FALSE;
@@ -896,10 +895,10 @@ bool QProcess::isRunning() const
d->exitValuesCalculated = TRUE;
#if defined(QT_QPROCESS_DEBUG)
- qDebug( "QProcess::isRunning() (PID: %d): FALSE", d->proc->pid );
+ odebug << "QProcess::isRunning() (PID: " << d->proc->pid << "): FALSE" << oendl;
#endif
return FALSE;
}
#if defined(QT_QPROCESS_DEBUG)
- qDebug( "QProcess::isRunning() (PID: %d): TRUE", d->proc->pid );
+ odebug << "QProcess::isRunning() (PID: " << d->proc->pid << "): TRUE" << oendl;
#endif
return TRUE;
@@ -921,5 +920,5 @@ void QProcess::writeToStdin( const QByteArray& buf )
{
#if defined(QT_QPROCESS_DEBUG)
-// qDebug( "QProcess::writeToStdin(): write to stdin (%d)", d->socketStdin );
+// odebug << "QProcess::writeToStdin(): write to stdin (" << d->socketStdin << ")" << oendl;
#endif
d->stdinBuf.enqueue( new QByteArray(buf) );
@@ -948,8 +947,8 @@ void QProcess::closeStdin()
d->notifierStdin = 0;
if ( ::close( d->proc->socketStdin ) != 0 ) {
- qWarning( "Could not close stdin of child process" );
+ owarn << "Could not close stdin of child process" << oendl;
}
#if defined(QT_QPROCESS_DEBUG)
- qDebug( "QProcess::closeStdin(): stdin (%d) closed", d->proc->socketStdin );
+ odebug << "QProcess::closeStdin(): stdin (" << d->proc->socketStdin << ") closed" << oendl;
#endif
d->proc->socketStdin = 0;
@@ -971,5 +970,5 @@ void QProcess::socketRead( int fd )
}
#if defined(QT_QPROCESS_DEBUG)
- qDebug( "QProcess::socketRead(): %d", fd );
+ odebug << "QProcess::socketRead(): " << fd << "" << oendl;
#endif
if ( fd == 0 )
@@ -1000,5 +999,5 @@ void QProcess::socketRead( int fd )
if ( fd == d->proc->socketStdout ) {
#if defined(QT_QPROCESS_DEBUG)
- qDebug( "QProcess::socketRead(): stdout (%d) closed", fd );
+ odebug << "QProcess::socketRead(): stdout (" << fd << ") closed" << oendl;
#endif
d->notifierStdout->setEnabled( FALSE );
@@ -1010,5 +1009,5 @@ void QProcess::socketRead( int fd )
} else if ( fd == d->proc->socketStderr ) {
#if defined(QT_QPROCESS_DEBUG)
- qDebug( "QProcess::socketRead(): stderr (%d) closed", fd );
+ odebug << "QProcess::socketRead(): stderr (" << fd << ") closed" << oendl;
#endif
d->notifierStderr->setEnabled( FALSE );
@@ -1062,5 +1061,5 @@ void QProcess::socketWrite( int fd )
}
#if defined(QT_QPROCESS_DEBUG)
- qDebug( "QProcess::socketWrite(): write to stdin (%d)", fd );
+ odebug << "QProcess::socketWrite(): write to stdin (" << fd << ")" << oendl;
#endif
ssize_t ret = ::write( fd,