bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fdatasync() error in shred from coreutils-5.2.1 on AIX 5.2


From: Albert Chin
Subject: Re: fdatasync() error in shred from coreutils-5.2.1 on AIX 5.2
Date: Sat, 29 May 2004 15:54:27 -0500
User-agent: Mutt/1.5.6i

On Sat, May 29, 2004 at 12:57:52AM -0700, Paul Eggert wrote:
> Following up on your message
> <http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00169.html>:
> 
> >> shred should try "lseek (fd, 0, SEEK_END)": did that fail too?
> >
> > The only lseek I see in the truss output is the following. It appears
> > very early.
> >   245772: open("/dev/lv00", 0400004001)                   = 3
> >   245772: fstatx(3, 0x2FF21F98, 128, 010)                 = 0
> >   245772: klseek(3, 0, 0, 0x00000002)                     = 0
> >   245772: klseek(3, 0, 0, 0x00000000)                     = 0
> 
> Yes, I'd expect it to be early.  I don't know what klseek is, though;
> if it returns zero, does that mean the file offset is zero?  If so,
> AIX is saying the file size is zero.  In this case 'shred' assumes
> that the OS isn't telling us the file size, so it goes ahead and
> writes data until write error.
> 
> Is /dev/lv00 a block special device, or a character special device, or
> something else?  POSIX says that seeks are supposed to work as one
> would expect on regular files, block special files, and directories,
> but seeks have implementation-defined behavior on other files.
> However, I thought that AIX let you seek on character special files as
> well (disk devices anyway).

# ls -ld /dev/lv00
brw-rw----   1 root     system       10, 12 May 29 15:44 /dev/lv00
# ls -ld /dev/rlv00
crw-rw----   1 root     system       10, 12 May 29 15:44 /dev/rlv00

> It's a bit odd that lseek isn't working though.

$ 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

The program above works correctly on Solaris 9/SPARC.

-- 
albert chin (address@hidden)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]