Commit graph

54 commits

Author SHA1 Message Date
Jiyong Park
a0e75045e6 Build adbd for recovery
adbd (and its dependencies) are marked as recovery_available:true so
that recovery version of the binary is built separately from the one for
system partition. This allows us to stop copying the system version to
the recovery partition and also opens up the way to enable shared
libraries in the recovery partition. Then we can also build adbd as a
dynamic executable.

Bug: 79146551
Test: m -j adbd.recovery
Change-Id: Ib95614c7435f9d0afc02a0c7d5ae1a94e439e32a
2018-05-24 14:11:11 +09:00
Elliott Hughes
a366494fc3 Remove misleading comment.
Bug: N/A
Test: N/A
Change-Id: Ie93d9d0abb13bf204c62f6951d3a7bae650f8e08
2018-04-23 21:50:43 -07:00
Elliott Hughes
0b539f3bcb Build /vendor/bin/logwrapper too.
Bug: https://issuetracker.google.com/77284669
Test: builds
Change-Id: Iaafc856f2a7441d318f7b9376caa6629e02a8e23
2018-04-11 08:28:37 -07:00
Elliott Hughes
dc699a269f bpfmt.
Bug: N/A
Test: builds
Change-Id: I89ad00e1c4c7e0767bc80a7ac7935a4d55e090ac
2018-02-16 17:58:14 -08:00
Elliott Hughes
693d63f9cf Add OWNERS.
Bug: N/A
Test: N/A
Change-Id: Ie785058c0f5eb9b4086c98ccba6e63e3ed411b65
2017-12-07 13:30:03 -08:00
Treehugger Robot
1620c51f75 Merge "logwrapper: add a benchmark for android_fork_execvp_ext" 2017-03-23 11:56:10 +00:00
Narayan Kamath
f704193384 logwrapper: add a benchmark for android_fork_execvp_ext
Current results on an aosp_angler (32 bit) :

Benchmark                           Time           CPU Iterations
-----------------------------------------------------------------
BM_android_fork_execvp_ext   15019207 ns    1002131 ns        700

Test: android_fork_execvp_ext_benchmark

Change-Id: I3d4339ff5cbb9a641cbb14f0b55d2b5fc18cdfde
2017-03-23 10:02:21 +00:00
Narayan Kamath
abd4613f05 Logwrapper: Remove unused support for input / output processing.
Should make it easier to switch callers over to posix_spawn once
that's available.

NOTE: The (now) unused arguments will be removed in a followup (multi-project)c
hange once we empirically confirm that there aren't any prebuilt blobs
using this function. I did readelf all currently checked in prebuilts to look
for a reference to this method, but one can never be too paranoid.

Test: make checkbuild
Change-Id: I454d80c52f269c31846133cc54375decd702fe71
2017-03-22 11:00:43 +00:00
Mark Salyzyn
30f991f251 liblog: use log/log.h when utilizing ALOG macros
Test: compile
Bug: 30465923
Change-Id: Id6d76510819ebd88c3f5003d00d73a0dbe85e943
2017-01-11 09:31:15 -08:00
Elliott Hughes
36e0d390a2 Rely on the platform -std default.
Bug: http://b/32019064
Test: builds
Change-Id: I18a1d816d63b64601485045070851f32d44e85eb
2016-10-10 14:31:12 -07:00
Mark Salyzyn
66ce3e08c5 system/core Replace cutils/log.h with android/log.h
Should use android/log.h instead of cutils/log.h as a good example
to all others.  Adjust header order to comply with Android Coding
standards.

Test: Compile
Bug: 26552300
Bug: 31289077
Change-Id: I2c9cbbbd64d8dccf2d44356361d9742e4a9b9031
2016-09-30 12:47:05 -07:00
Dan Willemsen
45f05240c2 Convert more Android.mk files to Android.bp
These modules have their dependencies satisfied, and aren't doing
anything strange.

Change-Id: I72039a15256cbd5e5eee0d79a15d66d74a6c087d
2016-07-13 17:41:45 -07:00
Tao Wu
bc31090b7a Don't go busy loop when waiting child process.
Before this change, code works like this: after gets POLLHUP from poll, it just
go a busy loop to do poll -> waitpid -> poll -> waitpid ... until child process
really exit. This doesn't make sense and is waste of CPU.

