This is the mail archive of the mailing list for the newlib project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch/ob] openat and friends for Cygwin

> On Apr 23 06:44, Eric Blake wrote:
> > Shouldn't you also declare utimensat in sys/stat.h?  Posix 200x scrapped
> > futimesat in favor of utimensat, in part because nanosecond resolution is
> > too important to overlook, and in part, to add a flag parameter so you can
> > adjust timestamps of symlinks independently of what they point to on file
> > systems that support that.

Done.  I applied the below patch.


        * libc/include/sys/stat.h (UTIME_NOW): Define for Cygwin.
        (UTIME_OMIT): Ditto.
        (utimensat): Declare for Cygwin.
        (futimens): Ditto.

Index: libc/include/sys/stat.h
RCS file: /cvs/src/src/newlib/libc/include/sys/stat.h,v
retrieving revision 1.18
diff -u -p -r1.18 stat.h
--- libc/include/sys/stat.h     23 Apr 2008 11:13:24 -0000      1.18
+++ libc/include/sys/stat.h     24 Apr 2008 09:30:11 -0000
@@ -115,6 +115,11 @@ struct     stat 
 #define        S_ISLNK(m)      (((m)&_IFMT) == _IFLNK)
 #define        S_ISSOCK(m)     (((m)&_IFMT) == _IFSOCK)

+#if defined(__CYGWIN__)
+/* Special tv_nsec values for futimens(2) and utimensat(2). */
+#define UTIME_NOW      -2L
+#define UTIME_OMIT     -1L

 int    _EXFUN(chmod,( const char *__path, mode_t __mode ));
 int     _EXFUN(fchmod,(int __fd, mode_t __mode));
@@ -135,6 +140,8 @@ int _EXFUN(fstatat, (int, const char *, 
 int    _EXFUN(mkdirat, (int, const char *, mode_t));
 int    _EXFUN(mkfifoat, (int, const char *, mode_t));
 int    _EXFUN(mknodat, (int, const char *, mode_t, dev_t));
+int    _EXFUN(utimensat, (int, const char *, const struct timespec *, int));
+int    _EXFUN(futimens, (int, const struct timespec *));

 /* Provide prototypes for most of the _<systemcall> names that are

Corinna Vinschen
Cygwin Project Co-Leader
Red Hat

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]