From 81bd1ca7231e12c4cd0248784355ddd8a6de6918 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 20 Oct 2005 14:26:23 +0000 Subject: [PATCH] * cygwin.din (futimes): Export. (lutimes): Export. * times.cc (utimes_worker): Created from utimes, add nofollow flag to implement utimes and lutimes. (utimes): Just call utimes_worker. (lutimes): New function. (futimes): Ditto. * include/cygwin/version.h: Bump API minor version. --- winsup/cygwin/ChangeLog | 11 ++++++++ winsup/cygwin/cygwin.din | 2 ++ winsup/cygwin/include/cygwin/version.h | 3 ++- winsup/cygwin/times.cc | 36 +++++++++++++++++++++++--- 4 files changed, 47 insertions(+), 5 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 713e93436..5a11ce6c8 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,14 @@ +2005-10-20 Corinna Vinschen + + * cygwin.din (futimes): Export. + (lutimes): Export. + * times.cc (utimes_worker): Created from utimes, add nofollow flag + to implement utimes and lutimes. + (utimes): Just call utimes_worker. + (lutimes): New function. + (futimes): Ditto. + * include/cygwin/version.h: Bump API minor version. + 2005-10-19 Christopher Faylor * sigproc.cc (child_info::sync): Move check for !wr_proc_pipe lower. diff --git a/winsup/cygwin/cygwin.din b/winsup/cygwin/cygwin.din index f172f1415..1aede4e01 100644 --- a/winsup/cygwin/cygwin.din +++ b/winsup/cygwin/cygwin.din @@ -1522,6 +1522,8 @@ utime SIGFE _utime = utime SIGFE utimes SIGFE _utimes = utimes SIGFE +futimes SIGFE +lutimes SIGFE utmpname SIGFE _utmpname = utmpname SIGFE utmpxname SIGFE diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index 9edd89856..2a6144f78 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -278,12 +278,13 @@ details. */ 139: Start using POSIX definition of struct msghdr and WinSock2 IPPROTO_IP values. 140: Export mlock, munlock. + 140: Export futimes, lutimes. */ /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */ #define CYGWIN_VERSION_API_MAJOR 0 -#define CYGWIN_VERSION_API_MINOR 140 +#define CYGWIN_VERSION_API_MINOR 141 /* There is also a compatibity version number associated with the shared memory regions. It is incremented when incompatible diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc index e4bcb8cef..1c28c51e3 100644 --- a/winsup/cygwin/times.cc +++ b/winsup/cygwin/times.cc @@ -441,12 +441,11 @@ gmtime (const time_t *tim_p) #endif /* POSIX_LOCALTIME */ -/* utimes: POSIX/SUSv3 */ -extern "C" int -utimes (const char *path, const struct timeval *tvp) +static int +utimes_worker (const char *path, const struct timeval *tvp, int nofollow) { int res = -1; - path_conv win32 (path, PC_SYM_FOLLOW); + path_conv win32 (path, nofollow ? PC_SYM_NOFOLLOW : PC_SYM_FOLLOW); fhandler_base *fh = NULL; bool fromfd = false; @@ -482,6 +481,35 @@ error: return res; } +/* utimes: POSIX/SUSv3 */ +extern "C" int +utimes (const char *path, const struct timeval *tvp) +{ + return utimes_worker (path, tvp, 0); +} + +/* BSD */ +extern "C" int +lutimes (const char *path, const struct timeval *tvp) +{ + return utimes_worker (path, tvp, 1); +} + +/* BSD */ +extern "C" int +futimes (int fd, const struct timeval *tvp) +{ + int res; + + cygheap_fdget cfd (fd); + if (cfd < 0) + res = -1; + else + res = cfd->utimes (tvp); + syscall_printf ("%d = futimes (%d, %p)", res, fd, tvp); + return res; +} + /* utime: POSIX 5.6.6.1 */ extern "C" int utime (const char *path, const struct utimbuf *buf)