内核在发出信号时获取堆栈

时间:2010-06-09 21:11:15

标签: linux-kernel kernel-module

我写内核必须在它们之间进行同步的读者和作者以及已经阅读按摩的阻止作者

当我在队列中等待时,我得到信号,所以我做了休息

while (i_Allready_Read(myf) == ALLREADY_READ || isExistWriter == false )
//while (!(i_Allready_Read(aliveProc,current->pid)))
{
    int i, is_sig = 0;
    printk(KERN_INFO "\n\n*****entered set in read ******\n\n" );
    if (i_Allready_Read(myf) == ALLREADY_READ )
        wait_event_interruptible (readWaitQ1, !i_Allready_Read(myf));
    else
        wait_event_interruptible (readWaitQ1, isExistWriter);

    //printk(KERN_INFO "Read Wakeup %d\n",current->pid);

    for (i = 0; i < _NSIG_WORDS && !is_sig; i++)
    {
        is_sig = current->pending.signal.sig[i] & ~current->blocked.sig[i];
    }

    if (is_sig)
    {
        handledClose(myf);
        module_put (THIS_MODULE);
        return -EINTR;
     }
   }
   return 0;//success

}

inline void handledClose(struct file *myf)//v

{     / *      *如果我们关闭作家其他作家      *将能够进入许可     * /

if (myf == writerpid )
{
    isExistWriter = DOESNT_EXIST;
    //printk(KERN_INFO "procfs_close : this is pid that just closed %d \n", writerpid);
}
/*
 *else its a reader so our numofreaders
 *need to decremented
*/
else
{
    removeFromArr(myf);
    numOfReaders--;
}

}

我的关闭什么也没做......

我做错了什么?

1 个答案:

答案 0 :(得分:1)

你在哪里唤醒等待队列?

你应该在某处调用wake_up(readWaitQ1);。将isExistWriter设置为true后可能。