private static void CopyUtsname(ref Utsname to, ref _Utsname from) { try { to = new Utsname { sysname = Marshal.PtrToStringAnsi(from.sysname), nodename = Marshal.PtrToStringAnsi(from.nodename), release = Marshal.PtrToStringAnsi(from.release), version = Marshal.PtrToStringAnsi(from.version), machine = Marshal.PtrToStringAnsi(from.machine), domainname = Marshal.PtrToStringAnsi(from.domainname) }; } finally { free(from._buf_); from._buf_ = IntPtr.Zero; } }
private static extern int sys_uname(out _Utsname buf);