Change-Id: If6cd8b0245587d623e309c3ae27f162e1c7ef504
Signed-off-by: Tao Wu <lepton@google.com>
2016-02-16 10:13:48 -08:00
Yusuke Sato
ae0b28f569 am eaf04aa0: am 3b94cef1: Merge "Add FORK_EXECVP_OPTION_CAPTURE_OUTPUT to logwrap.h"
* commit 'eaf04aa0986e069a2ccffb69b94f1e4d6ad6726c':
  Add FORK_EXECVP_OPTION_CAPTURE_OUTPUT to logwrap.h
2015-08-22 02:40:51 +00:00
Yusuke Sato
7980426a6f Add FORK_EXECVP_OPTION_CAPTURE_OUTPUT to logwrap.h
This allows raw popen calls in e.g. system/netd/ to be replaced
with android_fork_execvp_ext().

Change-Id: I159ece7369fa38ff8782024bef0d7cfafe74ecee
2015-08-21 17:14:59 -07:00
Yusuke Sato
2ef82cffad am d1b11a04: am e656be33: Merge "Add |opts| argument to android_fork_execvp_ext"
* commit 'd1b11a04903be74ba6a47307d8c3ef2731e3f4ab':
  Add |opts| argument to android_fork_execvp_ext
2015-08-19 22:31:08 +00:00
Yusuke Sato
d81c3c6c45 Add |opts| argument to android_fork_execvp_ext
to allow the caller to send data to the child's stdin.

Bug: 21725996
Change-Id: I818f5cf61045286c8d64a91b6d50f05740329be1
2015-08-19 11:00:37 -07:00
Yusuke Sato
7c842b57fe am ab64465d: am 0e3ce82b: Merge "Use fsck.f2fs -a instead of -f for faster boot"
* commit 'ab64465d1f16f414c0bde5e3c4707c32b8220bbc':
  Use fsck.f2fs -a instead of -f for faster boot
2015-07-21 18:25:57 +00:00
Yusuke Sato
0df08271fb Use fsck.f2fs -a instead of -f for faster boot
and run fsck with -f on clean shutdown instead.

With -f, fsck.f2fs always performs a full scan of the /data
partition regardless of whether the partition is clean or not.
The full scan takes more than 2 seconds on volantis-userdebug
and delays the OS boot.

With -a, the command does almost nothing when the partition
is clean and finishes within 20-30ms on volantis-userdebug.
When the partition has an error or its check point has
CP_FSCK_FLAG (aka "need_fsck"), the command does exactly the
same full scan as -f to fix it.

Bug: 21853106
Change-Id: I126263caf34c0f5bb8f5e6794454d4e72526ce38
2015-07-15 10:13:51 -07:00
Greg Hartman
465f75f602 Put in line breaks when logging to klog
Change-Id: I0fd4d0a03d8c69e1ef2d8192f59893f4bda61691
2015-02-03 17:06:33 +00:00
Elliott Hughes
84cfd1092d Fix "ptsname is not thread-safe; use ptsname_r instead" build break.
Change-Id: I8fdca8e85056e99e943bdcf93a48574d76addcdc
2014-07-29 11:06:53 -07:00
Mark Salyzyn
5254c4a448 logwrapper: turn on -Werror
- Deal with some -Wunused / -Wunused-variable issues

Change-Id: I27a99ffb962289ebbf04b40870b9404842030d2f
2014-05-02 14:15:59 -07:00
Elliott Hughes
ccecf14254 system/core 64-bit cleanup.
This cleans up most of the size-related problems in system/core.
There are still a few changes needed for a clean 64-bit build,
but they look like they might require changes to things like the
fastboot protocol.

Change-Id: I1560425a289fa158e13e2e3173cc3e71976f92c0
2014-01-16 12:54:18 -08:00
William Roberts
5605cdade8 logwrapper: fix missing include
Use of ECHILD with no definitive errno.h inclusion.

Explicitly listing the errno.h header file rather
then relying on the inclusion chain to do so.

