Commit graph

1459 commits

Author SHA1 Message Date
Mark Salyzyn
956870518e liblog: add __android_log_is_loggable()
- Add new liblog API __android_log_is_loggable(prio, tag, def)
- future plan to integrate this into the runtime checks and into
  the logd daemon for filtration. Inert for now.

Bug: 17760225
Change-Id: I16395b4d42acc08f0209f55a1cbf87b0b2112898
2015-02-09 22:12:59 +00:00
Christopher Ferris
c9c401e64b Merge "Move map data into backtrace data proper." 2015-02-06 23:29:00 +00:00
Christopher Ferris
12385e3ad0 Move map data into backtrace data proper.
The backtrace structure used to include a pointer to a backtrace_map_t
that represented the map data for a particular pc. This introduced a
race condition where the pointer could be discarded, but the backtrace
structure still contained a pointer to garbage memory. Now all of the map
information is right in the structure.

Bug: 19028453
Change-Id: If7088a73f3c6bf1f3bc8cdd2bb4b62e7cab831c0
2015-02-06 15:00:09 -08:00
Elliott Hughes
f682b4786a Clean up reading and writing in init.
This isn't particularly useful in and of itself, but it does introduce the
first (trivial) unit test, improves the documentation (including details
about how to debug init crashes), and made me aware of how unpleasant the
existing parser is.

I also fixed a bug in passing --- unless you thought the "peboot" and "pm"
commands were features...

Bug: 19217569
Change-Id: I6ab76129a543ce3ed3dab52ef2c638009874c3de
2015-02-06 14:20:30 -08:00
Elliott Hughes
d79801d60d Fix Windows build.
Take 2. Probably should have done this in the beginning, but thought I was
being clever.

Change-Id: I85c6e487eece9bcc75f8f62c850c2d4d1ee9e908
2015-02-05 08:21:37 -08:00
Elliott Hughes
202f024dee Add a WriteStringToFile overload that cares about permissions.
Change-Id: I857a80b61768d4e9610bdd149eff2d9d8e48d2c0
2015-02-04 14:30:23 -08:00
Elliott Hughes
0068da6a93 android_reboot should take a const char*.
The kernel argument is actually a void*, but it's only read from.

Change-Id: I305c50249bf12b7fbdea4721257aed52a0372f8d
2015-02-03 15:44:16 -08:00
Elliott Hughes
e44d25d645 Merge "Add Google-style StringPrintf." 2015-02-03 23:23:11 +00:00
Elliott Hughes
6b3be2902d Add Google-style StringPrintf.
Change-Id: If333c28b8ed047346a2dd85e591c4bedbab874cc
2015-02-03 15:21:07 -08:00
Elliott Hughes
714196d05c Extra Win32 compatibility.
Change-Id: Ibc583aba580f4fc15c243f495ead44b2ce4c6e5e
2015-02-03 14:26:58 -08:00
Elliott Hughes
dec12b2b71 Add Google-style ReadFileToString and WriteStringToFile.
Bug: 19217569
Change-Id: I64789d3fa6777ee30a324cdf00fdc275c1230e1b
2015-02-03 12:18:11 -08:00
Dmitriy Ivanov
40b52b2c88 Add close_file flag to OpenArchiveFd()
* We should be able to keep fd alive after CloseArchive()

Change-Id: I1aa2c039bb2a590ae72f256acc9ba5401c2c59b1
2015-01-30 17:57:13 -08:00
Yabin Cui
4a6e5a3b64 Kill HAVE_PTHREADS.
Bug: 19083585
Change-Id: Ic09eb3dd250bc5c5b63cac7998f99f5fa007f407
2015-01-27 14:23:22 -08:00
Mark Salyzyn
d91ab5815d liblog: add pstore write
Used to push the Android log messages into pstore
(when available, and no propagation of error).

Change-Id: I9def8cf796d35d347f502d9745d5f42ec1200253
2015-01-23 23:33:31 +00:00
Mark Salyzyn
b5f6e45d6b logd: create private/android_logger.h
- create a structure to depict the private header
  expected at logd end of socket.
