lseek error on block device

From: Albert Chin-A-Young (china_at_foo.com)
Date: 05/30/04

  • Next message: JWL: "Re: TSM on AIX with AIO?"
    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)
    

  • Next message: JWL: "Re: TSM on AIX with AIO?"

    Relevant Pages

    • Re: [PATCH] lockfs patch for 2.6
      ... * block device, we hould a read lock on the s->s_umount sem to make sure ... typedef struct bhv_vfsops { ...
      (Linux-Kernel)
    • Help in Java swings(internal Frame)
      ... public int getSize() ... public void valueChanged{ ... private JScrollPane scrollPane1; ... public class PeakContainer extends JInternalFrame ...
      (comp.lang.java.programmer)
    • [PATCH] get rid if __cpuinit and __cpuexit
      ... unsigned long action, void *hcpu) ... unsigned int cpu = hcpu; ... -static int __cpuinit ... __cpu_up(unsigned int cpu) ...
      (Linux-Kernel)
    • [PATCH,RFC 2.6.14 09/15] KGDB: SuperH-specific changes
      ... This adds basic support for KGDB on SuperH as well as adding some architecture ... -static int kgdb_uart_getchar ... -static void kgdb_uart_putchar ... * The command-line option can include a serial port specification ...
      (Linux-Kernel)
    • problem in java swings
      ... public int getSize() ... public void valueChanged{ ... private JScrollPane scrollPane1; ... public class PeakContainer extends JInternalFrame ...
      (comp.lang.java.programmer)