Commit graph

791 commits

Author SHA1 Message Date
Vernon Tang
8405ec0e75 Fold uevent message origin checking from init into libcutils.
Change-Id: I1a38e611a7ad990f74306ce453740a1eeed2416d
2011-04-27 14:17:15 +10:00
Dima Zavin
0fad7d023f libcutils: add a simple string parameter parsing ("a=b;c=d;") helper utils
Change-Id: Ifabeb75550fa6e351434e6e6d036b19331daf6c1
Signed-off-by: Dima Zavin <dima@android.com>
2011-04-20 19:04:40 -07:00
Dima Zavin
4fab9ac04e libcutils: hashmap: save next pointer in forEach before calling callback
If the callback passed to forEach tries to remove the element it was passed,
there's a use-after-free of the entry pointer in forEach.

Change-Id: Ia364b4775c9c55780b23f683b30cbff511b7f944
Signed-off-by: Dima Zavin <dima@android.com>
2011-04-19 15:16:18 -07:00
satok
f0a670eb12 do not merge. Fix a race in system properties.
Backport Iee1ca9b7defd6

This now passes:

$ adb shell am instrument -w -e class android.os.SystemPropertiesTest \
  com.android.frameworks.coretests.systemproperties/android.test.InstrumentationTestRunner

  (which tests setting and re-reading back system properties in a loop)

  This patch depends on I110b653a which moves property setting
  from libcutils into bionic.

  Bug: 3511230

Change-Id: I145e642bd13079677017bb64e361e176fc73b810
2011-03-15 23:15:02 -07:00
Brad Fitzpatrick
7cf20f925d Merge "Fix a race in system properties." 2011-03-14 17:09:36 -07:00
Ken Sumrall
e3aeeb4de3 Try to unmount writable filesystems when rebooting
Ext4 filesystems like to be unmounted before rebooting.  The Android system
doesn't have a traditional Linux init setup, and shutting down the system
was not much more than calling sync(2) and reboot(2).  This adds a new
function to libcutils called android_reboot().  By default, it calls sync()
and then remounts all writable filesystems as read-only and marks them clean.
There is a flag parameter in which the caller can ask for sync() not to be
called, or to not remount the filesystems as read-only.  Then it will call
reboot(2) as directed by the other parameters.  This change also updates
adb, init and toolbox to call the new android_reboot() function.
Fixes bugs 3350709 and 3495575.

Change-Id: I16d71ffce3134310d7a260f61ec6f4dd204124a7
2011-03-10 18:11:46 -08:00
Brad Fitzpatrick
eb1f0c6fd1 Fix a race in system properties.
This now passes:

$ adb shell am instrument -w -e class android.os.SystemPropertiesTest \
  com.android.frameworks.coretests.systemproperties/android.test.InstrumentationTestRunner

(which tests setting and re-reading back system properties in a loop)

This patch depends on I110b653a which moves property setting
from libcutils into bionic.

Bug: 3511230
Change-Id: Iee1ca9b7defd6060510a01f40fbe63ba4c96eb8d
2011-03-10 16:00:48 -08:00
Carl Shapiro
0a16d83969 Remove unconditional swap from the android atomic operations suite.
Bug: 3381237
Change-Id: I7bdc7c8eb4c1cc6303d96e40ca2f196a007c4dd2
2011-01-23 14:09:17 -08:00
Lu, Hongjiu
bb12ac9b85 Assembly coded android_memset16 and android_memset32
Change-Id: Ife2dd406e1dcb962e5e97788c515ac96f5c52e44
2011-01-07 11:26:34 -08:00
Bruce Beare
d7a295221a Assembly coded android_memset16 and android_memset32
Change-Id: Ifa05006df7ce7364d18eb10d64a818d619664475
Author: Lu, Hongjiu <hongjiu.lu@intel.com>
Signed-off-by: Mark Gross <mark.gross@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2011-01-02 17:00:09 -08:00
Carl Shapiro
d55f0adfb5 Qualify the source argument of atomic loads as a const pointer.
Also normalizes the opening brace placment in a few locations.

