Commit Graph

29218 Commits

Author SHA1 Message Date
Wei Wang a8d59faa75 libcutils: remove sched_set/getscheduler
Bug: 36667354
Test: angler taking video
Change-Id: Ie7fbcccbd02314468c03317319574ee7e433561d
2017-03-28 13:01:20 -07:00
Christopher Ferris a11c814d3d Only allow short functions in class definitions.
The previous rules would force short functions to be on a single line.
This change only allows single function lines in class definitions.

Test: Ran on a CL and verified single line functions only allowed in
Test: class defintions.
Change-Id: I5422543fdbb39da842bbd799c19fe2c443ff483c
2017-03-28 12:31:37 -07:00
Mark Salyzyn 621ae033a4 Merge "libcutils: handle root directory empty path"
am: 6105dbd01b

Change-Id: I48f4607f72c56ffb8bbf63682a70954995d48a28
2017-03-28 17:19:16 +00:00
Mark Salyzyn 6105dbd01b Merge "libcutils: handle root directory empty path" 2017-03-28 17:09:15 +00:00
Bowgo Tsai c30261f266 Merge "fs_mgr: change the log level in fs_mgr_get_boot_config()"
am: c8c3e61eeb

Change-Id: Ia5e4c77d45652c8b6d4e147175db99e44fecc0d5
2017-03-28 15:49:18 +00:00
Treehugger Robot c8c3e61eeb Merge "fs_mgr: change the log level in fs_mgr_get_boot_config()" 2017-03-28 15:43:56 +00:00
Mark Salyzyn d749a054ff Merge "logd: strip out empty trailing iovec"
am: 6b11faeb42

Change-Id: Ib6244cf3cd089c44dd71524e09f6d4a2227c65bd
2017-03-28 15:08:15 +00:00
Mark Salyzyn 6b11faeb42 Merge "logd: strip out empty trailing iovec" 2017-03-28 15:00:38 +00:00
Jeremy Compostella 3d642d48e2 libcutils: handle root directory empty path
Usually, the canned paths lack the leading '/' which means that the
root directory is an empty path.  This patch makes
load_canned_fs_config() handle this empty path as the root directory.
It also make it flexible enough to handle an optional leading '/'.

Original-Author: Jeremy Compostella <jeremy.compostella@intel.com>
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Signed-off-by: Gaelle Nassiet <gaellex.nassiet@intel.com>
Change-Id: Ice759ef37d1df23a54df1158ec0d3ad7f577a069
2017-03-28 14:57:22 +00:00
Bowgo Tsai 0f34094a17 fs_mgr: change the log level in fs_mgr_get_boot_config()
fs_mgr might try to get a non-existing config through fs_mgr_get_boot_config()
on a device (e.g., for backward compatibility). Lower the log level to INFO
so it won't appear on the recovery screen.

Bug: 35811655
Test: recovery boot sailfish
Change-Id: I81497259aff3691740170abeef932d363b52be35
2017-03-28 18:52:04 +08:00
Steven Moreland ee7137208e Merge "init: add class_restart"
am: 8678872a00

Change-Id: I92e6669b0e0a9b87fffc400f8a1ee2699bdda7fc
2017-03-28 04:27:40 +00:00
Treehugger Robot 8678872a00 Merge "init: add class_restart" 2017-03-28 04:22:47 +00:00
Josh Gao 6340d91308 Merge "debuggerd_client: properly wait for completion."
am: 372d8a2931

Change-Id: I16cc3b9538e9b9b0ca3662b0a2f64b55aa38100a
2017-03-28 03:24:35 +00:00
Treehugger Robot 372d8a2931 Merge "debuggerd_client: properly wait for completion." 2017-03-28 03:21:39 +00:00
Tom Cherry 256c8f5076 Merge "init: remove superfluous forward definitions"
am: deb23ba2c1

Change-Id: Ic8126b783cf8083a64cc0955074f586420685cdd
2017-03-28 02:32:10 +00:00
Treehugger Robot deb23ba2c1 Merge "init: remove superfluous forward definitions" 2017-03-28 02:22:51 +00:00
Tom Cherry dc597affcc Merge "init: Fix README.md for writepid"
am: 88d6b4af16

