utimes.c 752 B

12345678910111213141516171819202122232425262728293031323334
  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. #define utime __utime
  10. #include "syscalls.h"
  11. #include <utime.h>
  12. #ifdef __NR_utimes
  13. #define __NR___utimes __NR_utimes
  14. attribute_hidden _syscall2(int, __utimes, const char *, file, const struct timeval *, tvp);
  15. #else
  16. #include <stdlib.h>
  17. #include <sys/time.h>
  18. int attribute_hidden __utimes(const char *file, const struct timeval tvp[2])
  19. {
  20. struct utimbuf buf, *times;
  21. if (tvp) {
  22. times = &buf;
  23. times->actime = tvp[0].tv_sec;
  24. times->modtime = tvp[1].tv_sec;
  25. } else {
  26. times = NULL;
  27. }
  28. return utime(file, times);
  29. }
  30. #endif
  31. strong_alias(__utimes,utimes)