fchownat function

int fchownat(
  1. int fd,
  2. String filename,
  3. int owner,
  4. int group,
  5. int flag,
)

Change the owner and group of FILE relative to the directory FD is open on.

Implementation

int fchownat(
  int fd,
  String filename, // ffi.Pointer<Utf8> file,
  int owner,
  int group,
  int flag,
) {
  _fchownat ??= Libc().dylib.lookupFunction<
      ffi.Int32 Function(
          ffi.Int32, ffi.Pointer<Utf8>, ffi.Uint32, ffi.Uint32, ffi.Int32),
      _dart_fchownat>('fchownat');

  final cFilename = filename.toNativeUtf8();
  final result = _fchownat!(
    fd,
    cFilename,
    owner,
    group,
    flag,
  );

  malloc.free(cFilename);
  return result;
}