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
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2001-09-23 01:44:07 +0400
committerChristopher Faylor <me@cgf.cx>2001-09-23 01:44:07 +0400
commit9854ada7547fab60f8283aad78deff6011ac4d5b (patch)
tree739a6e9dcdf341d39cc2c9238d713896ed711312
parent880230dc7cb0fb299d2114ae4fb10efa7bcda626 (diff)
* dtable.cc (dtable::build_fhandler): Accept an optional path_conv argument.
If available, use this to calculate path name and device number. * dtable.h (dtable): Reflect above change. * fhandler.h (fhandler_base): Declare virtual method which accepts path_conv rather than path string as first argument. * fhandler.cc (fhandler_base::open): Define above new method. * syscalls.cc (_open): Set aside a path_conv variable for use in build_fhandler and subsequent call to open.
-rw-r--r--winsup/cygwin/ChangeLog13
-rw-r--r--winsup/cygwin/dtable.cc12
-rw-r--r--winsup/cygwin/dtable.h3
-rw-r--r--winsup/cygwin/fhandler.cc6
-rw-r--r--winsup/cygwin/fhandler.h1
-rw-r--r--winsup/cygwin/syscalls.cc18
6 files changed, 43 insertions, 10 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index ca302eb75..86a49a09b 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,16 @@
+Sat Sep 22 17:33:45 2001 Christopher Faylor <cgf@cygnus.com>
+ Corinna Vinschen <corinna@vinschen.de>
+
+ * dtable.cc (dtable::build_fhandler): Accept an optional path_conv
+ argument. If available, use this to calculate path name and device
+ number.
+ * dtable.h (dtable): Reflect above change.
+ * fhandler.h (fhandler_base): Declare virtual method which accepts
+ path_conv rather than path string as first argument.
+ * fhandler.cc (fhandler_base::open): Define above new method.
+ * syscalls.cc (_open): Set aside a path_conv variable for use in
+ build_fhandler and subsequent call to open.
+
Sat Sep 22 12:44:57 2001 Christopher Faylor <cgf@cygnus.com>
* exceptions.cc (setup_handler): Always relinquish lock after we've
diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
index 82009c943..8578cc76e 100644
--- a/winsup/cygwin/dtable.cc
+++ b/winsup/cygwin/dtable.cc
@@ -228,12 +228,20 @@ cygwin_attach_handle_to_fd (char *name, int fd, HANDLE handle, mode_t bin,
}
fhandler_base *
-dtable::build_fhandler (int fd, const char *name, HANDLE handle)
+dtable::build_fhandler (int fd, const char *name, HANDLE handle, path_conv *pc)
{
int unit;
DWORD devn;
- if ((devn = get_device_number (name, unit)) == FH_BAD)
+ if (!pc)
+ devn = get_device_number (name, unit);
+ else
+ {
+ pc->check (name);
+ devn = pc->get_devn ();
+ }
+
+ if (devn == FH_BAD)
{
struct sockaddr sa;
int sal = sizeof (sa);
diff --git a/winsup/cygwin/dtable.h b/winsup/cygwin/dtable.h
index 1a51c9249..7e27bf657 100644
--- a/winsup/cygwin/dtable.h
+++ b/winsup/cygwin/dtable.h
@@ -49,7 +49,8 @@ public:
void fixup_after_fork (HANDLE);
fhandler_base *build_fhandler (int fd, DWORD dev, const char *name,
int unit = -1);
- fhandler_base *build_fhandler (int fd, const char *name, HANDLE h);
+ fhandler_base *build_fhandler (int fd, const char *name, HANDLE h = NULL,
+ path_conv *pc = NULL);
inline int not_open (int fd)
{
SetResourceLock (LOCK_FD_LIST, READ_LOCK, "not_open");
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index 8ed52ffe9..a670e7860 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -289,6 +289,12 @@ fhandler_base::get_default_fmode (int flags)
return __fmode;
}
+int
+fhandler_base::open (path_conv& real_path, int flags, mode_t mode)
+{
+ return open ((char *) real_path, flags, mode);
+}
+
/* Open system call handler function.
Path is now already checked for symlinks */
int
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index 79d039e64..1fe6990d0 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -320,6 +320,7 @@ public:
{
return open (flags, mode);
}
+ virtual int open (path_conv& real_path, int flags, mode_t mode);
virtual int open (int flags, mode_t mode = 0);
virtual int close ();
virtual int fstat (struct stat *buf) { return stat_dev (get_device (), get_unit (), get_namehash (), buf); }
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index a98b23a50..19d259a0a 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -484,15 +484,19 @@ _open (const char *unix_path, int flags, ...)
if (fd < 0)
set_errno (ENMFILE);
- else if ((fh = cygheap->fdtab.build_fhandler (fd, unix_path, NULL)) == NULL)
- res = -1; // errno already set
- else if (!fh->open (unix_path, flags, (mode & 07777) & ~cygheap->umask))
+ else
{
- cygheap->fdtab.release (fd);
- res = -1;
+ path_conv pc;
+ if ((fh = cygheap->fdtab.build_fhandler (fd, unix_path, NULL, &pc)) == NULL)
+ res = -1; // errno already set
+ else if (!fh->open (pc, flags, (mode & 07777) & ~cygheap->umask))
+ {
+ cygheap->fdtab.release (fd);
+ res = -1;
+ }
+ else if ((res = fd) <= 2)
+ set_std_handle (res);
}
- else if ((res = fd) <= 2)
- set_std_handle (res);
ReleaseResourceLock (LOCK_FD_LIST,WRITE_LOCK|READ_LOCK," open");
}