Commit graph

628 commits

Author SHA1 Message Date
Elliott Hughes
0990d4fda8 Make SIGRTMIN hide the real-time signals we use internally.
__SIGRTMIN will continue to tell the truth. This matches glibc's
behavior (as evidenced by the fact that we don't need a special case
in the strsignal test now).

Change-Id: I1abe1681d516577afa8cd39c837ef12467f68dd2
2014-04-30 10:06:09 -07:00
Calin Juravle
77473e4085 Merge "Fix cpu_set_t" 2014-04-30 16:09:08 +00:00
Calin Juravle
b743790cca Fix cpu_set_t
- extend CPU_SETSIZE for LP64
- fix CPU_(AND|OR|XOR) macros
- fix CPU_OP_S macro
- fix __sched_cpucount
- tidy up the code

Change-Id: I741afff4d0c473e8a1ee6b4141981dc24467e0d4
2014-04-30 14:30:15 +01:00
Elliott Hughes
94336d8ecf Switch to OpenBSD stdio wide printf functions.
Change-Id: Icf4f8685d021ec6b7482ca1cc021ce8184098e4a
2014-04-29 17:39:29 -07:00
Elliott Hughes
c932225e10 Switch to OpenBSD stdio wide get/put functions.
Change-Id: I71f8769cdea874e55d397ca7682d9d4e659d3dcb
2014-04-29 17:08:03 -07:00
Elliott Hughes
01ae00f317 Switch to the OpenBSD implementations of the wide scanf functions.
This also gets us the C99 wcstoimax and wcstoumax, and a working fgetwc and
ungetwc, all of which are needed in the implementation.

This also brings several other files closer to upstream.

Change-Id: I23b025a8237a6dbb9aa50d2a96765ea729a85579
2014-04-29 16:28:56 -07:00
Elliott Hughes
770491fb4f Fix build (signed char issue).
Change-Id: I05d78f4c1599ed9a0c1285f9eb1e89bc2f55c24d
2014-04-29 16:05:58 -07:00
Elliott Hughes
3d7a0d9b08 Switch to the OpenBSD wcsto* functions.
This replaces a partial set of non-functional functions with a complete
set of functions, all of which actually work.

This requires us to implement mbsnrtowcs and wcsnrtombs which completes
the set of what we need for libc++.

The mbsnrtowcs is basically a copy & paste of wcsnrtombs, but I'm going
to go straight to looking at using the OpenBSD UTF-8 implementation rather
than keep polishing our home-grown turd.

(This patch also opportunistically switches us over to upstream btowc,
mbrlen, and wctob, since they're all trivially expressed in terms of
other functions.)

Change-Id: I0f81443840de0f1aa73b96f0b51988976793a323
2014-04-29 14:53:11 -07:00
Elliott Hughes
0a5e26da1e Add mbtowc and fix mbrtowc.
Change-Id: I48786cd82587e61188d40f6fd6e11ac05e857ae9
2014-04-28 17:51:13 -07:00
Elliott Hughes
d299bcfdad Replace our broken wcswcs with the working upstream one.
Change-Id: I2952684df5674d10f0564d92c2cd42597725c0e3
2014-04-28 16:46:24 -07:00
Elliott Hughes
533dde4dbf Fix brk/sbrk error checking.
Note that the kernel returns the current break on error or if the requested
break is smaller than the minimum break, or the new break. I don't know where
we got the idea that the kernel could return -1.

Also optimizes the query case.

Also hides an accidentally-exported symbol for LP64.

Change-Id: I0fd6b8b14ddf1ae82935c0c3fc610da5cc74932e
2014-04-25 19:38:33 -07:00
Elliott Hughes
08bfcff0d4 Merge "Allow liblog to pass failure reasons to debuggerd." 2014-04-24 20:29:43 +00:00
Calin Juravle
ae77f74bcf Merge "Clean-up _fpmath and fake_long_doubles" 2014-04-24 10:12:58 +00:00
Elliott Hughes
2e3b7108b5 Allow liblog to pass failure reasons to debuggerd.
assert(3) already does this, but LOG_ALWAYS_FATAL and LOG_ALWAYS_FATAL_IF
have been missing out.

Change-Id: I1d6214c4f792fa0d4ba3c14eded3fc9c332bd3c5
2014-04-23 14:52:49 -07:00
Elliott Hughes
a64d76895d Remove two dead files.
I forgot to remove these in the change that stopped building them
(eae5902e73).

Change-Id: I4665fa9f6b9b80c51778d5e82b49406fe56db9a6
2014-04-23 12:51:37 -07:00
Calin Juravle
1abc9ff6a5 Clean-up _fpmath and fake_long_doubles
- promoted IEEEld2bits to fpmath since most of the where the same for
diffrent archs
- removed _fpmath
- reinstated weak_references
- moved isfinite and isnormal to libc
- clean up fake_long_doubles
- clean up some useless ifdefs
- added missing nexttoward* tests

