From: corinna Date: Wed, 3 Dec 2003 09:55:41 +0000 (+0000) Subject: * fcntl.cc (fcntl_worker): Remove static storage class. X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=0353223dde95330f5d3a718dfa86bc0d73fe1a76;p=pf3gnuchains%2Fsourceware.git * fcntl.cc (fcntl_worker): Remove static storage class. * flock.cc (flock): Use struct __flock64. Call fcntl_worker. Use Cygwin errno functions instead of accessing errno directly. * winsup.h: Declare fcntl_worker. --- diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 966a812a5a..4113bc6b67 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,6 +1,13 @@ 2003-12-03 Corinna Vinschen - * fcntl.cc (_fcntl): Whitespace cleanup. + * fcntl.cc (fcntl_worker): Remove static storage class. + * flock.cc (flock): Use struct __flock64. Call fcntl_worker. + Use Cygwin errno functions instead of accessing errno directly. + * winsup.h: Declare fcntl_worker. + +2003-12-03 Corinna Vinschen + + * fcntl.cc: Whitespace cleanup. 2003-12-03 Christopher Faylor diff --git a/winsup/cygwin/fcntl.cc b/winsup/cygwin/fcntl.cc index a492bf93dc..d81126f52e 100644 --- a/winsup/cygwin/fcntl.cc +++ b/winsup/cygwin/fcntl.cc @@ -19,7 +19,7 @@ details. */ #include "cygheap.h" #include "thread.h" -static int +int fcntl_worker (int fd, int cmd, void *arg) { int res; diff --git a/winsup/cygwin/flock.cc b/winsup/cygwin/flock.cc index 09ea2b6dbb..b15962d94d 100644 --- a/winsup/cygwin/flock.cc +++ b/winsup/cygwin/flock.cc @@ -15,9 +15,9 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#include "winsup.h" +#include "cygerrno.h" #include -#include -#include #include #include @@ -25,7 +25,7 @@ int flock (int fd, int operation) { int i, cmd; - struct flock l = { 0, 0, 0, 0, 0 }; + struct __flock64 l = { 0, 0, 0, 0, 0 }; if (operation & LOCK_NB) { cmd = F_SETLK; @@ -39,40 +39,40 @@ flock (int fd, int operation) { case LOCK_EX: l.l_type = F_WRLCK; - i = fcntl (fd, cmd, &l); + i = fcntl_worker (fd, cmd, &l); if (i == -1) { - if ((errno == EAGAIN) || (errno == EACCES)) + if ((get_errno () == EAGAIN) || (get_errno () == EACCES)) { - errno = EWOULDBLOCK; + set_errno (EWOULDBLOCK); } } break; case LOCK_SH: l.l_type = F_RDLCK; - i = fcntl (fd, cmd, &l); + i = fcntl_worker (fd, cmd, &l); if (i == -1) { - if ((errno == EAGAIN) || (errno == EACCES)) + if ((get_errno () == EAGAIN) || (get_errno () == EACCES)) { - errno = EWOULDBLOCK; + set_errno (EWOULDBLOCK); } } break; case LOCK_UN: l.l_type = F_UNLCK; - i = fcntl (fd, cmd, &l); + i = fcntl_worker (fd, cmd, &l); if (i == -1) { - if ((errno == EAGAIN) || (errno == EACCES)) + if ((get_errno () == EAGAIN) || (get_errno () == EACCES)) { - errno = EWOULDBLOCK; + set_errno (EWOULDBLOCK); } } break; default: i = -1; - errno = EINVAL; + set_errno (EINVAL); break; } return i; diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h index 937b460618..26be3d0c3e 100644 --- a/winsup/cygwin/winsup.h +++ b/winsup/cygwin/winsup.h @@ -298,6 +298,8 @@ int symlink_worker (const char *, const char *, bool, bool) class path_conv; int access_worker (path_conv&, int) __attribute__ ((regparm (2))); +int fcntl_worker (int fd, int cmd, void *arg); + extern "C" int low_priority_sleep (DWORD) __attribute__ ((regparm (1))); #define SLEEP_0_STAY_LOW INFINITE