OSDN Git Service

* dtable.cc (dtable::build_fhandler): Accept an optional path_conv argument.
authorcgf <cgf>
Sat, 22 Sep 2001 21:44:07 +0000 (21:44 +0000)
committercgf <cgf>
Sat, 22 Sep 2001 21:44:07 +0000 (21:44 +0000)
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.

winsup/cygwin/ChangeLog
winsup/cygwin/dtable.cc
winsup/cygwin/dtable.h
winsup/cygwin/fhandler.cc
winsup/cygwin/fhandler.h
winsup/cygwin/syscalls.cc

index ca302eb..86a49a0 100644 (file)
@@ -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
index 82009c9..8578cc7 100644 (file)
@@ -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);
index 1a51c92..7e27bf6 100644 (file)
@@ -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");
index 8ed52ff..a670e78 100644 (file)
@@ -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
index 79d039e..1fe6990 100644 (file)
@@ -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); }
index a98b23a..19d259a 100644 (file)
@@ -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");
     }