Change-Id: Ic65adea2c9fc69118890f0be79f45152be307bcf
2017-03-28 01:13:57 +00:00
Treehugger Robot 88d6b4af16 Merge "init: Fix README.md for writepid" 2017-03-28 01:07:50 +00:00
Tom Cherry 3d5729402e Fix timeouts for android::base::WaitForProperty*
std::chrono doesn't handle integer overflow, so using
std::chrono::milliseconds::max() to indicate an infinite timeout is
not handled well in the current code.  It causes an 'absolute_timeout'
earlier in time than 'now' and causes the associated WaitForProperty*
functions to return immediately.

Also, any duration_cast from relative_timeout to nanoseconds would
cause the same issue, as it would overflow in the conversion and
result in an invalid results.

This change prevents any duration_casts of relative_timeout to
nanoseconds and replaces the logic to wait on an absolute timeout with
logic that compares the time elapsed to the provided relative timeout.

This change also includes a test that std::chrono::milliseconds::max()
does not return immediately and that negative values do return immediately.

Test: Boot bullhead + libbase_test

Change-Id: I335bfa7ba71e86c20119a0ed46014cad44361162
2017-03-27 18:05:58 -07:00
Tom Cherry 46b6c43b7c init: remove superfluous forward definitions
Test: Boot bullhead
Change-Id: I4a005616a825529bc2ad1b413e51b501f6407cbd
2017-03-27 17:55:37 -07:00
Wei Wang fd450bb95a Merge "init: add support of multiple class names"
am: 3c1568aa13

Change-Id: Ib018fc301449ab8f2d1db8550724c11d5df0430e
2017-03-28 00:47:55 +00:00
Tom Cherry b27004aa05 init: add exec_start command
Exec services may also want to set other service flags such as
priority.  Instead of expanding the exec syntax to handle this, create
a new command, exec_start, that will treat an existing service
definition as an exec service.  The new exec_start command will start
the service then halt init from executing further commands until the
service has exited.

This change additionally encapsulates the waiting_for_exec logic into
ServiceManager and removes the ambiguous 'bool' return value from
Reap() which previously indicated if a Reaped service was an exec
service or not.

Bug: 36511808
Bug: 36102163
Test: Bullhead boots, services run with exec_start as they do exec.

Change-Id: I44f775cf1c1dd81d5c715f44fdc150c651a2c80a
2017-03-27 17:41:27 -07:00
Treehugger Robot 3c1568aa13 Merge "init: add support of multiple class names" 2017-03-28 00:39:09 +00:00
Bowgo Tsai 75ada5fce3 Merge "fs_mgr_avb: allow top-level vbmeta struct to be in 'boot' partition"
am: ea057b46e0

Change-Id: Ib7583cd28f93e882a00dade3507ee75183674115
2017-03-28 00:35:57 +00:00
Treehugger Robot ea057b46e0 Merge "fs_mgr_avb: allow top-level vbmeta struct to be in 'boot' partition" 2017-03-28 00:28:33 +00:00
Wei Wang c0fc8e7b7b Merge "libcutils: remove schedgroup"
am: 3d8911fbbe

Change-Id: I351d6c199512cc8e5c5cd466452ea910f69061e7
2017-03-28 00:21:53 +00:00
Treehugger Robot 3d8911fbbe Merge "libcutils: remove schedgroup" 2017-03-28 00:15:46 +00:00
Josh Gao ae9d7676a5 debuggerd_client: properly wait for completion.
Use an intermediate pipe to detect and report when a requested dump has
completed.

Bug: http://b/35241370
Bug: http://b/35813071
Test: debuggerd_test
Test: manually triggered a background ANR
Change-Id: If14aedf6071288360f1a7853d5a2ee79db121759
2017-03-27 16:11:38 -07:00
Mark Salyzyn 232b57c60b Merge "logcat: test: run 256 simultaneous logcats"
am: b15429c0ea

