From 1727fba007956454046c6cf7a34c9b229f10032e Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 1 Apr 2003 16:11:41 +0000 Subject: [PATCH] * dir.cc: Change __off32_t to _off_t and __off64_t to _off64_t throughout. * fhandler.cc: Ditto. * fhandler.h: Ditto. * fhandler_clipboard.cc: Ditto. * fhandler_disk_file.cc: Ditto. * fhandler_dsp.cc: Ditto. * fhandler_floppy.cc: Ditto. * fhandler_mem.cc: Ditto. * fhandler_proc.cc: Ditto. * fhandler_process.cc: Ditto. * fhandler_random.cc: Ditto. * fhandler_registry.cc: Ditto. * fhandler_tape.cc: Ditto. * fhandler_termios.cc: Ditto. * fhandler_virtual.cc: Ditto. * fhandler_zero.cc: Ditto. * mmap.cc: Ditto. * pipe.cc: Ditto. * syscalls.cc: Ditto. * winsup.h: Ditto. * include/cygwin/stat.h: Ditto. * include/cygwin/types.h: Ditto. Remove definition of __off32_t and __off64_t. --- winsup/cygwin/ChangeLog | 27 ++++++++++++ winsup/cygwin/dir.cc | 10 ++--- winsup/cygwin/fhandler.cc | 12 ++--- winsup/cygwin/fhandler.h | 66 ++++++++++++++-------------- winsup/cygwin/fhandler_clipboard.cc | 4 +- winsup/cygwin/fhandler_disk_file.cc | 18 ++++---- winsup/cygwin/fhandler_dsp.cc | 4 +- winsup/cygwin/fhandler_floppy.cc | 22 +++++----- winsup/cygwin/fhandler_mem.cc | 6 +-- winsup/cygwin/fhandler_proc.cc | 20 ++++----- winsup/cygwin/fhandler_process.cc | 12 ++--- winsup/cygwin/fhandler_random.cc | 4 +- winsup/cygwin/fhandler_registry.cc | 8 ++-- winsup/cygwin/fhandler_tape.cc | 4 +- winsup/cygwin/fhandler_termios.cc | 4 +- winsup/cygwin/fhandler_virtual.cc | 12 ++--- winsup/cygwin/fhandler_zero.cc | 4 +- winsup/cygwin/include/cygwin/stat.h | 4 +- winsup/cygwin/include/cygwin/types.h | 6 +-- winsup/cygwin/mmap.cc | 42 +++++++++--------- winsup/cygwin/pipe.cc | 4 +- winsup/cygwin/syscalls.cc | 36 +++++++-------- winsup/cygwin/winsup.h | 2 +- 23 files changed, 178 insertions(+), 153 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index cacbfa14f..4eaf96f82 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,30 @@ +2003-04-01 Corinna Vinschen + + * dir.cc: Change __off32_t to _off_t and __off64_t to _off64_t + throughout. + * fhandler.cc: Ditto. + * fhandler.h: Ditto. + * fhandler_clipboard.cc: Ditto. + * fhandler_disk_file.cc: Ditto. + * fhandler_dsp.cc: Ditto. + * fhandler_floppy.cc: Ditto. + * fhandler_mem.cc: Ditto. + * fhandler_proc.cc: Ditto. + * fhandler_process.cc: Ditto. + * fhandler_random.cc: Ditto. + * fhandler_registry.cc: Ditto. + * fhandler_tape.cc: Ditto. + * fhandler_termios.cc: Ditto. + * fhandler_virtual.cc: Ditto. + * fhandler_zero.cc: Ditto. + * mmap.cc: Ditto. + * pipe.cc: Ditto. + * syscalls.cc: Ditto. + * winsup.h: Ditto. + * include/cygwin/stat.h: Ditto. + * include/cygwin/types.h: Ditto. Remove definition of __off32_t + and __off64_t. + 2003-03-31 Christopher Faylor * exceptions.cc (setup_handler): Make sure winapi lock is released when diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc index a2024233d..bd0fc624e 100644 --- a/winsup/cygwin/dir.cc +++ b/winsup/cygwin/dir.cc @@ -149,7 +149,7 @@ readdir (DIR *dir) return res; } -extern "C" __off64_t +extern "C" _off64_t telldir64 (DIR *dir) { if (check_null_invalid_struct_errno (dir)) @@ -161,14 +161,14 @@ telldir64 (DIR *dir) } /* telldir */ -extern "C" __off32_t +extern "C" _off_t telldir (DIR *dir) { return telldir64 (dir); } extern "C" void -seekdir64 (DIR *dir, __off64_t loc) +seekdir64 (DIR *dir, _off64_t loc) { if (check_null_invalid_struct_errno (dir)) return; @@ -180,9 +180,9 @@ seekdir64 (DIR *dir, __off64_t loc) /* seekdir */ extern "C" void -seekdir (DIR *dir, __off32_t loc) +seekdir (DIR *dir, _off_t loc) { - seekdir64 (dir, (__off64_t)loc); + seekdir64 (dir, (_off64_t)loc); } /* rewinddir: POSIX 5.1.2.1 */ diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index ddff658e9..f4f43e308 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -824,10 +824,10 @@ fhandler_base::writev (const struct iovec *const iov, const int iovcnt, return write (buf, tot); } -__off64_t -fhandler_base::lseek (__off64_t offset, int whence) +_off64_t +fhandler_base::lseek (_off64_t offset, int whence) { - __off64_t res; + _off64_t res; /* 9x/Me doesn't support 64bit offsets. We trap that here and return EINVAL. It doesn't make sense to simulate bigger offsets by a @@ -838,7 +838,7 @@ fhandler_base::lseek (__off64_t offset, int whence) { debug_printf ("Win9x, offset not 32 bit."); set_errno (EINVAL); - return (__off64_t)-1; + return (_off64_t)-1; } /* Seeks on text files is tough, we rewind and read till we get to the @@ -1274,7 +1274,7 @@ fhandler_base::readdir (DIR *) return NULL; } -__off64_t +_off64_t fhandler_base::telldir (DIR *) { set_errno (ENOTDIR); @@ -1282,7 +1282,7 @@ fhandler_base::telldir (DIR *) } void -fhandler_base::seekdir (DIR *, __off64_t) +fhandler_base::seekdir (DIR *, _off64_t) { set_errno (ENOTDIR); return; diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 445af49d8..3c4947dae 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -310,13 +310,13 @@ class fhandler_base virtual int write (const void *ptr, size_t len); virtual ssize_t readv (const struct iovec *, int iovcnt, ssize_t tot = -1); virtual ssize_t writev (const struct iovec *, int iovcnt, ssize_t tot = -1); - virtual __off64_t lseek (__off64_t offset, int whence); + virtual _off64_t lseek (_off64_t offset, int whence); virtual int lock (int, struct flock *); virtual void dump (); virtual int dup (fhandler_base *child); virtual HANDLE mmap (caddr_t *addr, size_t len, DWORD access, - int flags, __off64_t off); + int flags, _off64_t off); virtual int munmap (HANDLE h, caddr_t addr, size_t len); virtual int msync (HANDLE h, caddr_t addr, size_t len, int flags); virtual BOOL fixup_mmap_after_fork (HANDLE h, DWORD access, DWORD offset, @@ -369,8 +369,8 @@ class fhandler_base virtual void set_eof () {} virtual DIR *opendir (path_conv& pc); virtual dirent *readdir (DIR *); - virtual __off64_t telldir (DIR *); - virtual void seekdir (DIR *, __off64_t); + virtual _off64_t telldir (DIR *); + virtual void seekdir (DIR *, _off64_t); virtual void rewinddir (DIR *); virtual int closedir (DIR *); }; @@ -424,7 +424,7 @@ class fhandler_socket: public fhandler_base int ioctl (unsigned int cmd, void *); int fcntl (int cmd, void *); - __off64_t lseek (__off64_t, int) { return 0; } + _off64_t lseek (_off64_t, int) { return 0; } int shutdown (int how); int close (); void hclose (HANDLE) {close ();} @@ -462,7 +462,7 @@ class fhandler_pipe: public fhandler_base unsigned id; public: fhandler_pipe (DWORD devtype); - __off64_t lseek (__off64_t offset, int whence); + _off64_t lseek (_off64_t offset, int whence); select_record *select_read (select_record *s); select_record *select_write (select_record *s); select_record *select_except (select_record *s); @@ -537,7 +537,7 @@ class fhandler_dev_floppy: public fhandler_dev_raw virtual int open (path_conv *, int flags, mode_t mode = 0); virtual int close (void); - virtual __off64_t lseek (__off64_t offset, int whence); + virtual _off64_t lseek (_off64_t offset, int whence); virtual int ioctl (unsigned int cmd, void *buf); }; @@ -560,7 +560,7 @@ class fhandler_dev_tape: public fhandler_dev_raw virtual int open (path_conv *, int flags, mode_t mode = 0); virtual int close (void); - virtual __off64_t lseek (__off64_t offset, int whence); + virtual _off64_t lseek (_off64_t offset, int whence); virtual int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3))); @@ -607,15 +607,15 @@ class fhandler_disk_file: public fhandler_base int __stdcall fstat_by_handle (struct __stat64 *buf, path_conv *pc) __attribute__ ((regparm (3))); int __stdcall fstat_by_name (struct __stat64 *buf, path_conv *pc) __attribute__ ((regparm (3))); - HANDLE mmap (caddr_t *addr, size_t len, DWORD access, int flags, __off64_t off); + HANDLE mmap (caddr_t *addr, size_t len, DWORD access, int flags, _off64_t off); int munmap (HANDLE h, caddr_t addr, size_t len); int msync (HANDLE h, caddr_t addr, size_t len, int flags); BOOL fixup_mmap_after_fork (HANDLE h, DWORD access, DWORD offset, DWORD size, void *address); DIR *opendir (path_conv& pc); struct dirent *readdir (DIR *); - __off64_t telldir (DIR *); - void seekdir (DIR *, __off64_t); + _off64_t telldir (DIR *); + void seekdir (DIR *, _off64_t); void rewinddir (DIR *); int closedir (DIR *); }; @@ -631,8 +631,8 @@ class fhandler_cygdrive: public fhandler_disk_file fhandler_cygdrive (int unit); DIR *opendir (path_conv& pc); struct dirent *readdir (DIR *); - __off64_t telldir (DIR *); - void seekdir (DIR *, __off64_t); + _off64_t telldir (DIR *); + void seekdir (DIR *, _off64_t); void rewinddir (DIR *); int closedir (DIR *); int __stdcall fstat (struct __stat64 *buf, path_conv *pc) __attribute__ ((regparm (3))); @@ -668,7 +668,7 @@ class fhandler_serial: public fhandler_base int ioctl (unsigned int cmd, void *); int tcsetattr (int a, const struct termios *t); int tcgetattr (struct termios *t); - __off64_t lseek (__off64_t, int) { return 0; } + _off64_t lseek (_off64_t, int) { return 0; } int tcflush (int); void dump (); int is_tty () { return 1; } @@ -719,7 +719,7 @@ class fhandler_termios: public fhandler_base void fixup_after_fork (HANDLE); void fixup_after_exec (HANDLE parent) { fixup_after_fork (parent); } void echo_erase (int force = 0); - virtual __off64_t lseek (__off64_t, int); + virtual _off64_t lseek (_off64_t, int); }; enum ansi_intensity @@ -911,7 +911,7 @@ class fhandler_tty_slave: public fhandler_tty_common int dup (fhandler_base *child); void fixup_after_fork (HANDLE parent); - __off64_t lseek (__off64_t, int) { return 0; } + _off64_t lseek (_off64_t, int) { return 0; } select_record *select_read (select_record *s); int cygserver_attach_tty (HANDLE*, HANDLE*); }; @@ -938,7 +938,7 @@ class fhandler_pty_master: public fhandler_tty_common int tcflush (int); int ioctl (unsigned int cmd, void *); - __off64_t lseek (__off64_t, int) { return 0; } + _off64_t lseek (_off64_t, int) { return 0; } char *ptsname (); void set_close_on_exec (int val); @@ -977,7 +977,7 @@ class fhandler_dev_zero: public fhandler_base int open (path_conv *, int flags, mode_t mode = 0); int write (const void *ptr, size_t len); void __stdcall read (void *ptr, size_t& len) __attribute__ ((regparm (3))); - __off64_t lseek (__off64_t offset, int whence); + _off64_t lseek (_off64_t offset, int whence); void dump (); }; @@ -999,7 +999,7 @@ class fhandler_dev_random: public fhandler_base int open (path_conv *, int flags, mode_t mode = 0); int write (const void *ptr, size_t len); void __stdcall read (void *ptr, size_t& len) __attribute__ ((regparm (3))); - __off64_t lseek (__off64_t offset, int whence); + _off64_t lseek (_off64_t offset, int whence); int close (void); int dup (fhandler_base *child); @@ -1011,7 +1011,7 @@ class fhandler_dev_mem: public fhandler_base protected: int unit; DWORD mem_size; - __off64_t pos; + _off64_t pos; public: fhandler_dev_mem (int unit); @@ -1020,12 +1020,12 @@ class fhandler_dev_mem: public fhandler_base int open (path_conv *, int flags, mode_t mode = 0); int write (const void *ptr, size_t ulen); void __stdcall read (void *ptr, size_t& len) __attribute__ ((regparm (3))); - __off64_t lseek (__off64_t offset, int whence); + _off64_t lseek (_off64_t offset, int whence); int close (void); int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3))); int dup (fhandler_base *child); - HANDLE mmap (caddr_t *addr, size_t len, DWORD access, int flags, __off64_t off); + HANDLE mmap (caddr_t *addr, size_t len, DWORD access, int flags, _off64_t off); int munmap (HANDLE h, caddr_t addr, size_t len); int msync (HANDLE h, caddr_t addr, size_t len, int flags); BOOL fixup_mmap_after_fork (HANDLE h, DWORD access, DWORD offset, @@ -1042,7 +1042,7 @@ class fhandler_dev_clipboard: public fhandler_base int open (path_conv *, int flags, mode_t mode = 0); int write (const void *ptr, size_t len); void __stdcall read (void *ptr, size_t& len) __attribute__ ((regparm (3))); - __off64_t lseek (__off64_t offset, int whence); + _off64_t lseek (_off64_t offset, int whence); int close (void); int dup (fhandler_base *child); @@ -1050,7 +1050,7 @@ class fhandler_dev_clipboard: public fhandler_base void dump (); private: - __off64_t pos; + _off64_t pos; void *membuffer; size_t msize; bool eof; @@ -1068,7 +1068,7 @@ class fhandler_windows: public fhandler_base int write (const void *ptr, size_t len); void __stdcall read (void *ptr, size_t& len) __attribute__ ((regparm (3))); int ioctl (unsigned int cmd, void *); - __off64_t lseek (__off64_t, int) { return 0; } + _off64_t lseek (_off64_t, int) { return 0; } int close (void) { return 0; } void set_close_on_exec (int val); @@ -1094,7 +1094,7 @@ class fhandler_dev_dsp : public fhandler_base int write (const void *ptr, size_t len); void __stdcall read (void *ptr, size_t& len) __attribute__ ((regparm (3))); int ioctl (unsigned int cmd, void *); - __off64_t lseek (__off64_t, int); + _off64_t lseek (_off64_t, int); int close (void); int dup (fhandler_base * child); void dump (void); @@ -1106,8 +1106,8 @@ class fhandler_virtual : public fhandler_base protected: char *filebuf; size_t bufalloc; - __off64_t filesize; - __off64_t position; + _off64_t filesize; + _off64_t position; int fileid; // unique within each class public: @@ -1116,13 +1116,13 @@ class fhandler_virtual : public fhandler_base virtual int exists(); DIR *opendir (path_conv& pc); - __off64_t telldir (DIR *); - void seekdir (DIR *, __off64_t); + _off64_t telldir (DIR *); + void seekdir (DIR *, _off64_t); void rewinddir (DIR *); int closedir (DIR *); int write (const void *ptr, size_t len); void __stdcall read (void *ptr, size_t& len) __attribute__ ((regparm (3))); - __off64_t lseek (__off64_t, int); + _off64_t lseek (_off64_t, int); int dup (fhandler_base * child); int open (path_conv *, int flags, mode_t mode = 0); int close (void); @@ -1153,8 +1153,8 @@ class fhandler_registry: public fhandler_proc fhandler_registry (); int exists(); struct dirent *readdir (DIR *); - __off64_t telldir (DIR *); - void seekdir (DIR *, __off64_t); + _off64_t telldir (DIR *); + void seekdir (DIR *, _off64_t); void rewinddir (DIR *); int closedir (DIR *); diff --git a/winsup/cygwin/fhandler_clipboard.cc b/winsup/cygwin/fhandler_clipboard.cc index 9cf1b287d..616adf43e 100644 --- a/winsup/cygwin/fhandler_clipboard.cc +++ b/winsup/cygwin/fhandler_clipboard.cc @@ -244,8 +244,8 @@ fhandler_dev_clipboard::read (void *ptr, size_t& len) } } -__off64_t -fhandler_dev_clipboard::lseek (__off64_t offset, int whence) +_off64_t +fhandler_dev_clipboard::lseek (_off64_t offset, int whence) { /* On reads we check this at read time, not seek time. * On writes we use this to decide how to write - empty and write, or open, copy, empty diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 66679d972..ccd725360 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -230,7 +230,7 @@ fhandler_disk_file::fstat_helper (struct __stat64 *buf, path_conv *pc, to_timestruc_t (&ftLastWriteTime, &buf->st_mtim); to_timestruc_t (&ftCreationTime, &buf->st_ctim); buf->st_dev = pc->volser (); - buf->st_size = ((__off64_t)nFileSizeHigh << 32) + nFileSizeLow; + buf->st_size = ((_off64_t)nFileSizeHigh << 32) + nFileSizeLow; /* Unfortunately the count of 2 confuses `find (1)' command. So let's try it with `1' as link count. */ if (pc->isdir () && !pc->isremote () && nNumberOfLinks == 1) @@ -269,7 +269,7 @@ fhandler_disk_file::fstat_helper (struct __stat64 *buf, path_conv *pc, /* On systems supporting compressed (and sparsed) files, GetCompressedFileSize() returns the actual amount of bytes allocated on disk. */ - buf->st_blocks = (((__off64_t)nFileSizeHigh << 32) + buf->st_blocks = (((_off64_t)nFileSizeHigh << 32) + nFileSizeLow + S_BLKSIZE - 1) / S_BLKSIZE; else /* Just compute no. of blocks from file size. */ @@ -457,10 +457,10 @@ fhandler_disk_file::close () int fhandler_disk_file::lock (int cmd, struct flock *fl) { - __off64_t win32_start; + _off64_t win32_start; int win32_len; DWORD win32_upper; - __off64_t startpos; + _off64_t startpos; /* * We don't do getlck calls yet. @@ -494,7 +494,7 @@ fhandler_disk_file::lock (int cmd, struct flock *fl) __seterrno (); return -1; } - startpos = ((__off64_t)finfo.nFileSizeHigh << 32) + startpos = ((_off64_t)finfo.nFileSizeHigh << 32) + finfo.nFileSizeLow; break; } @@ -715,14 +715,14 @@ fhandler_disk_file::readdir (DIR *dir) return res; } -__off64_t +_off64_t fhandler_disk_file::telldir (DIR *dir) { return dir->__d_position; } void -fhandler_disk_file::seekdir (DIR *dir, __off64_t loc) +fhandler_disk_file::seekdir (DIR *dir, _off64_t loc) { rewinddir (dir); while (loc > dir->__d_position) @@ -829,14 +829,14 @@ fhandler_cygdrive::readdir (DIR *dir) return dir->__d_dirent; } -__off64_t +_off64_t fhandler_cygdrive::telldir (DIR *dir) { return fhandler_disk_file::telldir (dir); } void -fhandler_cygdrive::seekdir (DIR *dir, __off64_t loc) +fhandler_cygdrive::seekdir (DIR *dir, _off64_t loc) { if (!iscygdrive_root ()) return fhandler_disk_file::seekdir (dir, loc); diff --git a/winsup/cygwin/fhandler_dsp.cc b/winsup/cygwin/fhandler_dsp.cc index 54c8ad244..2ca44e321 100644 --- a/winsup/cygwin/fhandler_dsp.cc +++ b/winsup/cygwin/fhandler_dsp.cc @@ -487,8 +487,8 @@ fhandler_dev_dsp::read (void *ptr, size_t& len) return; } -__off64_t -fhandler_dev_dsp::lseek (__off64_t offset, int whence) +_off64_t +fhandler_dev_dsp::lseek (_off64_t offset, int whence) { return 0; } diff --git a/winsup/cygwin/fhandler_floppy.cc b/winsup/cygwin/fhandler_floppy.cc index e5da2418d..83d41ea07 100644 --- a/winsup/cygwin/fhandler_floppy.cc +++ b/winsup/cygwin/fhandler_floppy.cc @@ -79,16 +79,16 @@ fhandler_dev_floppy::close (void) return fhandler_dev_raw::close (); } -__off64_t -fhandler_dev_floppy::lseek (__off64_t offset, int whence) +_off64_t +fhandler_dev_floppy::lseek (_off64_t offset, int whence) { int ret; char buf[512]; - __off64_t drive_size = 0; - __off64_t lloffset = offset; - __off64_t current_position; - __off64_t sector_aligned_offset; - __off64_t bytes_left; + _off64_t drive_size = 0; + _off64_t lloffset = offset; + _off64_t current_position; + _off64_t sector_aligned_offset; + _off64_t bytes_left; DWORD low; LONG high = 0; @@ -142,7 +142,7 @@ fhandler_dev_floppy::lseek (__off64_t offset, int whence) __seterrno (); return -1; } - current_position = low + ((__off64_t) high << 32); + current_position = low + ((_off64_t) high << 32); if (is_writing) current_position += devbufend - devbufstart; else @@ -195,8 +195,8 @@ fhandler_dev_floppy::ioctl (unsigned int cmd, void *buf) DISK_GEOMETRY di; PARTITION_INFORMATION pi; DWORD bytes_read; - __off64_t drive_size = 0; - __off64_t start = 0; + _off64_t drive_size = 0; + _off64_t start = 0; switch (cmd) { case HDIO_GETGEO: @@ -271,7 +271,7 @@ fhandler_dev_floppy::ioctl (unsigned int cmd, void *buf) if (cmd == BLKGETSIZE) *(long *)buf = drive_size >> 9UL; else - *(__off64_t *)buf = drive_size; + *(_off64_t *)buf = drive_size; return 0; } case BLKRRPART: diff --git a/winsup/cygwin/fhandler_mem.cc b/winsup/cygwin/fhandler_mem.cc index 35157e85f..ea6fb4351 100644 --- a/winsup/cygwin/fhandler_mem.cc +++ b/winsup/cygwin/fhandler_mem.cc @@ -236,8 +236,8 @@ fhandler_dev_mem::close (void) return fhandler_base::close (); } -__off64_t -fhandler_dev_mem::lseek (__off64_t offset, int whence) +_off64_t +fhandler_dev_mem::lseek (_off64_t offset, int whence) { switch (whence) { @@ -270,7 +270,7 @@ fhandler_dev_mem::lseek (__off64_t offset, int whence) HANDLE fhandler_dev_mem::mmap (caddr_t *addr, size_t len, DWORD access, - int flags, __off64_t off) + int flags, _off64_t off) { if (off >= mem_size || (DWORD) len >= mem_size diff --git a/winsup/cygwin/fhandler_proc.cc b/winsup/cygwin/fhandler_proc.cc index 2c8698fbd..b9f6b38df 100644 --- a/winsup/cygwin/fhandler_proc.cc +++ b/winsup/cygwin/fhandler_proc.cc @@ -79,11 +79,11 @@ static const DWORD proc_fhandlers[PROC_LINK_COUNT] = { const char proc[] = "/proc"; const int proc_len = sizeof (proc) - 1; -static __off64_t format_proc_meminfo (char *destbuf, size_t maxsize); -static __off64_t format_proc_stat (char *destbuf, size_t maxsize); -static __off64_t format_proc_uptime (char *destbuf, size_t maxsize); -static __off64_t format_proc_cpuinfo (char *destbuf, size_t maxsize); -static __off64_t format_proc_partitions (char *destbuf, size_t maxsize); +static _off64_t format_proc_meminfo (char *destbuf, size_t maxsize); +static _off64_t format_proc_stat (char *destbuf, size_t maxsize); +static _off64_t format_proc_uptime (char *destbuf, size_t maxsize); +static _off64_t format_proc_cpuinfo (char *destbuf, size_t maxsize); +static _off64_t format_proc_partitions (char *destbuf, size_t maxsize); /* Auxillary function that returns the fhandler associated with the given path this is where it would be nice to have pattern matching in C - polymorphism @@ -387,7 +387,7 @@ fhandler_proc::fill_filebuf () return true; } -static __off64_t +static _off64_t format_proc_meminfo (char *destbuf, size_t maxsize) { unsigned long mem_total = 0UL, mem_free = 0UL, swap_total = 0UL, @@ -417,7 +417,7 @@ format_proc_meminfo (char *destbuf, size_t maxsize) swap_total >> 10, swap_free >> 10); } -static __off64_t +static _off64_t format_proc_uptime (char *destbuf, size_t maxsize) { unsigned long long uptime = 0ULL, idle_time = 0ULL; @@ -453,7 +453,7 @@ out: idle_time / 100, long (idle_time % 100)); } -static __off64_t +static _off64_t format_proc_stat (char *destbuf, size_t maxsize) { unsigned long long user_time = 0ULL, kernel_time = 0ULL, idle_time = 0ULL; @@ -581,7 +581,7 @@ can_set_flag (unsigned flag) return ((r1 ^ r2) & flag) != 0; } -static __off64_t +static _off64_t format_proc_cpuinfo (char *destbuf, size_t maxsize) { SYSTEM_INFO siSystemInfo; @@ -858,7 +858,7 @@ format_proc_cpuinfo (char *destbuf, size_t maxsize) #undef read_value -static __off64_t +static _off64_t format_proc_partitions (char *destbuf, size_t maxsize) { char *bufptr = destbuf; diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc index c93c121b1..d9b311a72 100644 --- a/winsup/cygwin/fhandler_process.cc +++ b/winsup/cygwin/fhandler_process.cc @@ -67,9 +67,9 @@ static const char * const process_listing[] = static const int PROCESS_LINK_COUNT = (sizeof (process_listing) / sizeof (const char *)) - 1; -static __off64_t format_process_stat (_pinfo *p, char *destbuf, size_t maxsize); -static __off64_t format_process_status (_pinfo *p, char *destbuf, size_t maxsize); -static __off64_t format_process_statm (_pinfo *p, char *destbuf, size_t maxsize); +static _off64_t format_process_stat (_pinfo *p, char *destbuf, size_t maxsize); +static _off64_t format_process_status (_pinfo *p, char *destbuf, size_t maxsize); +static _off64_t format_process_statm (_pinfo *p, char *destbuf, size_t maxsize); static int get_process_state (DWORD dwProcessId); static bool get_mem_values (DWORD dwProcessId, unsigned long *vmsize, unsigned long *vmrss, unsigned long *vmtext, @@ -365,7 +365,7 @@ fhandler_process::fill_filebuf () return true; } -static __off64_t +static _off64_t format_process_stat (_pinfo *p, char *destbuf, size_t maxsize) { char cmd[MAX_PATH]; @@ -500,7 +500,7 @@ format_process_stat (_pinfo *p, char *destbuf, size_t maxsize) ); } -static __off64_t +static _off64_t format_process_status (_pinfo *p, char *destbuf, size_t maxsize) { char cmd[MAX_PATH]; @@ -593,7 +593,7 @@ format_process_status (_pinfo *p, char *destbuf, size_t maxsize) ); } -static __off64_t +static _off64_t format_process_statm (_pinfo *p, char *destbuf, size_t maxsize) { unsigned long vmsize = 0UL, vmrss = 0UL, vmtext = 0UL, vmdata = 0UL, diff --git a/winsup/cygwin/fhandler_random.cc b/winsup/cygwin/fhandler_random.cc index 6d02db587..50693162e 100644 --- a/winsup/cygwin/fhandler_random.cc +++ b/winsup/cygwin/fhandler_random.cc @@ -139,8 +139,8 @@ fhandler_dev_random::read (void *ptr, size_t& len) (ssize_t) len = -1; } -__off64_t -fhandler_dev_random::lseek (__off64_t, int) +_off64_t +fhandler_dev_random::lseek (_off64_t, int) { return 0; } diff --git a/winsup/cygwin/fhandler_registry.cc b/winsup/cygwin/fhandler_registry.cc index f33b368a0..7f2cc5f02 100644 --- a/winsup/cygwin/fhandler_registry.cc +++ b/winsup/cygwin/fhandler_registry.cc @@ -32,8 +32,8 @@ static const int registry_len = sizeof ("registry") - 1; * the bottom 16 bits are the absolute position and the top 15 bits * make up the value index if we are enuerating values. */ -static const __off32_t REG_ENUM_VALUES_MASK = 0x8000000; -static const __off32_t REG_POSITION_MASK = 0xffff; +static const _off_t REG_ENUM_VALUES_MASK = 0x8000000; +static const _off_t REG_POSITION_MASK = 0xffff; /* List of root keys in /proc/registry. * Possibly we should filter out those not relevant to the flavour of Windows @@ -351,14 +351,14 @@ out: return res; } -__off64_t +_off64_t fhandler_registry::telldir (DIR * dir) { return dir->__d_position & REG_POSITION_MASK; } void -fhandler_registry::seekdir (DIR * dir, __off64_t loc) +fhandler_registry::seekdir (DIR * dir, _off64_t loc) { /* Unfortunately cannot simply set __d_position due to transition from sub-keys to * values. diff --git a/winsup/cygwin/fhandler_tape.cc b/winsup/cygwin/fhandler_tape.cc index c99a0190a..c37aefce9 100644 --- a/winsup/cygwin/fhandler_tape.cc +++ b/winsup/cygwin/fhandler_tape.cc @@ -161,8 +161,8 @@ fhandler_dev_tape::fstat (struct __stat64 *buf, path_conv *pc) return ret; } -__off64_t -fhandler_dev_tape::lseek (__off64_t offset, int whence) +_off64_t +fhandler_dev_tape::lseek (_off64_t offset, int whence) { struct mtop op; struct mtpos pos; diff --git a/winsup/cygwin/fhandler_termios.cc b/winsup/cygwin/fhandler_termios.cc index 411646415..f28481185 100644 --- a/winsup/cygwin/fhandler_termios.cc +++ b/winsup/cygwin/fhandler_termios.cc @@ -356,8 +356,8 @@ fhandler_termios::fixup_after_fork (HANDLE parent) fork_fixup (parent, get_output_handle (), "output_handle"); } -__off64_t -fhandler_termios::lseek (__off64_t, int) +_off64_t +fhandler_termios::lseek (_off64_t, int) { set_errno (ESPIPE); return -1; diff --git a/winsup/cygwin/fhandler_virtual.cc b/winsup/cygwin/fhandler_virtual.cc index b0a7f07d8..e2b725084 100644 --- a/winsup/cygwin/fhandler_virtual.cc +++ b/winsup/cygwin/fhandler_virtual.cc @@ -93,13 +93,13 @@ fhandler_virtual::opendir (path_conv& pc) return res; } -__off64_t fhandler_virtual::telldir (DIR * dir) +_off64_t fhandler_virtual::telldir (DIR * dir) { return dir->__d_position; } void -fhandler_virtual::seekdir (DIR * dir, __off64_t loc) +fhandler_virtual::seekdir (DIR * dir, _off64_t loc) { dir->__d_position = loc; return; @@ -118,15 +118,15 @@ fhandler_virtual::closedir (DIR * dir) return 0; } -__off64_t -fhandler_virtual::lseek (__off64_t offset, int whence) +_off64_t +fhandler_virtual::lseek (_off64_t offset, int whence) { /* * On Linux, when you lseek within a /proc file, * the contents of the file are updated. */ if (!fill_filebuf ()) - return (__off64_t) -1; + return (_off64_t) -1; switch (whence) { case SEEK_SET: @@ -140,7 +140,7 @@ fhandler_virtual::lseek (__off64_t offset, int whence) break; default: set_errno (EINVAL); - return (__off64_t) -1; + return (_off64_t) -1; } return position; } diff --git a/winsup/cygwin/fhandler_zero.cc b/winsup/cygwin/fhandler_zero.cc index 997abf764..084e1307f 100644 --- a/winsup/cygwin/fhandler_zero.cc +++ b/winsup/cygwin/fhandler_zero.cc @@ -42,8 +42,8 @@ fhandler_dev_zero::read (void *ptr, size_t& len) return; } -__off64_t -fhandler_dev_zero::lseek (__off64_t, int) +_off64_t +fhandler_dev_zero::lseek (_off64_t, int) { return 0; } diff --git a/winsup/cygwin/include/cygwin/stat.h b/winsup/cygwin/include/cygwin/stat.h index 1c1a5cd1f..a21e731b8 100644 --- a/winsup/cygwin/include/cygwin/stat.h +++ b/winsup/cygwin/include/cygwin/stat.h @@ -26,7 +26,7 @@ struct __stat32 __uid16_t st_uid; __gid16_t st_gid; __dev16_t st_rdev; - __off32_t st_size; + _off_t st_size; timestruc_t st_atim; timestruc_t st_mtim; timestruc_t st_ctim; @@ -44,7 +44,7 @@ struct __stat64 __uid32_t st_uid; __gid32_t st_gid; __dev32_t st_rdev; - __off64_t st_size; + _off64_t st_size; timestruc_t st_atim; timestruc_t st_mtim; timestruc_t st_ctim; diff --git a/winsup/cygwin/include/cygwin/types.h b/winsup/cygwin/include/cygwin/types.h index 793157e61..d5173b94b 100644 --- a/winsup/cygwin/include/cygwin/types.h +++ b/winsup/cygwin/include/cygwin/types.h @@ -31,12 +31,10 @@ typedef struct timespec timestruc_t; #ifndef __off_t_defined #define __off_t_defined -typedef long __off32_t; -typedef long long __off64_t; #ifdef __CYGWIN_USE_BIG_TYPES__ -typedef __off64_t off_t; +typedef _off64_t off_t; #else -typedef __off32_t off_t; +typedef _off_t off_t; #endif #endif /*__off_t_defined*/ diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc index accc739c0..e423156a6 100644 --- a/winsup/cygwin/mmap.cc +++ b/winsup/cygwin/mmap.cc @@ -45,13 +45,13 @@ class mmap_record HANDLE mapping_handle_; int devtype_; DWORD access_mode_; - __off64_t offset_; + _off64_t offset_; DWORD size_to_map_; caddr_t base_address_; DWORD *map_map_; public: - mmap_record (int fd, HANDLE h, DWORD ac, __off64_t o, DWORD s, caddr_t b) : + mmap_record (int fd, HANDLE h, DWORD ac, _off64_t o, DWORD s, caddr_t b) : fdesc_ (fd), mapping_handle_ (h), devtype_ (0), @@ -76,11 +76,11 @@ class mmap_record DWORD get_size () const { return size_to_map_; } caddr_t get_address () const { return base_address_; } DWORD *get_map () const { return map_map_; } - void alloc_map (__off64_t off, DWORD len); + void alloc_map (_off64_t off, DWORD len); void free_map () { if (map_map_) free (map_map_); } DWORD find_empty (DWORD pages); - __off64_t map_map (__off64_t off, DWORD len); + _off64_t map_map (_off64_t off, DWORD len); BOOL unmap_map (caddr_t addr, DWORD len); void fixup_map (void); int access (caddr_t address); @@ -111,7 +111,7 @@ mmap_record::find_empty (DWORD pages) } void -mmap_record::alloc_map (__off64_t off, DWORD len) +mmap_record::alloc_map (_off64_t off, DWORD len) { /* Allocate one bit per page */ map_map_ = (DWORD *) calloc (MAPSIZE (PAGE_CNT (size_to_map_)), @@ -138,8 +138,8 @@ mmap_record::alloc_map (__off64_t off, DWORD len) } } -__off64_t -mmap_record::map_map (__off64_t off, DWORD len) +_off64_t +mmap_record::map_map (_off64_t off, DWORD len) { /* Used ONLY if this mapping matches into the chunk of another already performed mapping in a special case of MAP_ANON|MAP_PRIVATE. @@ -169,7 +169,7 @@ mmap_record::map_map (__off64_t off, DWORD len) len * getpagesize (), prot, &old_prot)) { __seterrno (); - return (__off64_t)-1; + return (_off64_t)-1; } while (len-- > 0) @@ -267,10 +267,10 @@ public: DWORD hash; list (); ~list (); - mmap_record *add_record (mmap_record r, __off64_t off, DWORD len); + mmap_record *add_record (mmap_record r, _off64_t off, DWORD len); void erase (int i); void erase (); - mmap_record *match (__off64_t off, DWORD len); + mmap_record *match (_off64_t off, DWORD len); long match (caddr_t addr, DWORD len, long start); }; @@ -288,7 +288,7 @@ list::~list () } mmap_record * -list::add_record (mmap_record r, __off64_t off, DWORD len) +list::add_record (mmap_record r, _off64_t off, DWORD len) { if (nrecs == maxrecs) { @@ -302,7 +302,7 @@ list::add_record (mmap_record r, __off64_t off, DWORD len) /* Used in mmap() */ mmap_record * -list::match (__off64_t off, DWORD len) +list::match (_off64_t off, DWORD len) { if (fd == -1 && !off) { @@ -324,7 +324,7 @@ list::match (__off64_t off, DWORD len) /* Used in munmap() */ long -list::match (caddr_t addr, DWORD len, __off32_t start) +list::match (caddr_t addr, DWORD len, _off_t start) { for (int i = start + 1; i < nrecs; ++i) if (addr >= recs[i].get_address () @@ -422,7 +422,7 @@ map::erase (int i) static map *mmapped_areas; extern "C" caddr_t -mmap64 (caddr_t addr, size_t len, int prot, int flags, int fd, __off64_t off) +mmap64 (caddr_t addr, size_t len, int prot, int flags, int fd, _off64_t off) { syscall_printf ("addr %x, len %d, prot %x, flags %x, fd %d, off %D", addr, len, prot, flags, fd, off); @@ -466,7 +466,7 @@ mmap64 (caddr_t addr, size_t len, int prot, int flags, int fd, __off64_t off) fd = -1; /* Map always in multipliers of `granularity'-sized chunks. */ - __off64_t gran_off = off & ~(granularity - 1); + _off64_t gran_off = off & ~(granularity - 1); DWORD gran_len = howmany (off + len, granularity) * granularity - gran_off; fhandler_base *fh; @@ -488,7 +488,7 @@ mmap64 (caddr_t addr, size_t len, int prot, int flags, int fd, __off64_t off) { DWORD high; DWORD low = GetFileSize (fh->get_handle (), &high); - __off64_t fsiz = ((__off64_t)high << 32) + low; + _off64_t fsiz = ((_off64_t)high << 32) + low; fsiz -= gran_off; if (gran_len > fsiz) gran_len = fsiz; @@ -513,7 +513,7 @@ mmap64 (caddr_t addr, size_t len, int prot, int flags, int fd, __off64_t off) mmap_record *rec; if ((rec = map_list->match (off, len)) != NULL) { - if ((off = rec->map_map (off, len)) == (__off64_t)-1) + if ((off = rec->map_map (off, len)) == (_off64_t)-1) { syscall_printf ("-1 = mmap()"); ReleaseResourceLock (LOCK_MMAP_LIST, READ_LOCK|WRITE_LOCK, "mmap"); @@ -583,9 +583,9 @@ mmap64 (caddr_t addr, size_t len, int prot, int flags, int fd, __off64_t off) } extern "C" caddr_t -mmap (caddr_t addr, size_t len, int prot, int flags, int fd, __off32_t off) +mmap (caddr_t addr, size_t len, int prot, int flags, int fd, _off_t off) { - return mmap64 (addr, len, prot, flags, fd, (__off64_t)off); + return mmap64 (addr, len, prot, flags, fd, (_off64_t)off); } /* munmap () removes an mmapped area. It insists that base area @@ -733,7 +733,7 @@ invalid_address_range: */ HANDLE fhandler_base::mmap (caddr_t *addr, size_t len, DWORD access, - int flags, __off64_t off) + int flags, _off64_t off) { set_errno (ENODEV); return INVALID_HANDLE_VALUE; @@ -764,7 +764,7 @@ fhandler_base::fixup_mmap_after_fork (HANDLE h, DWORD access, DWORD offset, /* Implementation for disk files. */ HANDLE fhandler_disk_file::mmap (caddr_t *addr, size_t len, DWORD access, - int flags, __off64_t off) + int flags, _off64_t off) { DWORD protect; diff --git a/winsup/cygwin/pipe.cc b/winsup/cygwin/pipe.cc index a84aeee60..df8fbafc5 100644 --- a/winsup/cygwin/pipe.cc +++ b/winsup/cygwin/pipe.cc @@ -33,8 +33,8 @@ fhandler_pipe::fhandler_pipe (DWORD devtype) { } -__off64_t -fhandler_pipe::lseek (__off64_t offset, int whence) +_off64_t +fhandler_pipe::lseek (_off64_t offset, int whence) { debug_printf ("(%d, %d)", offset, whence); set_errno (ESPIPE); diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 9d5c5a832..6fa779f4b 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -533,10 +533,10 @@ extern "C" int _open (const char *, int flags, ...) extern "C" int _open64 (const char *, int flags, ...) __attribute__ ((alias ("open"))); -extern "C" __off64_t -lseek64 (int fd, __off64_t pos, int dir) +extern "C" _off64_t +lseek64 (int fd, _off64_t pos, int dir) { - __off64_t res; + _off64_t res; sigframe thisframe (mainthread); if (dir != SEEK_SET && dir != SEEK_CUR && dir != SEEK_END) @@ -557,16 +557,16 @@ lseek64 (int fd, __off64_t pos, int dir) return res; } -extern "C" int _lseek64 (int fd, __off64_t pos, int dir) +extern "C" int _lseek64 (int fd, _off64_t pos, int dir) __attribute__ ((alias ("lseek64"))); -extern "C" __off32_t -lseek (int fd, __off32_t pos, int dir) +extern "C" _off_t +lseek (int fd, _off_t pos, int dir) { - return lseek64 (fd, (__off64_t) pos, dir); + return lseek64 (fd, (_off64_t) pos, dir); } -extern "C" __off32_t _lseek (int, __off32_t, int) +extern "C" _off_t _lseek (int, _off_t, int) __attribute__ ((alias ("lseek"))); extern "C" int @@ -1030,7 +1030,7 @@ fstat64 (int fd, struct __stat64 *buf) return res; } -extern "C" int _fstat64 (int fd, __off64_t pos, int dir) +extern "C" int _fstat64 (int fd, _off64_t pos, int dir) __attribute__ ((alias ("fstat64"))); extern "C" int @@ -1043,7 +1043,7 @@ fstat (int fd, struct __stat32 *buf) return ret; } -extern "C" int _fstat (int fd, __off64_t pos, int dir) +extern "C" int _fstat (int fd, _off64_t pos, int dir) __attribute__ ((alias ("fstat"))); /* fsync: P96 6.6.1.1 */ @@ -1130,7 +1130,7 @@ stat_worker (const char *name, struct __stat64 *buf, int nofollow, return res; } -extern "C" int _stat (int fd, __off64_t pos, int dir) +extern "C" int _stat (int fd, _off64_t pos, int dir) __attribute__ ((alias ("stat"))); extern "C" int @@ -1736,7 +1736,7 @@ setmode (int fd, int mode) } extern "C" int -ftruncate64 (int fd, __off64_t length) +ftruncate64 (int fd, _off64_t length) { sigframe thisframe (mainthread); int res = -1; @@ -1753,7 +1753,7 @@ ftruncate64 (int fd, __off64_t length) if (cfd->get_handle ()) { /* remember curr file pointer location */ - __off64_t prev_loc = cfd->lseek (0, SEEK_CUR); + _off64_t prev_loc = cfd->lseek (0, SEEK_CUR); cfd->lseek (length, SEEK_SET); if (!SetEndOfFile (h)) @@ -1773,14 +1773,14 @@ ftruncate64 (int fd, __off64_t length) /* ftruncate: P96 5.6.7.1 */ extern "C" int -ftruncate (int fd, __off32_t length) +ftruncate (int fd, _off_t length) { - return ftruncate64 (fd, (__off64_t)length); + return ftruncate64 (fd, (_off64_t)length); } /* truncate: Provided by SVR4 and 4.3+BSD. Not part of POSIX.1 or XPG3 */ extern "C" int -truncate64 (const char *pathname, __off64_t length) +truncate64 (const char *pathname, _off64_t length) { sigframe thisframe (mainthread); int fd; @@ -1802,9 +1802,9 @@ truncate64 (const char *pathname, __off64_t length) /* truncate: Provided by SVR4 and 4.3+BSD. Not part of POSIX.1 or XPG3 */ extern "C" int -truncate (const char *pathname, __off32_t length) +truncate (const char *pathname, _off_t length) { - return truncate64 (pathname, (__off64_t)length); + return truncate64 (pathname, (_off64_t)length); } extern "C" long diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h index 7149bc33a..456339e01 100644 --- a/winsup/cygwin/winsup.h +++ b/winsup/cygwin/winsup.h @@ -162,7 +162,7 @@ void uinfo_init (void); #define ILLEGAL_UID ((__uid32_t)-1) #define ILLEGAL_GID16 ((__gid16_t)-1) #define ILLEGAL_GID ((__gid32_t)-1) -#define ILLEGAL_SEEK ((__off64_t)-1) +#define ILLEGAL_SEEK ((_off64_t)-1) #define uid16touid32(u16) ((u16)==ILLEGAL_UID16?ILLEGAL_UID:(__uid32_t)(u16)) #define gid16togid32(g16) ((g16)==ILLEGAL_GID16?ILLEGAL_GID:(__gid32_t)(g16))