From 8003e266edbc0ec62a586dd70dcc80dc13e2dbf0 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sun, 2 Dec 2007 07:18:29 +0000 Subject: explain why we use mmap instead of malloc --- libbb/copyfd.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libbb') 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, -- cgit v1.2.3