Change-Id: I5552acd928d17fc62192217a30ff2e4fab0b1936
2013-11-25 17:25:47 +00:00
Ken Sumrall
4eaf905858 Create a separate copy of the fsck logs
The log_target parameter of android_fork_execvp_ext() is now a
bit field, and multiple targets can be set to log to multiple
places at the same time.

The new target LOG_FILE will log to a file specified by the new
parameter file_path.

Set LOG_FILE and log to a file in /dev (the only writable filesystem
avilable when e2fsck runs) when invoking e2fsck in fs_mgr.

Bug: 10021342

Change-Id: I63baf644cc8c3afccc8345df27a74203b44d0400
2013-09-20 17:44:33 -07:00
Ken Sumrall
96e11b5bc4 logwrapper: Add ability to log to kernel log
Also add ability to do abbreviated logging where only the first
4K bytes and last 4K bytes of output are added to the desginated log.

Also update standalog logwrapper command to support the new options.

Change-Id: Ia49cbe58479b9f9ed077498d6852e20b21287bad
2013-04-14 17:10:55 -07:00
Rom Lemarchand
6ad53df633 liblogwrap: use POLLHUP flag to check when a child dies
Replace the old signal handling mechanism with a check of POLLHUP
to check when the child has died.

See http://b/8333626

Change-Id: Ic9909b6660b1c3d1ed3015568b1a1ee1c25afe20
2013-03-20 16:26:22 -07:00
Rom Lemarchand
74a7b91cbe liblogwrap: lock android_fork_execvp
Add a lock around android_fork_execvp to ensure no two threads can
execute it at the same time.

This is to help with http://b/8333626

Change-Id: I75d087a74b58f5b8e878675b301200f54d976fb2
2013-03-14 21:31:07 -07:00
Rom Lemarchand
451dd85fb2 liblogwrap: replace loops with calls to TEMP_FAILURE_RETRY
Makes the code slightly more readable and avoids boilerplate.

Change-Id: I023d9a1e1de729deaec97c62a5ca7983b6918f94
2013-03-12 08:55:38 -07:00
JP Abgrall
a689d13a19 logwrap lib: make logwrapper less verbose when told to not log
We don't care about exit codes if logwrap output is not requested.

Change-Id: Ibae5fe53527554a1fe865c2058deb0a128a9dde2
2013-02-13 16:31:58 -08:00
Rom Lemarchand
2f34c5033e logwrap: Change semantics of NULL status in android_fork_execvp
When passing a NULL status to android_fork_execvp the return
status will now be the return value of the child if it exited
properly, otherwise a non-0 value will be returned.

Change-Id: I13309c61b37b6b3f9d5507f7d6484e7b6baaf8d0
2013-02-08 09:37:52 -08:00
Rom Lemarchand
2a46bfa6b9 logwrapper: rename logwrap() to android_fork_execvp()
Also change the quiet flag to a logwrap flag (inverses the meaning of
the boolean).

Change-Id: I76047a7b460f4c28d52f26bfe3f65889d96047f8
2013-01-30 12:26:05 -08:00
Rom Lemarchand
f5200c0750 logwrap: add quiet flag to logwrap()
Add a quiet flag to the logwrap function that prevents messages from
getting logged.

Change-Id: Ic56c011fb608babae32b03900b955833a6bdd070
2013-01-28 16:14:20 -08:00
Rom Lemarchand
2c3b2e12c1 Merge "logwrap: Replace sigprocmask with pthread_sigmask" 2013-01-29 00:13:25 +00:00
Rom Lemarchand
665118f502 Merge "logwrap: wait for child process when receiving SIGINT or SIGQUIT" 2013-01-29 00:12:11 +00:00
Rom Lemarchand
ed179d2f98 logwrap: Replace sigprocmask with pthread_sigmask
sigprocmask has undefined behavior when called from a thread.
Replacing with pthread_sigmask to ensure correct behavior if
logwrap() gets called from a thread.

Change-Id: I77b6959d345eac8d7b90039ed8144ead8c19a00c
2013-01-29 00:05:24 +00:00
Rom Lemarchand
75c289aab9 logwrap: wait for child process when receiving SIGINT or SIGQUIT
- Wait for the child to exit before propagating SIGINT and SIGQUIT
to the parent
- Add ignore_int_quit argument to logwrap() that gives the caller the
option to ignore SIGINT and SIGQUIT while logwrap is running

