[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: kdeinit questions
From:       Waldo Bastian <bastian () kde ! org>
Date:       2002-01-02 4:45:25
[Download RAW message or body]

On Tuesday 01 January 2002 05:02 pm, Chris January wrote:
> I'm trying to debug KDE 2.2.1 when running with Cygwin on Windows 2000 and
> I was wondering if someone could answer me a few questions:
> In kdeinit.cpp there is a handle_requests(pid) line after launching kded
> and the extra programs specified on the command line with +programname. Is
> this function supposed to return? If not, how do the other programs on the
> command-line get launched? If so, what does the function have to do before
> it returns? What are the likely reasons it might not return?

It will listen for incoming launch requests till "pid" exits. So after 
starting kded it will wait for the kded process to exit, in the meantime it 
will listen for incoming launch requests, for example when kded asks kdeinit 
to run kbuildsycoca.

kded forks into two processes and the original process exits when kbuildsycoca 
has finished. This should be detected by kdeinit as it means that it can 
start the next process. The forked off kded process remains running for the 
duration of the KDE session.

If handle_requests doesn't return then either the kded process that gets 
started doesn't exit or the exit of the process doesn't get properly passed 
on to kdeinit. There are a few things that can go wrong inside kdeinit 
itself, it should normally be waiting in:
	result = select(max_sock, &rd_set, &wr_set, &e_set, 0);

Then when the kded exits kdeinit should get a SIGCHLD which should be caught 
by:
	static void sig_child_handler(int) { ... }
This one writes in "The pipe of Death (tm)":
	write(d.deadpipe[1], &c, 1);

The select call mentioned before should watch for any data on d.deadpipe[0] 
and when that arrives the select call returns, the loop gets taken and 
d.deadpipe[1] gets read. Then a call is made to waitpid to see which 
child-process caused the SIGCHLD:
	exit_pid = waitpid(-1, 0, WNOHANG);

The exit_pid is compared to waitForPid and if they are equal the function 
returns.

I hope that helps.

Cheers,
Waldo







>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic