Commit graph

1566 commits

Author SHA1 Message Date
Nick Kralevich
58ba58a97c logd: Don't embed a flexible array member within another struct
C (but not C++) has a concept of a flexible array member, which
is documented at https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html .
Using a flexible array member indicates that the structure is
really a header for a variable length object.

In logd's case, the variable length structure android_event_string_t
was embedded within another structure called
android_log_event_string_t. This makes gcc's __builtin_object_size()
function really confused. When compiling with C++,
__builtin_object_size(android_log_event_string_t.payload.data, 1)
would return 0, whereas if you compiled the code with C, the same
call would (properly) return -1.

Code which does automatic bounds checking, such as the proposed
patch at https://android-review.googlesource.com/145411 , will
cause problems for logd if this syntax is used.

Don't try to embed a variable length structure within another
structure. This doesn't appear to be valid C nor C++, and
while it's worked, it seems problematic.

Instead, inline the structure so it's one big happy structure.

Change-Id: I8ac02b7142a4f6560f5f80df2effcf720f9896fc
2015-04-07 10:12:20 -07:00
Mark Salyzyn
16045614fd android_filesystem_config.h: use __BEGIN_DECLS and __END_DECLS
Change-Id: Idb050b9ef4e7947664295b173e1b09d65accd3e9
2015-04-06 14:15:58 -07:00
Tim Kilbourn
628620c7ba Allow inputflinger to have CAP_BLOCK_SUSPEND.
(Cherry picked from commit 83e6f2606b)

Resolved conflict in include/private/android_filesystem_config.h, content
already in libcutils/fs_config.c.

Change-Id: I817707721786e9b920fef14ebe836fdcd65a8606
2015-04-06 10:57:29 -07:00
Mark Salyzyn
a21c29ee81 android_filesystem_config: move fs_config to libcutils
Bug: 19908228
Change-Id: Id51c0c50eb2677824d052882f4263193a08e1402
2015-04-06 10:04:16 -07:00
Elliott Hughes
146c244613 Only Windows doesn't have %zd.
Change-Id: Ie09619df212cf7c8aa18a6d46c3e6b6ca3f478cf
2015-04-03 12:53:36 -07:00
Elliott Hughes
edc49d7b98 Just use snprintf for android_get_control_socket.
Change-Id: I3d0da03847f79c9f9b2cfd7189a07f63b17fc4a2
2015-04-02 17:42:56 -07:00
Elliott Hughes
2040031f7b Be more intention-revealing with libcutils' strlcpy.
Several people have been independently confused about when this gets
built and why over the past couple of days.

Change-Id: I2d4a02f66e24c0734327585b7d27e50a344b1e94
2015-04-02 15:39:33 -07:00
Elliott Hughes
af98efbd15 Move all libcutils tests into the gtests.
This also fixes the bug where we were always testing against the fake
strlcpy we provide for glibc/Windows rather than the Android one.

This also removes some unnecessary library dependencies.

This also builds all the cutils tests for the host (static and dynamic).

Change-Id: Icd129d5b025c0ca801be5acf31a54ecd88608df9
2015-04-02 14:25:55 -07:00
Richard Uhler
0c266ef2d7 Merge "Define atrace_* functions for both target and host." 2015-04-01 17:29:34 +00:00
Christopher Ferris
9dc41d5d34 Merge "Refactor the code." 2015-03-31 21:11:36 +00:00
Christopher Ferris
2c43cff01d Refactor the code.
The object hierarchy was confusing and convoluted. This removes
a lot of unnecessary code, and consolidates the BacktraceCurrent
and BacktraceThread code into BacktraceCurrent.

Change-Id: I01c8407d493712a48169df49dd3ff46db4a7c3ae
2015-03-31 10:51:44 -07:00
Elliott Hughes
da40c00137 Log more timing information from init.
Also make important events in init's life NOTICE rather than INFO,
and ensure that NOTICE events actually make it to the kernel log.

Also fix the logging so that if you have a printf format string
error, the compiler now catches it.

