statvfs.cpp 557 B

1234567891011121314151617181920212223242526
  1. /*
  2. * Copyright (c) 2021, Justin Mietzner <sw1tchbl4d3@sw1tchbl4d3.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <errno.h>
  7. #include <string.h>
  8. #include <sys/statvfs.h>
  9. #include <syscall.h>
  10. extern "C" {
  11. int statvfs(char const* path, struct statvfs* buf)
  12. {
  13. Syscall::SC_statvfs_params params { { path, strlen(path) }, buf };
  14. int rc = syscall(SC_statvfs, &params);
  15. __RETURN_WITH_ERRNO(rc, rc, -1);
  16. }
  17. int fstatvfs(int fd, struct statvfs* buf)
  18. {
  19. int rc = syscall(SC_fstatvfs, fd, buf);
  20. __RETURN_WITH_ERRNO(rc, rc, -1);
  21. }
  22. }