Change-Id: If5c96cf23094917211310f00aa6aed515f110f5b
2013-01-29 00:04:50 +00:00
Rom Lemarchand
99e1966400 logwrap: ensure child exits with _exit
Always exit the child process with _exit() rather than exit() to ensure none
of the parent's atexit functions get called if the child needs to exit before
calling exec.

Change-Id: I6a75111ef1bb3468c114c98743565471cf82c9dd
2013-01-28 15:44:24 -08:00
Rom Lemarchand
cfb5ec3c28 logwrap: remove unnecessary call to setuid/setgid
Android allows all users to write to log.
The setuid/setgid call is unneeded and could cause unintended
side effects when called from daemons or programs that need
to run as root.

Change-Id: I3bdb26eaa4363ef037615e45a1a5cb1ceb4088f3
2013-01-28 13:12:37 -08:00
Rom Lemarchand
611f5b4b93 logwrap: fix off by 1 argument error
Fix off by 1 argument parsing error in liblogwrap.

Change-Id: I79832ae338a71c445f9f616d780c577826874386
2013-01-28 13:11:32 -08:00
Rom Lemarchand
0cc2cab6af logwrapper: switch to signal handlers for SIGCHLD
Switch to a signal handler to monitor SIGCHLD.
Also, clean up the exit path and log a warning when the
previous SIGCHLD sigaction is not default or ignore.

Change-Id: I7ef7daabee18d80e9e82fba3943cf1d03b504ae3
2013-01-28 13:08:04 -08:00
Rom Lemarchand
b58a822955 logwrapper: prevent logwrap from hanging when child dies
Sometimes the read on the PTY can wait indefinitely if the child
dies. By using a poll statement that monitors both the output
of the child and its state we prevent this from happening.

Change-Id: I51d5556c66f039bca673145ca72db262977e1689
2013-01-14 11:11:58 -08:00
Rom Lemarchand
113bd47d61 logwrapper: split into liblogwrap and the executable itself
Abstracting the functionality of logwrapper into a library and making
use of it for the logwrapper executable.

Change-Id: I2bcf722413f3a8454c6f52137dec86c4477fb8b5
2013-01-11 13:58:29 -08:00
Rom Lemarchand
b10c7b4e3d Revert "Remove -d option from logwrapper"
This reverts commit 4d74bcf445

Change-Id: Ibcd19400cd2589b52df2b3acaba25f02676ba9e0
2013-01-04 16:21:14 -08:00
Rom Lemarchand
4d74bcf445 Remove -d option from logwrapper
Removing the ability of logwrapper to die with a SIGSEGV at address
"return code from wait".

Change-Id: I563715db2b1e5e789af84190fc2ff78664d63572
2013-01-03 14:42:05 -08:00
Tanguy Pruvot
1f28b775cf logwrapper: reduce verbosity and fix usage
- no info on normal process exit (0)
 - basename as tag, not the full path
 - fix usage, bad "-x" parameter vs "-d" in code

Change-Id: Ife72729eaee2a366bd4226f3fbe3ba074219c974
2012-02-28 13:55:57 -08:00
Steve Block
61fbcbe976 Rename (IF_)LOG() to (IF_)ALOG()
Change-Id: Ifb82ae2c242becaffa3cf19e548b526e6616c2c7
2012-01-17 17:56:18 +00:00
Nick Kralevich
dd26bb3a00 Get rid of warnings when compiled with -Wformat-security
Change-Id: I2bfc6582a8198b22af08e4b8d58f532dc138cc02
2010-05-13 15:38:49 -07:00
christian.bejram
28a8dab590 Add a printf format.
This makes sure that data sent through logwrapper
is interpreted as strings

Change-Id: Ifafa7c3a39433743250aeb76da3c4d9cce05a13f
2010-05-10 14:47:56 -07:00
Dianne Hackborn
161b03c7ec Automated import from //branches/master/...@140824,140824 2009-03-24 18:36:50 -07:00