4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
26 #include <sys/sysmacros.h>
27 #include <sys/strsubr.h>
28 #include <sys/socket.h>
29 #include <sys/socketvar.h>
30 #include <sys/modctl.h>
31 #include <sys/cmn_err.h>
33 #include <inet/sdp_itf.h>
34 #include <../../../../kernel/fs/sockfs/sockcommon.h>
37 struct sonode
*socksdp_create(struct sockparams
*, int, int, int,
38 int, int *, cred_t
*);
39 static void socksdp_destroy(struct sonode
*);
41 static __smod_priv_t sosdp_priv
= {
47 static smod_reg_t sinfo
= {
57 * Module linkage information for the kernel
59 static struct modlsockmod modlsockmod
= {
60 &mod_sockmodops
, "SDP socket module", &sinfo
63 static struct modlinkage modlinkage
= {
70 * Creates a sdp socket data structure.
74 socksdp_create(struct sockparams
*sp
, int family
, int type
, int protocol
, int
75 sflags
, int *errorp
, cred_t
*cr
)
78 int kmflags
= (sflags
& SOCKET_NOSLEEP
) ? KM_NOSLEEP
: KM_SLEEP
;
80 dprint(4, ("Inside sosdp_create: domain:%d proto:%d type:%d",
81 family
, protocol
, type
));
86 * We only support one type of SDP socket. Let sotpi_create()
87 * handle all other cases, such as raw socket.
89 if (!(family
== AF_INET
|| family
== AF_INET6
) ||
90 !(type
== SOCK_STREAM
)) {
95 so
= kmem_cache_alloc(socket_cache
, kmflags
);
101 sonode_init(so
, sp
, family
, type
, protocol
, &sosdp_sonodeops
);
102 so
->so_pollev
|= SO_POLLEV_ALWAYS
;
104 dprint(2, ("sosdp_create: %p domain %d type %d\n", (void *)so
, family
,
107 so
->so_is_stream
= false;
110 * set the default values to be INFPSZ
111 * if a protocol desires it can change the value later
113 so
->so_proto_props
.sopp_rxhiwat
= SOCKET_RECVHIWATER
;
114 so
->so_proto_props
.sopp_rxlowat
= SOCKET_RECVLOWATER
;
115 so
->so_proto_props
.sopp_maxpsz
= INFPSZ
;
116 so
->so_proto_props
.sopp_maxblk
= INFPSZ
;
122 socksdp_destroy(struct sonode
*so
)
124 ASSERT(so
->so_ops
== &sosdp_sonodeops
);
126 sosdp_fini(so
, CRED());
128 kmem_cache_free(socket_cache
, so
);
134 return (mod_install(&modlinkage
));
140 return (mod_remove(&modlinkage
));
144 _info(struct modinfo
*modinfop
)
146 return (mod_info(&modlinkage
, modinfop
));