| version 1.21, 1996/02/04 02:17:52 |
version 1.22, 1996/05/22 13:54:58 |
| Line 80 socreate(dom, aso, type, proto) |
|
| Line 80 socreate(dom, aso, type, proto) |
|
| MALLOC(so, struct socket *, sizeof(*so), M_SOCKET, M_WAIT); |
MALLOC(so, struct socket *, sizeof(*so), M_SOCKET, M_WAIT); |
| bzero((caddr_t)so, sizeof(*so)); |
bzero((caddr_t)so, sizeof(*so)); |
| so->so_type = type; |
so->so_type = type; |
| if (p->p_ucred->cr_uid == 0) |
|
| so->so_state = SS_PRIV; |
|
| so->so_proto = prp; |
so->so_proto = prp; |
| error = |
error = (*prp->pr_usrreq)(so, PRU_ATTACH, (struct mbuf *)0, |
| (*prp->pr_usrreq)(so, PRU_ATTACH, NULL, (struct mbuf *)(long)proto, |
(struct mbuf *)(long)proto, (struct mbuf *)0, p); |
| NULL); |
|
| if (error) { |
if (error) { |
| so->so_state |= SS_NOFDREF; |
so->so_state |= SS_NOFDREF; |
| sofree(so); |
sofree(so); |
|
|
| struct socket *so; |
struct socket *so; |
| struct mbuf *nam; |
struct mbuf *nam; |
| { |
{ |
| |
struct proc *p = curproc; /* XXX */ |
| int s = splsoftnet(); |
int s = splsoftnet(); |
| int error; |
int error; |
| |
|
| error = (*so->so_proto->pr_usrreq)(so, PRU_BIND, NULL, nam, NULL); |
error = (*so->so_proto->pr_usrreq)(so, PRU_BIND, (struct mbuf *)0, |
| |
nam, (struct mbuf *)0, p); |
| splx(s); |
splx(s); |
| return (error); |
return (error); |
| } |
} |
| Line 122 solisten(so, backlog) |
|
| Line 121 solisten(so, backlog) |
|
| { |
{ |
| int s = splsoftnet(), error; |
int s = splsoftnet(), error; |
| |
|
| error = (*so->so_proto->pr_usrreq)(so, PRU_LISTEN, NULL, NULL, NULL); |
error = (*so->so_proto->pr_usrreq)(so, PRU_LISTEN, (struct mbuf *)0, |
| |
(struct mbuf *)0, (struct mbuf *)0, (struct proc *)0); |
| if (error) { |
if (error) { |
| splx(s); |
splx(s); |
| return (error); |
return (error); |
|
|
| } |
} |
| drop: |
drop: |
| if (so->so_pcb) { |
if (so->so_pcb) { |
| int error2 = (*so->so_proto->pr_usrreq)(so, PRU_DETACH, NULL, |
int error2 = (*so->so_proto->pr_usrreq)(so, PRU_DETACH, |
| NULL, NULL); |
(struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0, |
| |
(struct proc *)0); |
| if (error == 0) |
if (error == 0) |
| error = error2; |
error = error2; |
| } |
} |
|
|
| struct socket *so; |
struct socket *so; |
| { |
{ |
| |
|
| return (*so->so_proto->pr_usrreq)(so, PRU_ABORT, NULL, NULL, NULL); |
return (*so->so_proto->pr_usrreq)(so, PRU_ABORT, (struct mbuf *)0, |
| |
(struct mbuf *)0, (struct mbuf *)0, (struct proc *)0); |
| } |
} |
| |
|
| int |
int |
| Line 230 soaccept(so, nam) |
|
| Line 232 soaccept(so, nam) |
|
| if ((so->so_state & SS_NOFDREF) == 0) |
if ((so->so_state & SS_NOFDREF) == 0) |
| panic("soaccept: !NOFDREF"); |
panic("soaccept: !NOFDREF"); |
| so->so_state &= ~SS_NOFDREF; |
so->so_state &= ~SS_NOFDREF; |
| error = (*so->so_proto->pr_usrreq)(so, PRU_ACCEPT, NULL, nam, NULL); |
error = (*so->so_proto->pr_usrreq)(so, PRU_ACCEPT, (struct mbuf *)0, |
| |
nam, (struct mbuf *)0, (struct proc *)0); |
| splx(s); |
splx(s); |
| return (error); |
return (error); |
| } |
} |
| Line 258 soconnect(so, nam) |
|
| Line 261 soconnect(so, nam) |
|
| error = EISCONN; |
error = EISCONN; |
| else |
else |
| error = (*so->so_proto->pr_usrreq)(so, PRU_CONNECT, |
error = (*so->so_proto->pr_usrreq)(so, PRU_CONNECT, |
| NULL, nam, NULL); |
(struct mbuf *)0, nam, (struct mbuf *)0, |
| |
(struct proc *)0); |
| splx(s); |
splx(s); |
| return (error); |
return (error); |
| } |
} |
| Line 271 soconnect2(so1, so2) |
|
| Line 275 soconnect2(so1, so2) |
|
| int s = splsoftnet(); |
int s = splsoftnet(); |
| int error; |
int error; |
| |
|
| error = (*so1->so_proto->pr_usrreq)(so1, PRU_CONNECT2, NULL, |
error = (*so1->so_proto->pr_usrreq)(so1, PRU_CONNECT2, |
| (struct mbuf *)so2, NULL); |
(struct mbuf *)0, (struct mbuf *)so2, (struct mbuf *)0, |
| |
(struct proc *)0); |
| splx(s); |
splx(s); |
| return (error); |
return (error); |
| } |
} |
| Line 292 sodisconnect(so) |
|
| Line 297 sodisconnect(so) |
|
| error = EALREADY; |
error = EALREADY; |
| goto bad; |
goto bad; |
| } |
} |
| error = (*so->so_proto->pr_usrreq)(so, PRU_DISCONNECT, NULL, NULL, |
error = (*so->so_proto->pr_usrreq)(so, PRU_DISCONNECT, |
| NULL); |
(struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0, |
| |
(struct proc *)0); |
| bad: |
bad: |
| splx(s); |
splx(s); |
| return (error); |
return (error); |
|
|
| if (dontroute) |
if (dontroute) |
| so->so_options |= SO_DONTROUTE; |
so->so_options |= SO_DONTROUTE; |
| s = splsoftnet(); /* XXX */ |
s = splsoftnet(); /* XXX */ |
| error = (*so->so_proto->pr_usrreq)(so, (flags & MSG_OOB) ? |
error = (*so->so_proto->pr_usrreq)(so, |
| PRU_SENDOOB : PRU_SEND, |
(flags & MSG_OOB) ? PRU_SENDOOB : PRU_SEND, |
| top, addr, control); |
top, addr, control, (struct proc *)0); |
| splx(s); |
splx(s); |
| if (dontroute) |
if (dontroute) |
| so->so_options &= ~SO_DONTROUTE; |
so->so_options &= ~SO_DONTROUTE; |
| Line 521 soreceive(so, paddr, uio, mp0, controlp, |
|
| Line 527 soreceive(so, paddr, uio, mp0, controlp, |
|
| if (flags & MSG_OOB) { |
if (flags & MSG_OOB) { |
| m = m_get(M_WAIT, MT_DATA); |
m = m_get(M_WAIT, MT_DATA); |
| error = (*pr->pr_usrreq)(so, PRU_RCVOOB, m, |
error = (*pr->pr_usrreq)(so, PRU_RCVOOB, m, |
| (struct mbuf *)(long)(flags & MSG_PEEK), |
(struct mbuf *)(long)(flags & MSG_PEEK), (struct mbuf *)0, |
| NULL); |
(struct proc *)0); |
| if (error) |
if (error) |
| goto bad; |
goto bad; |
| do { |
do { |
|
|
| if (mp) |
if (mp) |
| *mp = (struct mbuf *)0; |
*mp = (struct mbuf *)0; |
| if (so->so_state & SS_ISCONFIRMING && uio->uio_resid) |
if (so->so_state & SS_ISCONFIRMING && uio->uio_resid) |
| (*pr->pr_usrreq)(so, PRU_RCVD, NULL, NULL, NULL); |
(*pr->pr_usrreq)(so, PRU_RCVD, (struct mbuf *)0, |
| |
(struct mbuf *)0, (struct mbuf *)0, (struct proc *)0); |
| |
|
| restart: |
restart: |
| if ((error = sblock(&so->so_rcv, SBLOCKWAIT(flags))) != 0) |
if ((error = sblock(&so->so_rcv, SBLOCKWAIT(flags))) != 0) |
|
|
| if (m == 0) |
if (m == 0) |
| so->so_rcv.sb_mb = nextrecord; |
so->so_rcv.sb_mb = nextrecord; |
| if (pr->pr_flags & PR_WANTRCVD && so->so_pcb) |
if (pr->pr_flags & PR_WANTRCVD && so->so_pcb) |
| (*pr->pr_usrreq)(so, PRU_RCVD, NULL, |
(*pr->pr_usrreq)(so, PRU_RCVD, (struct mbuf *)0, |
| (struct mbuf *)(long)flags, NULL); |
(struct mbuf *)(long)flags, (struct mbuf *)0, |
| |
(struct proc *)0); |
| } |
} |
| if (orig_resid == uio->uio_resid && orig_resid && |
if (orig_resid == uio->uio_resid && orig_resid && |
| (flags & MSG_EOR) == 0 && (so->so_state & SS_CANTRCVMORE) == 0) { |
(flags & MSG_EOR) == 0 && (so->so_state & SS_CANTRCVMORE) == 0) { |
| Line 804 soshutdown(so, how) |
|
| Line 812 soshutdown(so, how) |
|
| if (how & FREAD) |
if (how & FREAD) |
| sorflush(so); |
sorflush(so); |
| if (how & FWRITE) |
if (how & FWRITE) |
| return (*pr->pr_usrreq)(so, PRU_SHUTDOWN, NULL, NULL, NULL); |
return (*pr->pr_usrreq)(so, PRU_SHUTDOWN, (struct mbuf *)0, |
| |
(struct mbuf *)0, (struct mbuf *)0, (struct proc *)0); |
| return (0); |
return (0); |
| } |
} |
| |
|