diff options
Diffstat (limited to 'db2/os/os_stat.c')
-rw-r--r-- | db2/os/os_stat.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/db2/os/os_stat.c b/db2/os/os_stat.c index ee84ab0588..73600b6336 100644 --- a/db2/os/os_stat.c +++ b/db2/os/os_stat.c @@ -8,7 +8,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "@(#)os_stat.c 10.8 (Sleepycat) 10/25/97"; +static const char sccsid[] = "@(#)os_stat.c 10.11 (Sleepycat) 1/8/98"; #endif /* not lint */ #ifndef NO_SYSTEM_INCLUDES @@ -47,34 +47,35 @@ __os_exists(path, isdirp) * Return file size and I/O size; abstracted to make it easier * to replace. * - * PUBLIC: int __os_ioinfo __P((const char *, int, off_t *, off_t *)); + * PUBLIC: int __os_ioinfo + * PUBLIC: __P((const char *, int, u_int32_t *, u_int32_t *, u_int32_t *)); */ int -__os_ioinfo(path, fd, sizep, iop) +__os_ioinfo(path, fd, mbytesp, bytesp, iosizep) const char *path; int fd; - off_t *sizep, *iop; + u_int32_t *mbytesp, *bytesp, *iosizep; { struct stat sb; + COMPQUIET(path, NULL); + if (fstat(fd, &sb) == -1) return (errno); /* Return the size of the file. */ - if (sizep != NULL) - *sizep = sb.st_size; + if (mbytesp != NULL) + *mbytesp = sb.st_size / MEGABYTE; + if (bytesp != NULL) + *bytesp = sb.st_size % MEGABYTE; - /* - * Return the underlying filesystem blocksize, if available. Default - * to 8K on the grounds that most OS's use less than 8K as their VM - * page size. - */ + /* Return the underlying filesystem blocksize, if available. */ #ifdef HAVE_ST_BLKSIZE - if (iop != NULL) - *iop = sb.st_blksize; + if (iosizep != NULL) + *iosizep = sb.st_blksize; #else - if (iop != NULL) - *iop = 8 * 1024; + if (iosizep != NULL) + *iosizep = DB_DEF_IOSIZE; #endif return (0); } |