diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2020-12-14 18:25:28 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2020-12-14 18:25:28 +0100 |
commit | fd3c512f88d43e6633bd3c3110cfa0bb321adaa8 (patch) | |
tree | 97211484388a0db0a85957f2e3f3724cb1c9159f /util-linux | |
parent | db793480cb8ec3e5f878d1ec18b6ed5010c85e85 (diff) | |
download | busybox-w32-fd3c512f88d43e6633bd3c3110cfa0bb321adaa8.tar.gz busybox-w32-fd3c512f88d43e6633bd3c3110cfa0bb321adaa8.tar.bz2 busybox-w32-fd3c512f88d43e6633bd3c3110cfa0bb321adaa8.zip |
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 <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux')
-rw-r--r-- | util-linux/uevent.c | 7 |
1 files changed, 1 insertions, 6 deletions
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) | |||
74 | // for a new uevent notification to come in. | 74 | // for a new uevent notification to come in. |
75 | // We use a fresh mmap so that buffer is not allocated | 75 | // We use a fresh mmap so that buffer is not allocated |
76 | // until kernel actually starts filling it. | 76 | // until kernel actually starts filling it. |
77 | netbuf = mmap(NULL, USER_RCVBUF, | 77 | netbuf = xmmap_anon(USER_RCVBUF); |
78 | PROT_READ | PROT_WRITE, | ||
79 | MAP_PRIVATE | MAP_ANON, | ||
80 | /* ignored: */ -1, 0); | ||
81 | if (netbuf == MAP_FAILED) | ||
82 | bb_simple_perror_msg_and_die("mmap"); | ||
83 | 78 | ||
84 | // Here we block, possibly for a very long time | 79 | // Here we block, possibly for a very long time |
85 | len = safe_read(fd, netbuf, USER_RCVBUF - 1); | 80 | len = safe_read(fd, netbuf, USER_RCVBUF - 1); |