faccessat function

int faccessat(
  1. int fd,
  2. String filename,
  3. int type,
  4. int flag,
)

Test for access to FILE relative to the directory FD is open on. If AT_EACCESS is set in FLAG, then use effective IDs like eaccess', otherwise use real IDs like access'.

Implementation

int faccessat(
  int fd,
  String filename, // ffi.Pointer<Utf8> file,
  int type,
  int flag,
) {
  _faccessat ??= Libc().dylib.lookupFunction<
      ffi.Int32 Function(ffi.Int32, ffi.Pointer<Utf8>, ffi.Int32, ffi.Int32),
      _dart_faccessat>('faccessat');

  final cFilename = filename.toNativeUtf8();
  final result = _faccessat!(
    fd,
    cFilename,
    type,
    flag,
  );

  malloc.free(cFilename);

  return result;
}