#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("/tmp/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;
}
Output is:
write returns -1
Filesize limit exceeded (core dumped)
$ ls -l /tmp/blah
---------- 1 gsuresh users 4294967274 Dec 15 19:15 /tmp/blah
The kernel is 2.4.16 and /tmp is ext2. (It runs fine on 2.4.2).
Any idea why this happens and how to fix this?
Thanks
--suresh
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/