Squashed adb fixes.

fix up adb to prefer /sbin/sh if it exists

allow always insecure

Change-Id: I5c15731c95d123488e90aaeac5b497f556b53363

Conflicts:

	adb/Android.mk
ADB Logcat colored output.

This patch adds a new '-C' option to logcat so that the output is
colored with colors similar to the ones in DDMS.
Simply type "adb logcat -C" to use it.
Works well with bash in gnome-terminal.

Change-Id: Ie72199ecca0e04f2082c993f5763646bb09da61ea
init: Implement exec support

Code copied from CM7 implementation by Steve Kondik

Change-Id: Ie8f11e9dc9e552aa7a4fe354995daaf8f0d99a11
init: Include extra init file in /system/etc/init.local.rc

Change-Id: I2324b3be767a4bf2e0d32645a355f14e0b894c5b

Conflicts:

	rootdir/init.rc
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.
Restart oneshot services when manually restarted.

Restores manual restart behavior of oneshot services prior to I9935b519.

Change-Id: Iadfc8462838e3ad2dbbe38d76ba2ef0ce955f722
make use of exec support
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.
add data files for radio

Change-Id: I3b5b876f6ad7db5f8c1717ceec8f7125a9f61d0f
core: allow radio users to access all rmnet* interface

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

Conflicts:

	init/property_service.c
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
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: 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
init: Add noexec mount option

Change-Id: Ic13d66797a86d38432e79af0c3387ce986d0a19f
Add error handling to SocketClient::sendData

Return failure and set errno if mSocket isn't valid.

Change-Id: I579114d435db46d0bb5682167ef34bebe061a8f8
toolbox: rmmod: fix module unloading

Replace "-" with "_" in module name. This would keep
rmmod compatible with module-init-tools version of rmmod

Change-Id: I4470d9a98bc2f299acd94859fca4403aee279d2b
Signed-off-by: Vishal Bhoj <vishal.bhoj@linaro.org>
init: Check for symlinks with lstat() not open()

Using open() with an O_NOFOLLOW flag will result in a file falsely
being determined to be a symlink if the open fails for another
reason.

For example, a character device that isn't ready due to the
underlying hardware not being initialized yet will fail to open()

An example of this are any CG2900 device files prior to
execution of ste-cg29xx_ctrl

This uses lstat() instead of open() with O_NOFOLLOW to check
whether a file is a symlink or not.

Change-Id: Ie0d8d94b426c84c29b1b04d41a4cc15536cb307c