Commit graph

400 commits

Author SHA1 Message Date
Nick Kralevich
7eb3abdb3b klog: don't unconditionally call mknod()
If /dev/kmsg already exists, it's unnecessary for klog_init()
to create it's own copy. This avoids needing to grant the mknod
permission to everyone who uses kmsg. Typically the only time
/dev/kmsg doesn't exist is before ueventd starts.

(cherrypicked from commit 4d32a486fe)

Bug: 21242418
Change-Id: I0c88d80feca6899fcdbc8c9f2f99448ee0a3422d
2015-05-19 15:19:25 -07:00
Adam Lesinski
07edc3b3b3 Prevent integer overflow when allocating native_handle_t
User specified values of numInts and numFds can overflow
and cause malloc to allocate less than we expect, causing
heap corruption in subsequent operations on the allocation.

Bug: 19334482
Change-Id: I43c75f536ea4c08f14ca12ca6288660fd2d1ec55
2015-05-15 13:09:39 -07:00
Dan Albert
428fad97a0 Remove libbacktrace definition of gettid.
Also simplifies the Darwin implementation of gettid, because
apparently libbacktrace had a better way of doing it.

Bug: 19517541

(cherry picked from commit 23f750b068)

Change-Id: I2f888e8ed7a2f5719973786cbcbb399a81867ee9
2015-05-13 13:44:34 -07:00
Dan Albert
cd206b3900 Fix gettid() on Windows.
Accidentally had this all hidden by an #ifndef _WIN32 when I wrote it.

Bug: 19517541

(cherry picked from commit b3a36ca5ee)

Change-Id: Ifbd5d19e506e7313700e2e29a2dae5736e049844
2015-05-13 13:43:32 -07:00
Elliott Hughes
d5ff3e9449 Remove dead code.
We weren't even building this.

Change-Id: I8b2afbc76d784a7b24bbe0be6502b9fbcf0b5c09
2015-04-21 12:24:50 -07:00
Elliott Hughes
2cba9405f9 Merge "[MIPS] Fast android_memset for Mips64, Mipsr6" 2015-04-17 02:07:32 +00:00
Duane Sand
1ef9ccd772 [MIPS] Fast android_memset for Mips64, Mipsr6
Fix broken mips64 build by replacing mips32r2-only android_memset.S.
Use HW-bonded pairs of 64-bit stores to fill 128 bits/cycle.
Rely on HW automatic cache prefetch optimizations.
Software cache prefetching is counterproductive on next mips cores.
New method is coded in C, and also works okay on non-Mips architectures.

Change-Id: Id7153a8fe11538fe25287e101375661b0e99e2a2
2015-04-16 18:26:22 -07:00
Greg Hackmann
0e2d6015bc Merge "Revert "cutils: add OS-independent endian.h"" 2015-04-16 21:29:44 +00:00
Greg Hackmann
bf7f28a415 Revert "cutils: add OS-independent endian.h"
This reverts commit c3bac8b671.
2015-04-16 14:28:58 -07:00
Greg Hackmann
88e03449de Merge "cutils: add OS-independent endian.h" 2015-04-16 20:06:40 +00:00
Yabin Cui
51e32b52a3 Merge "Move trace.h to stdatomic." 2015-04-16 18:35:43 +00:00
Greg Hackmann
c3bac8b671 cutils: add OS-independent endian.h
cutils/endian.h provides the helpers defined in endian(3), either by
pulling in the OS's built-in endian.h (where available) or recreating
them using GCC builtins.

Change-Id: Ic8965f67e1efdc03f884dbe6b7fe0276f840e4fc
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2015-04-16 11:12:02 -07:00
Yabin Cui
a8ac32c781 Move trace.h to stdatomic.
Bug: 20262261
Change-Id: Idaf984786804eb76c285f38b11abbbc0d3706509
2015-04-16 10:41:16 -07:00
Mark Salyzyn
4232b378e7 libcutils: fs_config must use O_BINARY
Bug: 19908228
Change-Id: I3273cf99b320941f9530a015c9e582af72469acb
2015-04-16 08:44:33 -07:00
Mark Salyzyn
fd5b425b6e libcutils: fs_config: winsdk_tools build fix
Bug: 19908228
Change-Id: Ia725d20ca4f8a87deec63b6c661f6a09c8671231
2015-04-16 08:32:25 -07:00
Mark Salyzyn
7977cc63b1 libcutils: drop use of mmap
- Causes a build break for MAC and Windows

Bug: 19908228
Change-Id: I9d69967aa988c9ca202805593fa846cb670101cf
2015-04-15 19:28:36 -07:00
Mark Salyzyn
5d9e5efbcd libcutils: add fs_config_generate
Bug: 19908228
Change-Id: Icb0e189a86758bb779b9bdf7c0d92216d297869f
2015-04-15 16:43:07 -07:00
Mark Salyzyn
68651148dd libcutils: fs_config read from file
Intention is to read from ${OUT}/system/etc/fs_config_dirs and
${OUT}/system/etc/fs_config_files on host. And
/system/etc/fs_config_dirs and /system/etc/config_files
on target systems.

Bug: 19908228
Change-Id: Ieaedd99e88c7f7f717878d9344c387ddf335ccbb
2015-04-15 16:43:01 -07:00
Mark Salyzyn
7e82633106 Revert "libcutils: fs_config read from file"
There is no endian.h on windows

This reverts commit 4e5f71ae72.

Change-Id: I6aedf35ed319c7f8febc7ab98e104a625fb27f69
2015-04-15 22:30:30 +00:00
Mark Salyzyn
4e5f71ae72 libcutils: fs_config read from file
Intention is to read from ${OUT}/system/etc/fs_config_dirs and
${OUT}/system/etc/fs_config_files on host. And
/system/etc/fs_config_dirs and /system/etc/config_files
on target systems.

