Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2005-02-19 23:03:18 +0300
committerCorinna Vinschen <corinna@vinschen.de>2005-02-19 23:03:18 +0300
commitc2d0b9d89a3406e8905efa8fe58f9d948242e028 (patch)
tree2c543419a28ac35878e8c8b1cbe4c41881417c80 /winsup
parent2d7606a594bc02f4213fb14d780702d9be270e7f (diff)
* fhandler.h (class fhandler_socket): Declare new methods fchown,
fchmod and facl. * fhandler_socket.cc (fhandler_socket::fstat): Handle AF_LOCAL sockets. (fhandler_socket::fchmod): New method. (fhandler_socket::fchown): New method. (fhandler_socket::facl): New method.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog10
-rw-r--r--winsup/cygwin/fhandler.h3
-rw-r--r--winsup/cygwin/fhandler_socket.cc62
3 files changed, 70 insertions, 5 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 31685c20d..5c5cc537c 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,15 @@
2005-02-19 Corinna Vinschen <corinna@vinschen.de>
+ * fhandler.h (class fhandler_socket): Declare new methods fchown,
+ fchmod and facl.
+ * fhandler_socket.cc (fhandler_socket::fstat): Handle AF_LOCAL
+ sockets.
+ (fhandler_socket::fchmod): New method.
+ (fhandler_socket::fchown): New method.
+ (fhandler_socket::facl): New method.
+
+2005-02-19 Corinna Vinschen <corinna@vinschen.de>
+
* localtime.cc: Temporary implementation of setting __tzrule's offset
member to be used by strftime.
(__tzrule): New global variable.
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index 2d9c6215e..0617a82c5 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -433,6 +433,9 @@ class fhandler_socket: public fhandler_base
void signal_secret_event ();
void close_secret_event ();
int __stdcall fstat (struct __stat64 *buf) __attribute__ ((regparm (2)));
+ int __stdcall fchmod (mode_t mode) __attribute__ ((regparm (1)));
+ int __stdcall fchown (__uid32_t uid, __gid32_t gid) __attribute__ ((regparm (2)));
+ int __stdcall facl (int, int, __acl32 *) __attribute__ ((regparm (3)));
bool is_slow () {return 1;}
};
diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc
index 4f5552662..757c5a76b 100644
--- a/winsup/cygwin/fhandler_socket.cc
+++ b/winsup/cygwin/fhandler_socket.cc
@@ -34,6 +34,7 @@
#include "select.h"
#include "wininfo.h"
#include <unistd.h>
+#include <sys/acl.h>
extern bool fdsock (cygheap_fdmanip& fd, const device *, SOCKET soc);
extern "C" {
@@ -386,17 +387,68 @@ fhandler_socket::dup (fhandler_base *child)
int __stdcall
fhandler_socket::fstat (struct __stat64 *buf)
{
- int res = fhandler_base::fstat (buf);
- if (!res)
+ int res;
+ if (get_device () == FH_UNIX)
{
- buf->st_dev = 0;
- buf->st_ino = (__ino64_t) ((DWORD) get_handle ());
- buf->st_mode = S_IFSOCK | S_IRWXU | S_IRWXG | S_IRWXO;
+ res = fhandler_base::fstat_fs (buf);
+ if (!res)
+ {
+ buf->st_mode = (buf->st_mode & ~S_IFMT) | S_IFSOCK;
+ }
+ }
+ else
+ {
+ res = fhandler_base::fstat (buf);
+ if (!res)
+ {
+ buf->st_dev = 0;
+ buf->st_ino = (__ino64_t) ((DWORD) get_handle ());
+ buf->st_mode = S_IFSOCK | S_IRWXU | S_IRWXG | S_IRWXO;
+ }
}
return res;
}
int
+fhandler_socket::fchmod (mode_t mode)
+{
+ if (get_device () == FH_UNIX)
+ {
+ fhandler_disk_file fh;
+ fh.set_name (pc);
+ fh.get_device () = FH_FS;
+ int ret = fh.fchmod (mode);
+ SetFileAttributes (pc, GetFileAttributes (pc) | FILE_ATTRIBUTE_SYSTEM);
+ return ret;
+ }
+ return 0;
+}
+
+int
+fhandler_socket::fchown (__uid32_t uid, __gid32_t gid)
+{
+ if (get_device () == FH_UNIX)
+ {
+ fhandler_disk_file fh;
+ fh.set_name (pc);
+ return fh.fchown (uid, gid);
+ }
+ return 0;
+}
+
+int
+fhandler_socket::facl (int cmd, int nentries, __aclent32_t *aclbufp)
+{
+ if (get_device () == FH_UNIX)
+ {
+ fhandler_disk_file fh;
+ fh.set_name (pc);
+ return fh.facl (cmd, nentries, aclbufp);
+ }
+ return fhandler_base::facl (cmd, nentries, aclbufp);
+}
+
+int
fhandler_socket::bind (const struct sockaddr *name, int namelen)
{
int res = -1;