Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/kern/uipc_socket.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/kern/uipc_socket.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.115.6.2 retrieving revision 1.121 diff -u -p -r1.115.6.2 -r1.121 --- src/sys/kern/uipc_socket.c 2006/06/01 22:38:09 1.115.6.2 +++ src/sys/kern/uipc_socket.c 2006/06/21 12:55:12 1.121 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_socket.c,v 1.115.6.2 2006/06/01 22:38:09 kardel Exp $ */ +/* $NetBSD: uipc_socket.c,v 1.121 2006/06/21 12:55:12 yamt Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.115.6.2 2006/06/01 22:38:09 kardel Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.121 2006/06/21 12:55:12 yamt Exp $"); #include "opt_sock_counters.h" #include "opt_sosend_loan.h" @@ -130,9 +130,9 @@ EVCNT_ATTACH_STATIC(sosend_kvalimit); static struct callback_entry sokva_reclaimerentry; #ifdef SOSEND_NO_LOAN -int use_sosend_loan = 0; +int sock_loan_thresh = -1; #else -int use_sosend_loan = 1; +int sock_loan_thresh = 4096; #endif static struct simplelock so_pendfree_slock = SIMPLELOCK_INITIALIZER; @@ -145,7 +145,6 @@ int somaxkva = SOMAXKVA; static int socurkva; static int sokvawaiters; -#define SOCK_LOAN_THRESH 4096 #define SOCK_LOAN_CHUNK 65536 static size_t sodopendfree(void); @@ -478,7 +477,16 @@ socreate(int dom, struct socket **aso, i prp = pffindproto(dom, proto, type); else prp = pffindtype(dom, type); - if (prp == 0 || prp->pr_usrreq == 0) + if (prp == 0) { + /* no support for domain */ + if (pffinddomain(dom) == 0) + return (EAFNOSUPPORT); + /* no support for socket type */ + if (proto == 0 && type != 0) + return (EPROTOTYPE); + return (EPROTONOSUPPORT); + } + if (prp->pr_usrreq == 0) return (EPROTONOSUPPORT); if (prp->pr_type != type) return (EPROTOTYPE); @@ -844,9 +852,9 @@ sosend(struct socket *so, struct mbuf *a mlen = MLEN; } MCLAIM(m, so->so_snd.sb_mowner); - if (use_sosend_loan && - uio->uio_iov->iov_len >= SOCK_LOAN_THRESH && - space >= SOCK_LOAN_THRESH && + if (sock_loan_thresh >= 0 && + uio->uio_iov->iov_len >= sock_loan_thresh && + space >= sock_loan_thresh && (len = sosend_loan(so, uio, m, space)) != 0) { SOSEND_COUNTER_INCR(&sosend_loan_big);