lseek error on block device
From: Albert Chin-A-Young (china_at_foo.com)
Date: 05/30/04
- Previous message: charter: "Re: /usr/bin Program copy does not work unless root"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 30 May 2004 03:52:28 -0500
$ uname -a
AIX luna 2 5 0043880C4C00
$ oslevel -r
5200-01
$ lslpp -L bos.rte.libc
Fileset Level State Type Description
(Uninstaller)
----------------------------------------------------------------------------
bos.rte.libc 5.2.0.17 C F libc Library
$ cat size.c
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
int
main (void) {
int fd;
off_t size;
fd = open ("/dev/lv00", O_RDONLY);
if (fd == -1) {
printf ("%s\n", strerror (errno));
exit (1);
}
size = lseek (fd, 0, SEEK_END);
if (size == -1)
exit (2);
printf ("size: %lu\n", size);
close (fd);
}
$ xlc size.c
$ ./a.out
size: 0
Why doesn't lseek on a block device to SEEK_END return the size of the
block device? Is this operation unsupported? On Solaris 9, lseek returns
the size of the block device.
-- albert chin (china @at@ thewrittenword .dot. com)
- Previous message: charter: "Re: /usr/bin Program copy does not work unless root"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|