From 8d817b0f9ed20cfa5e9482074999c2973a2a9543 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Fri, 5 Oct 2001 04:21:41 +0000 Subject: Add second path_conv * argument to fstat()s throughout. * fhandler.h: Change read and fstat to regparm/stdcall throughout. (fhandler_base::fstat): Just declare. Don't define. (fhandler_disk_file::fstat_helper): Declare. * fhandler.cc (fhandler_base::fstat): Move here from fhandler.h, adapt from former stat_dev(). (fhandler_disk_file::fstat): Move most of the disk-file-specific logic from stat_worker to here. Use fstat_helper to derive final fstat output. (fhandler_disk_file::fstat_helper): New method, renamed from former fstat method. (num_entries): Moved here from syscalls.cc. * fhandler_mem.cc (fhandler_dev_mem::fstat): Use base class to initialize most stuff. Invert has_physical_mem_access test for establishing permissions. * fhandler_raw.cc (fhandler_dev_raw::fstat): Eliminate unneed test and memory clearing. Use base class to initialize most stuff. * syscalls.cc (stat_dev): Eliminate. (stat_worker): Simply call fstat method to generate fstat output. Move all device specific code to appropriate fstats. * dir.cc (opendir): Pass correct arg to stat_worker to allow following symlinks. --- winsup/cygwin/fhandler.h | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) (limited to 'winsup/cygwin/fhandler.h') diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 6f80b61b5..5a07c43c9 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -313,11 +313,11 @@ public: virtual int open (path_conv * real_path, 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); } + virtual int __stdcall fstat (struct stat *buf, path_conv *) __attribute__ ((regparm (2))); virtual int ioctl (unsigned int cmd, void *); virtual int fcntl (int cmd, void *); virtual char const * ttyname () { return get_name(); } - virtual int read (void *ptr, size_t len); + virtual int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (2))); virtual int write (const void *ptr, size_t len); virtual off_t lseek (off_t offset, int whence); virtual int lock (int, struct flock *); @@ -397,7 +397,7 @@ public: void set_shutdown_write () {FHSETF (SHUTWR);} int write (const void *ptr, size_t len); - int read (void *ptr, size_t len); + int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (2))); int ioctl (unsigned int cmd, void *); int fcntl (int cmd, void *); off_t lseek (off_t, int) { return 0; } @@ -438,7 +438,7 @@ public: select_record *select_except (select_record *s); int ready_for_read (int fd, DWORD howlong, int ignra); void set_close_on_exec (int val); - int read (void *ptr, size_t len); + int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (2))); int close (); void create_guard (SECURITY_ATTRIBUTES *sa) {guard = CreateMutex (sa, FALSE, NULL);} int dup (fhandler_base *child); @@ -481,7 +481,7 @@ public: int raw_read (void *ptr, size_t ulen); int raw_write (const void *ptr, size_t ulen); - int fstat (struct stat *buf); + int __stdcall fstat (struct stat *buf, path_conv *) __attribute__ ((regparm (2))); int dup (fhandler_base *child); @@ -522,16 +522,16 @@ protected: public: fhandler_dev_tape (const char *name, int unit); - virtual int open (path_conv *, int flags, mode_t mode = 0); - virtual int close (void); + int open (path_conv *, int flags, mode_t mode = 0); + int close (void); - virtual off_t lseek (off_t offset, int whence); + off_t lseek (off_t offset, int whence); - virtual int fstat (struct stat *buf); + int __stdcall fstat (struct stat *buf, path_conv *) __attribute__ ((regparm (2))); - virtual int dup (fhandler_base *child); + int dup (fhandler_base *child); - virtual int ioctl (unsigned int cmd, void *buf); + int ioctl (unsigned int cmd, void *buf); private: int tape_write_marks (int marktype, DWORD len); @@ -557,7 +557,8 @@ public: int close (); int lock (int, struct flock *); BOOL is_device () { return FALSE; } - int fstat (struct stat *buf); + int __stdcall fstat (struct stat *buf, path_conv *pc) __attribute__ ((regparm (2))); + int __stdcall fstat_helper (struct stat *buf) __attribute__ ((regparm (1))); HANDLE mmap (caddr_t *addr, size_t len, DWORD access, int flags, off_t off); int munmap (HANDLE h, caddr_t addr, size_t len); @@ -747,7 +748,7 @@ public: int write (const void *ptr, size_t len); void doecho (const void *str, DWORD len) { (void) write (str, len); } - int read (void *ptr, size_t len); + int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (2))); int close (); int tcflush (int); @@ -818,7 +819,7 @@ public: int open (path_conv *, int flags, mode_t mode = 0); int write (const void *ptr, size_t len); - int read (void *ptr, size_t len); + int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (2))); void init (HANDLE, DWORD, mode_t); int tcsetattr (int a, const struct termios *t); @@ -845,7 +846,7 @@ public: int accept_input (); int open (path_conv *, int flags, mode_t mode = 0); int write (const void *ptr, size_t len); - int read (void *ptr, size_t len); + int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (2))); int close (); int tcsetattr (int a, const struct termios *t); @@ -891,7 +892,7 @@ public: fhandler_dev_zero (const char *name); int open (path_conv *, int flags, mode_t mode = 0); int write (const void *ptr, size_t len); - int read (void *ptr, size_t len); + int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (2))); off_t lseek (off_t offset, int whence); int close (void); @@ -914,7 +915,7 @@ public: int get_unit () { return unit; } int open (path_conv *, int flags, mode_t mode = 0); int write (const void *ptr, size_t len); - int read (void *ptr, size_t len); + int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (2))); off_t lseek (off_t offset, int whence); int close (void); int dup (fhandler_base *child); @@ -935,10 +936,10 @@ public: int open (path_conv *, int flags, mode_t mode = 0); int write (const void *ptr, size_t ulen); - int read (void *ptr, size_t ulen); + int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (2))); off_t lseek (off_t offset, int whence); int close (void); - int fstat (struct stat *buf); + int __stdcall fstat (struct stat *buf, path_conv *) __attribute__ ((regparm (2))); int dup (fhandler_base *child); HANDLE mmap (caddr_t *addr, size_t len, DWORD access, int flags, off_t off); @@ -957,7 +958,7 @@ public: int is_windows (void) { return 1; } int open (path_conv *, int flags, mode_t mode = 0); int write (const void *ptr, size_t len); - int read (void *ptr, size_t len); + int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (2))); off_t lseek (off_t offset, int whence); int close (void); @@ -982,7 +983,7 @@ public: int is_windows (void) { return 1; } int open (path_conv *, int flags, mode_t mode = 0); int write (const void *ptr, size_t len); - int read (void *ptr, size_t len); + int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (2))); int ioctl (unsigned int cmd, void *); off_t lseek (off_t, int) { return 0; } int close (void) { return 0; } @@ -1009,7 +1010,7 @@ public: int open (path_conv *, int flags, mode_t mode = 0); int write (const void *ptr, size_t len); - int read (void *ptr, size_t len); + int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (2))); int ioctl (unsigned int cmd, void *); off_t lseek (off_t, int); int close (void); -- cgit v1.2.3