why doesn't following pseudo-code work (O_DIRECT results in EFAULT)
in_fd = open("/dev/mem");
in_mmap = mmap(in_fd);
out_fd = open("/tmp/file", O_DIRECT);
write(out_fd, in_mmap, PAGE_SIZE);
while following does (no O_DIRECT)
in_fd = open("/dev/mem");
in_mmap = mmap(in_fd);
out_fd = open("/tmp/file");
write(out_fd, in_mmap, PAGE_SIZE);
I guess it's something with virtual kernel pages to virtual user pages, which cannot be translated in the write call?
Best regards,
Friedrich
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…