Add EAFNOSUPPORT as a possible error if the address family is not
supported. This adds further differentiation between which argument to socket(2) caused the error. No longer are invalid domain (address family) errors classified as ENOPROTOSUPPORT errors. This should make socket(2) conform to current POSIX and X/Open standards. Fixes PR/33676.
This commit is contained in:
parent
d5b727f28d
commit
d05e0bc3e8
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: socket.2,v 1.32 2006/06/13 20:37:24 ginsbach Exp $
|
||||
.\" $NetBSD: socket.2,v 1.33 2006/06/13 21:19:56 ginsbach Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1983, 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -223,6 +223,9 @@ call fails if:
|
||||
.It Bq Er EACCES
|
||||
Permission to create a socket of the specified type and/or protocol
|
||||
is denied.
|
||||
.It Bq Er EAFNOSUPPORT
|
||||
The address family (domain) is not supported or
|
||||
the specified domain is not supported by this protocol family.
|
||||
.It Bq Er EMFILE
|
||||
The per-process descriptor table is full.
|
||||
.It Bq Er ENFILE
|
||||
@ -231,8 +234,10 @@ The system file table is full.
|
||||
Insufficient buffer space is available.
|
||||
The socket cannot be created until sufficient resources are freed.
|
||||
.It Bq Er EPROTONOSUPPORT
|
||||
The protocol type or the specified protocol is not supported
|
||||
within this domain.
|
||||
The protocol family is not supported or
|
||||
the specified protocol is not supported within this domain.
|
||||
.It Bq Er EPROTOTYPE
|
||||
The socket type is not supported by the protocol.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr accept 2 ,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: uipc_socket.c,v 1.119 2006/05/25 14:27:28 yamt Exp $ */
|
||||
/* $NetBSD: uipc_socket.c,v 1.120 2006/06/13 21:19:56 ginsbach Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
@ -68,7 +68,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.119 2006/05/25 14:27:28 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.120 2006/06/13 21:19:56 ginsbach Exp $");
|
||||
|
||||
#include "opt_sock_counters.h"
|
||||
#include "opt_sosend_loan.h"
|
||||
@ -478,7 +478,16 @@ socreate(int dom, struct socket **aso, int type, int proto, struct lwp *l)
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user