All of lore.kernel.org
 help / color / mirror / Atom feed
* Preventing signal interrupt in Kernel module code
@ 2002-09-13 13:54 ` Kevin Curtis
  0 siblings, 0 replies; 15+ messages in thread
From: Kevin Curtis @ 2002-09-13 13:54 UTC (permalink / raw)
  To: linux-newbie, linux-kernel

Hi,
	I have written a Kernel module and I'm having a small problem with
signals that I hope someone can steer me through.  The signal in question
are SIGCHILD, but that is not really relevant.  I must be able to handle any
signal that the process has enabled.

	My module has several wait queues, most of which I can cope with
being interrupted by a signal (returning EINTR to the process).  However,
there are some hardware operations that I need to wait for completion of, as
it would be impossible to restart them or pick up where we left off.  I
still want to use a wait queue so other things can run.  Is there some
system call I can make to mask signals until the operation has completed.
Would I still call signal_pending() to see if one had occurred while they
were blocked?

I'm sure the answer is really simple but I haven't stumbled across it yet.

TIA

Kevin
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply	[flat|nested] 15+ messages in thread
* RE: Preventing signal interrupt in Kernel module code
@ 2002-09-13 15:49 Kevin Curtis
  2002-09-13 17:22 ` Quinn Harris
  0 siblings, 1 reply; 15+ messages in thread
From: Kevin Curtis @ 2002-09-13 15:49 UTC (permalink / raw)
  To: 'Quinn Harris', linux-newbie

Thanks for the answer.  It was in the Linux Device Driver book too.  Should
have looked there first (this is available online at
http://www.xml.com/ldd/chapter/book/, very useful.

Just one more thing.  It would be nice to do something slightly different if
the signal was SIGTERM.  Is there anyway or seeing what signal caused the
interrupt?


Thanks again.

Kevin

-----Original Message-----
From: Quinn Harris [mailto:quinn@nmt.edu]
Sent: 13 September 2002 16:57
To: linux-newbie@vger.kernel.org
Subject: Re: Preventing signal interrupt in Kernel module code


Would placing the process waiting for the hardware in an
TASK_UNINTERRUPTIBLE state do what you want?  As far as I understand
it,  the TASK_UNINTERRUPTIBLE state is used to prevent anything from
waking up a process when it is waiting for something it can't be
interrupted by a signal from.  If you call wait_event(wq, condition);
(actually a define in sched.h) the process will be placed in a
TASK_UNINTERRUPTIBLE state until the wait queue is woken up and the
condition is met.  wait_event_interruptible(wq, condition) would allow a
process to be interrupted by a signal.  You might be doing essentially
what wait_event does without using it.  I have seen a bit of kernel code
(I think usually older code) that doesn't used wait_event when it could
to place the current process on a wait queue.


On Fri, 2002-09-13 at 07:54, Kevin Curtis wrote:
> Hi,
> 	I have written a Kernel module and I'm having a small problem with
> signals that I hope someone can steer me through.  The signal in question
> are SIGCHILD, but that is not really relevant.  I must be able to handle
any
> signal that the process has enabled.
> 
> 	My module has several wait queues, most of which I can cope with
> being interrupted by a signal (returning EINTR to the process).  However,
> there are some hardware operations that I need to wait for completion of,
as
> it would be impossible to restart them or pick up where we left off.  I
> still want to use a wait queue so other things can run.  Is there some
> system call I can make to mask signals until the operation has completed.
> Would I still call signal_pending() to see if one had occurred while they
> were blocked?
> 
> I'm sure the answer is really simple but I haven't stumbled across it yet.
> 
> TIA
> 
> Kevin
> -
> To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.linux-learn.org/faqs
> 


-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply	[flat|nested] 15+ messages in thread
* RE: Preventing signal interrupt in Kernel module code
@ 2002-09-13 16:02 Kevin Curtis
  0 siblings, 0 replies; 15+ messages in thread
From: Kevin Curtis @ 2002-09-13 16:02 UTC (permalink / raw)
  To: 'Ken Boyer', linux-newbie

Ok - I will refrain from posting technical questions here.  I did also post
it to the linux-kernel mail list too.  It's just that sometimes, a question
like mine is too trivial for them and gets ignored.  However, Ray is right,
don't let postings like mine put you off sending in your questions too.

By the way, even though I'm writing Kernel modules, I still have problems
with my Mandrake distro too.  The latest being that sound has stopped
working when I installed my network card.


Kevin

-----Original Message-----
From: Ken Boyer [mailto:kboyer@logicalimages.com]
Sent: 13 September 2002 17:00
To: linux-newbie@vger.kernel.org
Subject: RE: Preventing signal interrupt in Kernel module code



Thank you for the clarification.

Ken


-----Original Message-----
From: linux-newbie-owner@vger.kernel.org
[mailto:linux-newbie-owner@vger.kernel.org] On Behalf Of Ray Olszewski
Sent: Friday, September 13, 2002 11:54 AM
To: Bill Pleasants; linux-newbie@vger.kernel.org
Subject: Re: Preventing signal interrupt in Kernel module code


At 11:33 AM 9/13/02 -0700, Bill Pleasants wrote:
>Hello,
>I was told this list was for beginners.  From what I have read in the 
>past week, I think I am out of place.  I just want help getting a 
>Mandrake installation to work. Yours truly,
>Bill


You were told right; this list is for beginners. Some of us who hang out

here are not beginners, though (how else would you get knowledgeable 
*answers*, after all?), and one of us may, from time to time, pose a 
somewhat more advanced question to his colleagues. Not all that often, 
though ... there are better places to get answers to advanced questions 
than here.

That said, we don't have any automated filter to keep really complex 
questions off the list, and from time to time, someone will post an 
extremely technical question here. The one you posted in response to is
a 
good example; I don't know if the poster will get any help here (he
might, 
though it is a long shot), but his question really is way above what we 
customarily discuss.

