mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-22 04:03:11 +00:00
Restore errno save/restore in pages_purge_process_madvise_impl
TODO comment focused on free only, but this path is reachable via other calls and it is safer to leave errno preservation here.
This commit is contained in:
@@ -662,6 +662,7 @@ pages_purge_process_madvise_impl(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int saved_errno = get_errno();
|
||||||
size_t purged_bytes = (size_t)syscall(JE_SYS_PROCESS_MADVISE_NR,
|
size_t purged_bytes = (size_t)syscall(JE_SYS_PROCESS_MADVISE_NR,
|
||||||
PIDFD_SELF, (struct iovec *)vec, vec_len, MADV_DONTNEED, 0);
|
PIDFD_SELF, (struct iovec *)vec, vec_len, MADV_DONTNEED, 0);
|
||||||
if (purged_bytes == (size_t)-1) {
|
if (purged_bytes == (size_t)-1) {
|
||||||
@@ -671,6 +672,7 @@ pages_purge_process_madvise_impl(
|
|||||||
atomic_store_b(
|
atomic_store_b(
|
||||||
&process_madvise_gate, false, ATOMIC_RELAXED);
|
&process_madvise_gate, false, ATOMIC_RELAXED);
|
||||||
}
|
}
|
||||||
|
set_errno(saved_errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
return purged_bytes != total_bytes;
|
return purged_bytes != total_bytes;
|
||||||
|
|||||||
Reference in New Issue
Block a user