public unsafe static FileInfo LStat(string path) { var bytes = Encoding.UTF8.GetBytes(path); stat stat = default; fixed(byte *pathname = bytes) { int rv = LibC.lstat(pathname, &stat); if (rv == -1) { PlatformException.Throw(); } } return(ToFileInfo(stat)); }
public unsafe static string Readlink(string path) { var pathBytes = Encoding.UTF8.GetBytes(path); int bufferLength = 1024; byte *buffer = stackalloc byte[bufferLength]; long size; fixed(byte *pathname = pathBytes) { size = LibC.readlink(pathname, buffer, bufferLength); if (size == -1) { PlatformException.Throw(); } } return(Encoding.UTF8.GetString(buffer, (int)size)); }