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