From fd3c512f88d43e6633bd3c3110cfa0bb321adaa8 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 14 Dec 2020 18:25:28 +0100 Subject: libbb: create and use mmap() helpers function old new delta mmap_anon - 22 +22 mmap_read - 21 +21 xmmap_anon - 16 +16 rpm_gettags 465 447 -18 bb_full_fd_action 498 480 -18 uevent_main 337 310 -27 ------------------------------------------------------------------------------ (add/remove: 3/0 grow/shrink: 0/3 up/down: 59/-63) Total: -4 bytes Signed-off-by: Denys Vlasenko --- util-linux/uevent.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'util-linux') diff --git a/util-linux/uevent.c b/util-linux/uevent.c index 045b35432..015f1ee78 100644 --- a/util-linux/uevent.c +++ b/util-linux/uevent.c @@ -74,12 +74,7 @@ int uevent_main(int argc UNUSED_PARAM, char **argv) // for a new uevent notification to come in. // We use a fresh mmap so that buffer is not allocated // until kernel actually starts filling it. - netbuf = mmap(NULL, USER_RCVBUF, - PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANON, - /* ignored: */ -1, 0); - if (netbuf == MAP_FAILED) - bb_simple_perror_msg_and_die("mmap"); + netbuf = xmmap_anon(USER_RCVBUF); // Here we block, possibly for a very long time len = safe_read(fd, netbuf, USER_RCVBUF - 1); -- cgit v1.2.3