Also give messages from init, ueventd, and watchdogd distinct tags.
(Previously they'd all call themselves "init", and dmesg doesn't
include pids, so you couldn't untangle them.)

Also include the tag in SELinux messages.

Bug: 19544788
Change-Id: Ica6daea065bfdb80155c52c0b06f346a7df208fe
2015-03-28 00:25:22 -07:00
Richard Uhler
7d451ab96d Define atrace_* functions for both target and host.
This change defines atrace_* functions for the host that act as
no-ops, which makes it easier to add tracing in ART.

Change-Id: I89397e83986686a2b6a6f245c25017eb379081b1
2015-03-27 14:58:30 -07:00
Dan Albert
c6b30f376d O_CLOEXEC is O_NOINHERIT on Windows.
Change-Id: I714aa08344fa10684c99651f953834086cc162c7
2015-03-26 23:24:15 -07:00
Christopher Ferris
fc3576f675 Fix mac sdk build.
Add include files for types and functions that were not included properly.

Change-Id: I4849f5bdf535c6eec9254228cf980c30d11a5a1b
2015-03-23 21:40:30 -07:00
Dan Albert
7dfb61dcdc Move gettid() into libcutils.
Change-Id: Ic8a15036833e6d129b7998d954b804be391de399
2015-03-23 13:01:21 -07:00
Narayan Kamath
fd26252da2 Merge "Remove libzipfile." 2015-03-23 10:49:07 +00:00
Dan Stoza
ca87790cdc Merge "DO NOT MERGE Add ANativeWindow dataSpace; update graphics formats, color spaces" 2015-03-20 18:28:00 +00:00
Narayan Kamath
766adf9f31 Remove libzipfile.
No longer used and superceded by libziparchive.

Change-Id: Iafbaa5affd0ffd4de02681c8bbe32b21c523ff49
2015-03-20 17:59:51 +00:00
Eino-Ville Talvala
b93343d199 DO NOT MERGE Add ANativeWindow dataSpace; update graphics formats, color spaces
First stage of adding a new dataSpace field for ANativeWindow,
for communicating format- (and endpoint-) dependent information
about graphics buffers. For most formats, dataSpace describes the
color space of the buffer, while format describes the memory layout.

For some formats, the dataSpace may also specify that the buffer
contains depth measurements, encoded images, or other kinds of
information that is not necessarily a simple 2D image.
Rename the existing colorspace enumeration to dataspace, with an added
dataspace for depth, and sRGB gamma-corrected and linear colorspaces.

Add in a definition for Android depth point clouds as a
variable-length list of float-triplet coordinates, as the underlying
layout of buffers with format HAL_PIXEL_FORMAT_BLOB and dataSpace of
HAL_DATASPACE_DEPTH.

Also remove now-unnecessary sRGB HAL graphics formats, and remove the
alias RAW_SENSOR that was left in to ease transition to RAW16.

Cherry pick of I8797f67fb9c2b18da5975f2145303ca0bf98e62d with the
following diff to maintain source compatibility:

@@ -58,6 +58,11 @@ enum {
     HAL_PIXEL_FORMAT_RGB_565            = 4,
     HAL_PIXEL_FORMAT_BGRA_8888          = 5,

+    // Deprecated sRGB formats for source code compatibility
+    // Not for use in new code
+    HAL_PIXEL_FORMAT_sRGB_A_8888        = 0xC,
+    HAL_PIXEL_FORMAT_sRGB_X_8888        = 0xD,
+
     /*
      * 0x100 - 0x1FF
      *
@@ -189,6 +194,9 @@ enum {
      */
     HAL_PIXEL_FORMAT_RAW16 = 0x20,

+    // Temporary alias for source code compatibility; do not use in new code
+    HAL_PIXEL_FORMAT_RAW_SENSOR = HAL_PIXEL_FORMAT_RAW16,
+
     /*
      * Android RAW10 format:
      *

Change-Id: I5c5ba98b297436f950e06a181eb0ff955747680f
2015-03-19 13:19:48 -07:00
Greg Hackmann
38eb58d2a8 pixelflinger: make self-contained
pixelflinger should not be used for new projects and should be moved out
of system/core at some point.  As the first step, move all its headers
under system/core/libpixelflinger/include and update its Android.mk
files so they're not referring to the absolute system/core path anymore.

Change-Id: Idead273ab2c0450409d770f5402c4dba916192a9
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2015-03-19 12:34:35 -07:00
Elliott Hughes
3c292007c1 Remove obsolete files from fs_config's list.
Change-Id: I83716f48754de889d811d74074f9a32dc666c05e
2015-03-18 10:47:20 -07:00
Christopher Ferris
2b4a63fc6a Add variable length read to Backtrace.
Included tests for this new feature.

Changed the NULLs to nullptr in backtrace_test.

Changed UniquePtr to std::unique_ptr in backtrace_test.

Change-Id: I92375465b8f8ba84589834cc162db5915bf1be81
2015-03-17 14:56:02 -07:00
Dan Albert
c007bc3856 Revert "Revert "Create libbase.""
This reverts commit a7870d8816.
2015-03-16 10:08:46 -07:00
Nicolas Geoffray
a7870d8816 Revert "Create libbase."
Breaks internal master.

This reverts commit 98ff77204c.

Change-Id: I18dc6021cb43efff8aa88486c2d980dc2b8eedba
2015-03-16 11:07:29 +00:00
Dan Albert
98ff77204c Create libbase.
Move StringPrintf and the string based file I/O from libutils to
libbase.

Change-Id: I0297a6063874b9d92100e0dd5123fddfbda932fe
2015-03-14 16:36:18 -07:00
Elliott Hughes
c2f0ed64ce Remove unused header file.
This library no longer exists.

Change-Id: I5582b41b70691171b1ac5f2bffd623f2b2fc10e5
2015-03-14 09:28:49 -07:00
Mark Salyzyn
e79201e4cb am 4487c605: Merge changes I0ec0fe3e,I9e5fccba
* commit '4487c605eaeea2b85c8511fe915a286c3aaf4da4':
  liblog: logprint use <endian.h>
  private: Add event payload structures to android_logger.h
2015-03-04 22:44:41 +00:00
Mark Salyzyn
fa1c063feb private: Add event payload structures to android_logger.h
- common android_event_header_t
- android_event_int_t ANDROID_TYPE_INT payload
- android_log_event_int_t single ANDROID_TYPE_INT event
- android_event_long_t ANDROID_TYPE_LONG payload
- android_log_event_long_t single ANDROID_TYPE_LONG event
- android_event_string_t ANDROID_TYPE_STRING payload
- android_log_event_string_t single ANDROID_TYPE_STRING event

Change-Id: I9e5fccba38e3f230c2c4ec7dec51ed110c460f95
2015-03-04 12:48:04 -08:00
Mark Salyzyn
d851c80f0d am ae19b631: Merge "liblog: add pstore read"
* commit 'ae19b63168d1b958898180979156e2a4169ee4c2':
  liblog: add pstore read
2015-02-26 17:29:05 +00:00
Mark Salyzyn
6eef417119 liblog: add pstore read
Used to pull the Android log messages after a reboot. Adding
an ANDROID_LOG_PSTORE flag to the mode parameter in calls to
android_logger_list_alloc() and android_logger_list_alloc_time().
The side effects are that android_logger_clear() and
android_logger_list_read() will react with the user space
pstore driver. Forms a companion to the pstore console logs.

Change-Id: I7bb07b87b3bf73f059a21af3f810af37c7715b6d
2015-02-26 06:37:35 -08:00
Mark Salyzyn
f5579498d9 am 110166c1: Merge "liblog: introduce ANDROID_LOG_* flags"
* commit '110166c1dbcbe26e510ac3fdaf2e1fcc7efbcc4e':
  liblog: introduce ANDROID_LOG_* flags
2015-02-25 18:12:48 +00:00
Mark Salyzyn
2d3f38a6b8 liblog: introduce ANDROID_LOG_* flags
Move away from using POSIX open(2) flags and introduce ANDROID_LOG_* flags to
replace them. Add security by preventing random mode flags from getting into
underlying POSIX calls. ANDROID_LOG_* flags overlap POSIX O_* flag definitions.

Change-Id: Ib32bb64c287e8bf150be62242e1ba46bb37839fc
2015-02-25 17:44:18 +00:00
Narayan Kamath
f9df4b13bc am c40cf1ce: Merge "Remove useless refCounting from FileMap."
* commit 'c40cf1ce9d6910685bf2242c1db390af00684d9d':
  Remove useless refCounting from FileMap.
2015-02-24 12:56:45 +00:00
Narayan Kamath
6832a7a4e0 Remove useless refCounting from FileMap.
Nobody ever called acquire() so release() was always
equivalent to delete. Just use delete instead so that
people can use unique_ptr directly (or shared_ptr if
they really want refcounts).

Change-Id: I9e3ad5e0f6a4fcc4e02e5a2ff7ef9514fe234415
2015-02-23 15:49:43 +00:00
Andreas Gampe
f320e8e53d am ed318bff: Merge "log.h: Fix typo"
* commit 'ed318bff41c4515ca79a11afb97507a452e9fcd3':
  log.h: Fix typo
2015-02-10 16:53:30 +00:00
Mark Salyzyn
8a5198a150 am fd867303: Merge changes I420b5b8a,Ica23fe41
* commit 'fd867303861eb25bf7973739e71dc29b6356a336':
  log.h: wrap android_testLog around __android_log_is_loggable
  log.h: deprecate CONDITION
2015-02-10 16:53:24 +00:00
Mark Salyzyn
2671ffb619 am 95f7ecbd: Merge "liblog: add __android_log_is_loggable()"
* commit '95f7ecbd38df680c5295295bd2277f4b26865f1f':
  liblog: add __android_log_is_loggable()
2015-02-10 16:52:48 +00:00
Andreas Gampe
f45bbe496f log.h: Fix typo
Change-Id: I6b5e9bc9d40e5e5ecf9f50f7392675391e6f18e6
2015-02-09 16:13:33 -08:00
Mark Salyzyn
1df92e523e log.h: wrap android_testLog around __android_log_is_loggable
- take android_testLog from the bonepile and resurrect
- android_testLog is used, and makes sense in its current context
  as a holder for Android Logging policy.
- Default level when not specified is ANDROID_LOG_VERBOSE for
  eng and userdebug, and ANDROID_LOG_DEBUG for user.

NB: Properties, which are associated with __android_log_is_loggable are
not to be adjusted in user release; it would be useful at that juncture to
return a constant of (0) for VERBOSE, and a (1) for others on user builds.
Or default level to drop to ANDROID_LOG_DEBUG for all in future.

Bug: 17760225
Change-Id: I420b5b8a94d53d664c6a8b13546ebc424a147923
2015-02-09 15:37:32 -08:00
Mark Salyzyn
f5af82edf3 log.h: deprecate CONDITION
- replace CONDITION with __predict_false to match with bionic

Change-Id: Ica23fe41cf9a7ea5eaf1b8552780af9ec7827808
2015-02-09 15:25:48 -08:00
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
e6ed63e610 am c9c401e6: Merge "Move map data into backtrace data proper."
* commit 'c9c401e64ba00e8fa295cae30b2b0035fae1183a':
  Move map data into backtrace data proper.
2015-02-06 23:43:11 +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
b164b103eb am 5e753100: Merge "Clean up reading and writing in init."
* commit '5e753100c32c7b42ae4306a8023c419defd34c4e':
  Clean up reading and writing in init.
2015-02-06 22:33:18 +00: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
dcbeb41a67 am d558530b: Merge "Fix Windows build."
* commit 'd558530ba90cb6218fe8e255c71a034c3fe1ea58':
  Fix Windows build.
2015-02-05 18:51:07 +00: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
44fdd5d15a am 27d28d3b: Merge "Add a WriteStringToFile overload that cares about permissions."
* commit '27d28d3baff860d1fd936a5fcf2d920577c52575':
  Add a WriteStringToFile overload that cares about permissions.
2015-02-05 02:31:31 +00:00