- utilize this new structure instead of unscalable
  byte stream technique used to unpack in logd.

Change-Id: I2d0e5c3531c279f2dc1fbd74807210ff8d804de0
2015-01-23 23:32:11 +00:00
Christopher Ferris
9774df6134 Move 32 bit/64 bit check into debuggerd.
On 64 bit systems, calls to dump_backtrace_to_file or dump_tombstone
try and directly contact the correct debuggerd (32 bit vs 64 bit)
by reading the elf information for the executable.
Unfortunately, system_server makes a call to dump_backtrace_to_file
and it doesn't have permissions to read the executable data, so it
defaults to always contacting the 64 bit debuggerd.
This CL changes the code so that all dump requests go to the 64 bit
debuggerd, which reads the elf information and redirects requests for
32 bit processes to the 32 bit debuggerd.

Testing:

- Forced the watchdog code in system_server to dump stacks and
  verified that all native stacks are dumped correctly.
- Verified that dumpstate and bugreport still properly dump the native
  processes on a 64 bit and 32 bit system.
- Intentionally forced the 64 bit to 32 bit redirect to write only a
  byte at a time and verified there are no errors, and no dropped data.
- Used debuggerd and debuggerd64 to dump 32 bit and 64 bit processes
  seemlessly.
- Used debuggerd on a 32 bit system to dump native stacks.

Bug: https://code.google.com/p/android/issues/detail?id=97024
Change-Id: Ie01945153bdc1c4ded696c7334b61d58575314d1
2015-01-20 17:22:07 -08:00
Elliott Hughes
f21717cd87 Remove unused cruft from libcutils.
Change-Id: I316d39e8e0a9aa385d8e1f37678b8bf2c03441eb
2015-01-15 21:16:03 -08:00
Jeff Sharkey
9f72ef8944 Merge "Extend to receive NFLOG packets." 2015-01-16 01:11:02 +00:00
Christopher Ferris
fa41e0f5c8 Add timed versions of stack dumping functions.
Under some unknown circumstances, debuggerd could become unresponsive.
If you try and take a bugreport during this time, it will hang forever.
Adding functions that have a timeout will allow dumpstate to stop if
dumping is taking too long.

Bug: 18766581

(cherry picked from commit 5f2ff6a910)

Change-Id: I39e8e9c60209e3ef9efac795fedb8e1edce2bd3e
2015-01-15 15:34:21 -08:00
Jeff Sharkey
9a20e67fa6 Extend to receive NFLOG packets.
Packets captured and logged by the NFLOG target are unicast, so
extend to catch and decode them.  To avoid escaping issues, the raw
contents are passed around as hex strings.

Bug: 18335678
Change-Id: Ib7299500baa00080a1f000f9da843eb527363353
2015-01-15 12:50:59 -08:00
Chih-Hung Hsieh
ba8cdf99a4 Add required casts for clang/llvm -Wc++11-narrowing
system/core/include/utils/Mutex.h:134:25: error: non-constant-expression
cannot be narrowed from type 'long long' to '__kernel_time_t' (aka
'long') in initializer list [-Wc++11-narrowing]

system/core/include/utils/Mutex.h:135:26: error: non-constant-expression
cannot be narrowed from type 'long long' to 'long' in initializer list
[-Wc++11-narrowing]

Change-Id: Icb9df26aeb01617da5ab1c36987289f7c2b11954
2015-01-12 16:53:52 -08:00
Elliott Hughes
ae52165490 Remove HAVE_LIBC_SYSTEM_PROPERTIES and HAVE_SYSTEM_PROPERTY_SERVER.
Change-Id: I3d92dbecebd2bb449a8c4332de684919a58847ad
2015-01-12 13:56:34 -08:00
Elliott Hughes
76f0a84f6a Linux always has POSIX clocks available.
pixelflinger doesn't have to run on the Mac, but the Condition
code might.

Change-Id: Ib4e9b4daa6e848ffd5742959427b172d45f08e3c
2015-01-09 16:17:46 -08:00
Elliott Hughes
3906c8511e You either have winsock or <sys/sockets.h>.
There is no third choice.

