bb_getsockname.c 570 B

12345678910111213141516171819
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * Utility routines.
  4. *
  5. * Licensed under GPLv2, see file LICENSE in this source tree.
  6. */
  7. //kbuild:lib-y += bb_getsockname.o
  8. #include "libbb.h"
  9. int FAST_FUNC bb_getsockname(int sockfd, void *addr, socklen_t addrlen)
  10. {
  11. /* The usefullness of this function is that for getsockname(),
  12. * addrlen must go on stack (to _have_ an address to be passed),
  13. * but many callers do not need its modified value.
  14. * By using this shim, they can avoid unnecessary stack spillage.
  15. */
  16. return getsockname(sockfd, (struct sockaddr *)addr, &addrlen);
  17. }