utime.cpp 448 B

1234567891011121314151617181920212223
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <errno.h>
  7. #include <string.h>
  8. #include <syscall.h>
  9. #include <utime.h>
  10. extern "C" {
  11. int utime(char const* pathname, const struct utimbuf* buf)
  12. {
  13. if (!pathname) {
  14. errno = EFAULT;
  15. return -1;
  16. }
  17. int rc = syscall(SC_utime, pathname, strlen(pathname), buf);
  18. __RETURN_WITH_ERRNO(rc, rc, -1);
  19. }
  20. }