diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2000-02-23 15:39:54 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2000-02-23 15:39:54 +0000 |
commit | ee897edd394fbd5ad60e91c0c16f4b466607c6a5 (patch) | |
tree | 08694df8377a836639fdf9f986f85f83c261dd64 /lib/libc | |
parent | 59508d5acf689b72ed459bbc61c0eb2ebbee74d5 (diff) |
add freeifaddrs(3), which reclaims region allocated by getifaddrs(3).
in sync with kame and bsdi.
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/net/Makefile.inc | 3 | ||||
-rw-r--r-- | lib/libc/net/getifaddrs.3 | 9 | ||||
-rw-r--r-- | lib/libc/net/getifaddrs.c | 10 |
3 files changed, 15 insertions, 7 deletions
diff --git a/lib/libc/net/Makefile.inc b/lib/libc/net/Makefile.inc index 7504a3e1959..641d6121051 100644 --- a/lib/libc/net/Makefile.inc +++ b/lib/libc/net/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.29 2000/02/23 06:55:58 itojun Exp $ +# $OpenBSD: Makefile.inc,v 1.30 2000/02/23 15:39:53 itojun Exp $ # net sources .PATH: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/net ${LIBCSRCDIR}/net @@ -47,6 +47,7 @@ MLINKS+=gethostbyname.3 endhostent.3 gethostbyname.3 gethostbyaddr.3 \ gethostbyname.3 sethostent.3 gethostbyname.3 gethostent.3 \ gethostbyname.3 herror.3 gethostbyname.3 gethostbyname2.3 \ gethostbyname.3 hstrerror.3 +MLINKS+=getifaddrs.3 freeifaddrs.3 MLINKS+=getnetent.3 endnetent.3 getnetent.3 getnetbyaddr.3 \ getnetent.3 getnetbyname.3 getnetent.3 setnetent.3 MLINKS+=getprotoent.3 endprotoent.3 getprotoent.3 getprotobyname.3 \ diff --git a/lib/libc/net/getifaddrs.3 b/lib/libc/net/getifaddrs.3 index 68c12b552a8..c081a0602c5 100644 --- a/lib/libc/net/getifaddrs.3 +++ b/lib/libc/net/getifaddrs.3 @@ -1,5 +1,5 @@ -.\" $OpenBSD: getifaddrs.3,v 1.1 2000/02/23 06:55:58 itojun Exp $ -.\" BSDI getifaddrs.3,v 2.4 1999/03/15 20:57:20 jch Exp +.\" $OpenBSD: getifaddrs.3,v 1.2 2000/02/23 15:39:53 itojun Exp $ +.\" BSDI getifaddrs.3,v 2.5 2000/02/23 14:51:59 dab Exp .\" .\" Copyright (c) 1995, 1999 .\" Berkeley Software Design, Inc. All rights reserved. @@ -32,6 +32,8 @@ .Fd #include <ifaddrs.h> .Ft int .Fn getifaddrs "struct ifaddrs **ifap" +.Ft void +.Fn freeifaddrs "struct ifaddrs *ifp" .Sh DESCRIPTION The .Fn getifaddrs @@ -120,8 +122,7 @@ which contains per-address interface statistics. The data returned by .Fn getifaddrs is dynamically allocated and should be freed using -.Fn free -.Pq see Xr free 3 +.Fn freeifaddrs when no longer needed. .Sh RETURN VALUES Upon successful completion, a value of 0 is returned. diff --git a/lib/libc/net/getifaddrs.c b/lib/libc/net/getifaddrs.c index 9537405667c..828d2da215b 100644 --- a/lib/libc/net/getifaddrs.c +++ b/lib/libc/net/getifaddrs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getifaddrs.c,v 1.1 2000/02/23 06:55:58 itojun Exp $ */ +/* $OpenBSD: getifaddrs.c,v 1.2 2000/02/23 15:39:53 itojun Exp $ */ /* * Copyright (c) 1995, 1999 @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * BSDI getifaddrs.c,v 2.11 1999/03/15 20:57:20 jch Exp + * BSDI getifaddrs.c,v 2.12 2000/02/23 14:51:59 dab Exp */ /* * NOTE: SIOCGIFCONF case is not LP64 friendly. it also does not perform @@ -371,3 +371,9 @@ getifaddrs(struct ifaddrs **pif) } return (0); } + +void +freeifaddrs(struct ifaddrs *ifp) +{ + free(ifp); +} |