native_readlink function
Read the contents of the symbolic link PATH into no more than LEN bytes of BUF. The contents are not null-terminated. Returns the number of characters read, or -1 for errors.
Implementation
int native_readlink(
String path,
ffi.Pointer<Utf8> buf,
int len,
) {
final cPath = path.toNativeUtf8();
_readlink ??= Libc().dylib.lookupFunction<
ffi.Int64 Function(ffi.Pointer<Utf8>, ffi.Pointer<Utf8>, ffi.Uint64),
_dart_readlink>('readlink');
final read = _readlink!(
cPath,
buf,
len,
);
if (read == -1) {
_throwIfErrno('readlink', read, cPath);
}
malloc.free(cPath);
return read;
}