diff options
| -rw-r--r-- | Changes | 2 | ||||
| -rw-r--r-- | eio.c | 13 | ||||
| -rw-r--r-- | libeio.m4 | 14 | 
3 files changed, 25 insertions, 4 deletions
| @@ -28,4 +28,6 @@ TODO: openbsd requites stdint.h for intptr_t - why posix?          - no longer set errno to 0 before making syscalls, this only lures            people into the trap of believing errno shows success or failure.          - "fix" demo.c so that it works as non-root. +        - suppoert utimes seperately from futimes, as some systems have +          utimes but not futimes. @@ -818,12 +818,10 @@ eio__pwrite (int fd, void *buf, size_t count, off_t offset)  }  #endif -#ifndef HAVE_FUTIMES +#ifndef HAVE_UTIMES  # undef utimes -# undef futimes -# define utimes(path,times)  eio__utimes  (path, times) -# define futimes(fd,times)   eio__futimes (fd, times) +# define utimes(path,times)  eio__utimes (path, times)  static int  eio__utimes (const char *filename, const struct timeval times[2]) @@ -841,6 +839,13 @@ eio__utimes (const char *filename, const struct timeval times[2])      return utime (filename, 0);  } +#endif + +#ifndef HAVE_FUTIMES + +# undef futimes +# define futimes(fd,times) eio__futimes (fd, times) +  static int eio__futimes (int fd, const struct timeval tv[2])  {    errno = ENOSYS; @@ -5,6 +5,20 @@ AC_SEARCH_LIBS(     [AC_MSG_ERROR(pthread functions not found)]  ) +AC_CACHE_CHECK(for utimes, ac_cv_utimes, [AC_LINK_IFELSE([[ +#include <sys/types.h> +#include <sys/time.h> +#include <utime.h> +struct timeval tv[2]; +int res; +int main (void) +{ +   res = utimes ("/", tv); +   return 0; +} +]],ac_cv_utimes=yes,ac_cv_utimes=no)]) +test $ac_cv_utimes = yes && AC_DEFINE(HAVE_UTIMES, 1, utimes(2) is available) +  AC_CACHE_CHECK(for futimes, ac_cv_futimes, [AC_LINK_IFELSE([[  #include <sys/types.h>  #include <sys/time.h> | 
