diff options
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r-- | winsup/cygwin/syscalls.cc | 49 |
1 files changed, 42 insertions, 7 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 961bc3f12..f66363f7d 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -1033,8 +1033,16 @@ fstat64 (int fd, struct __stat64 *buf) return res; } -extern "C" int _fstat64 (int fd, _off64_t pos, int dir) - __attribute__ ((alias ("fstat64"))); +extern "C" int +_fstat64_r (struct _reent *ptr, int fd, struct __stat64 *buf) +{ + int ret; + + set_errno (0); + if ((ret = fstat64 (fd, buf)) == -1 && get_errno () != 0) + ptr->_errno = get_errno (); + return ret; +} extern "C" int fstat (int fd, struct __stat32 *buf) @@ -1046,8 +1054,16 @@ fstat (int fd, struct __stat32 *buf) return ret; } -extern "C" int _fstat (int fd, _off64_t pos, int dir) - __attribute__ ((alias ("fstat"))); +extern "C" int +_fstat_r (struct _reent *ptr, int fd, struct __stat32 *buf) +{ + int ret; + + set_errno (0); + if ((ret = fstat (fd, buf)) == -1 && get_errno () != 0) + ptr->_errno = get_errno (); + return ret; +} /* fsync: P96 6.6.1.1 */ extern "C" int @@ -1133,9 +1149,6 @@ stat_worker (const char *name, struct __stat64 *buf, int nofollow, return res; } -extern "C" int _stat (int fd, _off64_t pos, int dir) - __attribute__ ((alias ("stat"))); - extern "C" int stat64 (const char *name, struct __stat64 *buf) { @@ -1145,6 +1158,17 @@ stat64 (const char *name, struct __stat64 *buf) } extern "C" int +_stat64_r (struct _reent *ptr, const char *name, struct __stat64 *buf) +{ + int ret; + + set_errno (0); + if ((ret = stat64 (name, buf)) == -1 && get_errno () != 0) + ptr->_errno = get_errno (); + return ret; +} + +extern "C" int stat (const char *name, struct __stat32 *buf) { struct __stat64 buf64; @@ -1154,6 +1178,17 @@ stat (const char *name, struct __stat32 *buf) return ret; } +extern "C" int +_stat_r (struct _reent *ptr, const char *name, struct __stat32 *buf) +{ + int ret; + + set_errno (0); + if ((ret = stat (name, buf)) == -1 && get_errno () != 0) + ptr->_errno = get_errno (); + return ret; +} + /* lstat: Provided by SVR4 and 4.3+BSD, POSIX? */ extern "C" int lstat64 (const char *name, struct __stat64 *buf) |