Change-Id: I8f1206f22798f747896dd53f3081cdfa4b1707c4
2015-01-09 12:21:51 -08:00
Jesse Hall
7208a01514 Merge "Mutex: add timedLock() method" 2015-01-07 18:01:11 +00:00
Jesse Hall
601424a84f Mutex: add timedLock() method
This is not available for host builds because OSX doesn't have
pthread_mutex_timedlock() or equivalent.

Bug: 18842510
Change-Id: I072e74ab1a6f770fd245828b39c5f954dda1113b
2015-01-07 08:06:51 -08:00
Mark Salyzyn
decd92945f liblog: Add log_time += operator
Change-Id: I1d2987b6cb333fc344d4fee1b7bb25f32a4143c6
2015-01-05 16:27:54 +00:00
Dan Albert
da4f30c5b4 Merge "Remove incompatible Unicode compatibility types." 2014-12-12 02:42:30 +00:00
Chih-Hung Hsieh
c777f213b3 Use full qualified name in macros.
The ANDROID_SINGLETON_STATIC_INSTANCE is used in some files
out of the android namespace. If it does not use full qualified
names, users of this macro will need to use it inside the 'android'
namespace to avoid warnings from clang compiler.

Change-Id: Ie4d4ba2b57fdc72d0deb3b7c2326304a44a1300f
2014-12-11 11:19:57 -08:00
Elliott Hughes
111e3d3d9c Only Windows doesn't have <sys/uio.h>.
This should probably be in libcutils instead, so code that needs to
care about Windows can use readv/writev.

Change-Id: I7c2ceec3f742cee0e44f69fd4c88459376bd0e08
2014-11-25 13:27:43 -08:00
Elliott Hughes
b120134bd1 Remove long-dead readtty.
Change-Id: I15ae14542214a3802d43892da0d03cfb33e63c96
2014-11-24 12:01:21 -08:00
Elliott Hughes
8c275ffcba Fix Mac build.
Change-Id: Iae697ae257cf4b1d675e2b758dd31d5a6a71ae4d
2014-11-22 07:25:02 -08:00
Elliott Hughes
97ac0e1bb4 Kill HAVE_BIG_ENDIAN, HAVE_ENDIAN_H, and HAVE_LITTLE_ENDIAN.
Change-Id: I9e25ac9d27e95b04fb8bf7a66c619af0139d8b8f
2014-11-21 23:10:45 -08:00
Dan Albert
c59932f937 Remove incompatible Unicode compatibility types.
As well intentioned as these were, uint16_t and C++11's char16_t are
_not_ actually compatible. They are not implicitly convertible, and
they mangle differently, so they are not even ABI compatible. In our
now wonderous world of C++11, no one should be using these, so just
kill them.

Bug: 18300613
Change-Id: I06d92d7f1d937dd94a620874323d4c50eb6a31bd
2014-11-20 11:54:39 -08:00
Dan Albert
e4c649c9fc Add a pre-C++11 constexpr compatibility macro.
Needed for cases where something should be constexpr if possible, but
not being constexpr is fine if in pre-C++11 code (such as a const
static float member variable).

Bug: 18466763
Change-Id: I635d062575ba2fbc4cbe3a89f730128c404d95e1
2014-11-20 10:47:55 -08:00
Elliott Hughes
c3914d2be2 Remove atomic-inline.h.
Change-Id: I3ac0229b9c516744e6a9c9d9e795b43bc9c5636b
2014-11-17 14:38:56 -08:00
Elliott Hughes
e9ca709a73 Remove the error-prone TARGET_CPU_SMP from system/core.
This means that code that uses libcutils no longer has to ensure that
it's set ANDROID_SMP in the calling code's Android.mk for this to
function correctly.

Change-Id: I80c7ff170cd621106f34d6b74689d6b4f03e4eb7
2014-11-17 11:16:59 -08:00
Hans Boehm
c56648948c Second attempt to "Rewrite atomic.h to use stdatomic.h."
This should not be committed until win_sdk and aarch64 builds are
fixed in the presence of this CL.