That said ... we answer questions here. You don't ask any in your
posting. 
If you are having trouble, you'll need to tell us what the trouble is.

Asking for help here is not a substitute for things like reading the 
documentation and following your distro's installations instructions --
we 
generally avoid the bluntness of "RTFM" and "STFW" replies, but we do 
retain the underlying expectation that for general questions, you will
turn 
to FAQs, man pages, and other general documentation. If this is what you

need to do, someone here will usually tell you so ... though a bit more 
politely than you might see elsewhere.

As to your questions ... we do assume that someone who wants help will
make 
the effort to describe what he has done, and the problems he has 
encountered, with some specificity. We don't try to write personalized, 
soup-to-nuts tutorials.

So with that as background, please do not hesitate to pose
beginner-level 
questions here.



--
-------------------------------------------"Never tell me the
odds!"--------
Ray Olszewski					-- Han Solo
Palo Alto, California, USA			  ray@comarre.com
------------------------------------------------------------------------
-------

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie"
in the body of a message to majordomo@vger.kernel.org More majordomo
info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply	[flat|nested] 15+ messages in thread
[parent not found: <7C078C66B7752B438B88E11E5E20E72E0EF515@GENERAL.farsite.co. uk>]

end of thread, other threads:[~2002-09-14  9:20 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-13 13:54 Preventing signal interrupt in Kernel module code Kevin Curtis
2002-09-13 13:54 ` Kevin Curtis
2002-09-13 15:56 ` Quinn Harris
2002-09-13 18:33 ` Bill Pleasants
2002-09-13 15:39   ` Ken Boyer
2002-09-13 15:53   ` Ray Olszewski
2002-09-13 16:00     ` Ken Boyer
2002-09-13 21:33     ` starts error Bill Pleasants
2002-09-13 19:48       ` Ray Olszewski
2002-09-14  9:20       ` pa3gcu
2002-09-13 20:06   ` Preventing signal interrupt in Kernel module code Bryan Whitehead
  -- strict thread matches above, loose matches on Subject: below --
2002-09-13 15:49 Kevin Curtis
2002-09-13 17:22 ` Quinn Harris
2002-09-13 16:02 Kevin Curtis
     [not found] <7C078C66B7752B438B88E11E5E20E72E0EF515@GENERAL.farsite.co. uk>
2002-09-13 16:40 ` Ray Olszewski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.