On Mon, Aug 15, 2022 at 05:12:22PM +0200, Alexander Bluhm wrote:
> 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.

rebased to -current.

Anyone?

bluhm

Index: kern/uipc_socket.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/kern/uipc_socket.c,v
retrieving revision 1.286
diff -u -p -r1.286 uipc_socket.c
--- kern/uipc_socket.c  28 Aug 2022 18:43:12 -0000      1.286
+++ kern/uipc_socket.c  1 Sep 2022 18:47:36 -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 1 Sep 2022 18:47:36 -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.181
diff -u -p -r1.181 uipc_usrreq.c
--- kern/uipc_usrreq.c  31 Aug 2022 21:23:02 -0000      1.181
+++ kern/uipc_usrreq.c  1 Sep 2022 18:47:36 -0000
@@ -302,7 +302,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;
@@ -330,7 +330,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);
@@ -855,7 +856,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.248
diff -u -p -r1.248 pfkeyv2.c
--- net/pfkeyv2.c       31 Aug 2022 21:23:02 -0000      1.248
+++ net/pfkeyv2.c       1 Sep 2022 18:47:36 -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_disconnect(struct socket *);
 int pfkeyv2_shutdown(struct socket *);
@@ -268,7 +268,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;
@@ -280,7 +280,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.349
diff -u -p -r1.349 rtsock.c
--- net/rtsock.c        31 Aug 2022 21:23:02 -0000      1.349
+++ net/rtsock.c        1 Sep 2022 18:47:36 -0000
@@ -264,7 +264,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;
@@ -277,7 +277,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.273
diff -u -p -r1.273 in_pcb.c
--- netinet/in_pcb.c    30 Aug 2022 11:53:04 -0000      1.273
+++ netinet/in_pcb.c    1 Sep 2022 18:47:36 -0000
@@ -226,11 +226,12 @@ 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;
 
-       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.132
diff -u -p -r1.132 in_pcb.h
--- netinet/in_pcb.h    30 Aug 2022 11:53:04 -0000      1.132
+++ netinet/in_pcb.h    1 Sep 2022 18:47:36 -0000
@@ -277,7 +277,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.82
diff -u -p -r1.82 ip_divert.c
--- netinet/ip_divert.c 31 Aug 2022 21:23:02 -0000      1.82
+++ netinet/ip_divert.c 1 Sep 2022 18:47:36 -0000
@@ -300,7 +300,7 @@ release:
 }
 
 int
-divert_attach(struct socket *so, int proto)
+divert_attach(struct socket *so, int proto, int wait)
 {
        int error;
 
@@ -309,7 +309,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.20
diff -u -p -r1.20 ip_divert.h
--- netinet/ip_divert.h 28 Aug 2022 18:44:16 -0000      1.20
+++ netinet/ip_divert.h 1 Sep 2022 18:47:36 -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 *);
 int     divert_bind(struct socket *, struct mbuf *, struct proc *);
 int     divert_shutdown(struct socket *);
Index: netinet/ip_var.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_var.h,v
retrieving revision 1.103
diff -u -p -r1.103 ip_var.h
--- netinet/ip_var.h    28 Aug 2022 18:44:16 -0000      1.103
+++ netinet/ip_var.h    1 Sep 2022 18:47:36 -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 *);
 int     rip_bind(struct socket *so, struct mbuf *, struct proc *);
 int     rip_connect(struct socket *, struct mbuf *);
Index: netinet/raw_ip.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/raw_ip.c,v
retrieving revision 1.143
diff -u -p -r1.143 raw_ip.c
--- netinet/raw_ip.c    31 Aug 2022 21:23:02 -0000      1.143
+++ netinet/raw_ip.c    1 Sep 2022 18:47:36 -0000
@@ -502,7 +502,7 @@ release:
 }
 
 int
-rip_attach(struct socket *so, int proto)
+rip_attach(struct socket *so, int proto, int wait)
 {
        struct inpcb *inp;
        int error;
@@ -517,7 +517,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.379
diff -u -p -r1.379 tcp_input.c
--- netinet/tcp_input.c 30 Aug 2022 11:53:04 -0000      1.379
+++ netinet/tcp_input.c 1 Sep 2022 18:47:36 -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.186
diff -u -p -r1.186 tcp_subr.c
--- netinet/tcp_subr.c  30 Aug 2022 11:53:04 -0000      1.186
+++ netinet/tcp_subr.c  1 Sep 2022 18:47:36 -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.202
diff -u -p -r1.202 tcp_usrreq.c
--- netinet/tcp_usrreq.c        31 Aug 2022 21:23:02 -0000      1.202
+++ netinet/tcp_usrreq.c        1 Sep 2022 18:47:36 -0000
@@ -517,7 +517,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;
@@ -534,11 +534,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.153
diff -u -p -r1.153 tcp_var.h
--- netinet/tcp_var.h   31 Aug 2022 21:23:02 -0000      1.153
+++ netinet/tcp_var.h   1 Sep 2022 18:47:36 -0000
@@ -690,7 +690,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);
@@ -713,7 +713,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 *);
 int     tcp_bind(struct socket *, struct mbuf *, struct proc *);
 int     tcp_listen(struct socket *);
