[Sugar-devel] OT: waiting for non-child processes on Linux

Sascha Silbe sascha-ml-ui-sugar-devel at silbe.org
Fri Nov 6 17:28:40 EST 2009

For the sugar-datastore test suite, I'd like to run each test at a clean 
state, i.e. from an empty directory and using a new data store service 
process (esp. important for migration tests which I'm currently working 
To ensure that, I need to
a) find out the process id of the current data store service process 
(moderately easy, already implemented)
b) kill it and
c) wait for it to die.

The last part is suprisingly hard as it's a distant cousin (started by 
dbus-daemon, so even different session and group id) and wait*() only 
work for immediate child processes. POSIX allows implementations to 
provide extensions that support waiting for arbitrary processes, I 
couldn't find any system call on Linux that does so (but might have 
overlooked one).
Even starting a new process hierarchy (including dbus-daemon) from the 
top-level process for each single test case wouldn't help since 
dbus-daemon and its children (esp. the data store service process) 
cannot be waited for. :-/

Any idea on how to accomplish the given goal (without resorting to hacks 
like periodically starting pgrep)?

CU Sascha

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: Digital signature
Url : http://lists.sugarlabs.org/archive/sugar-devel/attachments/20091106/04475e64/attachment.pgp 

More information about the Sugar-devel mailing list