KProcess overhaul [PATCH]

Ralf Habacker ralf.habacker at freenet.de
Tue May 16 11:24:40 BST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thiago Macieira schrieb:
> Ralf Habacker wrote:
>> While trying to port some of the above mentioned locations to QProcess I
>> encountered a Qt issue using the QProcess pid() method, which is
>> implemented different on win32 systems
>>
>> #if defined(Q_OS_WIN32)
>> typedef struct _PROCESS_INFORMATION* Q_PID;
>> #else
>> typedef qint64 Q_PID;
>> #endif
>> ...
>> Q_PID pid() const;
>>
>>
>> This requires to wrap every reference to pid() depending on the platform
>> which is very annoying.
>>
>> #ifdef Q_WS_WIN
>> if (process->pid())
>>     pid = process->pid()->dwProcessId;
>> #else
>>     pid = process->pid();
>> #endif
> 
> Why do you need access to the process ID anyways?
> 
There are several places in kdelibs, where the process id of the started
application is used.

rhabacker at lxserver17:~/kde4/kdelibs> find -name '*.cpp' -exec grep -H
"[\.>]pid()" {} \;
./kio/kio/kdedesktopmimetype.cpp:  return p.pid();
./kio/kio/krun.cpp:  return (new KProcessRunner(p, binName))->pid();
./kio/kio/krun.cpp:  return (new KProcessRunner(p, binName, id))->pid();
./kio/kio/krun.cpp:  if ( !process_->pid() )
./kio/kio/krun.cpp:  if ( !process_->pid() )
./kio/kio/krun.cpp:  return process_->pid();
./kio/kio/krun.cpp:  if ( !binName.isEmpty() && ( showErr ||
process_->pid() == 0 ) )
./kio/kio/slave.cpp:       slave->setPID(proc.pid());
./kdecore/kstartupinfo.cpp:    pid_t pid = info.pid();
./khtml/test_regression_gui_window.cpp:
kill(m_activeProcess->pid(), SIGSTOP);
./khtml/test_regression_gui_window.cpp:
kill(m_activeProcess->pid(), SIGCONT);
./kinit/klauncher.cpp:       return slave->pid();
./kinit/klauncher.cpp:       return slave->pid();
./kinit/klauncher.cpp:        if (slave->pid() == pid)
./kinit/klauncher.cpp:       if (waitRequest->pid == slave->pid())
./kdeprint/kdeprintd.cpp:                       return ( int )proc->pid();
./kdeprint/kdeprintd.cpp:               m_windows.remove(w->pid());


Ralf
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEaahooHh+5t8EXncRAgKAAJ4+KliwoI2EW2vtCGXWozq2qQK9AwCfZ/Gb
WGi/3ZRQyYnCq4vQuwOOlAQ=
=3RHF
-----END PGP SIGNATURE-----




More information about the kde-core-devel mailing list