[Midnightbsd-cvs] src [6487] trunk: add allocaddrinfo(3)
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sat Dec 14 14:59:37 EST 2013
Revision: 6487
http://svnweb.midnightbsd.org/src/?rev=6487
Author: laffer1
Date: 2013-12-14 14:59:36 -0500 (Sat, 14 Dec 2013)
Log Message:
-----------
add allocaddrinfo(3)
Modified Paths:
--------------
trunk/include/netdb.h
trunk/lib/libc/net/Makefile.inc
trunk/lib/libc/net/Symbol.map
trunk/lib/libc/net/getaddrinfo.c
Modified: trunk/include/netdb.h
===================================================================
--- trunk/include/netdb.h 2013-12-12 03:09:55 UTC (rev 6486)
+++ trunk/include/netdb.h 2013-12-14 19:59:36 UTC (rev 6487)
@@ -281,6 +281,9 @@
void setnetgrent(const char *);
#endif
+#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || __BSD_VISIBLE
+struct addrinfo *allocaddrinfo(socklen_t);
+#endif
/*
* PRIVATE functions specific to the FreeBSD implementation
Modified: trunk/lib/libc/net/Makefile.inc
===================================================================
--- trunk/lib/libc/net/Makefile.inc 2013-12-12 03:09:55 UTC (rev 6486)
+++ trunk/lib/libc/net/Makefile.inc 2013-12-14 19:59:36 UTC (rev 6487)
@@ -60,7 +60,7 @@
ethers.3 ether_ntoa.3 ethers.3 ether_ntohost.3
MLINKS+=eui64.3 eui64_aton.3 eui64.3 eui64_hostton.3 \
eui64.3 eui64_ntoa.3 eui64.3 eui64_ntohost.3
-MLINKS+=getaddrinfo.3 freeaddrinfo.3
+MLINKS+=getaddrinfo.3 freeaddrinfo.3 getaddrinfo.3 allocaddrinfo.3
MLINKS+=gethostbyname.3 endhostent.3 gethostbyname.3 gethostbyaddr.3 \
gethostbyname.3 gethostbyname2.3 gethostbyname.3 gethostent.3 \
gethostbyname.3 herror.3 gethostbyname.3 hstrerror.3 \
Modified: trunk/lib/libc/net/Symbol.map
===================================================================
--- trunk/lib/libc/net/Symbol.map 2013-12-12 03:09:55 UTC (rev 6486)
+++ trunk/lib/libc/net/Symbol.map 2013-12-14 19:59:36 UTC (rev 6487)
@@ -148,6 +148,10 @@
sctp_sendv;
};
+MNBSD_1.1 {
+ allocaddrinfo;
+};
+
FBSDprivate_1.0 {
_nsdispatch;
_nsyyerror; /* generated from nslexer.l */
Modified: trunk/lib/libc/net/getaddrinfo.c
===================================================================
--- trunk/lib/libc/net/getaddrinfo.c 2013-12-12 03:09:55 UTC (rev 6486)
+++ trunk/lib/libc/net/getaddrinfo.c 2013-12-14 19:59:36 UTC (rev 6487)
@@ -1300,6 +1300,20 @@
return 0;
}
+struct addrinfo *
+allocaddrinfo(socklen_t addrlen)
+{
+ struct addrinfo *ai;
+
+ ai = calloc(sizeof(struct addrinfo) + addrlen, 1);
+ if (ai) {
+ ai->ai_addr = (void *)(ai+1);
+ ai->ai_addrlen = ai->ai_addr->sa_len = addrlen;
+ }
+
+ return ai;
+}
+
static struct addrinfo *
get_ai(const struct addrinfo *pai, const struct afd *afd, const char *addr)
{
More information about the Midnightbsd-cvs
mailing list