init: Safely restart services to avoid race conditions.

Previously, service restarts (either an explicit "restart", or a "stop,
start" pair) exhibited a race condition whereby the new (restarting)
service process was often spawned before the old (stopping) process had
terminated.  This may have resulted in the new service process failing to
acquire a limited resource (file lock, socket bind, etc.) that the old
process had not yet released.

Now, a stopping service remains in the 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.  This enables safe service restarts by stopping the service,
waiting for the old service process to terminate, and (only then) starting
the new service process.  In the event of "restarting" an already stopped
service, the previous behavior is maintained whereby the service is simply
started.

This scenario could be special-cased 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 that this commit alters the behaviors for explicit restarts of
critical and oneshot services.  Previously these serivces would simply be
restarted, whereas now, an explicit restart of a critical service counts as
a crash (which may result in a recovery reboot) and oneshot services go
into the disabled state.
init: Retain traditional restart behavior for critical and oneshot services.

Adds an SVC_RESTART state that's used for an explicit "restart" of a
running service.  This retains the traditional restart behavior for
critical and oneshot services (previously altered by 7e36edd8), whereby
these services are "simply restarted" instead of counting as a crash (for a
critical serivce) or going into the disabled state (for a oneshot service).
Add Mips memset speedup

Change-Id: I157aa8b500e271c213bf615dd4ceb25b3aedd7c2
fs_mgr_priv: Extend fs wait timeout to 20 seconds

In practice 5 seconds is too short to wait for a disk device node to
show up if the disk is USB; 20 seconds is a much more comfortable
window.

Change-Id: Iaf2c1f46b41a44fc1240d52d8498ca9cb639ea80
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Reconcile with jb-mr2-release - do not merge

Change-Id: I20987b51211410332c427eb876334b0c6a9bcc32
am 7c646cd3: am af4ececc: am 515bed0e: Merge "run-as:  set the SELinux security context."

* commit '7c646cd3594283bc4aaf53a0b10143a76281270f':
  run-as:  set the SELinux security context.
am 95b087fa: am 79d4381a: am 69f3ec84: Merge "Fix issues where the filename is referred to as \'sideload\'"

* commit '95b087fa90c89b21d18268c84167d1407f9e7905':
  Fix issues where the filename is referred to as 'sideload'
am 81b5b5fb: sync: factor sw_sync functionality out of header

* commit '81b5b5fb02a59a443877363b1451328c7ad11fb2':
  sync: factor sw_sync functionality out of header
am 4c8c35d0: Merge "move goldfish stuffs to device/generic/goldfish" into jb-mr2-dev

* commit '4c8c35d06ce6a673c6e015b809f94da0083cd4cc':
  move goldfish stuffs to device/generic/goldfish
am 598169e7: Merge "charger: accomodate minui change" into jb-mr2-dev

* commit '598169e7687ea831a495f9fa7dd7677c740d64d3':
  charger: accomodate minui change
am 2fa2dfd1: Merge "init: prevent action being added to the action_queue twice" into jb-mr2-dev

* commit '2fa2dfd105204b84a7a32e8fe790793ba23c7f87':
  init: prevent action being added to the action_queue twice
am 7b8970c5: fastboot: add support for some obscure args.

* commit '7b8970c577c788c9af582dac797c63b3134b201e':
  fastboot: add support for some obscure args.
am 0c06eb50: DO NOT MERGE - Document new -obb flag for adb backup

* commit '0c06eb5017e5888f0452da348d12fc92a767e45d':
  DO NOT MERGE - Document new -obb flag for adb backup
am dd0d0e78: am 822ea9b3: am fd5c6b9f: Merge "Close adb_usb.ini after reading it"

* commit 'dd0d0e78afb5b809983fe9cebac8cc5d54a284b6':
  Close adb_usb.ini after reading it
rootdir: goldfish: mount debugfs on boot time

goldfish is ported to linux-3.4 and have capability to run atrace.
But can't run atrace yet because debugfs is not mounted on boot time.

Change-Id: I0ce23bde3b8d1b2a88d4238272123e3ab8cb6970
Signed-off-by: Young-Ho Cha <ganadist@gmail.com>
am 53a02884: ueventd: allow platform devices to have just a /devices/ prefix - DO NOT MERGE

* commit '53a0288463c3fd88fb7f2cfa37c0e985eb1870f4':
  ueventd: allow platform devices to have just a /devices/ prefix - DO NOT MERGE
am 7398664d: am c8b3fee4: am f9094401: am 75f29709: am 09b43645: (-s ours) am 92b2cd23: (-s ours) Reconcile with jb-mr1-release - do not merge

* commit '7398664de30cf953b791ab5aeeb37dfd57410698':
Reconcile with jb-mr2-release - do not merge

Change-Id: If556a8aade619e94ef8cf3bfa2f65d4efa2c4550
am 451dd85f: liblogwrap: replace loops with calls to TEMP_FAILURE_RETRY

* commit '451dd85fb204b5015c461eabc78722abd1c4252a':
  liblogwrap: replace loops with calls to TEMP_FAILURE_RETRY
am d4b360a2: am 1d77e6e4: am 3960ec22: Merge "mkbootimg: support 8192/16384 pagesizes"

* commit 'd4b360a2e89d7d7f2dd7ff5f7dca6a2578c532cf':
  mkbootimg: support 8192/16384 pagesizes