Change-Id: I8f518e933094337d5d3371321326ffc03b3a5f5a
2010-09-28 14:06:00 -07:00
Jesse Wilson
7ab237f1ef Including dl heap stubs for the dalvikvm host build
Change-Id: I9d0ce98d433f71db25c58bf464ec9317552cfae6
2010-08-18 21:23:13 -07:00
Brian Carlstrom
f2af88e81a Tracking merge of dalvik-dev to gingerbread
git cherry-pick --no-commit b99a099c
git cherry-pick --no-commit 9811671e02
git cherry-pick --no-commit d0645bf0cc

Change-Id: Ie70fecaeaba97a25f114cd2717e381b5107533b1
2010-08-04 15:45:52 -07:00
Carl Shapiro
93b0cb40c1 Define inline atomic operations for x86 and ARM.
This change moves the ARM definitions into GCC extended inline
assembler.  In addition, the same set of x86 definitions are now
shared among all x86 targets.

Change-Id: I6e5aa3a413d0af2acbe5d32994983d35a01fdcb3
2010-06-23 12:51:26 -07:00
Andy McFadden
8dfa47da8c Atomic/SMP update, part 2.
Added new atomic functions, renamed some old ones.  Some #defines have
been added for backward compatibility.

Merged the pre- and post-ARMv6 implementations into a single file.

Renamed the semi-private __android_membar_full_smp to USE_SCREAMING_CAPS
since that's more appropriate for a macro.

Added lots of comments.

Note Mac OS X primitives have not been tested.

Change-Id: If827260750aeb61ad5c2b760e30658e29dbb26f2
2010-05-27 15:29:38 -07:00
Andy McFadden
ac322da69e Atomic/SMP update.
Added atomic-inline.h.  Added a platform-specific memory barrier call
there.

Added android_atomic_acquire_cmpxchg() and android_atomic_release_store().
Not tested on Mac OS X or SH.

Added memory barrier calls to linux-x86 atomics.  Mac OS X has barrier
functions already.  sh isn't really SMP-ready.  linux-arm needs work
(to be done in a separate change).

Updated the makefile to make the SMP state visible to the code here.
Note that host binaries are NOT built with SMP enabled; while our hosts
are very likely SMP, it's not worth figuring out e.g. whether it's okay
to use the SSE2 mfence instruction or have to use something else.  We
haven't had barriers enabled in host tools before, so there's probably
no need to stat now.

Removed quasiatomic 64-bit calls (now part of Dalvik).

Change-Id: I49e5e6c8abe70f304cdedb9d7b8e6e65f8925815
2010-05-20 21:40:33 -07:00
Brad Fitzpatrick
86b121523d fix windows SDK build
Change-Id: I2c563b20197803cafa91214aeff2c06fc0c75580
2010-05-08 11:51:13 -07:00
Brad Fitzpatrick
e43c248316 More fixes to Binder perf regression from Eclair
Re-use the file descriptor to change the cgroups.  There's a fast path
in the kernel for the case where the value's already uncahnged.  Also,
this is okay because the kernel ignores the write offset.  This is
essentially a ioctl-ish/datagram interface, despite being a fd we're
writing to.

This reduces Dalvik->Dalvik void/void Binder calls on Sapphire from
~1.2 to ~0.8 ms.  This is a bit slower than the ~0.7 ms we get
avoiding the write altogether.

strace confirms:

[pid  1557] ioctl(21, 0xc0186201 <unfinished ...>
[pid  1556] <... ioctl resumed> , 0x45399cd0) = 0
[pid  1556] write(22, "1556", 4)        = 4
[pid  1556] ioctl(21, 0xc0186201 <unfinished ...>
[pid  1555] <... ioctl resumed> , 0x45299cd0) = 0
[pid  1555] write(22, "1555", 4)        = 4
[pid  1555] ioctl(21, 0xc0186201 <unfinished ...>
[pid  1554] <... ioctl resumed> , 0x45199cd0) = 0
[pid  1554] write(22, "1554", 4)        = 4

