ksocket.c revision 6a571a2dc9fd3dada6de18b4c74cc8dcfca99eda
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/socketvar.h>
#include <sys/sysmacros.h>
#define SOCKETMOD_TCP "tcp"
#define SOCKETMOD_UDP "udp"
/*
* Kernel Sockets
*
* Mostly a wrapper around the private socket_* functions.
*/
int
{
static const int version = SOV_DEFAULT;
int error = 0;
/* All Solaris components should pass a cred for this operation. */
return (EAFNOSUPPORT);
if (error == EAFNOSUPPORT) {
/*
* Could be that root file sytem is not loaded or
* soconfig has not run yet.
*/
protocol == IPPROTO_TCP)) {
mod = SOCKETMOD_TCP;
protocol == IPPROTO_UDP)) {
mod = SOCKETMOD_UDP;
} else {
return (EAFNOSUPPORT);
}
return (error);
} else {
return (error);
}
}
return (0);
}
int
{
int error;
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks))
return (ENOTSOCK);
return (error);
}
int
{
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks))
return (ENOTSOCK);
}
int
{
int error;
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks))
return (ENOTSOCK);
return (EFAULT);
if (error != 0)
return (error);
if (error != 0) {
}
}
return (error);
}
int
{
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks))
return (ENOTSOCK);
}
int
{
int error;
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks)) {
*sent = 0;
return (ENOTSOCK);
}
auio.uio_loffset = 0;
if (flags & MSG_USERSPACE)
else
msghdr.msg_namelen = 0;
msghdr.msg_controllen = 0;
if (error != 0) {
*sent = 0;
return (error);
}
return (0);
}
int
{
int error;
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks)) {
*sent = 0;
return (ENOTSOCK);
}
auio.uio_loffset = 0;
if (flags & MSG_USERSPACE)
else
msghdr.msg_controllen = 0;
if (error != 0) {
*sent = 0;
return (error);
}
return (0);
}
int
{
int error;
int i;
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks)) {
*sent = 0;
return (ENOTSOCK);
}
auio.uio_loffset = 0;
if (flags & MSG_USERSPACE)
else
len = 0;
for (i = 0; i < msg->msg_iovlen; i++) {
return (EINVAL);
}
if (error != 0) {
*sent = 0;
return (error);
}
return (0);
}
int
{
int error;
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks)) {
*recv = 0;
return (ENOTSOCK);
}
auio.uio_loffset = 0;
if (flags & MSG_USERSPACE)
else
msghdr.msg_namelen = 0;
msghdr.msg_controllen = 0;
if (error != 0) {
*recv = 0;
return (error);
}
return (0);
}
int
{
int error;
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks)) {
*recv = 0;
return (ENOTSOCK);
}
auio.uio_loffset = 0;
if (flags & MSG_USERSPACE)
else
msghdr.msg_controllen = 0;
if (error != 0) {
*recv = 0;
return (error);
}
return (0);
}
int
{
int error;
int i;
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks)) {
*recv = 0;
return (ENOTSOCK);
}
auio.uio_loffset = 0;
else
len = 0;
for (i = 0; i < msg->msg_iovlen; i++) {
return (EINVAL);
}
if (error != 0) {
*recv = 0;
return (error);
}
return (0);
}
int
{
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks))
return (ENOTSOCK);
}
int
{
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks)) {
return (ENOTSOCK);
}
}
/* Remove callbacks, if any */
return (0);
}
int
{
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks))
return (ENOTSOCK);
return (EFAULT);
}
int
{
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks))
return (ENOTSOCK);
return (EFAULT);
}
int
{
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks))
return (ENOTSOCK);
return (EFAULT);
if (*optlen > SO_MAXARGSIZE)
return (EINVAL);
}
int
{
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks))
return (ENOTSOCK);
optlen = 0;
}
/* ARGSUSED */
int
{
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks))
return (ENOTSOCK);
return (EFAULT);
} else {
}
return (0);
}
int
{
int rval;
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks))
return (ENOTSOCK);
switch (cmd) {
default:
/* STREAM iotcls are not supported */
rval = EOPNOTSUPP;
} else {
}
break;
case FIOASYNC:
case SIOCSPGRP:
case FIOSETOWN:
case SIOCGPGRP:
case FIOGETOWN:
rval = EOPNOTSUPP;
break;
}
return (rval);
}
int
{
int i_val;
int error;
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks))
return (ENOTSOCK);
if (flags & MSG_MBLK_QUICKRELE) {
if (error != 0)
return (error);
/* Zero copy is not enable */
if (i_val == 0)
return (ECANCELED);
}
return (error);
}
void
{
} else
}
void
{
/*
* When so_count equals 1 means no thread working on this ksocket
*/
} else {
}
}