mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-08-18 05:13:53 +03:00
Add comments to retain context for syscall usage in file read/write.
This commit is contained in:
parent
e465b4cbba
commit
5421943db7
1 changed files with 8 additions and 0 deletions
|
|
@ -14,6 +14,14 @@
|
|||
JEMALLOC_ALWAYS_INLINE ssize_t
|
||||
os_file_write_once(int fd, const void *buf, size_t bytes) {
|
||||
#if defined(JEMALLOC_USE_SYSCALL) && defined(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.
|
||||
*
|
||||
* syscall() returns long or int, depending on platform, so capture the
|
||||
* result in the widest plausible type to avoid compiler warnings.
|
||||
*/
|
||||
return (ssize_t)syscall(SYS_write, fd, buf, bytes);
|
||||
#else
|
||||
return (ssize_t)write(fd, buf, bytes);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue