summaryrefslogtreecommitdiffstats
path: root/libcutils
Commit message (Collapse)AuthorAgeFilesLines
* libcutils: abort for invalid fdMark Salyzyn2016-07-151-2/+3
| | | | | | | | | If ashmem accessors are being called with a file descriptor that belongs to anything other than ashmem, we need to stop it right now so that they can fix the caller. Bug: 26871259 Change-Id: Icf9aafc3631a80b9af6fe0fea03599d61e285d21
* libcutils: ashmem print error message for invalid fdMark Salyzyn2016-07-151-0/+14
| | | | | | | | | NB: We decided to not sniff for the constant saved __ashmem_rdev in the early error path; requiring either the use of atomic operations, or acquiring a lock to do it correctly. The heroics are not worth it. Bug: 26871259 Change-Id: I46249838850ae32063eb5b7d08c731c5bb0fbf6b
* libcutils: ashmem check fd validityMark Salyzyn2016-07-151-1/+107
| | | | | | | | | | | | | | - collect st_rdev on open, or when required, for /dev/ashmem. - check in all cases if fd is a character device and matches rdev. - requires that we have open, read and write access to /dev/ashmem to check, assumption being that if we can not, then we have no right playing with the associated misdirected file descriptor. NB: ashmem libcutil library entry points can no longer be called in signal context. Bug: 26871259 Change-Id: I9a17e33317a9be795131473a51c16f761b5f7407
* libcutils: ashmem fortify and comply with Android coding standardMark Salyzyn2016-07-152-30/+40
| | | | | | | | | | - sort header order and in groups - remove all tabs, use only spaces - use TEMP_FAILURE_RETRY in system calls - preserve errno for -1 return Bug: 26871259 Change-Id: I94fffbcaeba01fcc18a3ed07c02389c06c54d3b7
* Use fsck.f2fs -a instead of -f for faster bootYusuke Sato2016-05-051-32/+155
| | | | | | | | | | | | | | | | | | 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
* sched_policy: zero proc_name buffer before populatingScott Mertz2016-03-301-0/+1
| | | | | | | | The process name will be read into the buffer containing the proc name filepath. We need to reinitialize the buffer before reading into it. Change-Id: I67710819c895d3f9e2b0d486ab8a11f29f8318e8
* sched_policy: split add_tid_to_cgroupPat Erley2016-03-241-11/+38
| | | | | | | | | add_tid_to_cgroup was also being used to add threads to cpusets. Split this into a generic write_tid_to_fd, and wrap it for cpusets and cgroups. This lets errors align with what the actual failure is. Change-Id: I2c5c97117428a33b6a328f73741d3516d4141f78
* sched_policy: Split cpuset/cgroup initPat Erley2016-03-241-3/+18
| | | | | | | | If a task only ever touches cgroups, don't initialize cpusets. This makes logging fails for cpusets much less spammy. Change-Id: Iad9c58db68ecd2c2445255bfe5564318064949a5
* libcutils: Add process name to logsPat Erley2016-03-241-10/+22
| | | | | | | This can help resolve permissions issues for tasks that want to twiddle the perf bits but don't have permissions. Change-Id: I6285c5c38224d1fb207cb26229cd7b779a8322ac
* libcutils: make sched_policy more robustPat Erley2016-03-181-1/+45
| | | | | | | | If you compile with cpusets enabled but the permissions are wrong the behavior becomes no real policy enforced at all. Fix this by making sched_policy fall back gracefully. Change-Id: Ife96ca64b991e23232a5bd0d6c21e30a5d16bde8
* Merge tag 'android-6.0.1_r22' of ↵Steve Kondik2016-03-111-0/+6
|\ | | | | | | | | | | | | | | https://android.googlesource.com/platform/system/core into cm-13.0 Android 6.0.1 release 22 Change-Id: Ia61f8e863f7413a67fe65f41ea2a30c086528df4
| * Fix logspam from system-background cpuset.Tim Murray2015-12-171-3/+0
| | | | | | | | | | | | | | | | | | | | | | system-background can't be opened by most processes, since system-bg is a privileged cpuset. Remove the log message when it can't be opened. We'll still log a failure to use the fd if we try to use it after it can't be opened, which is fine. bug 26249842 Change-Id: I99f185c51645bc81b6a41732848227c27675cdf7
| * Improve cpuset support for surfaceflinger.Tim Murray2015-11-181-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | SurfaceFlinger needs some of its threads in the system-background cpuset and some of its threads (the binder pool) outside of the system-background cpuset in order to improve UI perf/power consumption. Remove surfaceflinger from the system-background cpuset in init.rc and allow a thread to place itself in the system-background cpuset given enough permissions. bug 25745866 Change-Id: I85f7e41c5439e6ad7cc2d355e51f5dfb3a0c7088
* | set /system/etc/init.d/* permissionsMichaël Burtin2015-11-071-0/+1
| | | | | | | | | | | | | | | | ported from CM7 * moved to fs_config.c in 6.0 Change-Id: I279d78679f7d779d6cd6bbc6c834d94706937ae8
* | Update permissions to the superuser binaryRicardo Cerqueira2015-10-291-1/+2
| | | | | | | | Change-Id: Ia382c74854cfbe625653b8b6b016b37f93132658
* | cutils: Add support for ioprio cgroupSteve Kondik2015-10-121-12/+89
|/ | | | Change-Id: I335816304573149c1d96c5e6ea804a49e7695996
* fs_config: replace getenv('OUT') by new fs_config parameterThierry Strudel2015-07-091-6/+13
| | | | | | | | | | | | | | Using a getenv('OUT') in such a deep down function is a wrong design choice. Replacing with explicit parameter that may be NULL in case device specific files can be accessed from /. Since TARGET_COPY_OUT_SYSTEM may be defined to something different than system we also ensure that we use a path relative to TARGET_OUT to compute path to fs_config_* files. Bug: 21989305 Bug: 22048934 Change-Id: Id91bc183b29beac7379d1117ad83bd3346e6897b Signed-off-by: Thierry Strudel <tstrudel@google.com>
* Merge "Fix janky navbar ripples -- incorrect timerslack values" into mnc-devTodd Kjos2015-06-291-1/+3
|\
| * Fix janky navbar ripples -- incorrect timerslack valuesTodd Kjos2015-06-251-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a thread is created while the parent thread is "Background", then the default timerslack value gets set to the current timerslack value of the parent (40ms). The default value is used when transitioning to "Foreground" -- so the effect is that the timerslack value becomes 40ms regardless of foreground/background. This does occur intermittently for systemui when creating its render thread (pretty often on hammerhead and has been seen on shamu). If this occurs, then some systemui animations like navbar ripples can wait for up to 40ms to draw a frame when they intended to wait 3ms -- jank. This fix is to explicitly set the foreground timerslack to 50us. A consequence of setting timerslack behind the process' back is that any custom values for timerslack get lost whenever the thread has transition between fg/bg. See Bug: 19398120 Change-Id: Idc259717f62fa2255f8bafbbf88b68c0043f29cf
* | Don't set cgroup policy when updating cpusets.Tim Murray2015-06-221-4/+1
|/ | | | | | bug 21782794 Change-Id: I3b2cf8ae4f3ed0c14f206584ae7fa2b1a1d11ad0
* add cpuset support to libcutilsTim Murray2015-06-112-31/+92
| | | | | | bug 21782794 Change-Id: I249531754fb29442dc3c7434d77dbb103f4220a7
* Don't use TEMP_FAILURE_RETRY on close in system/core.Elliott Hughes2015-05-271-3/+3
| | | | | | Bug: http://b/20501816 Change-Id: I1839b48ee4f891b8431ecb809e37a4566a5b3e50 (cherry picked from commit 47b0134ec2b5e8c8b5b5671cd4a3e41261275532)
* klog: don't unconditionally call mknod()Nick Kralevich2015-05-191-0/+5
| | | | | | | | | | | | 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 4d32a486fe62ef2c1440167604654a2f4e023fbd) Bug: 21242418 Change-Id: I0c88d80feca6899fcdbc8c9f2f99448ee0a3422d
* Prevent integer overflow when allocating native_handle_tAdam Lesinski2015-05-151-2/+8
| | | | | | | | | 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
* Remove libbacktrace definition of gettid.Dan Albert2015-05-131-6/+1
| | | | | | | | | | | Also simplifies the Darwin implementation of gettid, because apparently libbacktrace had a better way of doing it. Bug: 19517541 (cherry picked from commit 23f750b068ddf5b20fb5d153a798b22562368992) Change-Id: I2f888e8ed7a2f5719973786cbcbb399a81867ee9
* Fix gettid() on Windows.Dan Albert2015-05-131-21/+21
| | | | | | | | | | Accidentally had this all hidden by an #ifndef _WIN32 when I wrote it. Bug: 19517541 (cherry picked from commit b3a36ca5ee79411c18984b85b224d9285b4468af) Change-Id: Ifbd5d19e506e7313700e2e29a2dae5736e049844
* Remove dead code.Elliott Hughes2015-04-211-335/+0
| | | | | | We weren't even building this. Change-Id: I8b2afbc76d784a7b24bbe0be6502b9fbcf0b5c09
* Merge "[MIPS] Fast android_memset for Mips64, Mipsr6"Elliott Hughes2015-04-173-325/+96
|\
| * [MIPS] Fast android_memset for Mips64, Mipsr6Duane Sand2015-04-163-325/+96
| | | | | | | | | | | | | | | | | | | | 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
* | Merge "Revert "cutils: add OS-independent endian.h""Greg Hackmann2015-04-162-61/+0
|\ \
| * | Revert "cutils: add OS-independent endian.h"Greg Hackmann2015-04-162-61/+0
| | | | | | | | | | | | This reverts commit c3bac8b6719332f31140b2a034b70cf7f9eb3e51.
* | | Merge "cutils: add OS-independent endian.h"Greg Hackmann2015-04-162-0/+61
|\ \ \ | |/ /
| * | cutils: add OS-independent endian.hGreg Hackmann2015-04-162-0/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Merge "Move trace.h to stdatomic."Yabin Cui2015-04-162-8/+8
|\ \ \ | |/ / |/| |
| * | Move trace.h to stdatomic.Yabin Cui2015-04-162-8/+8
| | | | | | | | | | | | | | | Bug: 20262261 Change-Id: Idaf984786804eb76c285f38b11abbbc0d3706509
* | | libcutils: fs_config must use O_BINARYMark Salyzyn2015-04-161-2/+6
| | | | | | | | | | | | | | | Bug: 19908228 Change-Id: I3273cf99b320941f9530a015c9e582af72469acb
* | | libcutils: fs_config: winsdk_tools build fixMark Salyzyn2015-04-161-1/+1
| |/ |/| | | | | | | Bug: 19908228 Change-Id: Ia725d20ca4f8a87deec63b6c661f6a09c8671231
* | libcutils: drop use of mmapMark Salyzyn2015-04-151-45/+30
| | | | | | | | | | | | | | - Causes a build break for MAC and Windows Bug: 19908228 Change-Id: I9d69967aa988c9ca202805593fa846cb670101cf
* | libcutils: add fs_config_generateMark Salyzyn2015-04-151-0/+21
| | | | | | | | | | Bug: 19908228 Change-Id: Icb0e189a86758bb779b9bdf7c0d92216d297869f
* | libcutils: fs_config read from fileMark Salyzyn2015-04-151-12/+141
| | | | | | | | | | | | | | | | | | | | 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
* | Revert "libcutils: fs_config read from file"Mark Salyzyn2015-04-151-125/+12
|/ | | | | | | | There is no endian.h on windows This reverts commit 4e5f71ae727c5993db05d0024da026bf68eabc59. Change-Id: I6aedf35ed319c7f8febc7ab98e104a625fb27f69
* libcutils: fs_config read from fileMark Salyzyn2015-04-151-12/+125
| | | | | | | | | | 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
* android_filesystem_config: move fs_config to libcutilsMark Salyzyn2015-04-061-11/+0
| | | | | Bug: 19908228 Change-Id: Id51c0c50eb2677824d052882f4263193a08e1402
* libcutils: add fs_configMark Salyzyn2015-04-062-0/+146
| | | | | Bug: 19908228 Change-Id: I78e6a8d780e578a287ffdee7b7120ecc74797e80
* Fix Windows strlcpy.c build.Elliott Hughes2015-04-021-2/+1
| | | | Change-Id: I572c553227a5a2cd57ec304de7e898d7c801fe93
* Be more intention-revealing with libcutils' strlcpy.Elliott Hughes2015-04-022-20/+8
| | | | | | | Several people have been independently confused about when this gets built and why over the past couple of days. Change-Id: I2d4a02f66e24c0734327585b7d27e50a344b1e94
* Move all libcutils tests into the gtests.Elliott Hughes2015-04-025-90/+96
| | | | | | | | | | | 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
* Move mips/mips64 android_memset16/android_memset32 into libcutils.Elliott Hughes2015-04-024-73/+327
| | | | Change-Id: Ia826dd872f64cc80635f50525a0c393f43ae5204
* Fix shared version of libcutils on the host to include strlcpyBrian Carlstrom2015-04-021-1/+1
| | | | Change-Id: Ic727508d9cfadea0050d1ccc491ee61aac1ef55a
* Revert "Disable the static libcutils tests."Dan Albert2015-04-011-17/+15
| | | | | | | | | | Also move them to libc++ since stlport is dead. Bug: 18389856 This reverts commit bb28776db0f5a107ef2b90ff1322f4c06b6cc7de. Change-Id: Icdf9be3bc5cc40433727ff71a121b145002dda72