help!!!!

Scott Manley (spm@star.arm.ac.uk)
Sun, 11 Jul 1999 15:21:48 +0100


I'm at the end of my tether...
I'm sorry to disturb you and all that but I'm one of those weak individuals
who can only play with code for 30 hours before asking for help....

I'm trying to learn a bit about module programming... building a character
device which will behave like a pipe with a few special characteristics.

I've basically been working from the Linux Kernel Module Programmers guide and
following most of the constructs in that.

anywa... whenever I try to do anything with the wait queue I get a kernel oops
along the lines of...

Jul 11 14:09:08 arpc65 kernel: general protection fault: 0000
Jul 11 14:09:08 arpc65 kernel: CPU: 0
Jul 11 14:09:08 arpc65 kernel: EIP: 0010:[interruptible_sleep_on+32/92]
Jul 11 14:09:08 arpc65 kernel: EFLAGS: 00010086
Jul 11 14:09:08 arpc65 kernel: eax: c09f4000 ebx: c09f5f70 ecx: c09f43a8
edx: ffffffff
Jul 11 14:09:08 arpc65 kernel: esi: 00000286 edi: 00001000 ebp: c09f5f78
esp: c09f5f70
Jul 11 14:09:08 arpc65 kernel: ds: 0018 es: 0018 ss: 0018
Jul 11 14:09:08 arpc65 kernel: Process cat (pid: 498, process nr: 82,
stackpage=c09f5000)
Jul 11 14:09:08 arpc65 kernel: Stack: c09f4000 c023cd83 c09f5f98 c48382de
c4838d8c c1bc9a20 ffffffea 00000000
Jul 11 14:09:08 arpc65 kernel: c09f43a0 c09f43a8 00001000 c0125462
c1bc9a20 0804aef8 00001000 c1bc9a34
Jul 11 14:09:08 arpc65 kernel: c09f4000 00001000 0804aef8 bffff9a4
c0109d60 00000000 0804aef8 00001000
Jul 11 14:09:08 arpc65 kernel: Call Trace: [<c48382de>] [<c4838d8c>]
[sys_read+174/196] [system_call+52/56]
Jul 11 14:09:08 arpc65 kernel: Code: 8b 02 85 c0 75 06 8d 42 fc 8d 76 00 89 43
04 89 1a e8 4a fb

The lines of relevance are prsumably.....

/* wait queue */
static struct wait_queue *lwait = 0;

static ssize_t liveice_read(struct file *file,
char *buffer, /* The buffer to fill with data */
size_t length, /* The length of the buffer */
loff_t *offset) /* Our offset in the file */
{
int available,requested,end_pos,i,is_sig=0;

/* check to see if the pointer is valid */
/* if(verify_area(VERIFY_WRITE,buffer,length))
return -EFAULT;*/

printk("Trying to read %d bytes from the pipe\n",length);
/*first - check that some input remains */
if(!live_buffer){
printk("No input buffer - waiting for writer\n");
if(file->f_flags & O_NONBLOCK){
/* no waiting here */
return -EAGAIN;
} else {
/* wait until something initialises the other end */
while(!live_buffer){
for(i=0; i<_NSIG_WORDS && !is_sig; i++)
is_sig = current->signal.sig[i] &
~current->blocked.sig[i];
if (is_sig) {
return -EINTR;
}
module_interruptible_sleep_on(&lwait);

}
}
}

It's that last module_interruptible_sleep_on(&lwait); which triggers the oops.

but any invocation of sleep or wake is causing this..

What the hell am I doing wrong?

Scott Manley (aka Szyzyg) /------ _@/ Mail -----\
___ _ _ __ __ _ | Armagh Observatory |
/ __| __ ___| |_| |_ | \/ |__ _ _ _ | |___ _ _ | Armagh |
\__ \/ _/ _ \ _| _| | |\/| / _` | ' \| / -_) || | | Northern Ireland |
|___/\__\___/\__|\__| |_| |_\__,_|_||_|_\___|\_, | | BT61 9DG. |
http://star.arm.ac.uk/~spm/welcome.html |__/ \=====================/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/