summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMike Hommey <mh@glandium.org>2012-03-27 12:48:58 (GMT)
committerJason Evans <jasone@canonware.com>2012-03-30 17:21:41 (GMT)
commit1a0e7770243e0539fa8fef7bb1512f784f93389f (patch)
tree27e634593f7e156c97ca13578e0944f4ec65c8de /src
parente77fa59ece7e23de586f08980f627b8102511755 (diff)
downloadjemalloc-1a0e7770243e0539fa8fef7bb1512f784f93389f.zip
jemalloc-1a0e7770243e0539fa8fef7bb1512f784f93389f.tar.gz
jemalloc-1a0e7770243e0539fa8fef7bb1512f784f93389f.tar.bz2
Add a SYS_write definition on systems where it is not defined in headers
Namely, in the Android NDK headers, SYS_write is not defined; but __NR_write is.
Diffstat (limited to 'src')
-rw-r--r--src/util.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index 090e1f0..895aa19 100644
--- a/src/util.c
+++ b/src/util.c
@@ -44,7 +44,17 @@ JEMALLOC_CATTR(visibility("hidden"), static)
void
wrtmessage(void *cbopaque, const char *s)
{
+
+#ifdef SYS_write
+ /*
+ * Use syscall(2) rather than write(2) when possible in order to avoid
+ * the possibility of memory allocation within libc. This is necessary
+ * on FreeBSD; most operating systems do not have this problem though.
+ */
UNUSED int result = syscall(SYS_write, STDERR_FILENO, s, strlen(s));
+#else
+ UNUSED int result = write(STDERR_FILENO, s, strlen(s));
+#endif
}
void (*je_malloc_message)(void *, const char *s)