summaryrefslogtreecommitdiff
path: root/util/sock.h
diff options
context:
space:
mode:
authorDwight <dmerriman@gmail.com>2008-12-04 14:33:18 -0500
committerDwight <dmerriman@gmail.com>2008-12-04 14:33:18 -0500
commit0fe5e50be0deb6790dc6789a027c821ea8eb6a81 (patch)
tree017f55c8c2d7fce68c36e49205b8c6901f123d3e /util/sock.h
parent30573a6d913eb33db89ccafd6e1dbb34e901583d (diff)
downloadmongo-0fe5e50be0deb6790dc6789a027c821ea8eb6a81.tar.gz
web console work
Diffstat (limited to 'util/sock.h')
-rw-r--r--util/sock.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/util/sock.h b/util/sock.h
index f2be1b0f636..4f678098aec 100644
--- a/util/sock.h
+++ b/util/sock.h
@@ -190,3 +190,15 @@ inline SockAddr::SockAddr(const char *ip, int port) {
sa.sin_addr.s_addr = inet_addr(ip);
addressSize = sizeof(sa);
}
+
+inline string getHostName() {
+ char buf[256];
+ int ec = gethostname(buf, 127);
+ if( ec || *buf == 0 ) {
+ log() << "can't get this server's hostname errno:" << ec << endl;
+ return "";
+ }
+ return buf;
+}
+
+