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-04-01 Corinna Vinschen <corinna@vinschen.de>
+
+ * 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 <cgf@redhat.com>
* exceptions.cc (setup_handler): Make sure winapi lock is released when
return res;
}
-extern "C" __off64_t
+extern "C" _off64_t
telldir64 (DIR *dir)
{
if (check_null_invalid_struct_errno (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;
/* 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 */
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
{
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
return NULL;
}
-__off64_t
+_off64_t
fhandler_base::telldir (DIR *)
{
set_errno (ENOTDIR);
}
void
-fhandler_base::seekdir (DIR *, __off64_t)
+fhandler_base::seekdir (DIR *, _off64_t)
{
set_errno (ENOTDIR);
return;
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,
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 *);
};
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 ();}
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);
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);
};
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)));
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 *);
};
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)));
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; }
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
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*);
};
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);
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 ();
};
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);
protected:
int unit;
DWORD mem_size;
- __off64_t pos;
+ _off64_t pos;
public:
fhandler_dev_mem (int unit);
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,
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);
void dump ();
private:
- __off64_t pos;
+ _off64_t pos;
void *membuffer;
size_t msize;
bool eof;
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);
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);
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:
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);
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 *);
}
}
-__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
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)
/* 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. */
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.
__seterrno ();
return -1;
}
- startpos = ((__off64_t)finfo.nFileSizeHigh << 32)
+ startpos = ((_off64_t)finfo.nFileSizeHigh << 32)
+ finfo.nFileSizeLow;
break;
}
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)
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);
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;
}
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;
__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
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:
if (cmd == BLKGETSIZE)
*(long *)buf = drive_size >> 9UL;
else
- *(__off64_t *)buf = drive_size;
+ *(_off64_t *)buf = drive_size;
return 0;
}
case BLKRRPART:
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)
{
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
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
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,
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;
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;
return ((r1 ^ r2) & flag) != 0;
}
-static __off64_t
+static _off64_t
format_proc_cpuinfo (char *destbuf, size_t maxsize)
{
SYSTEM_INFO siSystemInfo;
#undef read_value
-static __off64_t
+static _off64_t
format_proc_partitions (char *destbuf, size_t maxsize)
{
char *bufptr = destbuf;
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,
return true;
}
-static __off64_t
+static _off64_t
format_process_stat (_pinfo *p, char *destbuf, size_t maxsize)
{
char cmd[MAX_PATH];
);
}
-static __off64_t
+static _off64_t
format_process_status (_pinfo *p, char *destbuf, size_t maxsize)
{
char cmd[MAX_PATH];
);
}
-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,
(ssize_t) len = -1;
}
-__off64_t
-fhandler_dev_random::lseek (__off64_t, int)
+_off64_t
+fhandler_dev_random::lseek (_off64_t, int)
{
return 0;
}
* 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
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.
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;
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;
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;
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:
break;
default:
set_errno (EINVAL);
- return (__off64_t) -1;
+ return (_off64_t) -1;
}
return position;
}
return;
}
-__off64_t
-fhandler_dev_zero::lseek (__off64_t, int)
+_off64_t
+fhandler_dev_zero::lseek (_off64_t, int)
{
return 0;
}
__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;
__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;
#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*/
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),
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);
}
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_)),
}
}
-__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.
len * getpagesize (), prot, &old_prot))
{
__seterrno ();
- return (__off64_t)-1;
+ return (_off64_t)-1;
}
while (len-- > 0)
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);
};
}
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)
{
/* Used in mmap() */
mmap_record *
-list::match (__off64_t off, DWORD len)
+list::match (_off64_t off, DWORD len)
{
if (fd == -1 && !off)
{
/* 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 ()
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);
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;
{
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;
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");
}
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
*/
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;
/* 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;
{
}
-__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);
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)
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
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
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 */
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
}
extern "C" int
-ftruncate64 (int fd, __off64_t length)
+ftruncate64 (int fd, _off64_t length)
{
sigframe thisframe (mainthread);
int res = -1;
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))
/* 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;
/* 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
#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))