use O_DIRECT open file, when read will hang.
From: Hugang
Date: Thu Sep 18 2003 - 23:48:53 EST
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@xxxxxxxxxxxx, steve@xxxxxxxxxxxx
GPG FinePrint : 4099 3F1D AE01 1817 68F7 D499 A6C2 C418 86C8 610E
GPG Public Key: http://soulinfo.com/~hugang/HuGang.asc
MSN# : huganglinux@xxxxxxxxxxx [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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/