Change-Id: I88aaf94060873c6aebfd30f169741afa43616371
2017-03-27 22:51:36 +00:00
Mark Salyzyn 479c8c2e42 logd: strip out empty trailing iovec
If the last buffer has zero length, strip it out of the iovec
issued to SocketClient::sendDatav().

Test: gTest liblog-unit-tests, logd-unit-tests, logcat-unit-tests
Bug: 36497967
Change-Id: I8fc585bbec63402d0e818ff4c620fdd7edcc38dc
2017-03-27 15:49:24 -07:00
Mark Salyzyn b15429c0ea Merge "logcat: test: run 256 simultaneous logcats" 2017-03-27 22:46:03 +00:00
Mark Salyzyn f17500474a Merge changes I96998c4b,I161bf03b
am: dd0cd8d88f

Change-Id: I54191d23beed6fa2a2703a5cf8cb688b5c7a50fc
2017-03-27 22:35:19 +00:00
Keun-young Park bfb9bea368 Merge "update shutdown sequence and use shutdown_timeout to cover all wait"
am: 59cebb6e6f

Change-Id: I4a09594aba83bc489c9e1735b27e4dbdf5256385
2017-03-27 22:35:03 +00:00
Mark Salyzyn dd0cd8d88f Merge changes I96998c4b,I161bf03b
* changes:
  logd: last iterator initialized incorrectly
  logd: ASAN cleansing
2017-03-27 22:28:35 +00:00
Keun-young Park 59cebb6e6f Merge "update shutdown sequence and use shutdown_timeout to cover all wait" 2017-03-27 22:27:30 +00:00
Mark Salyzyn 1f46716f1c logd: last iterator initialized incorrectly
last should start with mLogElements.end() and be updated as
we iterate to find a matching time entry in the list. Since
it is impossible(sic) for a newer start time to be supplied
than the list, the incorrect iterator initialization should
be inconsequential, but if it ever happens this change will
behave correctly and dump nothing.

Test: gTest liblog-unit-tests, logd-unit-tests and logcat-unit-tests
Bug: 36536248
Bug: 36608728
Change-Id: I96998c4b713258f29d5db2e24a83ae562ddf3420
2017-03-27 21:26:13 +00:00
Wei Wang 641ff0a4d8 init: add support of multiple class names
Add support of multiple class names in service, so that related services
can be grouped together. By doing this, we can start/stop some services
for special purpose. For example, early zygote, early boot animation
and etc.

Bug: 36535312
Test: marlin boots with defined classes
Change-Id: Ifeaaf034fd836816e24f3775bece53ea83faada6
2017-03-27 20:59:05 +00:00
Steven Moreland 2b63d54af8 init: add class_restart
Bug: 34093663
Test: hwservicemanager `onrestart class_restart hal` works
Change-Id: Ie1e4daab2b7b4c6c714d4e3d05afa2d86d6233df
2017-03-27 13:52:47 -07:00
Keun-young Park 3ee0df9bdf update shutdown sequence and use shutdown_timeout to cover all wait
- Use ro.build.shutdown_timeout to cover the total time for shutdown.
  Limit wait time for termination only to half of shutdown_timeout
  with max of 3 secs as process not terminating by that time
  will not terminate anyway. It is better to move to the next
  stage quickly. fsck time for user shutdown is excluded from timeout.
- Change last detach to kill, sync, and umount. Last detach did not
  work in many tests.
- add sync after emulated partitions umount as it can trigger
  change in /data.

bug: 36551393
Test: many reboots
Change-Id: Ib75dc19af79b8326b02ccef6b16a8817ae7f8b0e
2017-03-27 13:44:50 -07:00
Mark Salyzyn 0484b3b575 logd: ASAN cleansing
A mixture of fixes and cleanup for LogKlog.cpp and friends.

- sscanf calls strlen.  Check if the string is missing a nul
  terminator, if it is, do not call sscanf.
- replace NULL with nullptr for stronger typechecking.
- pass by reference for simpler code.
- Use ssize_t where possible to check for negative values.
- fix FastCmp to add some validity checking since ASAN reports that
  callers are not making sure pre-conditions are met.
- add fasticmp templates for completeness.
- if the buffer is too small to contain a meaningful time, do not
  call down to log_time::strptime() because it does not limit its
  accesses to the buffer boundaries, instead stopping at a
  terminating nul or invalid match.
