Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Jun 1996 03:44:28 -0700 (PDT)
From:      asami@cs.berkeley.edu (Satoshi Asami)
To:        current@freebsd.org
Subject:   how to find size of special file
Message-ID:  <199606151044.DAA00936@silvia.HIP.Berkeley.EDU>

next in thread | raw e-mail | index | archive | help
Stupid question du jour:

How do you find out a size of a raw or cooked disk partition?  Neither
the obvious

    int fd ;
    struct stat sb ;
    fd = open(filename, ...) ;
    stat(fd, &sb) ;
    size = sb.st_size ;

nor the less obvious

    int fd ;
    struct stat sb ;
    fd = open(filename, ...) ;
    size = lseek(fd, 0, SEEK_END) ;

work on special files, even if they are disk partitions.  (They both
work on regular files....)

Satoshi



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199606151044.DAA00936>