linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Juergen Oberhofer <e9826367@student.tuwien.ac.at>
To: linuxppc-embedded@lists.linuxppc.org
Cc: Juergen Oberhofer <e9826367@student.tuwien.ac.at>
Subject: Re: mpc / linux kernel - user space
Date: Mon, 1 Dec 2003 14:47:31 +0100 (MET)	[thread overview]
Message-ID: <Pine.GHP.4.58.0312011432180.23681@stud3.tuwien.ac.at> (raw)
In-Reply-To: <1070266735.328.5.camel@linpc003.aimsys.nl>


Hello,
I tried to make use of wake_up_interruptible(wq) in my module as
following (I just wanted to test if I'm using it correctly):
If I'm doing insmod, the module blocks in the wake_up_interruptible call.
Does somebody know why? Maybe because there is no process sleeping? How do
I check this?

DECLARE_WAIT_QUEUE_HEAD(wq);

int sleepy_init(void) {
  test_file = create_proc_entry("test", 0666, NULL);
  if(test_file == NULL) {
    return -ENOMEM;
  }

  wake_up_interruptible(&wq);

  return 0;
}

void sleepy_cleanup(void) {
remove_proc_entry("test", NULL);
}

module_init(test_init);
module_exit(test_cleanup);


Best regards,
Juergen

On Fri, 2003-11-28 at 10:21, Aain_Devarenne%ZODIAC@zodiac.com wrote:
> Hi everybody
>
> I 'm pending on the same problem as Juergen,
> - How can a User Space Thread Wait for a signaling event set by KERNEL ?

e.g. issue a read on some device driver (/dev/<your driver>
which will block until an interrupt has occured.
something like this:

DECLARE_WAIT_QUEUE_HEAD(mydriver_queue);

ssize_t mydriver_read(
struct file *filp,
char *buf,
size_t count,
loff_t *f_pos)
{
/* wait on interrupt */
while (1) {
interruptible_sleep_on(&mydriver_queue);
if (signal_pending (current)) /* a signal arrived */
return -ERESTARTSYS; /* tell the fs layer to handle it */
else break;
}
return 0;
}

void mydriver_irqhandler(unsigned long arg)
{
wake_up_interruptible(&mydriver_queue);
}

Jaap-Jan


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

  parent reply	other threads:[~2003-12-01 13:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-27 16:07 mpc / linux kernel - user space Juergen Oberhofer
2003-11-27 17:38 ` Jaap-Jan Boor
2003-11-27 18:08   ` Juergen Oberhofer
2003-11-27 19:28     ` Dan Kegel
2003-11-28  4:30       ` How to change /proc to the writable directory John Zhou
2003-11-28  8:12         ` Wolfgang Denk
2003-11-28  9:16     ` mpc / linux kernel - user space Jaap-Jan Boor
2003-11-28 15:42       ` Dan Malek
2003-12-01  8:18         ` Jaap-Jan Boor
2003-12-01 12:51           ` Peripherals Memory Mapping Kevin A. Sapp
2003-12-14 15:28             ` Paul Miller
2003-12-01 13:47           ` Juergen Oberhofer [this message]
2003-11-28  5:34 ` mpc / linux kernel - user space Sampath Kumar
2003-11-28  8:14   ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.GHP.4.58.0312011432180.23681@stud3.tuwien.ac.at \
    --to=e9826367@student.tuwien.ac.at \
    --cc=linuxppc-embedded@lists.linuxppc.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).