utimes.c 804 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * utimes() for uClibc
  4. *
  5. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  6. *
  7. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  8. */
  9. #include <sys/syscall.h>
  10. #include <utime.h>
  11. #include <sys/time.h>
  12. /* libc_hidden_proto(utimes) */
  13. #ifdef __NR_utimes
  14. _syscall2(int, utimes, const char *, file, const struct timeval *, tvp)
  15. #else
  16. #include <stdlib.h>
  17. /* libc_hidden_proto(utime) */
  18. int 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. link_warning(utimes, "the use of LEGACY `utimes' is discouraged, use `utime'")
  32. libc_hidden_def(utimes)