ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/sys_unix.cpp
(Generate patch)

Comparing BasiliskII/src/Unix/sys_unix.cpp (file contents):
Revision 1.4 by cebix, 1999-10-15T14:50:38Z vs.
Revision 1.5 by cebix, 1999-10-31T23:18:37Z

# Line 27 | Line 27
27   #ifdef __linux__
28   #include <linux/cdrom.h>
29   #include <linux/fd.h>
30 + #include <linux/fs.h>
31   #include <linux/major.h>
32   #include <linux/kdev_t.h>
33   #include <linux/unistd.h>
# Line 428 | Line 429 | loff_t SysGetFileSize(void *arg)
429                  return fh->file_size;
430          else {
431   #if defined(__linux__)
432 <                loff_t pos = 0;
433 <                _llseek(fh->fd, 0, 0, &pos, SEEK_END);
434 <                return pos - fh->start_byte;
432 >                long blocks;
433 >                if (ioctl(fh->fd, BLKGETSIZE, &blocks) < 0)
434 >                        return 0;
435 >                D(bug(" BLKGETSIZE returns %d blocks\n", blocks));
436 >                return (loff_t)blocks * 512;
437   #else
438                  return lseek(fh->fd, 0, SEEK_END) - fh->start_byte;
439   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines