how to stop dbus-daemon after posix_spawn fork?
The posix_spawn arguments are a mystery to me, I use these, and could use advice, however, my real problem is this little server I have set up to spawn programs has worked flawlessly for years, but with fedora 22, it now spawns a dbus-daemon on every launch, which I then must clean up manually using the system-monitor.
How do I shut down the dbus-daemon when the the forked process closes, or, alternatively, how do I use a single dbus-daemon for the forked processes? dbus-daemon is also a mystery to me, fyi.
Note: the code sample provided was edited to remove my macros, & I hope it's translation to recognizable "C" is correct, but, its a standard fork.
Thanks Very much for all suggestions.
ons
pid_t pid;
/* signal( SIGCHLD, SIG_IGN );*/
struct sigaction arg={ SIG_IGN, SA_NOCLDWAIT // never wait for a child. //( for direct termination of children )
};
sigaction( SIGCHLD, &arg, NULL );
if( ( pid= fork() ) < 0 ) {
yas( "fork failed\n" );
exit( 1 );
else if ( pid== 0 ) {
char buf[ 4096 ];
getcwd( buf, 4096 );
chdir( runDir );
CHP spaArgs[] = { runCmd, runArgs, NULL };
CHP spaEnv[] = { "USERNAME="
, "USER="
, "PATH="
, "LD_LIBRARY_PATH="
, "DISPLAY=:0"
, "DESKTOP_SESSION=gnome"
, "HOME="
, "XAUTHORITY=/run/user/1000/gdm/Xauthority"
, NULL };
YAS( "The Parent process id is" +IST( getpid() ) );
INT err=posix_spawn( &pid, spaArgs[ 0 ], NULL, NULL, spaArgs, spaEnv );
if( err ) YAZ( SIM( err ) ) ;
exit( 0 );
}
int waitPIDerr= waitpid( pid, NULL, 0 /* WNOHANG */ );
if( waitPIDerr ) YAZ( SIM( waitPIDerr ) );
I also have a lot of sockets I open & close between applications. Might it be possible the dbus-daemon doesn't close because of pending sockets?