BUG=2660235

Change-Id: Ia9f9e1d5b792eaebc9560f89931faf6df0cf9c0d
2010-05-07 15:57:44 -07:00
Brad Fitzpatrick
253e27acb6 Optimize set_sched_policy(), which gets called in every binder call.
- use static /dev/cpuctl filenames, rather than sprintf() on the fly
- use a custom formatter instead of sprintf() for the tid number

This is a simplified version of Dan's original
Ifc9c81f74fe65f0695ead53b30194bc6adf00da0 to be less risky for Froyo.

Bug: 2660235
Change-Id: I744bbc2ec01fd2569612c814a497df40a933b622
2010-05-06 11:14:09 -07:00
San Mehat
7e8529a8b5 system/core: Switch libsysutils & sched_policy LOG -> SLOG
Change-Id: Id74c6895a8012c5915f2e259339101844de7c085
Signed-off-by: San Mehat <san@google.com>
2010-03-25 09:31:42 -07:00
San Mehat
503df20759 cutils: sched_policy: Make getSchedulerGroup() play nicely with multiple control groups
Signed-off-by: San Mehat <san@google.com>
2010-03-02 17:09:56 -08:00
San Mehat
85cf56892d cutils: schedpolicy: remove stray include
Signed-off-by: San Mehat <san@google.com>
2010-02-26 11:45:27 -08:00
San Mehat
e2fe261d1a cutils: iosched_policy: Don't do anything for simulator
Signed-off-by: San Mehat <san@google.com>
2010-02-26 11:02:31 -08:00
San Mehat
10d469bff9 system: Add support for getting/setting i/o priorities and include a userspace tool
Signed-off-by: San Mehat <san@google.com>
2010-02-25 14:02:55 -08:00
Barry Hayes
2dcf1fb9ff Merge "Break out create_contiguous_mspace_with_base 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." 2010-02-08 20:46:41 -08:00
Barry Hayes
b17772dcc8 Break out create_contiguous_mspace_with_base
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.
2010-01-26 13:35:20 -08:00
Andy McFadden
fe5684ef3a Try to fix Mac build.
Throwing in an include of <unistd.h> and <sys/types.h> to get off_t
defined.  Might work.
2010-01-26 09:30:02 -08:00
Andy McFadden
cf63d5d00f Implementation of open_memstream().
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.
2010-01-25 15:06:03 -08:00
Barry Hayes
8cd186d9e0 Fix bogus pointer math. 2009-12-10 13:26:00 -08:00
San Mehat
d7dbd7b78a am f95837a1: am cf9f442e: am c1c38dd0: system: sched_policy: Don\'t return an error when the thread we\'re trying to move exits on us
Merge commit 'f95837a1e13c9b63bfe0b0f95f00ec0d72ba2e74'

* commit 'f95837a1e13c9b63bfe0b0f95f00ec0d72ba2e74':
  system: sched_policy: Don't return an error when the thread we're trying to move exits on us
2009-12-04 04:22:14 -08:00
Doug Kwan
092799072f Add missing symbol type directives. 2009-12-03 17:20:58 -08:00
San Mehat
f95837a1e1 am cf9f442e: am c1c38dd0: 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
2009-12-03 16:38:09 -08:00
San Mehat
c1c38dd01c system: sched_policy: Don't return an error when the thread we're trying to move exits on us
Signed-off-by: San Mehat <san@google.com>
2009-12-03 12:19:12 -08:00
Erik Gilling
ac61a69b23 am 9fdf607c: am b63747d4: am f6eba8fa: cutils: make set_process_name set kernel thread name as well
Merge commit '9fdf607c20f9610e442baa87cac5479c98f9d200'

* commit '9fdf607c20f9610e442baa87cac5479c98f9d200':
  cutils: make set_process_name set kernel thread name as well
