summaryrefslogtreecommitdiffstats
path: root/sys/libkern
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2000-11-25 03:14:31 +0000
committeralfred <alfred@FreeBSD.org>2000-11-25 03:14:31 +0000
commit8372807ce82edc09a93fcf0b185a4e1c8f247798 (patch)
tree3a168fa600b2979c1fff0a57935d18c716c6a9fd /sys/libkern
parent2e16a9c704611f1a12799a89913e801586862b44 (diff)
downloadFreeBSD-src-8372807ce82edc09a93fcf0b185a4e1c8f247798.zip
FreeBSD-src-8372807ce82edc09a93fcf0b185a4e1c8f247798.tar.gz
add threadsafe version of inet_ntoa (inet_ntoa_r takes a buffer to fill)
this is used by some debugging functions
Diffstat (limited to 'sys/libkern')
-rw-r--r--sys/libkern/inet_ntoa.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sys/libkern/inet_ntoa.c b/sys/libkern/inet_ntoa.c
index 558188c..25cfff1 100644
--- a/sys/libkern/inet_ntoa.c
+++ b/sys/libkern/inet_ntoa.c
@@ -48,3 +48,17 @@ inet_ntoa(struct in_addr ina)
return buf;
}
+char *
+inet_ntoa_r(struct in_addr ina, char *buf)
+{
+ unsigned char *ucp = (unsigned char *)&ina;
+
+ sprintf(buf, "%d.%d.%d.%d",
+ ucp[0] & 0xff,
+ ucp[1] & 0xff,
+ ucp[2] & 0xff,
+ ucp[3] & 0xff);
+ return buf;
+}
+
+
OpenPOWER on IntegriCloud