how to use O_ASYNC and fcntl in perl?
问题 i want to use O_ASYNC option and when the pipe can read , the SIGIO's handler will run . but the following code are not work . any one can help me ? #!/bin/env perl use Fcntl; $SIG{IO}= sub { print "catch SIGIO!\n"; }; my $flags=0; open(FH,"-|","sleep 4 ;echo aaa") or die "$!"; fcntl(FH,F_GETFL,$flags) or die "$!"; fcntl(FH,F_SETFL,$flags | O_NONBLOCK | O_ASYNC) or die "$!"; sleep(5); print "complete\n"; my perl version is 5.16.1 , operation system is Redhat 5u4 ,kernel 2.6.18, x86_64 回答1: