Re: move PRU_RCVD request to (*pru_rcvd)()
On Tue, Aug 23, 2022 at 11:47:30AM +0300, Vitaliy Makkoveev wrote: > On Mon, Aug 22, 2022 at 11:08:07PM -0900, Philip Guenther wrote: > > Since pru_rcvd() is only invoked if the protocol has the PR_WANTRCVD flag > > set, there should be no need to test whether the callback is set: a > > protocol without the callback MUST NOT have PR_WANTRCVD. This may make sense. But we should have a look at all functions to see if they should do the NULL check. The old behavior was to return EOPNOTSUPP. > > (I guess this could, alternatively, go the other direction and eliminate > > PR_WANTRCVD and use the presence of the callback to decide whether the > > protocol needs anything to be done.) > > I don't want this. At least the per buffer locking could require relock > in the PRU_RCVD path, and I don't to do it within handler or pru_rcvd() > wrapper. > > > > > Side note: pru_rcvd() (and the pru_rcvd implementations) should have a > > return type of void. > > Maybe. But we should look at all funtions to make a decision what return type we want. > Since the TCP socket could exist without PCB, and we want to return > error in this case, all callbacks should return int. In other hand, we > always do `so_pcb' NULL check before call pru_rcvd() and we don't > interesting in the pru_rcvd() return value. > > Also PRU_RCVD is not the only request where return value type could > be changed to void, at least PRU_SHUTDOWN handlers have no error path, > except the same case for TCP sockets. > > Anyway, as I said in the one of preceding split diff for unix sockets > case, this time I want only split existing (*pru_usrreq)() handlers, and > leave possible refactoring to the future. The split diffs are mostly > mechanical, but huge enough, and I don't want to make them harder. > > So I want to commit this as is. Get this in as it is. First finish the conversion, then consider guenther@'s comments. After everything has been converted, we will have a better view what is needed. bluhm > > On Mon, Aug 22, 2022 at 1:40 PM Vitaliy Makkoveev wrote: > > > > > Another one. > > > > > > Since we never use `flags' arg within handlers, remove it from the > > > pru_rcvd() args. > > > > > > Index: sys/sys/protosw.h > > > === > > > RCS file: /cvs/src/sys/sys/protosw.h,v > > > retrieving revision 1.43 > > > diff -u -p -r1.43 protosw.h > > > --- sys/sys/protosw.h 22 Aug 2022 21:18:48 - 1.43 > > > +++ sys/sys/protosw.h 22 Aug 2022 22:27:08 - > > > @@ -72,6 +72,7 @@ struct pr_usrreqs { > > > int (*pru_accept)(struct socket *, struct mbuf *); > > > int (*pru_disconnect)(struct socket *); > > > int (*pru_shutdown)(struct socket *); > > > + int (*pru_rcvd)(struct socket *); > > > }; > > > > > > struct protosw { > > > @@ -314,10 +315,11 @@ pru_shutdown(struct socket *so) > > > } > > > > > > static inline int > > > -pru_rcvd(struct socket *so, int flags) > > > +pru_rcvd(struct socket *so) > > > { > > > - return (*so->so_proto->pr_usrreqs->pru_usrreq)(so, > > > - PRU_RCVD, NULL, (struct mbuf *)(long)flags, NULL, curproc); > > > + if (so->so_proto->pr_usrreqs->pru_rcvd) > > > + return (*so->so_proto->pr_usrreqs->pru_rcvd)(so); > > > + return (EOPNOTSUPP); > > > } > > > > > > static inline int > > > Index: sys/kern/uipc_socket.c > > > === > > > RCS file: /cvs/src/sys/kern/uipc_socket.c,v > > > retrieving revision 1.284 > > > diff -u -p -r1.284 uipc_socket.c > > > --- sys/kern/uipc_socket.c 21 Aug 2022 16:22:17 - 1.284 > > > +++ sys/kern/uipc_socket.c 22 Aug 2022 22:27:08 - > > > @@ -1156,7 +1156,7 @@ dontblock: > > > SBLASTRECORDCHK(&so->so_rcv, "soreceive 4"); > > > SBLASTMBUFCHK(&so->so_rcv, "soreceive 4"); > > > if (pr->pr_flags & PR_WANTRCVD && so->so_pcb) > > > - pru_rcvd(so, flags); > > > + pru_rcvd(so); > > > } > > > if (orig_resid == uio->uio_resid && orig_resid && > > > (flags & MSG_EOR) == 0 && (so->so_state & SS_CANTRCVMORE) == > > > 0) { > > > @@ -1521,7 +1521,7 @@ somove(struct socket *so, int wait) > > > if (m == NULL) { > > > sbdroprecord(so, &so->so_rcv); > > > if (so->so_proto->pr_flags & PR_WANTRCVD && so->so_pcb) > > > - pru_rcvd(so, 0); > > > + pru_rcvd(so); > > > goto nextpkt; > > > } > > > > > > @@ -1627,7 +1627,7 @@ somove(struct socket *so, int wait) > > > > > > /* Send window update to source peer as receive buffer has > > > changed. */ > > > if (so->so_proto->pr_flags & PR_WANTRCVD && so->so_pcb) > > > - pru_rcvd(so, 0); > > > + pru_rcvd(so); > > > > > > /* Receive buffer did shrink by
Re: move PRU_RCVD request to (*pru_rcvd)()
On Mon, Aug 22, 2022 at 11:08:07PM -0900, Philip Guenther wrote: > Since pru_rcvd() is only invoked if the protocol has the PR_WANTRCVD flag > set, there should be no need to test whether the callback is set: a > protocol without the callback MUST NOT have PR_WANTRCVD. > > (I guess this could, alternatively, go the other direction and eliminate > PR_WANTRCVD and use the presence of the callback to decide whether the > protocol needs anything to be done.) I don't want this. At least the per buffer locking could require relock in the PRU_RCVD path, and I don't to do it within handler or pru_rcvd() wrapper. > > Side note: pru_rcvd() (and the pru_rcvd implementations) should have a > return type of void. > Since the TCP socket could exist without PCB, and we want to return error in this case, all callbacks should return int. In other hand, we always do `so_pcb' NULL check before call pru_rcvd() and we don't interesting in the pru_rcvd() return value. Also PRU_RCVD is not the only request where return value type could be changed to void, at least PRU_SHUTDOWN handlers have no error path, except the same case for TCP sockets. Anyway, as I said in the one of preceding split diff for unix sockets case, this time I want only split existing (*pru_usrreq)() handlers, and leave possible refactoring to the future. The split diffs are mostly mechanical, but huge enough, and I don't want to make them harder. So I want to commit this as is. > > Philip Guenther > > > > On Mon, Aug 22, 2022 at 1:40 PM Vitaliy Makkoveev wrote: > > > Another one. > > > > Since we never use `flags' arg within handlers, remove it from the > > pru_rcvd() args. > > > > Index: sys/sys/protosw.h > > === > > RCS file: /cvs/src/sys/sys/protosw.h,v > > retrieving revision 1.43 > > diff -u -p -r1.43 protosw.h > > --- sys/sys/protosw.h 22 Aug 2022 21:18:48 - 1.43 > > +++ sys/sys/protosw.h 22 Aug 2022 22:27:08 - > > @@ -72,6 +72,7 @@ struct pr_usrreqs { > > int (*pru_accept)(struct socket *, struct mbuf *); > > int (*pru_disconnect)(struct socket *); > > int (*pru_shutdown)(struct socket *); > > + int (*pru_rcvd)(struct socket *); > > }; > > > > struct protosw { > > @@ -314,10 +315,11 @@ pru_shutdown(struct socket *so) > > } > > > > static inline int > > -pru_rcvd(struct socket *so, int flags) > > +pru_rcvd(struct socket *so) > > { > > - return (*so->so_proto->pr_usrreqs->pru_usrreq)(so, > > - PRU_RCVD, NULL, (struct mbuf *)(long)flags, NULL, curproc); > > + if (so->so_proto->pr_usrreqs->pru_rcvd) > > + return (*so->so_proto->pr_usrreqs->pru_rcvd)(so); > > + return (EOPNOTSUPP); > > } > > > > static inline int > > Index: sys/kern/uipc_socket.c > > === > > RCS file: /cvs/src/sys/kern/uipc_socket.c,v > > retrieving revision 1.284 > > diff -u -p -r1.284 uipc_socket.c > > --- sys/kern/uipc_socket.c 21 Aug 2022 16:22:17 - 1.284 > > +++ sys/kern/uipc_socket.c 22 Aug 2022 22:27:08 - > > @@ -1156,7 +1156,7 @@ dontblock: > > SBLASTRECORDCHK(&so->so_rcv, "soreceive 4"); > > SBLASTMBUFCHK(&so->so_rcv, "soreceive 4"); > > if (pr->pr_flags & PR_WANTRCVD && so->so_pcb) > > - pru_rcvd(so, flags); > > + pru_rcvd(so); > > } > > if (orig_resid == uio->uio_resid && orig_resid && > > (flags & MSG_EOR) == 0 && (so->so_state & SS_CANTRCVMORE) == > > 0) { > > @@ -1521,7 +1521,7 @@ somove(struct socket *so, int wait) > > if (m == NULL) { > > sbdroprecord(so, &so->so_rcv); > > if (so->so_proto->pr_flags & PR_WANTRCVD && so->so_pcb) > > - pru_rcvd(so, 0); > > + pru_rcvd(so); > > goto nextpkt; > > } > > > > @@ -1627,7 +1627,7 @@ somove(struct socket *so, int wait) > > > > /* Send window update to source peer as receive buffer has > > changed. */ > > if (so->so_proto->pr_flags & PR_WANTRCVD && so->so_pcb) > > - pru_rcvd(so, 0); > > + pru_rcvd(so); > > > > /* Receive buffer did shrink by len bytes, adjust oob. */ > > state = so->so_state; > > Index: sys/kern/uipc_usrreq.c > > === > > RCS file: /cvs/src/sys/kern/uipc_usrreq.c,v > > retrieving revision 1.174 > > diff -u -p -r1.174 uipc_usrreq.c > > --- sys/kern/uipc_usrreq.c 22 Aug 2022 21:18:48 - 1.174 > > +++ sys/kern/uipc_usrreq.c 22 Aug 2022 22:27:08 - > > @@ -136,6 +136,7 @@ const struct pr_usrreqs uipc_usrreqs = { > > .pru_accept = uipc_accept, > > .pru_disconnect = uipc_disconnect, > > .pru_shutdown = uipc_shutdown, > > + .pru_rcvd = uipc_rcvd,
Re: move PRU_RCVD request to (*pru_rcvd)()
Since pru_rcvd() is only invoked if the protocol has the PR_WANTRCVD flag set, there should be no need to test whether the callback is set: a protocol without the callback MUST NOT have PR_WANTRCVD. (I guess this could, alternatively, go the other direction and eliminate PR_WANTRCVD and use the presence of the callback to decide whether the protocol needs anything to be done.) Side note: pru_rcvd() (and the pru_rcvd implementations) should have a return type of void. Philip Guenther On Mon, Aug 22, 2022 at 1:40 PM Vitaliy Makkoveev wrote: > Another one. > > Since we never use `flags' arg within handlers, remove it from the > pru_rcvd() args. > > Index: sys/sys/protosw.h > === > RCS file: /cvs/src/sys/sys/protosw.h,v > retrieving revision 1.43 > diff -u -p -r1.43 protosw.h > --- sys/sys/protosw.h 22 Aug 2022 21:18:48 - 1.43 > +++ sys/sys/protosw.h 22 Aug 2022 22:27:08 - > @@ -72,6 +72,7 @@ struct pr_usrreqs { > int (*pru_accept)(struct socket *, struct mbuf *); > int (*pru_disconnect)(struct socket *); > int (*pru_shutdown)(struct socket *); > + int (*pru_rcvd)(struct socket *); > }; > > struct protosw { > @@ -314,10 +315,11 @@ pru_shutdown(struct socket *so) > } > > static inline int > -pru_rcvd(struct socket *so, int flags) > +pru_rcvd(struct socket *so) > { > - return (*so->so_proto->pr_usrreqs->pru_usrreq)(so, > - PRU_RCVD, NULL, (struct mbuf *)(long)flags, NULL, curproc); > + if (so->so_proto->pr_usrreqs->pru_rcvd) > + return (*so->so_proto->pr_usrreqs->pru_rcvd)(so); > + return (EOPNOTSUPP); > } > > static inline int > Index: sys/kern/uipc_socket.c > === > RCS file: /cvs/src/sys/kern/uipc_socket.c,v > retrieving revision 1.284 > diff -u -p -r1.284 uipc_socket.c > --- sys/kern/uipc_socket.c 21 Aug 2022 16:22:17 - 1.284 > +++ sys/kern/uipc_socket.c 22 Aug 2022 22:27:08 - > @@ -1156,7 +1156,7 @@ dontblock: > SBLASTRECORDCHK(&so->so_rcv, "soreceive 4"); > SBLASTMBUFCHK(&so->so_rcv, "soreceive 4"); > if (pr->pr_flags & PR_WANTRCVD && so->so_pcb) > - pru_rcvd(so, flags); > + pru_rcvd(so); > } > if (orig_resid == uio->uio_resid && orig_resid && > (flags & MSG_EOR) == 0 && (so->so_state & SS_CANTRCVMORE) == > 0) { > @@ -1521,7 +1521,7 @@ somove(struct socket *so, int wait) > if (m == NULL) { > sbdroprecord(so, &so->so_rcv); > if (so->so_proto->pr_flags & PR_WANTRCVD && so->so_pcb) > - pru_rcvd(so, 0); > + pru_rcvd(so); > goto nextpkt; > } > > @@ -1627,7 +1627,7 @@ somove(struct socket *so, int wait) > > /* Send window update to source peer as receive buffer has > changed. */ > if (so->so_proto->pr_flags & PR_WANTRCVD && so->so_pcb) > - pru_rcvd(so, 0); > + pru_rcvd(so); > > /* Receive buffer did shrink by len bytes, adjust oob. */ > state = so->so_state; > Index: sys/kern/uipc_usrreq.c > === > RCS file: /cvs/src/sys/kern/uipc_usrreq.c,v > retrieving revision 1.174 > diff -u -p -r1.174 uipc_usrreq.c > --- sys/kern/uipc_usrreq.c 22 Aug 2022 21:18:48 - 1.174 > +++ sys/kern/uipc_usrreq.c 22 Aug 2022 22:27:08 - > @@ -136,6 +136,7 @@ const struct pr_usrreqs uipc_usrreqs = { > .pru_accept = uipc_accept, > .pru_disconnect = uipc_disconnect, > .pru_shutdown = uipc_shutdown, > + .pru_rcvd = uipc_rcvd, > }; > > void > @@ -243,32 +244,6 @@ uipc_usrreq(struct socket *so, int req, > } > break; > > - case PRU_RCVD: > - switch (so->so_type) { > - > - case SOCK_DGRAM: > - panic("uipc 1"); > - /*NOTREACHED*/ > - > - case SOCK_STREAM: > - case SOCK_SEQPACKET: > - if ((so2 = unp_solock_peer(so)) == NULL) > - break; > - /* > -* Adjust backpressure on sender > -* and wakeup any waiting to write. > -*/ > - so2->so_snd.sb_mbcnt = so->so_rcv.sb_mbcnt; > - so2->so_snd.sb_cc = so->so_rcv.sb_cc; > - sowwakeup(so2); > - sounlock(so2); > - break; > - > - default: > - panic("uipc 2"); > - } > - break; > - > case PRU_SEND: > if (control) { > sounlock(so); > @@ -567,6
Re: move PRU_RCVD request to (*pru_rcvd)()
On Tue, Aug 23, 2022 at 01:39:12AM +0300, Vitaliy Makkoveev wrote: > Another one. > > Since we never use `flags' arg within handlers, remove it from the > pru_rcvd() args. OK bluhm@ > Index: sys/sys/protosw.h > === > RCS file: /cvs/src/sys/sys/protosw.h,v > retrieving revision 1.43 > diff -u -p -r1.43 protosw.h > --- sys/sys/protosw.h 22 Aug 2022 21:18:48 - 1.43 > +++ sys/sys/protosw.h 22 Aug 2022 22:27:08 - > @@ -72,6 +72,7 @@ struct pr_usrreqs { > int (*pru_accept)(struct socket *, struct mbuf *); > int (*pru_disconnect)(struct socket *); > int (*pru_shutdown)(struct socket *); > + int (*pru_rcvd)(struct socket *); > }; > > struct protosw { > @@ -314,10 +315,11 @@ pru_shutdown(struct socket *so) > } > > static inline int > -pru_rcvd(struct socket *so, int flags) > +pru_rcvd(struct socket *so) > { > - return (*so->so_proto->pr_usrreqs->pru_usrreq)(so, > - PRU_RCVD, NULL, (struct mbuf *)(long)flags, NULL, curproc); > + if (so->so_proto->pr_usrreqs->pru_rcvd) > + return (*so->so_proto->pr_usrreqs->pru_rcvd)(so); > + return (EOPNOTSUPP); > } > > static inline int > Index: sys/kern/uipc_socket.c > === > RCS file: /cvs/src/sys/kern/uipc_socket.c,v > retrieving revision 1.284 > diff -u -p -r1.284 uipc_socket.c > --- sys/kern/uipc_socket.c21 Aug 2022 16:22:17 - 1.284 > +++ sys/kern/uipc_socket.c22 Aug 2022 22:27:08 - > @@ -1156,7 +1156,7 @@ dontblock: > SBLASTRECORDCHK(&so->so_rcv, "soreceive 4"); > SBLASTMBUFCHK(&so->so_rcv, "soreceive 4"); > if (pr->pr_flags & PR_WANTRCVD && so->so_pcb) > - pru_rcvd(so, flags); > + pru_rcvd(so); > } > if (orig_resid == uio->uio_resid && orig_resid && > (flags & MSG_EOR) == 0 && (so->so_state & SS_CANTRCVMORE) == 0) { > @@ -1521,7 +1521,7 @@ somove(struct socket *so, int wait) > if (m == NULL) { > sbdroprecord(so, &so->so_rcv); > if (so->so_proto->pr_flags & PR_WANTRCVD && so->so_pcb) > - pru_rcvd(so, 0); > + pru_rcvd(so); > goto nextpkt; > } > > @@ -1627,7 +1627,7 @@ somove(struct socket *so, int wait) > > /* Send window update to source peer as receive buffer has changed. */ > if (so->so_proto->pr_flags & PR_WANTRCVD && so->so_pcb) > - pru_rcvd(so, 0); > + pru_rcvd(so); > > /* Receive buffer did shrink by len bytes, adjust oob. */ > state = so->so_state; > Index: sys/kern/uipc_usrreq.c > === > RCS file: /cvs/src/sys/kern/uipc_usrreq.c,v > retrieving revision 1.174 > diff -u -p -r1.174 uipc_usrreq.c > --- sys/kern/uipc_usrreq.c22 Aug 2022 21:18:48 - 1.174 > +++ sys/kern/uipc_usrreq.c22 Aug 2022 22:27:08 - > @@ -136,6 +136,7 @@ const struct pr_usrreqs uipc_usrreqs = { > .pru_accept = uipc_accept, > .pru_disconnect = uipc_disconnect, > .pru_shutdown = uipc_shutdown, > + .pru_rcvd = uipc_rcvd, > }; > > void > @@ -243,32 +244,6 @@ uipc_usrreq(struct socket *so, int req, > } > break; > > - case PRU_RCVD: > - switch (so->so_type) { > - > - case SOCK_DGRAM: > - panic("uipc 1"); > - /*NOTREACHED*/ > - > - case SOCK_STREAM: > - case SOCK_SEQPACKET: > - if ((so2 = unp_solock_peer(so)) == NULL) > - break; > - /* > - * Adjust backpressure on sender > - * and wakeup any waiting to write. > - */ > - so2->so_snd.sb_mbcnt = so->so_rcv.sb_mbcnt; > - so2->so_snd.sb_cc = so->so_rcv.sb_cc; > - sowwakeup(so2); > - sounlock(so2); > - break; > - > - default: > - panic("uipc 2"); > - } > - break; > - > case PRU_SEND: > if (control) { > sounlock(so); > @@ -567,6 +542,37 @@ uipc_shutdown(struct socket *so) > > socantsendmore(so); > unp_shutdown(unp); > + return (0); > +} > + > +int > +uipc_rcvd(struct socket *so) > +{ > + struct socket *so2; > + > + switch (so->so_type) { > + case SOCK_DGRAM: > + panic("uipc 1"); > + /*NOTREACHED*/ > + > + case SOCK_STREAM: > + case SOCK_SEQPACKET: > + if ((so2 = unp_solock_peer(so)) == NULL) > + break; > + /* > + * Adjust backpressure on sender > + * and wakeup any waiting to write. >
move PRU_RCVD request to (*pru_rcvd)()
Another one. Since we never use `flags' arg within handlers, remove it from the pru_rcvd() args. Index: sys/sys/protosw.h === RCS file: /cvs/src/sys/sys/protosw.h,v retrieving revision 1.43 diff -u -p -r1.43 protosw.h --- sys/sys/protosw.h 22 Aug 2022 21:18:48 - 1.43 +++ sys/sys/protosw.h 22 Aug 2022 22:27:08 - @@ -72,6 +72,7 @@ struct pr_usrreqs { int (*pru_accept)(struct socket *, struct mbuf *); int (*pru_disconnect)(struct socket *); int (*pru_shutdown)(struct socket *); + int (*pru_rcvd)(struct socket *); }; struct protosw { @@ -314,10 +315,11 @@ pru_shutdown(struct socket *so) } static inline int -pru_rcvd(struct socket *so, int flags) +pru_rcvd(struct socket *so) { - return (*so->so_proto->pr_usrreqs->pru_usrreq)(so, - PRU_RCVD, NULL, (struct mbuf *)(long)flags, NULL, curproc); + if (so->so_proto->pr_usrreqs->pru_rcvd) + return (*so->so_proto->pr_usrreqs->pru_rcvd)(so); + return (EOPNOTSUPP); } static inline int Index: sys/kern/uipc_socket.c === RCS file: /cvs/src/sys/kern/uipc_socket.c,v retrieving revision 1.284 diff -u -p -r1.284 uipc_socket.c --- sys/kern/uipc_socket.c 21 Aug 2022 16:22:17 - 1.284 +++ sys/kern/uipc_socket.c 22 Aug 2022 22:27:08 - @@ -1156,7 +1156,7 @@ dontblock: SBLASTRECORDCHK(&so->so_rcv, "soreceive 4"); SBLASTMBUFCHK(&so->so_rcv, "soreceive 4"); if (pr->pr_flags & PR_WANTRCVD && so->so_pcb) - pru_rcvd(so, flags); + pru_rcvd(so); } if (orig_resid == uio->uio_resid && orig_resid && (flags & MSG_EOR) == 0 && (so->so_state & SS_CANTRCVMORE) == 0) { @@ -1521,7 +1521,7 @@ somove(struct socket *so, int wait) if (m == NULL) { sbdroprecord(so, &so->so_rcv); if (so->so_proto->pr_flags & PR_WANTRCVD && so->so_pcb) - pru_rcvd(so, 0); + pru_rcvd(so); goto nextpkt; } @@ -1627,7 +1627,7 @@ somove(struct socket *so, int wait) /* Send window update to source peer as receive buffer has changed. */ if (so->so_proto->pr_flags & PR_WANTRCVD && so->so_pcb) - pru_rcvd(so, 0); + pru_rcvd(so); /* Receive buffer did shrink by len bytes, adjust oob. */ state = so->so_state; Index: sys/kern/uipc_usrreq.c === RCS file: /cvs/src/sys/kern/uipc_usrreq.c,v retrieving revision 1.174 diff -u -p -r1.174 uipc_usrreq.c --- sys/kern/uipc_usrreq.c 22 Aug 2022 21:18:48 - 1.174 +++ sys/kern/uipc_usrreq.c 22 Aug 2022 22:27:08 - @@ -136,6 +136,7 @@ const struct pr_usrreqs uipc_usrreqs = { .pru_accept = uipc_accept, .pru_disconnect = uipc_disconnect, .pru_shutdown = uipc_shutdown, + .pru_rcvd = uipc_rcvd, }; void @@ -243,32 +244,6 @@ uipc_usrreq(struct socket *so, int req, } break; - case PRU_RCVD: - switch (so->so_type) { - - case SOCK_DGRAM: - panic("uipc 1"); - /*NOTREACHED*/ - - case SOCK_STREAM: - case SOCK_SEQPACKET: - if ((so2 = unp_solock_peer(so)) == NULL) - break; - /* -* Adjust backpressure on sender -* and wakeup any waiting to write. -*/ - so2->so_snd.sb_mbcnt = so->so_rcv.sb_mbcnt; - so2->so_snd.sb_cc = so->so_rcv.sb_cc; - sowwakeup(so2); - sounlock(so2); - break; - - default: - panic("uipc 2"); - } - break; - case PRU_SEND: if (control) { sounlock(so); @@ -567,6 +542,37 @@ uipc_shutdown(struct socket *so) socantsendmore(so); unp_shutdown(unp); + return (0); +} + +int +uipc_rcvd(struct socket *so) +{ + struct socket *so2; + + switch (so->so_type) { + case SOCK_DGRAM: + panic("uipc 1"); + /*NOTREACHED*/ + + case SOCK_STREAM: + case SOCK_SEQPACKET: + if ((so2 = unp_solock_peer(so)) == NULL) + break; + /* +* Adjust backpressure on sender +* and wakeup any waiting to write. +*/ + so2->so_snd.sb_mbcnt = so->so_rcv.sb_mbcnt; + so2->so_snd.sb_cc = so->so_rcv.sb_cc; + sowwakeup(so2); + sounlock(so2)