diff options
author | peter <peter@FreeBSD.org> | 1997-09-14 03:12:54 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1997-09-14 03:12:54 +0000 |
commit | e762286917ce1de5d1fc3744a413be43a74c656b (patch) | |
tree | 79cb2580df056b798c6654c99e4634c80eba2383 /sys/i386/isa/sound/midibuf.c | |
parent | 1a4a67a50c6c9977582495bb8c3772445cbb094a (diff) | |
download | FreeBSD-src-e762286917ce1de5d1fc3744a413be43a74c656b.zip FreeBSD-src-e762286917ce1de5d1fc3744a413be43a74c656b.tar.gz |
Update select -> poll.
I am not particularly happy with this stuff, I have no way to test it.
Diffstat (limited to 'sys/i386/isa/sound/midibuf.c')
-rw-r--r-- | sys/i386/isa/sound/midibuf.c | 48 |
1 files changed, 14 insertions, 34 deletions
diff --git a/sys/i386/isa/sound/midibuf.c b/sys/i386/isa/sound/midibuf.c index 58ff1ee..79e1a16 100644 --- a/sys/i386/isa/sound/midibuf.c +++ b/sys/i386/isa/sound/midibuf.c @@ -418,45 +418,25 @@ MIDIbuf_ioctl (int dev, struct fileinfo *file, #ifdef ALLOW_SELECT int -MIDIbuf_select (int dev, struct fileinfo *file, int sel_type, select_table * wait) +MIDIbuf_poll (int dev, struct fileinfo *file, int events, select_table * wait) { - dev = dev >> 4; + int revents = 0; - switch (sel_type) - { - case SEL_IN: - if (!DATA_AVAIL (midi_in_buf[dev])) - { -#if defined(__FreeBSD__) - selrecord(wait, &selinfo[dev]); -#else - input_sleep_flag[dev].mode = WK_SLEEP; - select_wait (&input_sleeper[dev], wait); -#endif - return 0; - } - return 1; - break; + dev = dev >> 4; - case SEL_OUT: - if (SPACE_AVAIL (midi_out_buf[dev])) - { -#if defined(__FreeBSD__) - selrecord(wait, &selinfo[dev]); -#else - midi_sleep_flag[dev].mode = WK_SLEEP; - select_wait (&midi_sleeper[dev], wait); -#endif - return 0; - } - return 1; - break; + if (events & (POLLIN | POLLRDNORM)) + if (!DATA_AVAIL (midi_in_buf[dev])) + selrecord(wait, &selinfo[dev]); + else + revents |= events & (POLLIN | POLLRDNORM); - case SEL_EX: - return 0; - } + if (events & (POLLOUT | POLLWRNORM)) + if (SPACE_AVAIL (midi_out_buf[dev])) + selrecord(wait, &selinfo[dev]); + else + revents |= events & (POLLOUT | POLLWRNORM); - return 0; + return revents; } #endif /* ALLOW_SELECT */ |