Process launch (semi)problem in POCO

Please post support and help requests here.
Posts: 4
Joined: 03 Jul 2012, 08:07

Process launch (semi)problem in POCO

Postby DmitryBogdanov » 14 Jul 2012, 20:36

Second problem we came across when working with POCO is process launch (Foundation/src/Process_Unix.cpp, method ProcessImpl::launchImpl). It does not allow the library consumer to make an intrusion between fork and execvp. This caused us problems when we tried to start a script which starts Linux service from /etc/init.d, and had some signals blocked in our process. Pseudo-code:

sigset_t sset;
pthread_sigmask(SIG_BLOCK, &sset, 0);

Poco::Process::Args args;
Process::launch("/etc/init.d/cups", args, ...);

The service has no chance to start since it is (probably) using some signals which are blocked in our application by pthread_sigmask call. Problem is reproducible on CentOS and Debian.

We just added the following after fork and before execvp to ProcessImpl::launchImpl for Unix:

sigset_t sset;
pthread_sigmask(SIG_UNBLOCK, &sset, 0);

This unblocked signals in child program and let us proceed. However theoretically consumer may want to execute whatever code after fork and before execvp, so I would add an ability to register custom method(s) to be executed before execvp. fork'ed process inherits many properties of parent process, and without control on those properties in child process usage of Process::launch facility is quite limited.

Posts: 1375
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Process launch (semi)problem in POCO

Postby alex » 16 Jul 2012, 03:22

Return to “Support”

Who is online

Users browsing this forum: No registered users and 6 guests