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