xfs behaviour on OpenBSD

Kristaps Johnson <[email protected]>
Newsgroups gmane.comp.file-systems.arla.general
Message-ID <[email protected]>
Hello everybody.  I wonder if somebody can shed some light on strange 
behahiour (or sloppy thinking on my part).

If I mount_xfs on OpenBSD (3.9), and run two versions of a programme, one 
that read(2)s and one that fread(3)s, the read returns end-of-file while 
the fread returns correct values.

Sample code (minimal for brevity):

-------
#include <sys/types.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>

int
main(int argc, char *argv[])
{
         char c = 0;
#if READ
         int fd = open("/dev/xfs0", O_RDWR);
         read(fd, &c, 1);
#else /* FREAD */
         FILE *f = fopen("/dev/xfs0", "r+");
         fread(&c, 1, 1, f);
#endif
         printf("read character %d\n", c);
         return(0);
}
--------

...just to demonstrate.  When I raise an oper (e.g., "ls /mnt/xfs0") the 
read returns end-of-file while the fread returns a proper value.

Any suggestions?

Thanks,
Kristaps
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.