Use SB_ASYNC in struct sockbuf sb_flags field instead of SS_ASYNC in
struct socket so_state field to decide if we need to send asynchronous notifications. This makes possible to request notification on write but not on read, and vice versa. This is used in Linux emulation code, because when async I/O is requested, Linux does not send SIGIO to write end of sockets, and it never send any SIGIO to any end of pipes. Il Linux emulation code, we then set SB_ASYNC only on the read end of sockets, and on no end for pipes.
This commit is contained in:
parent
d5c13f3228
commit
94a4020177
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sys_socket.c,v 1.30 2001/05/19 17:28:33 manu Exp $ */
|
||||
/* $NetBSD: sys_socket.c,v 1.31 2001/06/16 21:29:32 manu Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1990, 1993
|
||||
@ -100,12 +100,7 @@ soo_ioctl(fp, cmd, data, p)
|
||||
return (0);
|
||||
|
||||
case FIOASYNC:
|
||||
if (
|
||||
#ifndef __HAVE_MINIMAL_EMUL
|
||||
(!(so->so_state & SS_ISAPIPE) ||
|
||||
(!(p->p_emul->e_flags & EMUL_NO_BSD_ASYNCIO_PIPE))) &&
|
||||
#endif
|
||||
*(int *)data) {
|
||||
if (*(int *)data) {
|
||||
so->so_state |= SS_ASYNC;
|
||||
so->so_rcv.sb_flags |= SB_ASYNC;
|
||||
so->so_snd.sb_flags |= SB_ASYNC;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: uipc_socket2.c,v 1.38 2001/04/30 03:32:56 kml Exp $ */
|
||||
/* $NetBSD: uipc_socket2.c,v 1.39 2001/06/16 21:29:32 manu Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1988, 1990, 1993
|
||||
@ -290,7 +290,7 @@ sb_lock(struct sockbuf *sb)
|
||||
/*
|
||||
* Wakeup processes waiting on a socket buffer.
|
||||
* Do asynchronous notification via SIGIO
|
||||
* if the socket has the SS_ASYNC flag set.
|
||||
* if the socket buffer has the SB_ASYNC flag set.
|
||||
*/
|
||||
void
|
||||
sowakeup(struct socket *so, struct sockbuf *sb)
|
||||
@ -303,7 +303,7 @@ sowakeup(struct socket *so, struct sockbuf *sb)
|
||||
sb->sb_flags &= ~SB_WAIT;
|
||||
wakeup((caddr_t)&sb->sb_cc);
|
||||
}
|
||||
if (so->so_state & SS_ASYNC) {
|
||||
if (sb->sb_flags & SB_ASYNC) {
|
||||
if (so->so_pgid < 0)
|
||||
gsignal(-so->so_pgid, SIGIO);
|
||||
else if (so->so_pgid > 0 && (p = pfind(so->so_pgid)) != 0)
|
||||
|
Loading…
Reference in New Issue
Block a user