Safely restart services to avoid race conditions.

At present, service restarts exhibit a race condition whereby the new
(restarting) service process is often spawned before the old (stopping)
process has terminated.  This may result in the new service process failing
to acquire a limited resource (file lock, socket bind, etc.) that the old
process has not yet released.

The new method preforms a safe service restart by stopping the service,
waiting for the old service process to terminate, and (only then) start the
new service process.  In the event of "restarting" an already stopped
service, the previous behavior is maintained whereby the service is simply
started.

Conflicts:
	init/init.c
Create /cache/dalvik-cache

manually imported commit ba422208f99552f12f34e6f28cc44445f0e6d9e0 by ctso

Change-Id: I617573a14a8cf08d353804016b3351186720d199

Conflicts:
	rootdir/init.rc
init: Never allow two same-service processes to exist simultaneously.

A stopping service now remains in SVC_RUNNING state until its exiting
process has been reaped by waitpid.  This prevents a "stop, start" sequence
from spawning a second service process before resources held by the first
are released.  However, a "stop, start" pair _will_ restart the service
after exit (unless critical or oneshot).

This scenario was originally special-cased by the SVC_RESTART state used by
the restart command.  However, we have observed instances where services
are, unintentionally, stopped and started "too quickly," and so
simultaneous processes for the same service should never be allowed.  Note
the SVC_RESTART state (and restart) command is still useful to explicitly
restart critical and oneshot services, for which the "stop, start"
procedure is not intended.

Conflicts:
	init/init.c
init: Don't confuse do_exec with other exiting processes.

The waitpid call in do_exec may return early with EINTR when init receives
a signal, e.g., a SIGCHLD from an exiting service process.  do_exec should
check waitpid for an EINTR "error", to ensure that it returns only after
waiting on its child process.
Add required permissions and files for data

 - Add /data/radio
 - Set gateway property after DNS
 - Allow radio users to set properties associated with
   all rmnet interfaces. Not just rmnet0

Change-Id: Ia60fcb8f90aa73ffd40e839b93356ee50a9e5072
init: Properly detect hardware revision

 * get_hardware_name was returning early if the hardware type was set on
   the command line, and not proceeding to parse it from /proc/cpuinfo
 * Fix it so that it always parses ro.revision :)

Change-Id: Ib5d31d536066fc6829db756cb6e5f003a05bf440
Update unpackbootimg to verify the Android boot image magic value. It will also search the first 512 bytes for padding.

Change-Id: I490cba05f2bb616a3f64e3271ecaa61eb9e64be8
unpackbootimg: Fix up the padding search in case the magic does not fall on a 8 byte boundary.

Change-Id: I57471f9c2117cd7965b6958ea0aa88e356436da6
unpackbootimg: Fix magic search.

Change-Id: I68470b637556a08e48ff72b7ef8811cba13b04ad
unpackbootimg: apparently mkbootimg no longer accepts hex values

Change-Id: I95a33f7b40470e4500d418d863a65a75e7aa8499
unpackbootimg: Need to also update the written file.

Change-Id: I45faddbae85273c79b2837f97933634b6e70546f
charger: suspend when not animating

Suspend will save power (i.e. charge faster) by disabling unneeded
devices such as the touch-sensitive keys on galaxysmtd.

Change-Id: I9b2eae1af2e9687546af9dcb10ce1fcb4c1e1ed6
init: Add "export_rc" command to export env from a specified file

New export_rc command to import environment variables from
a specified file at the time the command is executed.

Differences between "import" and "export_rc":
1) export_rc can only import environment vars
2) export_rc is performed when the command
   is executed rather than at the time the
   command is parsed (i.e. "import")

Example:
in /init.rc:
    on post-fs
        export_rc /system/etc/init.xyz.rc

in /system/etc/init.xyz.rc:
    export LD_PRELOAD /system/lib/libxyz.so

Change-Id: If616dea5b508c27e9f7a95b5e9db696ecea2fdee
core: Add API to retrieve mtu size

Adding an API to libnetutils to retrieve mtu size of an interface
Made few utility functions from ifc_utils public

Change-Id: Iddec2dcd9f241b146d7f362e2df0724cf740d1f2
(cherry picked from commit 108cded7d96cc347f36b5b78c404c5ebccce13d7)
Provide permission for graphics to set service.bootanim.exit prop

Change-Id: If23d14172022907fcefdcf7430904eb560d4d64c

Conflicts:
	init/property_service.c
Update tcp buffersize settings

Soem of these values are from CAF, some of these are
from various shipping devices, some are educated
guesses based on the properties of each connection.

In general, the higher the bandwidth-delay product
of a network, the larger the buffer needs to be.

Change-Id: Idd8cd27727b5e66bd3a46be5f9853380acbda8ba
ramdiskaddr is now ramdisk_offset

Change-Id: I3bf83af5f7001f581506dc7fd9b1eb653334ad35
toolbox: new applet restart

- stop + start
- for the lazy.

Change-Id: Ie0ef0e27f5b7819a5575ece6b82c5813f4e38420
unpackbootimg: remove host LOCAL_MODULE_TAG

Change-Id: I199d680dc5ab8bf50f5be65c29095bf3adade695