Bug: 19908228
Change-Id: I0966a94f79a3fae4f7325056c701ea355370f9df
2015-04-15 11:22:52 -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
Mark Salyzyn
8b2c7dee59 libcutils: add fs_config
Bug: 19908228
Change-Id: I78e6a8d780e578a287ffdee7b7120ecc74797e80
2015-04-06 10:04:15 -07:00
Elliott Hughes
8193d41ea6 Fix Windows strlcpy.c build.
Change-Id: I572c553227a5a2cd57ec304de7e898d7c801fe93
2015-04-02 17:21:47 -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
Elliott Hughes
a492f3797a Move mips/mips64 android_memset16/android_memset32 into libcutils.
Change-Id: Ia826dd872f64cc80635f50525a0c393f43ae5204
2015-04-02 11:59:22 -07:00
Brian Carlstrom
60a347fc87 Fix shared version of libcutils on the host to include strlcpy
Change-Id: Ic727508d9cfadea0050d1ccc491ee61aac1ef55a
2015-04-02 00:43:45 -07:00
Dan Albert
43db1c347b Revert "Disable the static libcutils tests."
Also move them to libc++ since stlport is dead.

Bug: 18389856

This reverts commit bb28776db0.

Change-Id: Icdf9be3bc5cc40433727ff71a121b145002dda72
2015-04-01 16:45:28 -07:00
Richard Uhler
0c266ef2d7 Merge "Define atrace_* functions for both target and host." 2015-04-01 17:29:34 +00:00
Elliott Hughes
c02f81cccb Always unlink /dev/__kmsg__.
Whether the open succeeds or fails, we should unlink.

Change-Id: Ic2f1e10dc7b6d6e459c56049da00d165bd63ba8f
2015-03-28 09:51:54 -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
Richard Uhler
a0115bf78d Merge "Add make target for shared libcutils on host." 2015-03-25 15:48:42 +00:00
Richard Uhler
acb31ba905 Add make target for shared libcutils on host.
Needed by host dex2oat.

Change-Id: Ia5b53136de3d531c820f03c3f251e58418204be1
2015-03-24 14:46:01 -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
483060208c More Mac fix.
Change-Id: I7a1f726819c68eea1afb7e45f92954325f8933e1
2015-03-23 16:38:46 -07:00
Dan Albert
e308104390 Undo mac fix to fix windows, fix mac differently.
Change-Id: I7d1ee439d25e17c31c0be448e67a90a0f626ff42
2015-03-23 16:07:42 -07:00
Dan Albert
728b13f08d (Probably) fix the mac build.
Change-Id: I4209f2d66d8701df2f32dcfb79abea9ea6d3dc69
2015-03-23 14:48:05 -07:00
Dan Albert
7dfb61dcdc Move gettid() into libcutils.
Change-Id: Ic8a15036833e6d129b7998d954b804be391de399
2015-03-23 13:01:21 -07:00
Nick Kralevich
5e14f416af am 6864e673: Merge "More SOCK_CLOEXEC"
* commit '6864e6739027adf725ced33777d3e21f80a95479':
  More SOCK_CLOEXEC
2015-02-27 23:19:11 +00:00
Nick Kralevich
6d3cddb2e2 More SOCK_CLOEXEC
Change-Id: I3e18f34d08a6443aaf55d7c91c27867840ac1773
2015-02-26 13:32:52 -08:00
Narayan Kamath
d9ee5ff49f am f1ac6917: Merge "Remove loghack.h."
* commit 'f1ac6917da172dd3e6829bac41fcbf23e96da079':
  Remove loghack.h.
2015-02-21 10:15:55 +00:00
Narayan Kamath
453a332812 Remove loghack.h.
This was supposedly used to enable logging when !HAVE_ANDROID_OS
but it's only used in a file that's target specific.

Change-Id: Id83f2597e48a66b4821fc3b1237e212872b909fb
2015-02-21 09:46:31 +00:00
Andreas Gampe
dc941b5f37 am 623eebe6: Merge "Libcutils: Remove unused variable"
* commit '623eebe68f3c6c9e54cf5b186696052d2948410c':
  Libcutils: Remove unused variable
2015-02-20 01:02:45 +00:00
Andreas Gampe
7f71a45a17 Libcutils: Remove unused variable
Change-Id: I95eed017e78468c4946b2a5b62b6fe92e256673e
2015-02-19 16:54:32 -08:00
Elliott Hughes
7faec394d1 am 3bc8ae63: Merge "Use mkstemp for host ashmem."
* commit '3bc8ae63ce3bbcc0ab61def99a4e9b4822ba3f51':
  Use mkstemp for host ashmem.
2015-02-10 16:52:44 +00:00
Elliott Hughes
2004a863dc Use mkstemp for host ashmem.
Bug: 19310167
Change-Id: Ic4e32b3924a9aa0b0d095d445108cbcf2231cd91
2015-02-09 12:49:53 -08:00
Elliott Hughes
8a2634c2ab am 55732f49: Merge "android_reboot should take a const char*."
* commit '55732f49287a75f9baabe9f150443aec9234c90d':
  android_reboot should take a const char*.
2015-02-04 01:20:40 +00: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
Yabin Cui
631965a32e am e862350b: Merge "Kill HAVE_PTHREADS."
* commit 'e862350bb2eb3d3eda526da7f3b6d5c2dd40a445':
  Kill HAVE_PTHREADS.
2015-01-27 22:45:14 +00:00