This reverts commit 2789faabfa.

We additionally remove uniprocessor support from the earlier CL,
thus avoiding a potential compiler code reordering issue.

Change-Id: I7207a5ca2efa907a6f757f172d7090a62b2311fe
2014-11-13 15:59:10 -08:00
Yabin Cui
266092c52d kill HAVE_POSIX_FILEMAP
Bug: 18315579
Change-Id: I0bd5fb946b12cb90e0c9c73a478df41609b8c3e2
2014-11-11 10:31:30 -08:00
Nick Kralevich
65a83bdf2e Merge "Reserve some AIDs for OEMs" 2014-11-10 17:42:58 +00:00
Johan Redestig
60ac6364ec Reserve some AIDs for OEMs
OEMs frequently add some AIDs on their own. Reserve some range
for them to use.

Change-Id: I3c729c889c9bd3e105ae4f6fb0c04a42a10eb25c
2014-11-10 08:14:21 +01:00
Stephen Hines
f02c797256 Merge "Move winsock2.h in front of a potential windows.h include." 2014-11-09 07:24:43 +00:00
Stephen Hines
7e34121e39 Move winsock2.h in front of a potential windows.h include.
Files that included FileMap.h (possibly transitively), before including
ByteOrder.h (which pulls in winsock2.h directly), will experience a
compiler warning/error from the latest mingw headers. This happens because
the headers require that winsock2.h come before windows.h in all cases.
The simplest (and most error-proof) fix for now is to include winsock2.h
before this use of windows.h.

Change-Id: I33069e4c9962d9820d0ea5976554f89d7ff6307c
2014-11-08 19:30:05 -08:00
Dan Albert
2f5ad5ff86 Make Unicode.h use types that match libc++.
libc++ also defines these types for pre-C++11, and the two definitions
need to match to avoid redefinition errors.

Bug: 18300613
Change-Id: I1e9198d39f7c470f37bc6edba2dca2d499f54c9b
2014-11-08 20:22:30 +00:00
Calin Juravle
4de4e6defc resolved conflicts for merge of e3c22c41 to stage-aosp-master
Change-Id: I566aeb2e2de15813ee199d4635098029457fdf3d
2014-10-28 19:09:50 +00:00
Calin Juravle
f9d9e2a2d9 Handle code_cache dir creation in libnativebridge
Also:

- add kPreInitiliazed state to native bridge with check transition:
kOpened->kPreInitialized->kInitialized
- made sure we free the memory for the code_cache_path
- tidy up some error messages
- tidy up tests
- add a dummy native bridge to test with

Bug: 18027433
Bug: 18097480

Change-Id: I39f74c93580f2e224080dd3df2ffaa9cf9f8cd9c
2014-10-27 15:03:13 +00:00
Chih-Hung Hsieh
c37387a4cd am 07f1300c: am 7979f1ce: Merge "Do not inline rarely used trace function bodies."
* commit '07f1300c4c4f7d3c0df540bf8df3443c3f4539cd':
  Do not inline rarely used trace function bodies.
2014-10-15 17:57:07 +00:00
Chih-Hung Hsieh
2d3150e736 Do not inline rarely used trace function bodies.
When atrace_* functions are inlined,
the rarely used 1024-byte buffers are allocated on stack.

BUG: 17444504
Change-Id: I773512aeb70e8b79f3803c6d59cba064d2aa65b6
2014-10-14 15:37:20 -07:00
Hans Boehm
f381920b58 am 072877af: am 41198eea: Merge "Revert "Rewrite atomic.h to use stdatomic.h.""
* commit '072877af485d49f11e227c0d22a7bb4a341533d6':
  Revert "Rewrite atomic.h to use stdatomic.h."
2014-10-04 02:17:43 +00:00
Hans Boehm
2789faabfa Revert "Rewrite atomic.h to use stdatomic.h."
This reverts commit cb344d4640.

Change-Id: Ib17cd8d00695062177ce863cedc4ec7148012317
2014-10-04 00:49:06 +00:00