-
-/*
- * User requests on pipes and other internally implemented
- * structures.
- */
-/*ARGSUSED*/
-piusrreq(so, req, m, addr)
- struct socket *so;
- int req;
- struct mbuf *m;
- caddr_t addr;
-{
- struct socket *so2 = (struct socket *)so->so_pcb;
-
-COUNT(PIUSRREQ);
- switch (req) {
-
- case PRU_ATTACH:
- case PRU_DETACH:
- break;
-
- case PRU_CONNECT:
- case PRU_ACCEPT:
- return (EOPNOTSUPP);
-
- case PRU_DISCONNECT:
- if (so2 == 0)
- return (ENOTCONN);
- so->so_pcb = 0;
- soisdisconnected(so);
- break;
-
- case PRU_SHUTDOWN:
- socantsendmore(so);
- if (so2)
- socantrcvmore(so2);
- break;
-
- case PRU_RCVD:
- if (so->so_rcv.sb_cc == 0 && so2 && so2->so_snd.sb_cc) {
- so->so_rcv.sb_cc = so2->so_snd.sb_cc;
- so->so_rcv.sb_mbcnt = so2->so_snd.sb_mbcnt;
- so->so_rcv.sb_mb = so2->so_rcv.sb_mb;
- so2->so_snd.sb_cc = 0;
- so2->so_snd.sb_mbcnt = 0;
- so2->so_snd.sb_mb = 0;
- sorwakeup(so);
- sowwakeup(so2);
- }
- break;
-
- case PRU_SEND:
- sbappend(&so->so_snd, m);
- sorwakeup(so2);
- break;
-
- case PRU_ABORT:
- return (EOPNOTSUPP);
-
- case PRU_CONTROL:
- return (EOPNOTSUPP);
-
- default:
- panic("piusrreq");
- }
- return (0);
-}