From 2b09be25a3929c8c6d7e23e1abb4756187c5036b Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sun, 20 Feb 2005 11:44:32 +0000 Subject: * fhandler.h (enum query_state): Add query_write_attributes state. (fhandler_base::status.query_open): Add a bit to make room for more states. (class fhandler_base): Declare new method utimes. (class fhandler_socket): Ditto. (class fhandler_disk_file): Ditto. (fhandler_disk_file::fhandler_disk_file): Add constructor with path_conv parameter. * fhandler.cc (fhandler_base::open): Add query_write_attributes handling. (fhandler_base::utimes): New method. * fhandler_disk_file.cc (fhandler_disk_file::link): Simplify. Open file with query_write_attributes instead of query_write_control. (fhandler_disk_file::utimes): New method. (fhandler_disk_file::fhandler_disk_file): Add constructor with path_conv parameter setting pc member immediately. * fhandler_socket.cc (fhandler_socket::fchmod): Use new fhandler_disk_file constructor. (fhandler_socket::fchown): Ditto. (fhandler_socket::facl): Ditto. (fhandler_socket::link): Ditto. (fhandler_socket::utimes): New method. * times.cc: Include dtable.h. (timeval_to_filetime): Make non-static. (utimes): Move functionality into fhandler method utimes. Just call this method from here. * winsup.h: Simplify declarations of time helper functions. (timeval_to_filetime): Add extern declaration. --- winsup/cygwin/fhandler_socket.cc | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'winsup/cygwin/fhandler_socket.cc') diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 4e3f5e084..9f0b39f53 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -414,8 +414,7 @@ fhandler_socket::fchmod (mode_t mode) { if (get_device () == FH_UNIX) { - fhandler_disk_file fh; - fh.set_name (pc); + fhandler_disk_file fh (pc); fh.get_device () = FH_FS; int ret = fh.fchmod (mode); SetFileAttributes (pc, GetFileAttributes (pc) | FILE_ATTRIBUTE_SYSTEM); @@ -429,8 +428,7 @@ fhandler_socket::fchown (__uid32_t uid, __gid32_t gid) { if (get_device () == FH_UNIX) { - fhandler_disk_file fh; - fh.set_name (pc); + fhandler_disk_file fh (pc); return fh.fchown (uid, gid); } return 0; @@ -441,8 +439,7 @@ fhandler_socket::facl (int cmd, int nentries, __aclent32_t *aclbufp) { if (get_device () == FH_UNIX) { - fhandler_disk_file fh; - fh.set_name (pc); + fhandler_disk_file fh (pc); return fh.facl (cmd, nentries, aclbufp); } return fhandler_base::facl (cmd, nentries, aclbufp); @@ -453,13 +450,23 @@ fhandler_socket::link (const char *newpath) { if (get_device () == FH_UNIX) { - fhandler_disk_file fh; - fh.set_name (pc); + fhandler_disk_file fh (pc); return fh.link (newpath); } return fhandler_base::link (newpath); } +int +fhandler_socket::utimes (const struct timeval *tvp) +{ + if (get_device () == FH_UNIX) + { + fhandler_disk_file fh (pc); + return fh.utimes (tvp); + } + return fhandler_base::utimes (tvp); +} + int fhandler_socket::bind (const struct sockaddr *name, int namelen) { -- cgit v1.2.3