2009-11-05 15:52:30 -08:00
Erik Gilling
9fdf607c20 am b63747d4: am f6eba8fa: 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
2009-11-05 15:46:45 -08:00
Erik Gilling
f6eba8fac8 cutils: make set_process_name set kernel thread name as well
Signed-off-by: Erik Gilling <konkers@android.com>
2009-11-05 12:26:56 -08:00
San Mehat
1c2ce696c8 am 525fb03e: am 58e50f80: am 805d67ab: cutils: sched_policy: Fix bug where we were unable to move backgrounded threads into the foreground
Merge commit '525fb03e18f9b08651e3d8abb262d70c3482b405'

* commit '525fb03e18f9b08651e3d8abb262d70c3482b405':
  cutils: sched_policy: Fix bug where we were unable to move backgrounded threads into the foreground
2009-10-29 20:12:21 -07:00
San Mehat
f15b4ef688 am 748cb49e: am cc43ee42: am d2e4e46c: cutils: schedpolicy: Add debug code to log sched policy transitions
Merge commit '748cb49e0049e0f504137a4930ec8502affbb03a'

* commit '748cb49e0049e0f504137a4930ec8502affbb03a':
  cutils: schedpolicy: Add debug code to log sched policy transitions
2009-10-29 20:09:33 -07:00
San Mehat
525fb03e18 am 58e50f80: am 805d67ab: 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
2009-10-29 19:52:46 -07:00
San Mehat
748cb49e00 am cc43ee42: am d2e4e46c: cutils: schedpolicy: Add debug code to log sched policy transitions
Merge commit 'cc43ee42acc3df89f584c670c4287e25808f23b2' into eclair-mr2-plus-aosp

* commit 'cc43ee42acc3df89f584c670c4287e25808f23b2':
  cutils: schedpolicy: Add debug code to log sched policy transitions
2009-10-29 19:52:40 -07:00
San Mehat
805d67ab11 cutils: sched_policy: Fix bug where we were unable to move backgrounded threads into the foreground
Signed-off-by: San Mehat <san@google.com>
2009-10-29 13:56:26 -07:00
San Mehat
d2e4e46ce4 cutils: schedpolicy: Add debug code to log sched policy transitions
Signed-off-by: San Mehat <san@google.com>
2009-10-29 11:50:01 -07:00
San Mehat
5f64815d8a am 38b2ddc4: am 17bfbd3c: am c0dfca7a: cutils: Add support for reading a processes scheduler policy
Merge commit '38b2ddc4a7cf1c47397af118a6d466d45f59da04'

* commit '38b2ddc4a7cf1c47397af118a6d466d45f59da04':
  cutils: Add support for reading a processes scheduler policy
2009-10-28 23:50:51 -07:00
San Mehat
38b2ddc4a7 am 17bfbd3c: am c0dfca7a: 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
2009-10-28 11:52:39 -07:00
San Mehat
c0dfca7ae1 cutils: Add support for reading a processes scheduler policy
Signed-off-by: San Mehat <san@google.com>
2009-10-27 12:27:42 -07:00
Ben Cheng
21ec779abe Add stack unwinding directives to atomic-android-arm.S.
For bug 2182296.

Eclair branch Dr. No approved by: hiroshi
2009-10-21 10:47:31 -07:00
Jean-Baptiste Queru
573463c31c am 62f39c10: merge from open-source master
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
2009-10-14 16:12:21 -07:00
Jean-Baptiste Queru
62f39c105a merge from open-source master 2009-10-14 16:02:20 -07:00
Jean-Baptiste Queru
b029e92428 merge from open-source master 2009-10-14 08:19:24 -07:00
Ben Cheng
afdf977b8d am 22f9d880: am 8a0a5274: Add stack unwinding directives to atomic-android-arm.S.
Merge commit '22f9d880941cf1db87fd19437bce71420eedf8bd'

* commit '22f9d880941cf1db87fd19437bce71420eedf8bd':
  Add stack unwinding directives to atomic-android-arm.S.
