Bernhard Reutner-Fischer wrote:
On Mon, May 30, 2011 at 10:09:30AM -0700, Mark Hinds wrote:
Why isn't futimes in uClibc? I found a patch which seems to work,
You must me using an old version.
I don't think so. 0.9.32-rc3 seems to be the freshest thing around.
mothra(toolchain/uClibc-0.9.32-rc3)% find . -name \*.c | xargs grep futimes
./libc/sysdeps/linux/common/futimesat.c: * futimesat() for uClibc
./libc/sysdeps/linux/common/futimesat.c:#ifdef __NR_futimesat
./libc/sysdeps/linux/common/futimesat.c:_syscall3(int, futimesat, int, fd,
const char *, file, const struct timeval *, tvp)
./libc/sysdeps/linux/common/futimesat.c:/* should add emulation with futimes()
and /proc/self/fd/ ... */
mothra(toolchain/uClibc-0.9.32-rc3)% find . -name \*.h | xargs grep futimes
./include/sys/time.h:extern int futimes (int __fd, __const struct timeval
__tvp[2]) __THROW;
./include/sys/time.h:extern int futimesat (int __fd, __const char *__file,
./include/bits/sysnum.h:#undef __NR_futimesat
./include/bits/sysnum.h:#define __NR_futimesat (0 +326)
./include/bits/sysnum.h:#define SYS_futimesat __NR_futimesat
mothra(toolchain/uClibc-0.9.32-rc3)% vi ./include/sys/time.h
#ifdef __USE_BSD
/* Same as `utimes', but does not follow symbolic links. */
extern int lutimes (__const char *__file, __const struct timeval __tvp[2])
__THROW __nonnull ((1));
#if 0
/* Same as `utimes', but takes an open file descriptor instead of a name. */
extern int futimes (int __fd, __const struct timeval __tvp[2]) __THROW;
#endif
#endif
I just used futimens and TIMEVAL_TO_TIMESPEC() in the app which used futimes
(perl-5.14.0 doio.c).
I suppose I don't care much one way or the other, but seems fairly simple
to add futimes() to uClibc since it does have futimens()
Just copy libc/sysdeps/linux/common/futimens.c to futimes.c and change to
int futimes(int fd, const struct timeval* tvp)
{
struct timespec ts[2];
TIMEVAL_TO_TIMESPEC(tvp[0], ts[0]);
TIMEVAL_TO_TIMESPEC(tvp[1], ts[1]);
return utimensat(fd, 0, ts, 0); <- this is what futimens does
}
Just my 2 bits :-)
Mark Hinds
_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc