diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 15c1c82..eb2e5df 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -197,6 +197,16 @@ int socreate(int dom, struct socket **aso, int type, int proto, struct thread *td) { + return socreate2(dom, aso, type, proto, td, 1); +} + +/* + * socreate_fast feature will be activate when param fast is true + */ +int +socreate2(int dom, struct socket **aso, int type, + int proto, struct thread *td, int fast) +{ struct proc *p = td->td_proc; struct protosw *prp; struct socket *so; @@ -263,8 +273,10 @@ socreate(int dom, struct socket **aso, int type, /* * Auto-sizing of socket buffers is managed by the protocols and * the appropriate flags must be set in the pru_attach function. + * + * Activate socreate_fast when fast and sysctl socreate_fast are on */ - if (use_socreate_fast && prp->pr_usrreqs->pru_preattach) + if (use_socreate_fast && fast && prp->pr_usrreqs->pru_preattach) error = so_pru_attach_fast(so, proto, &ai); else error = so_pru_attach(so, proto, &ai); diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h index a9eb0f3..ee55ba1 100644 --- a/sys/sys/socketvar.h +++ b/sys/sys/socketvar.h @@ -428,6 +428,8 @@ int soconnect (struct socket *so, struct sockaddr *nam, struct thread *td, int soconnect2 (struct socket *so1, struct socket *so2); int socreate (int dom, struct socket **aso, int type, int proto, struct thread *td); +int socreate2 (int dom, struct socket **aso, int type, int proto, + struct thread *td, int fast); int sodisconnect (struct socket *so); void sodiscard (struct socket *so); void sofree (struct socket *so);