From: Denis Vlasenko Date: Sun, 2 Dec 2007 07:18:29 +0000 (-0000) Subject: explain why we use mmap instead of malloc X-Git-Tag: 1_9_0~37 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=8003e266edbc0ec62a586dd70dcc80dc13e2dbf0;p=oweals%2Fbusybox.git explain why we use mmap instead of malloc --- diff --git a/libbb/copyfd.c b/libbb/copyfd.c index ed383ae28..08bc6f8df 100644 --- a/libbb/copyfd.c +++ b/libbb/copyfd.c @@ -22,6 +22,8 @@ static off_t bb_full_fd_action(int src_fd, int dst_fd, off_t size) char *buffer; int buffer_size; + /* We want page-aligned buffer, just in case kernel is clever + * and can do page-aligned io more efficiently */ buffer = mmap(NULL, CONFIG_FEATURE_COPYBUF_KB * 1024, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON,