native_ttyname function
Return the pathname of the terminal associate with the fd
or
null if no terminal is associated with the fd
Throws a PosixException if an error occurs.
This method is not thread safe.
Implementation
ffi.Pointer<Utf8> native_ttyname(
int fd,
) {
_ttyname ??= Libc()
.dylib
.lookupFunction<ffi.Pointer<Utf8> Function(ffi.Int32), _dart_ttyname>(
'ttyname');
final cName = _ttyname!(
fd,
);
if (cName == ffi.nullptr) {
_throwIfErrno('ttyname', -1);
}
return cName;
}