1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
4 
5 #include "pal_runtimeextensions.h"
6 #include "pal_types.h"
7 #include <stdio.h>
8 #include <sys/utsname.h>
9 
SystemNative_GetNodeName(char * version,int * capacity)10 extern "C" int32_t SystemNative_GetNodeName(char* version, int* capacity)
11 {
12     struct utsname _utsname;
13     if (uname(&_utsname) != -1)
14     {
15         int r = snprintf(version, static_cast<size_t>(*capacity), "%s", _utsname.nodename);
16         if (r > *capacity)
17         {
18             *capacity = r + 1;
19             return -1;
20         }
21     }
22 
23     return 0;
24 }
25