1b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)// Copyright (c) 2013 The Chromium Authors. All rights reserved. 2b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 3b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)// found in the LICENSE file. 4b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 5b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)#include "sync/util/get_session_name_linux.h" 6b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 7b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)#include <limits.h> // for HOST_NAME_MAX 8b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)#include <unistd.h> // for gethostname() 9b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 10b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)#include "base/linux_util.h" 11b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 12b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)namespace syncer { 13b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)namespace internal { 14b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 15b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)std::string GetHostname() { 16b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) char hostname[HOST_NAME_MAX]; 17b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) if (gethostname(hostname, HOST_NAME_MAX) == 0) // Success. 18b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) return hostname; 19b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) return base::GetLinuxDistro(); 20b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)} 21b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 22b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)} // namespace internal 23b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)} // namespace syncer 24b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 25