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 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
}
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);
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");
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
{
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); }
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");
}