Messages in this thread | | | Date | Fri, 19 Sep 2003 12:46:31 +0800 | From | Hugang <> | Subject | use O_DIRECT open file, when read will hang. |
| |
Hello all:
Steps to reproduce:
rm -f /tmp/1.log touch /tmp/1.log echo << EOF > /tmp/hang.c #include <sys/types.h> #include <asm/fcntl.h>
main() { int i; char buf[1025];
i = open("/tmp/1.log", O_RDONLY | 040000, 0); if ( i != -1) { read(i, buf, 1); } printf("'%s'", buf); } EOF gcc -o /tmp/hang /tmp/hang.c /tmp/hang
-- Hu Gang / Steve Email : hugang@soulinfo.com, steve@soulinfo.com GPG FinePrint : 4099 3F1D AE01 1817 68F7 D499 A6C2 C418 86C8 610E GPG Public Key: http://soulinfo.com/~hugang/HuGang.asc MSN# : huganglinux@hotmail.com [9:00AM - 5:30PM +8:00] RLU# : 204016 [1999] (Register Linux User) - 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/
| |