(Not on the list, please CC on replies)
Hi,
Doing O_DIRECT I/O to a buffer which is not on an appropriate block boundary
seem to fail with return code 22 instead of -22 (EINVAL). This is on 2.4.2
with an XFS tree checkout from 20010329.
tia,
Lennert
-- test.c
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#define O_DIRECT 040000 /* direct disk access hint */
int main()
{
char buf[16384];
int fd;
char *p;
p = (char *)((((unsigned long)buf) + 8191) & ~8191L);
fd = open("blah", O_CREAT | O_RDWR | O_DIRECT);
printf("write returns %i\n", write(fd, buf, 8192));
printf("write returns %i\n", write(fd, p, 1));
return 0;
}
-- actual output
[buytenh@mara test]$ ./test
write returns 22
write returns 22
|