aboutsummaryrefslogtreecommitdiff
path: root/libbb/bb_getsockname.c
blob: 1af9b39b9c09b053deec33fd0831328eb8a7e7ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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);
}