patch-2.2.15 linux/drivers/char/random.c
Next file: linux/drivers/char/rio/Makefile
Previous file: linux/drivers/char/radio-gemtek.c
Back to the patch index
Back to the overall index
- Lines: 78
- Date:
Fri Apr 21 12:46:05 2000
- Orig file:
v2.2.14/drivers/char/random.c
- Orig date:
Wed Oct 20 01:12:35 1999
diff -u --new-file --recursive --exclude-from ../../exclude v2.2.14/drivers/char/random.c linux/drivers/char/random.c
@@ -425,6 +425,7 @@
static struct timer_rand_state *irq_timer_state[NR_IRQS];
static struct timer_rand_state *blkdev_timer_state[MAX_BLKDEV];
static struct wait_queue *random_read_wait;
+static struct wait_queue *random_poll_wait;
static struct wait_queue *random_write_wait;
static ssize_t random_read(struct file * file, char * buf,
@@ -556,6 +557,7 @@
#endif
extract_timer_state.dont_count_entropy = 1;
random_read_wait = NULL;
+ random_poll_wait = NULL;
random_write_wait = NULL;
}
@@ -763,7 +765,10 @@
/* Wake up waiting processes, if we have enough entropy. */
if (r->entropy_count >= WAIT_INPUT_BITS)
+ {
wake_up_interruptible(&random_read_wait);
+ wake_up_interruptible(&random_poll_wait);
+ }
}
#ifdef RANDOM_BENCHMARK
@@ -1219,7 +1224,10 @@
r->entropy_count = 0;
if (r->entropy_count < WAIT_OUTPUT_BITS)
+ {
wake_up_interruptible(&random_write_wait);
+ wake_up_interruptible(&random_poll_wait);
+ }
while (nbytes) {
/* Hash the pool to get the output */
@@ -1328,6 +1336,7 @@
schedule();
continue;
}
+ current->state = TASK_RUNNING;
n = extract_entropy(&random_state, buf, n, 1);
if (n < 0) {
retval = n;
@@ -1364,8 +1373,7 @@
{
unsigned int mask;
- poll_wait(file, &random_read_wait, wait);
- poll_wait(file, &random_write_wait, wait);
+ poll_wait(file, &random_poll_wait, wait);
mask = 0;
if (random_state.entropy_count >= WAIT_INPUT_BITS)
mask |= POLLIN | POLLRDNORM;
@@ -1448,7 +1456,10 @@
* entropy.
*/
if (random_state.entropy_count >= WAIT_INPUT_BITS)
+ {
wake_up_interruptible(&random_read_wait);
+ wake_up_interruptible(&random_poll_wait);
+ }
return 0;
case RNDGETPOOL:
if (!capable(CAP_SYS_ADMIN))
@@ -1501,7 +1512,10 @@
* entropy.
*/
if (random_state.entropy_count >= WAIT_INPUT_BITS)
+ {
wake_up_interruptible(&random_read_wait);
+ wake_up_interruptible(&random_poll_wait);
+ }
return 0;
case RNDZAPENTCNT:
if (!capable(CAP_SYS_ADMIN))
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)