ksocket.c revision 68b2bbf26c7040fea4281dcb58b81e7627e46f34
/*
* 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 2014 Nexenta Systems, Inc. All rights reserved.
*/
#include <unistd.h>
#include <errno.h>
#include <umem.h>
#define _KSOCKET_MAGIC 0xabcdef09
#ifndef SS_CLOSING
#define SS_CLOSING 0x00010000
#endif
/*
* NB: you can't cast this into a sonode like you can with a normal
* ksocket_t, but no correct code should ever do that anyway.
* The ksocket_t type is opaque to prevent exactly that.
*/
struct __ksocket {
int kso_fd;
};
/*ARGSUSED*/
static int
{
return (0);
}
/*ARGSUSED*/
static void
{
}
#pragma init(_ksocket_init)
int
_ksocket_init(void)
{
sizeof (struct __ksocket), 0,
return (0);
}
#pragma fini(_ksocket_fini)
int
_ksocket_fini(void)
{
return (0);
}
static ksocket_t
_ksocket_create(int fd)
{
return (ks);
}
static void
{
}
int
{
int fd;
/* All Solaris components should pass a cred for this operation. */
if (fd < 0) {
return (errno);
}
return (0);
}
/*
* This is marked NODIRECT so the main program linking with this library
* can provide its own "bind helper" function. See: fksmbd_ksock.c
*/
/* ARGSUSED */
int
{
return (EACCES);
}
int
{
int err = 0;
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks))
return (ENOTSOCK);
}
return (err);
}
int
{
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks))
return (ENOTSOCK);
return (errno);
return (0);
}
int
{
int fd;
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks))
return (ENOTSOCK);
return (EFAULT);
if (fd < 0)
return (errno);
return (0);
}
int
{
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks))
return (ENOTSOCK);
return (errno);
return (0);
}
int
{
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks)) {
*sent = 0;
return (ENOTSOCK);
}
if (error < 0) {
*sent = 0;
return (errno);
}
return (0);
}
int
{
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks)) {
*sent = 0;
return (ENOTSOCK);
}
if (error < 0) {
*sent = 0;
return (errno);
}
return (0);
}
int
{
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks)) {
*sent = 0;
return (ENOTSOCK);
}
if (error < 0) {
*sent = 0;
return (errno);
}
return (0);
}
int
{
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks)) {
*recvd = 0;
return (ENOTSOCK);
}
if (error < 0) {
*recvd = 0;
return (errno);
}
return (0);
}
int
{
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks)) {
*recvd = 0;
return (ENOTSOCK);
}
if (error != 0) {
*recvd = 0;
return (errno);
}
return (0);
}
int
{
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks)) {
*recvd = 0;
return (ENOTSOCK);
}
if (error < 0) {
*recvd = 0;
return (errno);
}
return (0);
}
int
{
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks))
return (ENOTSOCK);
return (errno);
return (0);
}
int
{
int fd;
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks)) {
return (ENOTSOCK);
}
/*
* The real ksocket wakes up everything.
* It seems the only way we can do that
* is to go ahead and close the FD.
*/
return (0);
}
int
{
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks))
return (ENOTSOCK);
return (EFAULT);
return (errno);
return (0);
}
int
{
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks))
return (ENOTSOCK);
return (EFAULT);
return (errno);
return (0);
}
int
{
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks))
return (ENOTSOCK);
optlen = 0;
return (errno);
return (0);
}
int
{
int rval;
/* All Solaris components should pass a cred for this operation. */
if (!KSOCKET_VALID(ks))
return (ENOTSOCK);
if (rval != 0)
return (rval);
}
void
{
} else
}
void
{
/*
* When so_count equals 1 means no thread working on this ksocket
*/
} else {
}
}