2 // Mono.Posix.Syscall.cs: System calls to Posix subsystem features
7 using System.Runtime.InteropServices;
11 public class Syscall {
12 [DllImport ("libc", EntryPoint="gethostname")]
13 static extern int syscall_gethostname (byte[] p, int len);
15 public static string GetHostName ()
17 byte [] buf = new byte [256];
18 int res = syscall_gethostname (buf, buf.Length);
21 for (res = 0; res < buf.Length; ++res) {
26 return Encoding.UTF8.GetString (buf, 0, res);