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.
Create /cache/dalvik-cache

manually imported commit ba422208f99552f12f34e6f28cc44445f0e6d9e0 by ctso

Change-Id: I617573a14a8cf08d353804016b3351186720d199
Allow 'system' user to modify cpufreq control files

This is needed by new CPU Settings in CMParts

Change-Id: I0ec4e0b1705670034a433df549b2895985c476af
rootdir: Change sysfs permissions to allow user control ksm

Change-Id: I8a57a3d3bb7b5cd34d58416ca8778dfd6df3111b
Restart oneshot services when manually restarted.

Restores manual restart behavior of oneshot services prior to I9935b519.

Change-Id: Iadfc8462838e3ad2dbbe38d76ba2ef0ce955f722
Allow system to call custom reboot cmd

Change-Id: Id726b46f644e72c9a67d64777abe1e3dbdbc0a82
set /system/etc/init.d/* permissions

ported from CM7

Change-Id: I279d78679f7d779d6cd6bbc6c834d94706937ae8
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.
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.
Toolbox implementation of chown has a bad print

When the chown program fails it prints out an error message
and is describing itself as chmod. This has been corrected.

Change-Id: I2c489975f09343bdf66acbf7df6e7183c2daff78
Signed-off-by: christian bejram <christian.bejram@stericsson.com>
core: allow radio users to access all rmnet* interface

Change-Id: Ibc3bf9654cf68362369422f82afe53ef86e3e710
Modular backuptool.sh.  Executes backup and restore methods defined in arbitrary /system/addon.d/*.sh scripts.

Set permissions on /system/addon.d/ and files within.

Patch Series
============
http://review.cyanogenmod.com/#change,13265
CyanogenMod/android_build
  * edify generator
http://review.cyanogenmod.com/#change,13266
CyanogenMod/android_system_core
  * permissions on /system/addon.d
http://review.cyanogenmod.com/#change,13267
CyanogenMod/android_vendor_cm
  * 50-cm.sh reference backup script
  * modular backuptool.sh
  * support backuptool.functions used by /system/addon.d/*.sh scripts

Change-Id: I4f1464ea8d55f45d47ba760a7a448036a46feb00
audio: Don't use QCOM_HARDWARE when AUDIO_LEGACY is active

The older (GB) blobs used with AUDIO_LEGACY do not support the
new enums.

Change-Id: If80539060dbef53e984ca3d52d65cac6a499e8dd
init: Let radio user manipulate service properties

I'm seeing some devices (with broadcom's btld) in which the
radio services (RIL) use the service. namespace to pass or store
data...

Conflicts:

	init/property_service.c

Change-Id: I6e3177689a12b0925064e615408bc1e0f175bcf3
Increase CMD_ARGS_MAX in FrameworkListener

This increases the maximum number of arguments for a framework command
from 16 to 32. 16 arguments are already used by NetworkManagementService
.startTethering().

Change-Id: I0b369889f7f790f43f9c89da0c4e133a342debd7
Restrict zygote to system user.

CVE-2011-3918: Address denial of service attack against Android's
zygote process. This change enforces that only UID=system can
directly connect to zygote to spawn processes.

Change-Id: I89f5f05fa44ba8582920b66854df3e79527ae067
Use #define value of 1 to indicate presence of headers.

strace tests the value of HAVE_TERMIO_H and HAVE_SYS_UIO_H using

Change-Id: If899845503547410cf17d005733d1c0c6741e939
init: Add an emmc-specific configuration file

 * Load init.emmc.rc if emmc_boot is set
 * This makes startup much cleaner for devices with a mess of vendor RC
   configurations.

Change-Id: Ifa6d0ca104c11e037740690da0ff6284c2f4a3ca
init: Increase maximum number of Android properties to 372

(cherry picked from commit 2af5dedb813b5f2fb1355ccf6e4a5de2378665d6)

Change-Id: Ic4b45a10196b24ba2e4798fef45a125f9f3dbf15
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