native_pipe function
Create a one-way communication channel (pipe).
If successful, two file descriptors are stored in PIPEDES;
bytes written on PIPEDES1
can be read from PIPEDES0
.
Returns 0 if successful, -1 if not.
Implementation
List<int> native_pipe(
ffi.Pointer<ffi.Int32> __pipedes,
) {
final cPipedes = malloc.allocate<ffi.Int32>(2);
_pipe ??= Libc()
.dylib
.lookupFunction<ffi.Int32 Function(ffi.Pointer<ffi.Int32>), _dart_pipe>(
'pipe');
final result = _pipe!(
cPipedes,
);
_throwIfErrno('pipe', result, cPipedes);
final pipedes = cPipedes.asTypedList(2);
malloc.free(cPipedes);
return pipedes;
}