[OpenAFS-devel] Odd Behavior with 1.4.2fc3
Jason McCormick
jasonmc@cert.org
Tue, 19 Sep 2006 10:11:02 -0400
This is a multi-part message in MIME format.
--------------010705020409090008060404
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Jason McCormick wrote:
> I'm working on a small test case to show this better.
Here's a small program that shows the output of the fstat64() command.
On OpenAFS <= 1.4.1 (tested on 1.2.13 and 1.4.1) st_blksize is always
4096. On 1.4.2fc4 it's 0.
--
Jason McCormick <jasonmc@cert.org>
CERT Infrastructure Group
--------------010705020409090008060404
Content-Type: text/x-csrc;
name="blksize.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="blksize.c"
#define _D_GNU_SOURCE 1
#define _D_FILE_OFFSET_BITS 64
/* fstat, open */
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
/* open */
#include <fcntl.h>
/* fprintf */
#include <stdio.h>
int main(int argc, char *argv[]) {
int fd, ret;
struct stat stbuf;
ssize_t nb;
fprintf(stderr, "about to open %s...\n", argv[1]);
if ((fd = open(argv[1], O_RDONLY, 0666)) < 0) {
perror("open");
return 1;
}
fprintf(stderr, "about to open %s...\n", argv[1]);
if ((ret = fstat(fd, &stbuf)) != 0) {
perror("write");
return 2;
}
fprintf(stdout, "%0ld\tdev_t st_dev; /* device */\n", stbuf.st_dev);
fprintf(stdout, "%0ld\tino_t st_ino; /* inode */\n", stbuf.st_ino);
fprintf(stdout, "%0ld\tmode_t st_mode; /* protection */\n", stbuf.st_mode);
fprintf(stdout, "%0ld\tnlink_t st_nlink; /* number of hard links */\n",stbuf.st_nlink);
fprintf(stdout, "%0ld\tuid_t st_uid; /* user ID of owner */\n", stbuf.st_uid);
fprintf(stdout, "%0ld\tgid_t st_gid; /* group ID of owner */\n", stbuf.st_gid);
fprintf(stdout, "%0ld\tdev_t st_rdev; /* device type (if inode device) */\n", stbuf.st_rdev);
fprintf(stdout, "%0ld\toff_t st_size; /* total size, in bytes */\n", stbuf.st_size);
fprintf(stdout, "%0ld\tblksize_t st_blksize; /* blocksize for filesystem I/O */\n", stbuf.st_blksize);
fprintf(stdout, "%0ld\tblkcnt_t st_blocks; /* number of blocks allocated */\n", stbuf.st_blocks);
fprintf(stdout, "%0ld\ttime_t st_atime; /* time of last access */\n", stbuf.st_atime);
fprintf(stdout, "%0ld\ttime_t st_mtime; /* time of last modification */\n", stbuf.st_mtime);
fprintf(stdout, "%0ld\ttime_t st_ctime; /* time of last status change */\n", stbuf.st_ctime);
fprintf(stderr, "about to open %s...\n", argv[1]);
if (close(fd) != 0) {
perror("close");
return 3;
}
}
--------------010705020409090008060404--