MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / malloc_write_fd

Function malloc_write_fd

deps/jemalloc/include/jemalloc/internal/malloc_io.h:66–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64void malloc_printf(const char *format, ...) JEMALLOC_FORMAT_PRINTF(1, 2);
65
66static inline ssize_t
67malloc_write_fd(int fd, const void *buf, size_t count) {
68#if defined(JEMALLOC_USE_SYSCALL) && defined(SYS_write)
69 /*
70 * Use syscall(2) rather than write(2) when possible in order to avoid
71 * the possibility of memory allocation within libc. This is necessary
72 * on FreeBSD; most operating systems do not have this problem though.
73 *
74 * syscall() returns long or int, depending on platform, so capture the
75 * result in the widest plausible type to avoid compiler warnings.
76 */
77 long result = syscall(SYS_write, fd, buf, count);
78#else
79 ssize_t result = (ssize_t)write(fd, buf,
80#ifdef _WIN32
81 (unsigned int)
82#endif
83 count);
84#endif
85 return (ssize_t)result;
86}
87
88static inline ssize_t
89malloc_read_fd(int fd, void *buf, size_t count) {

Callers 3

token_errorFunction · 0.85
prof_dump_flushFunction · 0.85
wrtmessageFunction · 0.85

Calls

no outgoing calls

Tested by 1

token_errorFunction · 0.68