add freeifaddrs(), which reclaims region allocated by getifaddrs().
in sync with kame and bsdi.
This commit is contained in:
parent
e1c9f9e96d
commit
4b9363d8e4
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ifaddrs.h,v 1.1 2000/02/23 06:57:47 itojun Exp $ */
|
||||
/* $NetBSD: ifaddrs.h,v 1.2 2000/02/23 15:29:19 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 ifaddrs.h,v 2.4 1999/03/15 20:59:28 jch Exp
|
||||
* BSDI ifaddrs.h,v 2.5 2000/02/23 14:51:59 dab Exp
|
||||
*/
|
||||
|
||||
#ifndef _IFADDRS_H_
|
||||
@ -50,6 +50,7 @@ struct ifaddrs {
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern int getifaddrs __P((struct ifaddrs **));
|
||||
extern void freeifaddrs __P((struct ifaddrs *));
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" $NetBSD: getifaddrs.3,v 1.1 2000/02/23 06:57:46 itojun Exp $
|
||||
.\" BSDI getifaddrs.3,v 2.4 1999/03/15 20:57:20 jch Exp
|
||||
.\" $NetBSD: getifaddrs.3,v 1.2 2000/02/23 15:29:18 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.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: getifaddrs.c,v 1.1 2000/02/23 06:57:46 itojun Exp $ */
|
||||
/* $NetBSD: getifaddrs.c,v 1.2 2000/02/23 15:29:18 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
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
@ -367,3 +367,9 @@ getifaddrs(struct ifaddrs **pif)
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
freeifaddrs(struct ifaddrs *ifp)
|
||||
{
|
||||
free(ifp);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user