mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-04-18 08:31:46 +03:00
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.
This commit is contained in:
parent
e77fa59ece
commit
1a0e777024
2 changed files with 13 additions and 0 deletions
|
|
@ -1,6 +1,9 @@
|
|||
#include <sys/mman.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/syscall.h>
|
||||
#if !defined(SYS_write) && defined(__NR_write)
|
||||
#define SYS_write __NR_write
|
||||
#endif
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/uio.h>
|
||||
|
|
|
|||
10
src/util.c
10
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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue