utimes.c 627 B

123456789101112131415161718192021222324252627282930
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * utimes() for uClibc
  4. *
  5. * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org>
  6. *
  7. * GNU Library General Public License (LGPL) version 2 or later.
  8. */
  9. #include "syscalls.h"
  10. #include <utime.h>
  11. #ifdef __NR_utimes
  12. _syscall2(int, utimes, const char *, file, const struct timeval *, tvp);
  13. #else
  14. #include <stdlib.h>
  15. #include <sys/time.h>
  16. int utimes(const char *file, const struct timeval tvp[2])
  17. {
  18. struct utimbuf buf, *times;
  19. if (tvp) {
  20. times = &buf;
  21. times->actime = tvp[0].tv_sec;
  22. times->modtime = tvp[1].tv_sec;
  23. } else {
  24. times = NULL;
  25. }
  26. return utime(file, times);
  27. }
  28. #endif