1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "nacl_io/ossocket.h"
7 #ifdef PROVIDES_SOCKET_API
11 #include "sdk_util/macros.h"
15 const char* hstrerror(int err) {
16 // These error message texts are taken straight from the man page
17 const char* host_not_found_msg =
18 "The specified host is unknown.";
19 const char* no_address_msg =
20 "The requested name is valid but does not have an IP address.";
21 const char* no_recovery_msg =
22 "A nonrecoverable name server error occurred.";
23 const char* try_again_msg =
24 "A temporary error occurred on an authoritative name server. "
26 const char* internal_msg =
27 "Internal error in gethostbyname.";
28 const char* unknown_msg_base =
29 "Unknown error in gethostbyname: ";
33 return host_not_found_msg;
35 return no_address_msg;
37 return no_recovery_msg;
43 std::stringstream msg;
44 msg << unknown_msg_base << err << ".";
46 static std::string unknown_msg;
47 unknown_msg.assign(msg.str());
48 return unknown_msg.c_str();
54 #endif // PROVIDES_SOCKET_API