You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2016/04/11 18:51:30 UTC

mesos git commit: Adding a stout interface for `sethostname` system call in linux.

Repository: mesos
Updated Branches:
  refs/heads/master 4dfa91fc2 -> 00141e4a5


Adding a stout interface for `sethostname` system call in linux.

Review: https://reviews.apache.org/r/45953/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/00141e4a
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/00141e4a
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/00141e4a

Branch: refs/heads/master
Commit: 00141e4a56a81525fec1f86f2b212dcbc04e3a8c
Parents: 4dfa91f
Author: Avinash sridharan <av...@mesosphere.io>
Authored: Mon Apr 11 09:51:16 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Mon Apr 11 09:51:16 2016 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/3rdparty/stout/include/stout/net.hpp | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/00141e4a/3rdparty/libprocess/3rdparty/stout/include/stout/net.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/net.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/net.hpp
index c3812c9..1c99d89 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/net.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/net.hpp
@@ -273,6 +273,17 @@ inline Try<std::string> getHostname(const IP& ip)
 }
 
 
+// Returns a `Try` of the result of attempting to set the `hostname`.
+inline Try<Nothing> setHostname(const std::string& hostname)
+{
+  if (sethostname(hostname.c_str(), hostname.size()) != 0) {
+    return ErrnoError();
+  }
+
+  return Nothing();
+}
+
+
 // Returns the names of all the link devices in the system.
 inline Try<std::set<std::string>> links()
 {