version 1.7, 2002/11/26 19:50:30 |
version 1.7.6.5, 2005/02/04 07:09:16 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* documentation and/or other materials provided with the distribution. |
* 3. All advertising materials mentioning features or use of this software |
* 3. Neither the name of the University nor the names of its contributors |
* must display the following acknowledgement: |
|
* This product includes software developed by the University of |
|
* California, Berkeley and its contributors. |
|
* 4. Neither the name of the University nor the names of its contributors |
|
* may be used to endorse or promote products derived from this software |
* may be used to endorse or promote products derived from this software |
* without specific prior written permission. |
* without specific prior written permission. |
* |
* |
|
|
* Internal `Firm_event' interface for the keyboard and mouse drivers. |
* Internal `Firm_event' interface for the keyboard and mouse drivers. |
*/ |
*/ |
|
|
|
#include <sys/cdefs.h> |
|
__KERNEL_RCSID(0, "$NetBSD$"); |
|
|
#include <sys/param.h> |
#include <sys/param.h> |
#include <sys/fcntl.h> |
#include <sys/fcntl.h> |
#include <sys/malloc.h> |
#include <sys/malloc.h> |
|
|
* Initialize a firm_event queue. |
* Initialize a firm_event queue. |
*/ |
*/ |
void |
void |
ev_init(ev) |
ev_init(struct evvar *ev) |
register struct evvar *ev; |
|
{ |
{ |
|
|
ev->ev_get = ev->ev_put = 0; |
ev->ev_get = ev->ev_put = 0; |
|
|
* Tear down a firm_event queue. |
* Tear down a firm_event queue. |
*/ |
*/ |
void |
void |
ev_fini(ev) |
ev_fini(struct evvar *ev) |
register struct evvar *ev; |
|
{ |
{ |
|
|
free(ev->ev_q, M_DEVBUF); |
free(ev->ev_q, M_DEVBUF); |
|
|
* (User cannot write an event queue.) |
* (User cannot write an event queue.) |
*/ |
*/ |
int |
int |
ev_read(ev, uio, flags) |
ev_read(struct evvar *ev, struct uio *uio, int flags) |
register struct evvar *ev; |
|
struct uio *uio; |
|
int flags; |
|
{ |
{ |
int s, n, cnt, error; |
int s, n, cnt, error; |
|
|
Line 147 ev_read(ev, uio, flags) |
|
Line 141 ev_read(ev, uio, flags) |
|
} |
} |
|
|
int |
int |
ev_poll(ev, events, p) |
ev_poll(struct evvar *ev, int events, struct lwp *l) |
register struct evvar *ev; |
|
int events; |
|
struct proc *p; |
|
{ |
{ |
int s = splev(), revents = 0; |
int s, revents = 0; |
|
|
|
s = splev(); |
if (events & (POLLIN | POLLRDNORM)) { |
if (events & (POLLIN | POLLRDNORM)) { |
if (ev->ev_get == ev->ev_put) |
if (ev->ev_get == ev->ev_put) |
selrecord(p, &ev->ev_sel); |
selrecord(l, &ev->ev_sel); |
else |
else |
revents |= events & (POLLIN | POLLRDNORM); |
revents |= events & (POLLIN | POLLRDNORM); |
} |
} |
revents |= events & (POLLOUT | POLLWRNORM); |
revents |= events & (POLLOUT | POLLWRNORM); |
|
|
splx(s); |
splx(s); |
return (revents); |
return (revents); |
} |
} |