Index: netinet/udp_usrreq.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/udp_usrreq.c,v
retrieving revision 1.297
diff -u -p -r1.297 udp_usrreq.c
--- netinet/udp_usrreq.c        31 Aug 2022 21:23:02 -0000      1.297
+++ netinet/udp_usrreq.c        1 Sep 2022 18:47:36 -0000
@@ -1130,7 +1130,7 @@ release:
 }
 
 int
-udp_attach(struct socket *so, int proto)
+udp_attach(struct socket *so, int proto, int wait)
 {
        int error;
 
@@ -1141,7 +1141,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.44
diff -u -p -r1.44 udp_var.h
--- netinet/udp_var.h   28 Aug 2022 18:44:16 -0000      1.44
+++ netinet/udp_var.h   1 Sep 2022 18:47:36 -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 *);
 int     udp_bind(struct socket *, struct mbuf *, struct proc *);
 int     udp_connect(struct socket *, struct mbuf *);
Index: netinet6/ip6_divert.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/ip6_divert.c,v
retrieving revision 1.81
diff -u -p -r1.81 ip6_divert.c
--- netinet6/ip6_divert.c       31 Aug 2022 21:23:02 -0000      1.81
+++ netinet6/ip6_divert.c       1 Sep 2022 18:47:36 -0000
@@ -306,7 +306,7 @@ release:
 }
 
 int
-divert6_attach(struct socket *so, int proto)
+divert6_attach(struct socket *so, int proto, int wait)
 {
        int error;
 
@@ -316,7 +316,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.18
diff -u -p -r1.18 ip6_divert.h
--- netinet6/ip6_divert.h       28 Aug 2022 18:44:17 -0000      1.18
+++ netinet6/ip6_divert.h       1 Sep 2022 18:47:36 -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 *);
 int     divert6_bind(struct socket *, struct mbuf *, struct proc *);
 int     divert6_shutdown(struct socket *);
Index: netinet6/ip6_var.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/ip6_var.h,v
retrieving revision 1.101
diff -u -p -r1.101 ip6_var.h
--- netinet6/ip6_var.h  28 Aug 2022 18:44:17 -0000      1.101
+++ netinet6/ip6_var.h  1 Sep 2022 18:47:36 -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_bind(struct socket *, struct mbuf *, struct proc *);
 int    rip6_connect(struct socket *, struct mbuf *);
Index: netinet6/raw_ip6.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/raw_ip6.c,v
retrieving revision 1.164
diff -u -p -r1.164 raw_ip6.c
--- netinet6/raw_ip6.c  31 Aug 2022 21:23:02 -0000      1.164
+++ netinet6/raw_ip6.c  1 Sep 2022 18:47:36 -0000
@@ -617,7 +617,7 @@ release:
 }
 
 int
-rip6_attach(struct socket *so, int proto)
+rip6_attach(struct socket *so, int proto, int wait)
 {
        struct inpcb *in6p;
        int error;
@@ -632,15 +632,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.50
diff -u -p -r1.50 protosw.h
--- sys/protosw.h       31 Aug 2022 21:23:02 -0000      1.50
+++ sys/protosw.h       1 Sep 2022 18:47:36 -0000
@@ -65,7 +65,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 *);
        int     (*pru_bind)(struct socket *, struct mbuf *, struct proc *);
        int     (*pru_listen)(struct socket *);
@@ -263,9 +263,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.109
diff -u -p -r1.109 socketvar.h
--- sys/socketvar.h     1 Sep 2022 05:31:49 -0000       1.109
+++ sys/socketvar.h     1 Sep 2022 18:47:36 -0000
@@ -331,7 +331,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.37
diff -u -p -r1.37 unpcb.h
--- sys/unpcb.h 28 Aug 2022 21:35:12 -0000      1.37
+++ sys/unpcb.h 1 Sep 2022 18:47:36 -0000
@@ -114,7 +114,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 *);
 int    uipc_bind(struct socket *, struct mbuf *, struct proc *);
 int    uipc_listen(struct socket *);

Reply via email to