Bug: 14134235
Change-Id: I95639c4885653fe47fd7dc0570ee5bb3389bbc6b
2014-04-23 19:03:06 +01:00
Elliott Hughes
532ad903d2 Merge "Switch to the upstream OpenBSD getenv/putenv/setenv implementation." 2014-04-23 01:52:06 +00:00
Elliott Hughes
eae5902e73 Remove strntoimax and strntoumax from the future.
Where do these turds come from?

Change-Id: Id9ad2cc85c6128aa63b5d56ff2aa455bde39a5eb
2014-04-22 17:56:42 -07:00
Elliott Hughes
58d9e280d4 Switch to the upstream OpenBSD getenv/putenv/setenv implementation.
This fixes all the bugs found by the new tests.

Change-Id: Id5a5f9f39a0620208bafa053f871a044725b4795
2014-04-22 17:41:00 -07:00
Elliott Hughes
8d77bce185 LP64 shouldn't include the non-standard <time64.h> cruft.
This patch includes just enough to keep external/chromium_org building
until they switch 64-bit Android over to using the regular non-Android code.

Change-Id: Iecaf274efa46ae18a42d5e3439c5aa4f909177c1
2014-04-22 13:55:58 -07:00
Elliott Hughes
d3679c815e clang is >= 3.4 now; remove a hack.
Change-Id: I8d976ee0fd88eca9779c87b5d7e27f46b4b1b489
2014-04-21 10:15:14 -07:00
Elliott Hughes
9b22c21cee Merge "Make uselocale(3) claim its pthread key in an ELF constructor." 2014-04-18 22:27:20 +00:00
Elliott Hughes
2f68866f37 Make uselocale(3) claim its pthread key in an ELF constructor.
pthread_once is nice for decoupling, but it makes resource availability less
predictable, which is a bad thing.

This fixes a test failure if uselocale(3) is called before
pthread.pthread_key_create_lots runs.

Change-Id: Ie2634f986a50e7965582d4bd6e5aaf48cf0d55c8
2014-04-18 13:34:26 -07:00
Elliott Hughes
1b836ee6f8 Fix a wchar.wcstombs_wcrtombs test failure.
Looks like I screwed up a last-minute refactor and didn't re-run the tests.

Change-Id: I90a710ae66a313a9812859650aa0b4e8c6bc57f9
2014-04-18 13:32:33 -07:00
Elliott Hughes
0549371bd7 Upgrade to current vfprintf.
This gets us various bug fixes and missing C99 functionality.

Bug: https://code.google.com/p/android/issues/detail?id=64886
Change-Id: Ie9f8ac569e9b5eec1e4a1faacfe2c21662eaf895
2014-04-17 17:30:03 -07:00
Elliott Hughes
8da69a25b7 Merge "Switch fpclassify over to ieee_ext." 2014-04-16 23:57:06 +00:00
Elliott Hughes
f081e139fe Switch fpclassify over to ieee_ext.
Change-Id: I441bb7f715da24e1c04b0386ad9dcde0ea8c797c
2014-04-16 16:45:59 -07:00
Elliott Hughes
20828db758 Use FLT_ROUNDS in LP64 strtold.
Change-Id: I75323be6e1cadb00770fcdd08422836b03737416
2014-04-16 16:09:41 -07:00
Elliott Hughes
4bd97cee28 Switch to gdtoa.
This gives us a real strtold for LP64 and fixes various LP64
bugs.

Bug: 13563801
Change-Id: I277858d718ee746e136b6b6308a495ba50dfa488
2014-04-16 15:15:52 -07:00
Elliott Hughes
40b0579127 Add iswblank for libcxx.
We have similar degenerate implementations for all the other isw* functions,
so it's weird to exclude just one.

Change-Id: I659b97930e68598826c4882bb59f4146870fb6a0
2014-04-15 12:04:05 -07:00
Elliott Hughes
02c78a3867 Reimplement isinf/isnan/fpclassify.
Also move isinf and isnan into libc like everyone else.

Also move fpclassify to libc like the BSDs (but unlike glibc). We need
this to be able to upgrade our float/double/long double parsing to gdtoa.

Also add some missing aliases. We now have all of:

  isnan, __isnan, isnanf, __isnanf, isnanl, __isnanl,
  isinf, __isinf, isinff, __isinff, isinfl, __isinfl,
  __fpclassify, __fpclassifyd, __fpclassifyf, __fpclassifyl.

Bug: 13469877
Change-Id: I407ffbac06c765a6c5fffda8106c37d7db04f27d
2014-04-14 14:35:47 -07:00
Elliott Hughes
b676aafad0 Remove unnecessary #includes.
Change-Id: Ie7e0c9ea03f35517c7dcf09fc808c12e55262bc1
2014-04-10 17:50:06 -07:00
Calin Juravle
a5d83312bd Merge "Use glibc structure for __cmsg_nxthdr." 2014-04-09 06:06:48 +00:00
Elliott Hughes
c4936e20a3 Flesh out <locale.h>.
This is a trivial implementation that only supports the C/POSIX locale.

