Hi,

System calls should not fail due to temporary memory shortage in
malloc(9) or pool_get(9).

Pass down a wait flag to pru_attach().  During syscall socket(2)
it is ok to wait, this logic was missing for internet pcb.  Pfkey
and route sockets were already waiting.

sonewconn() cannot wait when called during TCP 3-way handshake.
This logic has been preserved.  Unix domain stream socket connect(2)
can wait until the other side has created the socket to accept.

ok?

bluhm


Index: kern/uipc_socket.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/kern/uipc_socket.c,v
retrieving revision 1.283
diff -u -p -r1.283 uipc_socket.c
--- kern/uipc_socket.c  15 Aug 2022 09:11:38 -0000      1.283
+++ kern/uipc_socket.c  15 Aug 2022 14:57:47 -0000
@@ -138,11 +138,12 @@ soinit(void)
 }
 
 struct socket *
-soalloc(int prflags)
+soalloc(int wait)
 {
        struct socket *so;
 
-       so = pool_get(&socket_pool, prflags);
+       so = pool_get(&socket_pool, (wait == M_WAIT ? PR_WAITOK : PR_NOWAIT) |
+           PR_ZERO);
        if (so == NULL)
                return (NULL);
        rw_init_flags(&so->so_lock, "solock", RWL_DUPOK);
@@ -174,7 +175,7 @@ socreate(int dom, struct socket **aso, i
                return (EPROTONOSUPPORT);
        if (prp->pr_type != type)
                return (EPROTOTYPE);
-       so = soalloc(PR_WAITOK | PR_ZERO);
+       so = soalloc(M_WAIT);
        klist_init(&so->so_rcv.sb_sel.si_note, &socket_klistops, so);
        klist_init(&so->so_snd.sb_sel.si_note, &socket_klistops, so);
        sigio_init(&so->so_sigio);
@@ -193,7 +194,7 @@ socreate(int dom, struct socket **aso, i
        so->so_rcv.sb_timeo_nsecs = INFSLP;
 
        solock(so);
-       error = pru_attach(so, proto);
+       error = pru_attach(so, proto, M_WAIT);
        if (error) {
                so->so_state |= SS_NOFDREF;
                /* sofree() calls sounlock(). */
Index: kern/uipc_socket2.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/kern/uipc_socket2.c,v
retrieving revision 1.127
diff -u -p -r1.127 uipc_socket2.c
--- kern/uipc_socket2.c 13 Aug 2022 21:01:46 -0000      1.127
+++ kern/uipc_socket2.c 15 Aug 2022 14:57:47 -0000
@@ -168,7 +168,7 @@ soisdisconnected(struct socket *so)
  * Connstatus may be 0 or SS_ISCONNECTED.
  */
 struct socket *
-sonewconn(struct socket *head, int connstatus)
+sonewconn(struct socket *head, int connstatus, int wait)
 {
        struct socket *so;
        int persocket = solock_persocket(head);
@@ -185,7 +185,7 @@ sonewconn(struct socket *head, int conns
                return (NULL);
        if (head->so_qlen + head->so_q0len > head->so_qlimit * 3)
                return (NULL);
-       so = soalloc(PR_NOWAIT | PR_ZERO);
+       so = soalloc(wait);
        if (so == NULL)
                return (NULL);
        so->so_type = head->so_type;
@@ -238,7 +238,7 @@ sonewconn(struct socket *head, int conns
                sounlock(head);
        }
 
-       error = pru_attach(so, 0);
+       error = pru_attach(so, 0, wait);
 
        if (persocket) {
                sounlock(so);
Index: kern/uipc_usrreq.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/kern/uipc_usrreq.c,v
retrieving revision 1.168
diff -u -p -r1.168 uipc_usrreq.c
--- kern/uipc_usrreq.c  15 Aug 2022 09:11:38 -0000      1.168
+++ kern/uipc_usrreq.c  15 Aug 2022 14:57:47 -0000
@@ -477,7 +477,7 @@ const struct sysctl_bounded_args unpdgct
 };
 
 int
-uipc_attach(struct socket *so, int proto)
+uipc_attach(struct socket *so, int proto, int wait)
 {
        struct unpcb *unp;
        int error;
@@ -505,7 +505,8 @@ uipc_attach(struct socket *so, int proto
                if (error)
                        return (error);
        }
-       unp = pool_get(&unpcb_pool, PR_NOWAIT|PR_ZERO);
+       unp = pool_get(&unpcb_pool, (wait == M_WAIT ? PR_WAITOK : PR_NOWAIT) |
+           PR_ZERO);
        if (unp == NULL)
                return (ENOBUFS);
        refcnt_init(&unp->unp_refcnt);
@@ -796,7 +797,7 @@ unp_connect(struct socket *so, struct mb
                solock(so2);
 
                if ((so2->so_options & SO_ACCEPTCONN) == 0 ||
-                   (so3 = sonewconn(so2, 0)) == NULL) {
+                   (so3 = sonewconn(so2, 0, M_WAIT)) == NULL) {
                        error = ECONNREFUSED;
                }
 
Index: net/pfkeyv2.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/net/pfkeyv2.c,v
retrieving revision 1.235
diff -u -p -r1.235 pfkeyv2.c
--- net/pfkeyv2.c       15 Aug 2022 09:11:38 -0000      1.235
+++ net/pfkeyv2.c       15 Aug 2022 14:57:47 -0000
@@ -169,7 +169,7 @@ static int npromisc = 0;
 
 void pfkey_init(void);
 
-int pfkeyv2_attach(struct socket *, int);
+int pfkeyv2_attach(struct socket *, int, int);
 int pfkeyv2_detach(struct socket *);
 int pfkeyv2_usrreq(struct socket *, int, struct mbuf *, struct mbuf *,
     struct mbuf *, struct proc *);
@@ -261,7 +261,7 @@ pfkey_init(void)
  * Attach a new PF_KEYv2 socket.
  */
 int
-pfkeyv2_attach(struct socket *so, int proto)
+pfkeyv2_attach(struct socket *so, int proto, int wait)
 {
        struct pkpcb *kp;
        int error;
@@ -273,7 +273,8 @@ pfkeyv2_attach(struct socket *so, int pr
        if (error)
                return (error);
 
-       kp = pool_get(&pkpcb_pool, PR_WAITOK|PR_ZERO);
+       kp = pool_get(&pkpcb_pool, (wait == M_WAIT ? PR_WAITOK : PR_NOWAIT) |
+           PR_ZERO);
        so->so_pcb = kp;
        refcnt_init(&kp->kcb_refcnt);
        kp->kcb_socket = so;
Index: net/rtsock.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/net/rtsock.c,v
retrieving revision 1.335
diff -u -p -r1.335 rtsock.c
--- net/rtsock.c        15 Aug 2022 09:11:38 -0000      1.335
+++ net/rtsock.c        15 Aug 2022 14:57:47 -0000
@@ -297,7 +297,7 @@ route_usrreq(struct socket *so, int req,
 }
 
 int
-route_attach(struct socket *so, int proto)
+route_attach(struct socket *so, int proto, int wait)
 {
        struct rtpcb    *rop;
        int              error;
@@ -310,7 +310,8 @@ route_attach(struct socket *so, int prot
         * code does not care about the additional fields
         * and works directly on the raw socket.
         */
-       rop = pool_get(&rtpcb_pool, PR_WAITOK|PR_ZERO);
+       rop = pool_get(&rtpcb_pool, (wait == M_WAIT ? PR_WAITOK : PR_NOWAIT) |
+           PR_ZERO);
        so->so_pcb = rop;
        /* Init the timeout structure */
        timeout_set_proc(&rop->rop_timeout, rtm_senddesync_timer, so);
Index: netinet/in_pcb.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/in_pcb.c,v
retrieving revision 1.270
diff -u -p -r1.270 in_pcb.c
--- netinet/in_pcb.c    8 Aug 2022 12:06:30 -0000       1.270
+++ netinet/in_pcb.c    15 Aug 2022 14:57:47 -0000
@@ -223,14 +223,15 @@ in_rootonly(u_int16_t port, u_int16_t pr
 }
 
 int
-in_pcballoc(struct socket *so, struct inpcbtable *table)
+in_pcballoc(struct socket *so, struct inpcbtable *table, int wait)
 {
        struct inpcb *inp;
        struct inpcbhead *head;
 
        NET_ASSERT_LOCKED();
 
-       inp = pool_get(&inpcb_pool, PR_NOWAIT|PR_ZERO);
+       inp = pool_get(&inpcb_pool, (wait == M_WAIT ? PR_WAITOK : PR_NOWAIT) |
+           PR_ZERO);
        if (inp == NULL)
                return (ENOBUFS);
        inp->inp_table = table;
Index: netinet/in_pcb.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/in_pcb.h,v
retrieving revision 1.129
diff -u -p -r1.129 in_pcb.h
--- netinet/in_pcb.h    15 May 2022 09:12:20 -0000      1.129
+++ netinet/in_pcb.h    15 Aug 2022 14:57:47 -0000
@@ -272,7 +272,7 @@ extern int in_pcbnotifymiss;
 
 void    in_init(void);
 void    in_losing(struct inpcb *);
-int     in_pcballoc(struct socket *, struct inpcbtable *);
+int     in_pcballoc(struct socket *, struct inpcbtable *, int);
 int     in_pcbbind(struct inpcb *, struct mbuf *, struct proc *);
 int     in_pcbaddrisavail(struct inpcb *, struct sockaddr_in *, int,
            struct proc *);
Index: netinet/ip_divert.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_divert.c,v
retrieving revision 1.69
diff -u -p -r1.69 ip_divert.c
--- netinet/ip_divert.c 15 Aug 2022 09:11:39 -0000      1.69
+++ netinet/ip_divert.c 15 Aug 2022 14:57:47 -0000
@@ -329,7 +329,7 @@ release:
 }
 
 int
-divert_attach(struct socket *so, int proto)
+divert_attach(struct socket *so, int proto, int wait)
 {
        int error;
 
@@ -338,7 +338,7 @@ divert_attach(struct socket *so, int pro
        if ((so->so_state & SS_PRIV) == 0)
                return EACCES;
 
-       error = in_pcballoc(so, &divbtable);
+       error = in_pcballoc(so, &divbtable, wait);
        if (error)
                return error;
 
Index: netinet/ip_divert.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_divert.h,v
retrieving revision 1.16
diff -u -p -r1.16 ip_divert.h
--- netinet/ip_divert.h 15 Aug 2022 09:11:39 -0000      1.16
+++ netinet/ip_divert.h 15 Aug 2022 14:57:47 -0000
@@ -72,7 +72,7 @@ void   divert_packet(struct mbuf *, int, 
 int     divert_sysctl(int *, u_int, void *, size_t *, void *, size_t);
 int     divert_usrreq(struct socket *,
            int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *);
-int     divert_attach(struct socket *, int);
+int     divert_attach(struct socket *, int, int);
 int     divert_detach(struct socket *);
 #endif /* _KERNEL */
 #endif /* _IP_DIVERT_H_ */
Index: netinet/ip_var.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_var.h,v
retrieving revision 1.97
diff -u -p -r1.97 ip_var.h
--- netinet/ip_var.h    15 Aug 2022 09:11:39 -0000      1.97
+++ netinet/ip_var.h    15 Aug 2022 14:57:47 -0000
@@ -258,7 +258,7 @@ int  rip_output(struct mbuf *, struct so
            struct mbuf *);
 int     rip_usrreq(struct socket *,
            int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *);
-int     rip_attach(struct socket *, int);
+int     rip_attach(struct socket *, int, int);
 int     rip_detach(struct socket *);
 #ifdef MROUTING
 extern struct socket *ip_mrouter[];    /* multicast routing daemon */
Index: netinet/raw_ip.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/raw_ip.c,v
retrieving revision 1.130
diff -u -p -r1.130 raw_ip.c
--- netinet/raw_ip.c    15 Aug 2022 09:11:39 -0000      1.130
+++ netinet/raw_ip.c    15 Aug 2022 14:57:47 -0000
@@ -597,7 +597,7 @@ release:
 }
 
 int
-rip_attach(struct socket *so, int proto)
+rip_attach(struct socket *so, int proto, int wait)
 {
        struct inpcb *inp;
        int error;
@@ -612,7 +612,7 @@ rip_attach(struct socket *so, int proto)
        if ((error = soreserve(so, rip_sendspace, rip_recvspace)))
                return error;
        NET_ASSERT_LOCKED();
-       if ((error = in_pcballoc(so, &rawcbtable)))
+       if ((error = in_pcballoc(so, &rawcbtable, wait)))
                return error;
        inp = sotoinpcb(so);
        inp->inp_ip.ip_p = proto;
Index: netinet/tcp_input.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/tcp_input.c,v
retrieving revision 1.377
diff -u -p -r1.377 tcp_input.c
--- netinet/tcp_input.c 11 Aug 2022 09:13:21 -0000      1.377
+++ netinet/tcp_input.c 15 Aug 2022 14:57:47 -0000
@@ -3502,7 +3502,7 @@ syn_cache_get(struct sockaddr *src, stru
         * the connection, abort it.
         */
        oso = so;
-       so = sonewconn(so, SS_ISCONNECTED);
+       so = sonewconn(so, SS_ISCONNECTED, M_DONTWAIT);
        if (so == NULL)
                goto resetandabort;
 
Index: netinet/tcp_subr.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/tcp_subr.c,v
retrieving revision 1.185
diff -u -p -r1.185 tcp_subr.c
--- netinet/tcp_subr.c  8 Aug 2022 12:06:30 -0000       1.185
+++ netinet/tcp_subr.c  15 Aug 2022 14:57:47 -0000
@@ -411,12 +411,13 @@ tcp_respond(struct tcpcb *tp, caddr_t te
  * protocol control block.
  */
 struct tcpcb *
-tcp_newtcpcb(struct inpcb *inp)
+tcp_newtcpcb(struct inpcb *inp, int wait)
 {
        struct tcpcb *tp;
        int i;
 
-       tp = pool_get(&tcpcb_pool, PR_NOWAIT|PR_ZERO);
+       tp = pool_get(&tcpcb_pool, (wait == M_WAIT ? PR_WAITOK : PR_NOWAIT) |
+           PR_ZERO);
        if (tp == NULL)
                return (NULL);
        TAILQ_INIT(&tp->t_segq);
Index: netinet/tcp_usrreq.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/tcp_usrreq.c,v
retrieving revision 1.187
diff -u -p -r1.187 tcp_usrreq.c
--- netinet/tcp_usrreq.c        15 Aug 2022 09:11:39 -0000      1.187
+++ netinet/tcp_usrreq.c        15 Aug 2022 14:57:47 -0000
@@ -687,7 +687,7 @@ tcp_ctloutput(int op, struct socket *so,
  * buffer space, and entering LISTEN state to accept connections.
  */
 int
-tcp_attach(struct socket *so, int proto)
+tcp_attach(struct socket *so, int proto, int wait)
 {
        struct tcpcb *tp;
        struct inpcb *inp;
@@ -704,11 +704,11 @@ tcp_attach(struct socket *so, int proto)
        }
 
        NET_ASSERT_LOCKED();
-       error = in_pcballoc(so, &tcbtable);
+       error = in_pcballoc(so, &tcbtable, wait);
        if (error)
                return (error);
        inp = sotoinpcb(so);
-       tp = tcp_newtcpcb(inp);
+       tp = tcp_newtcpcb(inp, wait);
        if (tp == NULL) {
                unsigned int nofd = so->so_state & SS_NOFDREF;  /* XXX */
 
Index: netinet/tcp_var.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/tcp_var.h,v
retrieving revision 1.141
diff -u -p -r1.141 tcp_var.h
--- netinet/tcp_var.h   15 Aug 2022 09:11:39 -0000      1.141
+++ netinet/tcp_var.h   15 Aug 2022 14:57:47 -0000
@@ -689,7 +689,7 @@ void        tcp6_mtudisc(struct inpcb *, int);
 void   tcp6_mtudisc_callback(struct sockaddr_in6 *, u_int);
 #endif
 struct tcpcb *
-        tcp_newtcpcb(struct inpcb *);
+        tcp_newtcpcb(struct inpcb *, int);
 void    tcp_notify(struct inpcb *, int);
 int     tcp_output(struct tcpcb *);
 void    tcp_pulloutofband(struct socket *, u_int, struct mbuf *, int);
@@ -712,7 +712,7 @@ struct tcpcb *
 int     tcp_sysctl(int *, u_int, void *, size_t *, void *, size_t);
 int     tcp_usrreq(struct socket *,
            int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *);
-int     tcp_attach(struct socket *, int);
+int     tcp_attach(struct socket *, int, int);
 int     tcp_detach(struct socket *);
 void    tcp_xmit_timer(struct tcpcb *, int);
 void    tcpdropoldhalfopen(struct tcpcb *, u_int16_t);
Index: netinet/udp_usrreq.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/udp_usrreq.c,v
retrieving revision 1.282
diff -u -p -r1.282 udp_usrreq.c
--- netinet/udp_usrreq.c        15 Aug 2022 09:11:39 -0000      1.282
+++ netinet/udp_usrreq.c        15 Aug 2022 14:57:47 -0000
@@ -1238,7 +1238,7 @@ release:
 }
 
 int
-udp_attach(struct socket *so, int proto)
+udp_attach(struct socket *so, int proto, int wait)
 {
        int error;
 
@@ -1249,7 +1249,7 @@ udp_attach(struct socket *so, int proto)
                return error;
 
        NET_ASSERT_LOCKED();
-       if ((error = in_pcballoc(so, &udbtable)))
+       if ((error = in_pcballoc(so, &udbtable, wait)))
                return error;
 #ifdef INET6
        if (sotoinpcb(so)->inp_flags & INP_IPV6)
Index: netinet/udp_var.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/udp_var.h,v
retrieving revision 1.38
diff -u -p -r1.38 udp_var.h
--- netinet/udp_var.h   15 Aug 2022 09:11:39 -0000      1.38
+++ netinet/udp_var.h   15 Aug 2022 14:57:47 -0000
@@ -141,7 +141,7 @@ int  udp6_output(struct inpcb *, struct 
 int     udp_sysctl(int *, u_int, void *, size_t *, void *, size_t);
 int     udp_usrreq(struct socket *,
            int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *);
-int     udp_attach(struct socket *, int);
+int     udp_attach(struct socket *, int, int);
 int     udp_detach(struct socket *);
 #endif /* _KERNEL */
 #endif /* _NETINET_UDP_VAR_H_ */
Index: netinet6/ip6_divert.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/ip6_divert.c,v
retrieving revision 1.68
diff -u -p -r1.68 ip6_divert.c
--- netinet6/ip6_divert.c       15 Aug 2022 09:11:39 -0000      1.68
+++ netinet6/ip6_divert.c       15 Aug 2022 14:57:47 -0000
@@ -335,7 +335,7 @@ release:
 }
 
 int
-divert6_attach(struct socket *so, int proto)
+divert6_attach(struct socket *so, int proto, int wait)
 {
        int error;
 
@@ -345,7 +345,7 @@ divert6_attach(struct socket *so, int pr
        if ((so->so_state & SS_PRIV) == 0)
                return EACCES;
 
-       error = in_pcballoc(so, &divb6table);
+       error = in_pcballoc(so, &divb6table, wait);
        if (error)
                return (error);
 
Index: netinet6/ip6_divert.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/ip6_divert.h,v
retrieving revision 1.14
diff -u -p -r1.14 ip6_divert.h
--- netinet6/ip6_divert.h       15 Aug 2022 09:11:39 -0000      1.14
+++ netinet6/ip6_divert.h       15 Aug 2022 14:57:47 -0000
@@ -72,7 +72,7 @@ void   divert6_packet(struct mbuf *, int,
 int     divert6_sysctl(int *, u_int, void *, size_t *, void *, size_t);
 int     divert6_usrreq(struct socket *,
            int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *);
-int     divert6_attach(struct socket *, int);
+int     divert6_attach(struct socket *, int, int);
 int     divert6_detach(struct socket *);
 #endif /* _KERNEL */
 
Index: netinet6/ip6_var.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/ip6_var.h,v
retrieving revision 1.95
diff -u -p -r1.95 ip6_var.h
--- netinet6/ip6_var.h  15 Aug 2022 09:11:39 -0000      1.95
+++ netinet6/ip6_var.h  15 Aug 2022 14:57:47 -0000
@@ -353,7 +353,7 @@ int rip6_output(struct mbuf *, struct so
            struct mbuf *);
 int    rip6_usrreq(struct socket *,
            int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *);
-int    rip6_attach(struct socket *, int);
+int    rip6_attach(struct socket *, int, int);
 int    rip6_detach(struct socket *);
 int    rip6_sysctl(int *, u_int, void *, size_t *, void *, size_t);
 
Index: netinet6/raw_ip6.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/raw_ip6.c,v
retrieving revision 1.150
diff -u -p -r1.150 raw_ip6.c
--- netinet6/raw_ip6.c  15 Aug 2022 09:11:39 -0000      1.150
+++ netinet6/raw_ip6.c  15 Aug 2022 14:57:47 -0000
@@ -722,7 +722,7 @@ release:
 }
 
 int
-rip6_attach(struct socket *so, int proto)
+rip6_attach(struct socket *so, int proto, int wait)
 {
        struct inpcb *in6p;
        int error;
@@ -737,15 +737,15 @@ rip6_attach(struct socket *so, int proto
        if ((error = soreserve(so, rip6_sendspace, rip6_recvspace)))
                return error;
        NET_ASSERT_LOCKED();
-       if ((error = in_pcballoc(so, &rawin6pcbtable)))
+       if ((error = in_pcballoc(so, &rawin6pcbtable, wait)))
                return error;
 
        in6p = sotoinpcb(so);
        in6p->inp_ipv6.ip6_nxt = proto;
        in6p->inp_cksum6 = -1;
 
-       in6p->inp_icmp6filt = malloc(sizeof(struct icmp6_filter),
-           M_PCB, M_NOWAIT);
+       in6p->inp_icmp6filt = malloc(sizeof(struct icmp6_filter), M_PCB,
+           wait == M_WAIT ? M_WAITOK : M_NOWAIT);
        if (in6p->inp_icmp6filt == NULL) {
                in_pcbdetach(in6p);
                return ENOMEM;
Index: sys/protosw.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/sys/protosw.h,v
retrieving revision 1.37
diff -u -p -r1.37 protosw.h
--- sys/protosw.h       15 Aug 2022 09:11:39 -0000      1.37
+++ sys/protosw.h       15 Aug 2022 14:57:47 -0000
@@ -64,7 +64,7 @@ struct pr_usrreqs {
        int     (*pru_usrreq)(struct socket *, int, struct mbuf *,
                    struct mbuf *, struct mbuf *, struct proc *);
 
-       int     (*pru_attach)(struct socket *, int);
+       int     (*pru_attach)(struct socket *, int, int);
        int     (*pru_detach)(struct socket *);
 };
 
@@ -250,9 +250,9 @@ extern const struct protosw inet6sw[];
 #endif /* INET6 */
 
 static inline int
-pru_attach(struct socket *so, int proto)
+pru_attach(struct socket *so, int proto, int wait)
 {
-       return (*so->so_proto->pr_usrreqs->pru_attach)(so, proto);
+       return (*so->so_proto->pr_usrreqs->pru_attach)(so, proto, wait);
 }
 
 static inline int
Index: sys/socketvar.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/sys/socketvar.h,v
retrieving revision 1.107
diff -u -p -r1.107 socketvar.h
--- sys/socketvar.h     13 Aug 2022 21:01:46 -0000      1.107
+++ sys/socketvar.h     15 Aug 2022 14:57:47 -0000
@@ -332,7 +332,7 @@ void        soisconnecting(struct socket *);
 void   soisdisconnected(struct socket *);
 void   soisdisconnecting(struct socket *);
 int    solisten(struct socket *, int);
-struct socket *sonewconn(struct socket *, int);
+struct socket *sonewconn(struct socket *, int, int);
 void   soqinsque(struct socket *, struct socket *, int);
 int    soqremque(struct socket *, int);
 int    soreceive(struct socket *, struct mbuf **, struct uio *,
Index: sys/unpcb.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/sys/unpcb.h,v
retrieving revision 1.27
diff -u -p -r1.27 unpcb.h
--- sys/unpcb.h 15 Aug 2022 09:11:39 -0000      1.27
+++ sys/unpcb.h 15 Aug 2022 14:57:47 -0000
@@ -111,7 +111,7 @@ extern const struct pr_usrreqs uipc_usrr
 
 int    uipc_usrreq(struct socket *, int , struct mbuf *,
                         struct mbuf *, struct mbuf *, struct proc *);
-int    uipc_attach(struct socket *, int);
+int    uipc_attach(struct socket *, int, int);
 int    uipc_detach(struct socket *);
 
 void   unp_init(void);

Reply via email to