diff options
author | Denys Vlasenko | 2018-02-11 14:55:46 +0100 |
---|---|---|
committer | Denys Vlasenko | 2018-02-11 14:55:46 +0100 |
commit | ba3b9dbf065438402d89655d7baefb0ccc6f0663 (patch) | |
tree | 4669edd0fb031940a794eaf8942bdbf314efea2e /libbb | |
parent | d3162773d5c722cc1f5c5b1ea5171c8d3c208135 (diff) | |
download | busybox-ba3b9dbf065438402d89655d7baefb0ccc6f0663.zip busybox-ba3b9dbf065438402d89655d7baefb0ccc6f0663.tar.gz |
libbb: introduce and use bb_getsockname()
function old new delta
bb_getsockname - 18 +18
xrtnl_open 88 83 -5
do_iplink 1216 1209 -7
arping_main 1686 1668 -18
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 0/3 up/down: 18/-30) Total: -12 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/bb_getsockname.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libbb/bb_getsockname.c b/libbb/bb_getsockname.c new file mode 100644 index 0000000..1af9b39 --- /dev/null +++ b/libbb/bb_getsockname.c @@ -0,0 +1,19 @@ +/* vi: set sw=4 ts=4: */ +/* + * Utility routines. + * + * Licensed under GPLv2, see file LICENSE in this source tree. + */ +//kbuild:lib-y += bb_getsockname.o + +#include "libbb.h" + +int FAST_FUNC bb_getsockname(int sockfd, void *addr, socklen_t addrlen) +{ + /* The usefullness of this function is that for getsockname(), + * addrlen must go on stack (to _have_ an address to be passed), + * but many callers do not need its modified value. + * By using this shim, they can avoid unnecessary stack spillage. + */ + return getsockname(sockfd, (struct sockaddr *)addr, &addrlen); +} |