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

Bobby Powers bobbypowers at gmail.com
Sat Nov 7 10:55:13 EST 2009


On Fri, Nov 6, 2009 at 5:28 PM, Sascha Silbe
<sascha-ml-ui-sugar-devel at silbe.org> wrote:
>
> 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 on).
> 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)?

Hello,

There have been some people implementing a userspace kqueue library
for Linux (partly to get Grand Central Dispatch running), who have the
same problem.  I don't think they have an answer yet, but you might
bring it up on their mailing list
http://mark.heily.com/libkqueue/

yours,
Bobby

>
> CU Sascha
>
> --
> http://sascha.silbe.org/
> http://www.infra-silbe.de/
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iQEcBAEBAgAGBQJK9KMVAAoJELpz82VMF3Dae5kH/1Oow8ovGBNqbSquNyH0yiL2
> y6VCpEXVol4M4au9v1JGObQh4r4I1cJ+H6nz3tL8rFtgeFPOhfBddCQAqtZSk2kk
> gmA2u0AjnkbrklM+bEA7s1BrP23EUlaXXL0SpxDZNj6lQu44qvJPc3IFf1UjqWu3
> F/H2XXPd7c/UOlnrZvTzanGpciu7ze3Qrs1UkfmWauAwaaC9VkBYveNdxXAqb9P8
> K4j9SQ4Q4wyxb4XKYXbteM9ei3skpyBiWCS5VJkLPB0qDeDZrHYYXIe1J114KA4p
> vX2twEJ/ZO9FqA5Eih0P3qs5efRl4HdjKE1FrCl1yle/BVSzez6iACK/mtFEuLc=
> =A8Jr
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
>


More information about the Sugar-devel mailing list