Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 02 Mar 2001 18:02:56 +0300 (MSK)
From:      Dmitry Dicky <diwil@eis.ru>
To:        freebsd-hackers@freebsd.org
Subject:   stupid device driver question
Message-ID:  <XFMail.010302180256.diwil@eis.ru>

next in thread | raw e-mail | index | archive | help
Hi fellows,

I'm writing some device driver which should pass some data to the user
space.

The part of the device read routine looks as follows:

----------------------------------
int
dev_read(dev_t dev, struct uio *uio, int ioflag)
{
    int err = 0;
/* ... */
    amnt = MIN(uio->uio_resid, cntw);
/* Wait here until data available .... how? */
    err = uiomove(buf2, amnt, uio);
    if (err != 0) {
        return(err);
    }
    
    memset(buf2, 0, amnt);
    cntw -= amnt;
    return 0;
}
-------------------------------------
User application hands on read(2).

But buf2 being filled upon some event and 'dev_read' should
wait until data in buf2 available.

So, the question is:
How can I hang dev_read, issue some signal and then continue uiomove(9)
data to the user space?


Thanks in advance,
D.



-- 
*********************************************************************
   ("`-''-/").___..--''"`-._     (\       Dimmy the Wild      UA1ACZ
    `6_ 6  )   `-.  (     ).`-.__.`)      Enterprise Information Sys 
    (_Y_.)'  ._   )  `._ `. ``-..-'       Nevsky prospekt,   20 / 44
  _..`--'_..-_/  /--'_.' ,'               Saint Petersburg,   Russia
 (il),-''  (li),'  ((!.-'                 +7 (812) 3148860,  5585314
*********************************************************************

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.010302180256.diwil>