Change-Id: Ib11cea4249e1862aca96a8b94d58ea9a418cbe75
2014-04-08 19:37:38 -07:00
Calin Juravle
ff64831b09 Use glibc structure for __cmsg_nxthdr.
Bug: 13418328
Change-Id: I7e656b373e53e80d708325321e48dcedacf5086d
2014-04-09 00:55:24 +03:00
Elliott Hughes
5363a45f2b Clean up localeconv(3).
The OpenBSD doesn't support C99, and the extent to which we support
locales is trivial, so just do it ourselves.

Change-Id: If0a06e627ecc593f7b8ea3e9389365782e49b00e
2014-04-08 14:34:12 -07:00
Christopher Ferris
41059d764f Merge "Add stpcpy/stpncpy." 2014-04-08 01:21:07 +00:00
Christopher Ferris
950a58e24d Add stpcpy/stpncpy.
Add tests for the above.

Add the fortify implementations of __stpcpy_chk and __stpncpy_chk.

Modify the strncpy test to cover more cases and use this template for
stpncpy.

Add all of the fortify test cases.

Bug: 13746695
Change-Id: I8c0f0d4991a878b8e8734fff12c8b73b07fdd344
2014-04-07 16:41:53 -07:00
Elliott Hughes
efbdb53f84 Remove a non-standard turd: strtotimeval.
Change-Id: I1b1e40746cb573e3fb73a5276969b40c5da36d15
2014-04-07 15:17:19 -07:00
Elliott Hughes
77e944fd46 Implement wctomb(3) for ltrace.
This is an implementation in the style of the rest: char == byte.

We might want to come back and implement UTF-8, but this is enough for ltrace.

Bug: 13747066
Change-Id: Ib2b63609c9014fdef9a8491e067467c4fc5ae3cc
2014-04-07 14:29:28 -07:00
Elliott Hughes
473d06707b Fix the POSIX timers fix.
If we're not going to wait for the timer threads to exit, we need
another way to ensure that we don't free the data they're using
prematurely. The easiest way to ensure that is to let them free the
data themselves.

Change-Id: Icee17c87bbcb9c3aac5868973f595d08569f33aa
2014-04-01 19:07:52 -07:00
Elliott Hughes
64b2963224 Fix debug malloc for LP64.
Change-Id: I5de2097b6589c0d6750b2a3bc3cbb06227de6d5f
2014-04-01 13:48:30 -07:00
Weichuan Yan
f1d7536dcf Fix and clean up strtotimeval
- parsing of fractional part was wrong (always parsed as 0)
- return value was also wrong in the presence of fractional parts
- general style clean up

Change-Id: I1935a63db938dbed7cacb4b5646e993a52c27f1a
Signed-off-by: Weichuan Yan <wchyan@marvell.com>
2014-03-27 14:57:36 +00:00
Calin Juravle
9e8a8dc18c Merge "Remove ALIGNBYTES and ALIGN from <sys/param.h>" 2014-03-24 12:11:30 +00:00
Mark Salyzyn
cce6c380d7 Merge "libc: Thread IDs missing from logcat -v thread" 2014-03-21 20:09:32 +00:00
Calin Juravle
c20de90287 Remove ALIGNBYTES and ALIGN from <sys/param.h>
There are only three users of bionic definition of ALIGN and keeping it
in sys/param.h polutes the namespace.

I inline the definition in the the three places that's used.

Bug: 13400663
Change-Id: I565008e8426c38ffb07422f42cd8e547d53044e9
2014-03-21 09:59:34 +00:00
Christopher Ferris
753ad778bc Fix deadlock in timer_delete.
If the callback function for a timer did a timer_delete, the function
would never return. The problem was that the timer_delete function would try
to wait until the timer thread has finished. Waiting for yourself to finish
doesn't work very well.

Bug: 13397340
Change-Id: Ica123a5bafbc8660c8a4a909e5c2dead55ca429d
2014-03-20 20:47:45 -07:00
Mark Salyzyn
8664be583a libc: Thread IDs missing from logcat -v thread
- stuff caller's thread id into the packet.

Bug: 13568206
Change-Id: If8b318ef75c7dcdddb05da8ac3038860f0fda5ec
2014-03-20 16:35:18 -07:00
Elliott Hughes
f2cea021ab Clean up <stdio.h> macros.
Also neuter __isthreaded.

We should come back to try to hide struct FILE's internals for LP64.

Bug: 3453512
Bug: 3453550
Change-Id: I7e115329fb4579246a72fea367b9fc8cb6055d18
2014-03-13 14:54:53 -07:00
jiaguo
879d330499 property: fix getting dirty serial value
__system_property_serial just returned serial value without
checking if it is dirty, so check and wait until serial
value is not dirty before return

Change-Id: If485b6251b5555b004912c66c7c2cb455a7fdbdc
Signed-off-by: jiaguo <jiaguo@marvell.com>
2014-03-13 12:42:52 -07:00