- 论坛徽章:
- 4
|
- static int scull_getwritespace(struct scull_pipe *dev, struct file *filp)
- {
- while (spacefree(dev) == 0) { /* full */
- DEFINE_WAIT(wait);
- up(&dev->sem);
- if (filp->f_flags & O_NONBLOCK)
- return -EAGAIN;
- PDEBUG("\"%s\" writing: going to sleep\n",current->comm);
- prepare_to_wait(&dev->outq, &wait, TASK_INTERRUPTIBLE);
- if (spacefree(dev) == 0)
- schedule();
- finish_wait(&dev->outq, &wait);
- if (signal_pending(current))
- return -ERESTARTSYS; /* signal: tell the fs layer to handle it */
- if (down_interruptible(&dev->sem))
- return -ERESTARTSYS;
- }
- return 0;
- }
复制代码 回复 2# humjb_1983
这个,真没有啊。
|
|