This routine allows creating a contiguous mspace from raw mapped memory.
In turn, this will enable preallocation of the 3 heap spaces, which will help
remembered sets and zygote/app checks given pointer values.
POSIX seems to have chosen open_memstream() over the BSD variant. We
want something for Dalvik that will work on both GNU/Linux and Android,
so this is open_memstream() implemented in terms of BSD funopen().
For Windows there's just a stub that calls abort().
I'm putting this in libcutils since it seems inappropriate for bionic
(which provides the BSD alternatives) but isn't Dalvik-specific.
Merge commit 'f95837a1e13c9b63bfe0b0f95f00ec0d72ba2e74'
* commit 'f95837a1e13c9b63bfe0b0f95f00ec0d72ba2e74':
system: sched_policy: Don't return an error when the thread we're trying to move exits on us
Merge commit 'cf9f442ef336d4fb6300318a3137b23a4697e048' into eclair-mr2-plus-aosp
* commit 'cf9f442ef336d4fb6300318a3137b23a4697e048':
system: sched_policy: Don't return an error when the thread we're trying to move exits on us
Merge commit '9fdf607c20f9610e442baa87cac5479c98f9d200'
* commit '9fdf607c20f9610e442baa87cac5479c98f9d200':
cutils: make set_process_name set kernel thread name as well
Merge commit 'b63747d4d9d2e26c90a5310c996210e722159d04' into eclair-mr2-plus-aosp
* commit 'b63747d4d9d2e26c90a5310c996210e722159d04':
cutils: make set_process_name set kernel thread name as well
Merge commit '525fb03e18f9b08651e3d8abb262d70c3482b405'
* commit '525fb03e18f9b08651e3d8abb262d70c3482b405':
cutils: sched_policy: Fix bug where we were unable to move backgrounded threads into the foreground
Merge commit '58e50f80307577268ecb6b86aa97236e008a9aa0' into eclair-mr2-plus-aosp
* commit '58e50f80307577268ecb6b86aa97236e008a9aa0':
cutils: sched_policy: Fix bug where we were unable to move backgrounded threads into the foreground
Merge commit '38b2ddc4a7cf1c47397af118a6d466d45f59da04'
* commit '38b2ddc4a7cf1c47397af118a6d466d45f59da04':
cutils: Add support for reading a processes scheduler policy
Merge commit '17bfbd3ccbb798aa4068cd59150ce712660a62a4' into eclair-mr2-plus-aosp
* commit '17bfbd3ccbb798aa4068cd59150ce712660a62a4':
cutils: Add support for reading a processes scheduler policy
Merge commit '62f39c105af8789fd9308fa6a5b91f0963a7c59b'
* commit '62f39c105af8789fd9308fa6a5b91f0963a7c59b':
adb: Add "adb disconnect" command for disconnecting TCP/IP devices.
Add support for Acer devices
adb: Add USB Vendor IDs for LG and Huawei
Add NOTICE file and license tag for adb
adb: Clean up argument passing for create_service_thread()
Revert "adb: Another attempted workaround for the adb disconnect problem."
libsysutils: Fix some bugs in NetlinkListener and NetlinkEvent
added SuperH atomic support to libcutils
This introduces a new HAVE_SCHED_H arch define, which is used
to prevent from building sched_policy.c during the Windows SDK.
Change-Id: I3667857a4ae7d6baaf1efd1cd187a5baf91419d8
The problem is that time_t is signed, and the original code relied on the
fact that (X + c < X) in case of overflow for c >= 0. Unfortunately, this
condition is only guaranteed by the standard for unsigned arithmetic, and
the gcc 4.4.0 optimizer did completely remove the corresponding test from
the code. This resulted in a missing boundary check, and an infinite loop.
The problem is solved by testing explicitely for TIME_T_MIN and TIME_T_MAX
in the loop that uses this.
Also fix increment_overflow and long_increment_overflow which were buggy
for exactly the same reasons.
Also remove some compiler warnings.
Note: a similar fix was performed in bionic/libc
ARMv6 onwards. These architectures provide the load-linked, store-conditional pair of ldrex/strex whose use
is recommended in place of 'swp'. Also, the description of the 'swp' instruction in the ARMv6 reference
manual states that the swap operation does not include any memory barrier guarantees.This fix attempts to
address these issues by providing an atomic swap implementation using ldrex/strex under _ARM_HAVE_LDREX_STREX
macro. _ARM_HAVE_LDREX_STREX macro is defined in cpu-features.h file and patch is submitted under change ID 11088.
This Fix is verified on ST Ericsson's U8500 platform and Submitted on behalf of a third-party:
Surinder-pal SINGH from STMicroelectronics.
This is needed by the MemoryFile changes in
https://android-git.corp.google.com/g/2714
where it is used to find out whether a file descriptor
refers to an ashmem region.
asocket_connect()
asocket_accept()
asocket_read()
asocket_write()
These calls are similar to the regular syscalls, but can be aborted with:
asocket_abort()
Calling close() on a regular POSIX socket does not abort blocked syscalls on
that socket in other threads.
After calling asocket_abort() the socket cannot be reused.
Call asocket_destory() *after* all threads have finished with the socket to
finish closing the socket and free the asocket structure.
The helper is implemented by setting the socket non-blocking to initiate
syscalls connect(), accept(), read(), write(), then using a blocking poll()
on both the primary socket and a local pipe. This makes the poll() abortable
by writing a byte to the local pipe in asocket_abort().
asocket_create() sets the fd to non-blocking mode. It must not be changed to
blocking mode.
Using asocket will triple the number of file descriptors required per
socket, due to the local pipe. It may be possible to use a global pipe per
process rather than per socket, but we have not been able to come up with a
race-free implementation yet.
All functions except asocket_init() and asocket_destroy() are thread safe.