On 08/14/2012 12:15 PM, Yury wrote:
> Hi all.
>
> I try to understand now how vold works and I've found that if some
> volume cannot be unmounted Android detects which process holds the
> resources and sends to it SIGTERM Linux signal. So, maybe someone can
> answer and explain the following questions:
> 1. How do Android processes process this signal? What happens with an
> Android process when it receives this signal? Where can I find code that
> process this signal?
AFAIK, Signals are handled the same as they would be on any Linux. See
http://unixhelp.ed.ac.uk/CGI/man-cgi?signal+7 which explains the default
actions and such.
Processes are allowed to install their own signal handlers. If they
don't then the default actions in the link above are taken. I'm not
sure if these actions are taken by the kernel or by libc (bionic).
> 2. Is it possible to send this signal to system process like
> system_server, acore or launcher? How do they process them and how they
> are recovered from the incorrect state?
Yes, and developers regularly do this using the 'kill' command.
http://linux.die.net/man/1/kill
Many of the core services (like system_server) will get automatically
re-started by the init process. Init reads the stuff in the files
/init.*.rc and starts up things like this. If they die, init respawns
them. Init is the very first program that the kernel executes after
booting.
-gabriel