Why my little proggy can't get SIGIO in FreeBSD 3.3-RELEASE,
when i type my keyboard?
In 2.2.6-RELEASE it works right.
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <err.h>
#include <signal.h>
#include <syslog.h>
#include <errno.h>
#include <err.h>
void
rkbd(int sig)
{
int i,j;
u_char b[1024],*c;
syslog(LOG_DEBUG,"***** ");
i=read(0,b,1024);
if(i<0)
syslog(LOG_DEBUG,"read failed due to %s",strerror(errno));
else
if(!i)
syslog(LOG_DEBUG,"read null bites");
else{
b[i]='\0';
puts("\n******");
fputs(b,stdout);
puts("******\n");
fflush(stdout);
}
}
int
main(int argc,char **argv)
{
if(fcntl(0,F_SETFL,O_ASYNC)==-1)
err(errno,NULL);
signal(SIGIO,rkbd);
for(;;){
sleep(10);
}
}
S/MIME Cryptographic Signature