> Hints as to what the best equivalent to BLKGETSIZE might be would definitely
> be appreciated.

The return value from lseek(fd, 0, SEEK_END) should work. But it does not
work with character "disk" devices on old Solaris (<10) releases.

% cat devsz.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>

int
main(int argc, char **argv)
{
        int fd;
        fd = open(argv[1], O_RDONLY);
        if (fd < 0) {
                perror(argv[1]);
                exit(1);
        }
        printf("%lld\n", (long long) lseek(fd, 0, SEEK_END));
        exit(0);
}
% gcc `getconf LFS_CFLAGS` -o devsz devsz.c
# ./devsz /dev/rdsk/c0d0p0
100029726720
# ./devsz /dev/dsk/c0d0p0
100029726720
# ./devsz /vol/dev/aliases/rmdisk2
16384512
...
This message posted from opensolaris.org
_______________________________________________
opensolaris-discuss mailing list
[email protected]

Reply via email to