- move strnstr to LogUtils.h, drop size checking of needle and
  clearly report the list of needles used with android::strnstr
- replace 'sizeof(static const char[]) - 1' with strlen.

Test: gTest liblog-unit-test, logd-unit-tests & logcat-unit-tests
Bug: 30792935
Bug: 36536248
Bug: 35468874
Bug: 34949125
Bug: 34606909
Bug: 36075298
Bug: 36608728
Change-Id: I161bf03ba029050e809b31cceef03f729d318866
2017-03-27 13:32:57 -07:00
Jeff Vander Stoep b19825012e Merge "Move selinux policy build decisions to sepolicy Makefile"
am: 784c851785

Change-Id: If07e860115d028acd98b62488326eeb9c9a49ceb
2017-03-27 20:06:50 +00:00
Treehugger Robot 784c851785 Merge "Move selinux policy build decisions to sepolicy Makefile" 2017-03-27 20:03:04 +00:00
Tom Cherry e564dac2b3 init: Fix README.md for writepid
writepid takes a list of space delimited files.  Make this clear in
the documentation, following the format for repeated fields used in
the rest of the file.

Test: N/A
Change-Id: I5bbe453fcb54f060d3cc5a82e9b38d3091a1ece3
2017-03-27 12:55:33 -07:00
Tao Bao 07052c0509 Merge "fs_mgr: use different fstab paths for normal/recovery boot"
am: 9c59029add

Change-Id: I1b7d622f1d518f446301c4467fab72107cc4f171
2017-03-27 19:29:41 +00:00
Tao Bao 9c59029add Merge "fs_mgr: use different fstab paths for normal/recovery boot" 2017-03-27 19:23:12 +00:00
Mark Salyzyn fbc0fe429b logcat: test: run 256 simultaneous logcats
For logd daemon, heavy reader stress. For system popen fork and
execute of logcat measure baseline against liblogcat. For liblogcat
local concurrent thread, locking, argument parsing and context scaling
for popen-style pair of android_logcat_run_command_thread* functions.

NB: 1000 logcat executables ran, but did not scale well on time
    blocked for more than a minute. With 343 contexts of
    android_logcat_run_command_thread ran out of local resources
    to even return a file descriptor, and the per-context event tag
    mappings coincidentally ran out at 340 when threads ran, although
    that path was consistently 15% faster than the popen test.

Test: gtest logcat-unit-tests --gtest_filter=*.End_to_End_multitude
Bug: 35326290
Change-Id: I0e1a5d4f8ffbd77fa8db13d53f4d328973731895
2017-03-27 11:57:53 -07:00
Wei Wang 40267986da libcutils: remove schedgroup
After removing bg_non_interactive cgroup, there is only a ROOT cgroup.
This CL removes the no-op trying to set cgroup.
It also removes the attempt to open non-exist bg_non_interactive cgroup.

Bug: 36649832
Test: marlin boosts and cgroup ROOT task looks normal
Change-Id: Ibccd6db1499306174c940aec9219b20c1b86173d
2017-03-27 11:57:29 -07:00
Bowgo Tsai d05a2f7dcb fs_mgr: use different fstab paths for normal/recovery boot
recovery boot: /etc/recovery.fstab
  normal boot: use the first one found by the order:
               /odm/etc/fstab.{hardware} ->
               /vendor/etc/fstab.{hardware} ->
               /fstab.{hardware}

Bug: 35811655
Bug: 36637553

Test: Sideload OTA installation in sailfish
Change-Id: I3e260e077afa5a37fb65246246c824e9379e68c8
2017-03-28 01:34:28 +08:00
Steven Moreland e326cb121e Merge "Revert "Revert "Start hwservicemanager earlier."""
am: ca622b4e78

Change-Id: I6d08f24f108f84130c059f2515219ebcdbc82b18
2017-03-27 17:31:05 +00:00
Treehugger Robot ca622b4e78 Merge "Revert "Revert "Start hwservicemanager earlier.""" 2017-03-27 17:28:38 +00:00