summaryrefslogtreecommitdiffstats
path: root/luni/src/main/native
Commit message (Collapse)AuthorAgeFilesLines
* Add getxattr/setxattr/removexattr syscalls.Jeff Sharkey2015-07-022-0/+66
| | | | | Bug: 20275572 Change-Id: I958056f757f095ad6278624e293a5583d9cee822
* Add ENONET to OsConstantsErik Kline2015-06-241-0/+1
| | | | | | Bug: 19537384 Change-Id: I155f3db741bdac96f1ecb1ccb15b31faab85e819 (cherry picked from commit 959a23e37abdfa26059e3770eacfe36dea8fc01c)
* Configure ICU4C without relying on build-time flagsNeil Fuller2015-06-031-2/+7
| | | | | | | | | | | | | The presence of the build-time flags appears to cause ICU4C to open the .dat file again as a fallback if it fails to find a config value. This is even though the .dat file is explicitly mapped using udata_setCommonData(). Bug: 19960867 Bug: 19961406 (cherry-picked from commit 79fdcc64ea2d9234f258dac57f04b1017a573311) Change-Id: I03f0f2d661dd2de2b0db085519159f7deb60816d
* Fix file descriptor leak when opening invalid archives.Narayan Kamath2015-05-121-0/+1
| | | | | bug: https://code.google.com/p/android/issues/detail?id=171099 Change-Id: I8425d8289839579f1122c61a61ea403f3a7c49fb
* Remove libcore_util_CharsetUtils.cppNarayan Kamath2015-04-281-0/+0
| | | | | | | For some reason, this was made empty but not removed in 83c7414449bc406b. Change-Id: I9a2b613d2281db450e46aa824ce3a6a865fddb8c
* Merge "Removed offset and value from String and added StringFactory."Jeff Hao2015-04-283-252/+0
|\
| * Removed offset and value from String and added StringFactory.Jeff Hao2015-04-273-252/+0
| | | | | | | | Change-Id: I55314ceb906d0bf7e78545dcd9bc3489a5baf03f
* | Ensure proper integer promotion for bit shifts.Dan Albert2015-04-271-2/+2
|/ | | | | | | Previously this was a 32-bit value being shifted up to 63 bits, which is undefined behavior. Change-Id: I99bb38508937f7a33d5c2c841b7cc32d5f374ef9
* Move java.nio.Charsets to libcore.util.Narayan Kamath2015-04-223-4/+4
| | | | | | | | This isn't public API, and isn't related to NIO. It's only ever used by java.lang.String. bug: 10898787 Change-Id: I4e194406746b88ba7268c2553e467e7e05400b40
* Implement mapLibraryName in Java.Elliott Hughes2015-04-161-13/+0
| | | | | | No need for native code here. Change-Id: Iaeb0369b5638a6681fd94fd999641801719aaea2
* Switch DateIntervalFormat/RelativeDateTimeFormatter to ICU4JTravis Keep2015-04-144-191/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Information below from the existing benchmarks on a hammerhead. All times given in microseconds. Note that the new version is slower, but this is a small difference in absolute terms and means less maintenance for libcore. The ICU team is rewriting some of the underlying code in ICU4J for a future ICU release which may alter performance. ICU4C + JNI DateIntervalFormat_formatDateRange_DATE 67.8 DateIntervalFormat_formatDateRange_DATE_TIME 76.0 DateIntervalFormat_formatDateRange_TIME 54.8 ICU4J DateIntervalFormat_formatDateRange_DATE 179 DateIntervalFormat_formatDateRange_DATE_TIME 181 DateIntervalFormat_formatDateRange_TIME 167 ICU4C + JNI RelativeDateTimeFormatter_getRelativeDateTimeString 151.6 RelativeDateTimeFormatter_getRelativeDateTimeString_ABBREV 169.0 RelativeDateTimeFormatter_getRelativeTimeSpanString 27.8 RelativeDateTimeFormatter_getRelativeTimeSpanString_ABBREV 27.7 ICU4J RelativeDateTimeFormatter_getRelativeDateTimeString 366.5 RelativeDateTimeFormatter_getRelativeDateTimeString_ABBREV 377.6 RelativeDateTimeFormatter_getRelativeTimeSpanString 23.2 RelativeDateTimeFormatter_getRelativeTimeSpanString_ABBREV 22.9 Bug: 20127691 Change-Id: I1ebc08fd9c974743026ae1e6c848fb4de8aa0e48
* Merge "Changes to enable timezone data overrides for ICU and libcore"Neil Fuller2015-04-071-18/+62
|\
| * Changes to enable timezone data overrides for ICU and libcoreNeil Fuller2015-03-261-18/+62
| | | | | | | | | | Bug: 19941636 Change-Id: Id587be99f645978c2e1067c9f8eef26d6d63ec27
* | Implement BreakIterator in terms of icu4j.Narayan Kamath2015-04-023-225/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note that we need manual range checks in our wrapper because the ICU4J implementation will clamp offsets to either end of the input text. benchmark results : text benchmark us linear runtime LIPSUM BreakIterator 326.02 ===== LIPSUM IcuBreakIterator 333.47 ====== LONGPARA BreakIterator 227.67 ==== LONGPARA IcuBreakIterator 228.68 ==== GERMAN BreakIterator 79.09 = GERMAN IcuBreakIterator 81.30 = THAI BreakIterator 1654.11 ============================== THAI IcuBreakIterator 1646.75 ============================= THAI2 BreakIterator 44.28 = THAI2 IcuBreakIterator 42.67 = TABS BreakIterator 12.79 = TABS IcuBreakIterator 12.53 = ACCENT BreakIterator 16.26 = ACCENT IcuBreakIterator 15.37 = EMOJI BreakIterator 17.71 = EMOJI IcuBreakIterator 18.34 = SPACES BreakIterator 16.86 = SPACES IcuBreakIterator 15.78 = EMPTY BreakIterator 9.22 = EMPTY IcuBreakIterator 9.96 = NEWLINE BreakIterator 11.08 = NEWLINE IcuBreakIterator 9.96 = BIDI BreakIterator 19.54 = BIDI IcuBreakIterator 18.96 = Change-Id: I72023dd605da8e33974aa3181506f0d9c7bc180e
* | Add a test to confirm that TZ data is in syncNeil Fuller2015-03-271-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | Android has two sources of timezone data: one used by bionic / libcore code, and one used by ICU. When ICU4J is added more tests can be added to confirm that ICU4C and ICU4J agree on time zone and other sources of data like CLDR and the ICU version itself. Bug: 19941636 Change-Id: I614392a876e19a55e362489f142eec71beaf5547
* | Merge "Remove forced alignment code."Christopher Ferris2015-03-241-84/+21
|\ \
| * | Remove forced alignment code.Christopher Ferris2015-03-231-84/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The move from to gcc 4.8 to gcc 4.9 for arm32 introduced a bug in this code. The original code is trying to out smart the compiler by arch, but we got caught. Running benchmarks, the amount of time we save by doing this is in the nanosecond range, so just let the compiler figure things out on it's own. It turns out for aarch64, x86, x86_64, two of the functions produce exactly the same code. For swapLongs, x86/x86_64 produces slightly different code but is about the same performance. For arm32, letting the compiler optimize also leads to about the same performance. Adding unit tests and benchmark code for these. Bug: 19692084 Change-Id: I858eb3147ef1e9e2c1894ddb226cdddcc0baf933
* | | Use compiler pragmas instead of flags.Narayan Kamath2015-03-232-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | This lets us turn off warnings for a small segment of the code instead of the entire project. bug: 19823499 Change-Id: I9309e9a33bddc33e8c100a49416e95b2a56e2385
* | | Merge "Set -Wno-deprecated-declarations to access deprecated IDNA2003 API."Narayan Kamath2015-03-191-0/+3
|\ \ \
| * | | Set -Wno-deprecated-declarations to access deprecated IDNA2003 API.Fredrik Roubert2015-03-191-0/+3
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | In libcore_icu_NativeIDN.cpp there are calls to the deprecated IDNA2003 API which means that this code as of ICU55 no longer will compile without specifying the -Wno-deprecated-declarations compiler flag. bug: 19823499 Change-Id: Id5cd5da0d6c3ce62a5c642c99364d29eaebe7709
* | | Merge "Fix an ntohs/htons issue."Lorenzo Colitti2015-03-191-1/+1
|\ \ \ | |/ / |/| |
| * | Fix an ntohs/htons issue.Lorenzo Colitti2015-03-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When converting between sockaddr_ll and PacketSocketAddress, we use ntohs in both directions. Converting from sockaddr_ll to PacketSocketAddress should use ntohs instead. This doesn't actually affect anything, because ntohs and htons identical, but it is conceptually wrong. Change-Id: Idd3cfcc11c4d6b7fed0c4b75a7935547f67eda12
* | | Remove executable permissions from java_lang_StringToReal.cppNarayan Kamath2015-03-171-0/+0
|/ / | | | | | | Change-Id: I0e36d41a822db1b9607543a9033f190eed5363c8
* | Also support IPv4 fallback in the SocketAddress version of sendto.Lorenzo Colitti2015-03-141-6/+21
| | | | | | | | Change-Id: I90bbc9661b0a48bb19c9c1c5aa4cd493f4dff2fa
* | Support packet sockets in libcore.Lorenzo Colitti2015-03-142-2/+70
| | | | | | | | | | Bug: 19704592 Change-Id: Ic424e4c36f6de028df4a3095f57a08b68da78033
* | Add a version of sendto that takes a SocketAddress.Lorenzo Colitti2015-03-141-0/+19
| | | | | | | | | | | | | | | | Only the byte[] version for now. The ByteBuffer version will be added later. Bug: 19704592 Change-Id: I35c5f305b5828ff3315e42aae72aa4b01839e2fc
* | Make it possible to use AF_INET sockets created by libcore.Lorenzo Colitti2015-03-141-22/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, it's possible to create AF_INET sockets using: Libcore.os.socket(AF_INET, ... but such sockets can't be used for anything, because os.bind() and os.connect() automatically convert IPv4 addresses to IPv4-mapped addresses (e.g., 192.0.2.1 to ::ffff:192.0.2.1), and passing a sockaddr_in6 to a system call on an AF_INET socket causes the kernel to return EAFNOSUPPORT. When this happens, retry using an unmapped IPv4 address. We could also call getsockopt(SOL_SOCKET, SO_DOMAIN) before every system call and pass in the appropriate socket address structure, but that would cause these socket functions to make two system calls instead of one and would probably halve the performance of sendto(). This way, there's only one system call for most sockets (including all AF_INET6 sockets created in Java), and two system calls only in the rare case of a socket that's explicitly created as AF_INET. Bug: 18558481 Bug: 19704592 Change-Id: I71b3728b6a72b742e156d4c60db65e88b9a9e51e
* | Replace work-around with proper DecimalFormatSymbols helper function.Fredrik Roubert2015-03-111-2/+7
| | | | | | | | | | | | | | | | | | The helper function createWithLastResortData() was introduced in ICU 4.8 and eliminates the need to call the private default constructor: http://bugs.icu-project.org/trac/ticket/7392 Change-Id: I6d615b23c28c449442aeab6d37b7d92e844a7ae8
* | Merge "Add support for netlink sockets and addresses."Erik Kline2015-03-102-8/+109
|\ \
| * | Add support for netlink sockets and addresses.Erik Kline2015-03-092-8/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Additionally: - support bind and connect calls with SocketAddresses - getsockname and getpeername can return a NetlinkSocketAddress Developed in conjunction with: https://android-review.googlesource.com/135490 Bug: 18581716 Change-Id: I760a06cdb9bdb26c734fb02cf668a94de982e2b6
* | | Explicitly specify the icu:: namespace.Elliott Hughes2015-03-0616-228/+228
|/ / | | | | | | | | Bug: 15350832 Change-Id: I8d84f3e50b643806ccf01190797c69ce6445b539
* | Add ST_* constants to OsConstantsNick Kralevich2015-02-261-0/+9
|/ | | | | | | | | | Expose ST_* constants via OsConstants. Without these constants being exposed, it's impossible to meaningfully use StructStatVfs.f_flag returned from the Os.statvfs() call. For now, @hide the new constants. Change-Id: I82536521972e9e87a1936dd712b9e8153d120cc1
* Use ICU for relative time formattingTao Bao2015-02-113-0/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rewrite the DateUtils' relative time formatting APIs (getRelativeTimeSpanString, getRelativeDateTimeString) to use ICU ones. Two APIs that take withPreposition parameter are not changed. Because (a) ICU doesn't provide functionality to format preposition; (b) They are not really computing relative time but instead calling formatDateRange() to get the absolute time/date string. Benchmark results on aosp_hammerhead-userdebug: before: benchmark us linear runtime DateUtils_getRelativeDateTimeString 127.1 ========================== DateUtils_getRelativeDateTimeString_ABBREV 145.0 ============================== DateUtils_getRelativeTimeSpanString 28.0 ===== DateUtils_getRelativeTimeSpanString_ABBREV 27.9 ===== now: benchmark us linear runtime RelativeDateTimeFormatter_getRelativeDateTimeString 119.2 ========================== RelativeDateTimeFormatter_getRelativeDateTimeString_ABBREV 133.8 ============================== RelativeDateTimeFormatter_getRelativeTimeSpanString 24.6 ===== RelativeDateTimeFormatter_getRelativeTimeSpanString_ABBREV 24.7 ===== Bug: 19146457 Bug: 5252772 Change-Id: Ief74608354964a17e42191d7b1a58964f3a9acfd
* Fix deflater in / out counts for inputs > 4G.Narayan Kamath2015-01-304-5/+18
| | | | | | | | | | | | | | | | | | | | | The underlying inflate & deflate can process any amount of data correctly, since the protocol is chunk based (the size of each chunk is limited to 32 bits, usually) and there is no limit to the number of chunks. On LP32, the stream counters are limited to 32 bit counts and the manual recommends that the caller maintain their own counters to support larger counts. <quote> Note however that the strm.total_in and strm_total_out counters may be limited to 4 GB. These counters are provided as a convenience and are not used internally by inflate() or deflate(). The application can easily set up its own counters updated after each call of inflate() or deflate() to count beyond 4 GB. </quote> Change-Id: I066e1141935154773360c1b9f94c56bd604f8474
* Merge "Work around 32 bit glibc bug."Narayan Kamath2015-01-301-0/+17
|\
| * Work around 32 bit glibc bug.Narayan Kamath2015-01-291-0/+17
| | | | | | | | | | | | | | Don't allow glibc's TEMP_FAILURE_RETRY on 32 bit hosts, it will truncate 64 bit return types such as from lsee64, sendfile etc. Change-Id: I009510a69ec80d42a17192bf960b056456bd88f5
* | Fix the infinite loop issue of the conversion from string to doubleJingwei Zhang2015-01-231-134/+17
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | This patch provide the additional check for “z”. The “if” statement checks whether the double precision value z, is at the end of a binade (a term used to describe the set of numbers in a binary IEEE 754 floating-point format that all have the same exponent, i.e., a binade is the interval [2n, 2n+1) for some value of n.) If so, it needs to adjust for the change of ulp (unit of least precision is the spacing between two consecutive floating-point numbers, i.e., the value the least significant digit represents if it is 1). The adjustment is done by the “simpleShiftLeftHighPrecision” routine. This is all necessary, except when z is close to denormal (i.e. DOUBLE_TO_LONGBITS(z)==DOUBLE_NORMAL_MASK) where no adjustment is needed since the ulp should remain the same once z becomes denormal. This means we can remove the old hack that counted how many times we'd incremented or decremented, so this patch removes the DECREMENT_DOUBLE and INCREMENT_DOUBLE macros. This patch also contains the float equivalent of everything mentioned above, plus some new tests. Finally, this patch removes the USE_LL conditional compilation because it was always true. Bug: 18087920 Change-Id: I4a9112f012dfd9eeb8db89f0652528b6c02e8f1e Signed-off-by: Jingwei Zhang <jingwei.zhang@intel.com> Signed-off-by: Mingwei Shi <mingwei.shi@intel.com>
* Remove fcntlLong, use fcntlInt for F_SETFD instead.Narayan Kamath2015-01-191-6/+0
| | | | | | | | | | fcntlLong works too, but only because of the syscall conventions happen to place the lower 32 bits of our jlong in the right register. This change also gets rid of fcntlLong because there aren't any documented fcntl calls that take a 64 bit integer argument. Change-Id: I8d187d5b906195fc663675a07a5f116dcd210d16
* Merge "Add fcntlInt."Narayan Kamath2015-01-191-12/+18
|\
| * Add fcntlInt.Narayan Kamath2015-01-161-12/+18
| | | | | | | | | | | | Hidden for now, for use from the frameworks. Change-Id: I30d95b28ecbc422aaa5bf28fb2f288c3ca026493
* | Merge "Cache class and field lookups in StrictJarFile."Narayan Kamath2015-01-161-5/+7
|\ \ | |/ |/|
| * Cache class and field lookups in StrictJarFile.Narayan Kamath2015-01-081-5/+7
| | | | | | | | | | | | | | | | Iterating over a list of ZipEntries might otherwise do more work than necessary and create unnecessary garbage. Also, this is the idiom for such JNI code. Change-Id: I869289a32e0822bab9ca0345cdc3fc5aaa8adc7e
* | Fix and clean up FileDescriptor.isSocket.Elliott Hughes2015-01-081-3/+5
|/ | | | | | | | | | | | | | | | The original logic was accidentally inverted. This prevented sockets from being untagged, which would result in cancelled requests stalling out with sub-optimal TCP ZeroWindow detection instead of sending RST packets. Add a comment explaining how this works. Switch from SO_ERROR (which has a side-effect) to SO_DEBUG (which doesn't). Add a unit test. Bug: 18706592 Change-Id: Ib822a9727668908e04f87a6deb104dcebf333f05
* Add various system calls needed by the zygote.Elliott Hughes2014-12-171-0/+20
| | | | | Bug: 18719692 Change-Id: I91a943369bc3b331e7e06e758f729b008c3c041c
* Don't TEMP_FAILURE_RETRY calls that can't fail.Elliott Hughes2014-12-171-4/+4
| | | | | | | | | | | | | | | It turns out that while GCC doesn't care, clang is unhappy with us because it notices that we're comparing an unsigned value (like a uid_t) against -1: libcore/luni/src/main/native/libcore_io_Posix.cpp:727:12: error: comparison of integers of different signs: 'typeof (getegid())' (aka 'unsigned int') and 'int' [-Werror,-Wsign-compare] return TEMP_FAILURE_RETRY(getegid()); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Bug: 18759467 Change-Id: If71b11cbdd0cda2b8efcc1706eb49856c3770bb8
* Fix poll to never return EINTR.Elliott Hughes2014-12-171-14/+50
| | | | | Bug: 18759467 Change-Id: Ia5b97a55318b5990ad6b80d15641223aa4fb06f5
* Remove unnecessary include directives.Elliott Hughes2014-12-151-7/+0
| | | | | | These are all picked up by virtue of the libraries that we use. Change-Id: Ib5e86c65d53f3448d5f1d0c0d24f0f63ef5f1868
* Fix Mac build (control reaches end of non-void function).Elliott Hughes2014-12-121-0/+1
| | | | Change-Id: I94d85f1848db7c787f423ca9e7f7695ffd754a56
* Merge "Fix Mac build (unused parameter)."Elliott Hughes2014-12-131-1/+1
|\
| * Fix Mac build (unused parameter).Elliott Hughes2014-12-121-1/+1
| | | | | | | | Change-Id: I164eb9083cc17f858dcbb0da046184440881395d