liblog: fix fd leakage

File descriptors remain open across an exec unless FD_CLOEXEC is
set.  Add O_CLOEXEC to the open() call to prevent file descriptor
leakage.

In particular, the following program will eventually run out of
file descriptors:

int main(int argc, char **argv) {
  printf("===== entering main =====\n");
  ALOGW("entering main");
  system("ls -l /proc/self/fd/");

  execv(argv[0], argv);
  printf("exec failed\n");
  return -1;
}

Change-Id: I5be43ab3b9f82a05f242b1f586454c50568af388
debuggerd: Fix minor memory leak

free_ptrace_context(context) doesn't free(context),
which leaks the memory allocated to context.

Change-Id: Ic199b257aefc9a05ec2d902958efa8a57a601fb1
Signed-off-by: Liangtao Gao <gliangtao@gmail.com>
Add sysinit support with semaphore.
Introduced semaphore mechanism that prevents system services
from starting until init.d scripts finish executing.
This avoids conflicts with scripts like int2ext when services
are starting while data are being moved from data partition
to sd-ext partition.
WARNING: this approach requires the last init.d script that
sets ro.filesystem.ready property to 1 to continue boot sequence.
Otherwise device will not continue booting.
Example file: /system/etc/init.d/99complete
\#!/system/bin/sh
sync;
setprop ro.filesystem.ready 1;

Change-Id: Iae9b3c902c4f04c2ab254dabafbe4aee8715ac69