Floppy-Disk blocked signal problem.

From: Richard B. Johnson
Date: Fri Nov 07 2003 - 18:10:42 EST



Hello all,

Linux 2.4.22 has a major problem when reading the floppy disk.
Signal delivery is so delayed that many are lost. This program
will show that one can't count upon getting even one signal per
second reliably delivered when a floppy is being read!

This was first discovered when trying to ise ITIMER_REAL with
100 ticks/second. Lucky if we got one. Then I found that even
trying to get one tick/second was a problem:


#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <malloc.h>
#include <fcntl.h>
#include <signal.h>

#define BUF_LEN 0x10000
int main(void);

void handler(int unused)
{
alarm(1);
fprintf(stderr, "%08x\n", time(NULL));
}
int main()
{
int fd;
char *buf;
if((fd = open("/dev/fd0", O_RDONLY)) == -1)
{
perror("open");
exit(EXIT_FAILURE);
}
if((buf = malloc(BUF_LEN * sizeof(char))) == NULL)
{
fprintf(stderr, "No memory\n");
exit(EXIT_FAILURE);
}
signal(SIGALRM, handler);
alarm(1);
while(read(fd, buf, BUF_LEN) == BUF_LEN)
;
close(fd);
free(buf);
return 0;
}


Script started on Fri Nov 7 12:07:02 2003
$ ./xxx
3fabd13d
3fabd13f
3fabd141
3fabd144
3fabd145
3fabd148
3fabd14a
3fabd14c
3fabd14e
3fabd150
3fabd153
3fabd154
3fabd157
3fabd159
3fabd15b
3fabd15d
3fabd15f
3fabd161
3fabd163
3fabd166
3fabd168
3fabd16a
# exit
exit
Script done on Fri Nov 7 12:07:59 2003

Cheers,
Dick Johnson
Penguin : Linux version 2.4.22 on an i686 machine (797.90 BogoMips).
Note 96.31% of all statistics are fiction.


-
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/