2009-10-13 17:06:10 -07:00
Ben Cheng
22f9d88094 am 8a0a5274: Add stack unwinding directives to atomic-android-arm.S.
Merge commit '8a0a5274ff37cbf3acad0199735a05e5fe3b5c9d' into eclair-mr2-plus-aosp

* commit '8a0a5274ff37cbf3acad0199735a05e5fe3b5c9d':
  Add stack unwinding directives to atomic-android-arm.S.
2009-10-13 09:58:49 -07:00
Ben Cheng
8a0a5274ff Add stack unwinding directives to atomic-android-arm.S. 2009-10-12 16:51:23 -07:00
Elliott Hughes
67a2ea3dea Now all the callers are gone, remove adb_networking.*.
(This is the final patch removing adb networking.)

Bug: 1122968
2009-10-02 13:29:47 -07:00
Android Code Review
808c89e120 Merge change 10445
* changes:
  added SuperH atomic support to libcutils
2009-09-17 14:04:33 -07:00
Raphael
554c0f351b am 05647c89: Merge change 25170 into eclair
Merge commit '05647c89ef330c8d3fbc3504ecb5f29db89c84fd' into eclair-plus-aosp

* commit '05647c89ef330c8d3fbc3504ecb5f29db89c84fd':
  Disable sched_policy under Windows.
2009-09-17 08:42:38 -07:00
Raphael
0384a98d6f Disable sched_policy under Windows.
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
2009-09-15 17:10:17 -07:00
Jean-Baptiste Queru
3e42572835 merge from open-source master 2009-09-15 07:52:20 -07:00
San Mehat
3cd5b66ba0 libcutils: Dont include kernel header + add defines
Signed-off-by: San Mehat <san@google.com>
2009-09-14 16:05:51 -07:00
San Mehat
493dad9663 libcutils: Add abstracted support for setting scheduler policies
Also changes the background policy to use SCHED_BATCH. IDLEPRIO
can cause 100% starvation.

Signed-off-by: San Mehat <san@google.com>
2009-09-12 10:48:03 -07:00
David 'Digit' Turner
833ea8d502 Fix an infinite loop in time2sub.
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
2009-09-09 18:32:07 -07:00
Vinay HARUGOP
02608475ed ARM architecture reference manuals for ARMv6 & ARMv7 state that the use of 'swp' instruction is deprecated
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.
2009-09-10 00:34:35 +05:30
Mathias Agopian
ca5e0bc3fe android_atomic_write() implementation was using cmpxchg which was useless 2009-09-03 16:31:37 -07:00
Shin-ichiro KAWASAKI
c6af9114fc added SuperH atomic support to libcutils 2009-08-04 19:14:22 +09:00
Jean-Baptiste Queru
96d58f4f52 Merge korg/donut into korg/master 2009-07-25 18:07:41 -07:00
Mathias Agopian
af20325a45 Merge commit 'goog/master' into merge_master 2009-06-05 15:45:43 -07:00
Android (Google) Code Review
baf83e0250 am 3f627205: Merge change 2875 into donut
Merge commit '3f6272056275a00c30c07394d63bbe81cc9c5eba'

* commit '3f6272056275a00c30c07394d63bbe81cc9c5eba':
  Added ashmem_get_size_region() function.
2009-06-02 05:30:08 -07:00
Bjorn Bringert
7be52b1a0e Added ashmem_get_size_region() function.
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.
2009-06-02 00:55:30 +01:00
Nick Pelly
fa5bf90831 Fix bug where ECONNABORTED would have always occured on asocket_write.
Use POLLOUT for writes. Duh.
2009-05-29 16:10:22 -07:00
Nick Pelly
260f48a917 Helper to perform abortable blocking operations on a socket:
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.
2009-05-29 16:10:16 -07:00
Mathias Agopian
1edfd382ba Merge commit 'goog/master' into merge_master 2009-05-27 14:25:54 -07:00
Raphael
f3cdf37276 Don't compile abort_socket.c for host targets. It is only intended to run on Linux targets. 2009-05-26 13:23:23 -07:00
Android (Google) Code Review
4cd6e915e5 Merge change 2329
* changes:
  Fix bug where ECONNABORTED would have always occured on asocket_write.
2009-05-22 09:30:24 -07:00
Nick Pelly
111bfcefc3 Fix bug where ECONNABORTED would have always occured on asocket_write.
Use POLLOUT for writes. Duh.
2009-05-22 09:09:34 -07:00
Mathias Agopian
67667115c5 merge master to master_gl 2009-05-22 01:08:01 -07:00
Mathias Agopian
3fc51ba17d move native_handle stuff from master_gl 2009-05-20 17:22:13 -07:00
Nick Pelly
92a7541bce Helper to perform abortable blocking operations on a socket:
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.
2009-05-20 15:20:30 -07:00
Mathias Agopian
8f13782e7b move native_handle stuff from master_gl 2009-05-20 14:51:48 -07:00
David 'Digit' Turner
34c22c5ba9 am 414ff7d9: Move fdevent from libcutils into adb directory. ADB is the only client of this API, and I intend to modify it extensively to clean its codebase soon.
Merge commit '414ff7d98ac8d7610a26206335954ad15f43f3ac'

* commit '414ff7d98ac8d7610a26206335954ad15f43f3ac':
  Move fdevent from libcutils into adb directory. ADB is the only client of this API, and I intend to modify it extensively to clean its codebase soon.
2009-05-18 08:37:02 -07:00
David 'Digit' Turner
414ff7d98a Move fdevent from libcutils into adb directory. ADB is the only client of this API, and I intend to modify it extensively to clean its codebase soon. 2009-05-18 17:07:46 +02:00
Eric Fischer
035b427c70 am 722a5c04: Add support for "standalone months" to tztime\'s strftime().
Merge commit '722a5c0462f38827f4097065bfc3826b9e0e9fb4'

* commit '722a5c0462f38827f4097065bfc3826b9e0e9fb4':
  Add support for "standalone months" to tztime's strftime().
2009-05-15 10:15:18 -07:00
Eric Fischer
722a5c0462 Add support for "standalone months" to tztime's strftime().
The idea here is that some languages need a different form of the month
name in constructions like "January 2" than in "January 2009", since the
one in the "January 2" case really means "of January."  So with this change,
a format string of "%-B" will use the standalone month, while "%B" will
continue to use the format month.
2009-05-14 17:22:20 -07:00
Mathias Agopian
ab15ac0881 Merge commit 'goog/master' into merge_master 2009-05-07 17:46:47 -07:00
David 'Digit' Turner
a26c4e049a Fix a potential integer overflow bug that could result in memory overwrites.
Also add a check to the result of malloc()
2009-05-02 19:43:30 +02:00
Mathias Agopian
8cd81ab3f2 get rid of native_handle_{dup|copy} since they were not used any longer 2009-05-02 00:06:41 -07:00
Mathias Agopian
1d3faaf72f Integrate from //sandbox/mathias/donut/...@145728
SurfaceFlinger rework for new EGL driver model support.
2009-04-10 14:24:31 -07:00
The Android Open Source Project
b1487e4c58 auto import //branches/master/...@140412 2009-03-18 22:20:28 -07:00
The Android Open Source Project
e037fd7e19 auto import from //branches/cupcake_rel/...@138607 2009-03-13 13:04:37 -07:00
The Android Open Source Project
dd7bc3319d auto import from //depot/cupcake/@135843 2009-03-03 19:32:55 -08:00
The Android Open Source Project
e54eebbf1a auto import from //depot/cupcake/@135843 2009-03-03 18:29:04 -08:00
The Android Open Source Project
35237d1358 Code drop from //branches/cupcake/...@124589 2008-12-17 18:08:08 -08:00
The Android Open Source Project
4f6e8d7a00 Initial Contribution 2008-10-21 07:00:00 -07:00