socksctpvnops.c revision e6f13f867aee09b686a93cafd9c45389c0997ca6
/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/vfs_opreg.h>
#include <sys/sysmacros.h>
#include <sys/socketvar.h>
#include <inet/sctp_itf.h>
#include "socksctp.h"
/*
* SCTP sockfs vnode operations
*/
caller_context_t *);
struct cred *, caller_context_t *);
caller_context_t *);
caller_context_t *);
caller_context_t *);
static int socksctpv_poll(struct vnode *, short, int, short *,
struct pollhead **, caller_context_t *);
const fs_operation_def_t socksctp_vnodeops_template[] = {
};
struct vnodeops *socksctp_vnodeops;
/*ARGSUSED3*/
static int
{
struct sctp_sonode *ss;
int error = 0;
if (flag & SO_ACCEPTOR) {
/*
* Protocol control block already created
*/
return (0);
}
/*
* Active open.
*/
} else {
}
}
return (error);
}
/*ARGSUSED*/
static int
{
struct sctp_sonode *ss;
struct sctp_sa_id *ssi;
struct sctp_soassoc *ssa;
int sendsig = 0;
int32_t i;
if (count > 1) {
return (0);
}
/*
* Need to set flags as there might be ops in progress on
* this socket.
*
* If socket already disconnected/disconnecting,
* don't send signal (again).
*/
sendsig |= SCTPSIG_READ;
sendsig |= SCTPSIG_WRITE;
soisdisconnected(so, 0);
/*
* Initiate connection shutdown. Update SCTP's receive
* window.
*/
/*
* New associations can't come in, but old ones might get
* closed in upcall. Protect against that by taking a reference
* on the association.
*/
ssa->ssa_rxqueued);
}
}
if (sendsig != 0) {
}
}
return (0);
}
/*ARGSUSED2*/
static int
{
return (EOPNOTSUPP);
}
lmsg.msg_namelen = 0;
lmsg.msg_controllen = 0;
}
/*
* Send data, see sosctp_sendmsg()
*/
/*ARGSUSED2*/
static int
{
struct sctp_sonode *ss;
int error;
return (EOPNOTSUPP);
}
for (;;) {
return (EPIPE);
}
if (error != 0) {
return (error);
}
}
break;
return (EAGAIN);
} else {
/*
* Xmit window full in a blocking socket.
* Wait for space to become available and try again.
*/
if (error == 0) { /* signal */
return (EINTR);
}
}
}
return (ENOTCONN);
}
/* Don't allow sending a message larger than the send buffer size. */
return (EMSGSIZE);
}
if (count == 0) {
return (0);
}
goto error_ret;
}
/* Copy in the message. */
goto error_ret;
}
if (error == 0)
return (0);
return (error);
}
/*ARGSUSED4*/
static int
{
struct sctp_sonode *ss;
int error;
int intval;
struct sctp_soassoc *ssa;
void *conn;
void *buf;
int buflen;
/* handle socket specific ioctls */
switch (cmd) {
case FIONBIO:
return (EFAULT);
}
if (value) {
} else {
}
return (0);
case FIOASYNC:
return (EFAULT);
}
if (value) {
/* Turn on SIGIO */
} else {
/* Turn off SIGIO */
}
return (0);
case SIOCSPGRP:
case FIOSETOWN:
return (EFAULT);
}
return (error);
case SIOCGPGRP:
case FIOGETOWN:
return (EFAULT);
return (0);
case SIOCATMARK:
/*
* No support for urgent data.
*/
intval = 0;
return (EFAULT);
return (0);
/* from strioctl */
case FIONREAD:
/*
* Return number of bytes of data in all data messages
* in queue in "arg".
* For stream socket, amount of available data.
* For sock_dgram, # of available bytes + addresses.
*/
return (EFAULT);
return (0);
case SIOCSCTPGOPT:
return (EFAULT);
}
return (EINVAL);
/*
* Find the correct sctp_t based on whether it is 1-N socket
* or not.
*/
return (error);
}
} else {
}
/* Copyin the option buffer and then call sctp_get_opt(). */
/* Let's allocate a buffer enough to hold an int */
}
return (EFAULT);
}
/* The option level has to be IPPROTO_SCTP */
}
/* No error, copyout the result with the correct buf len. */
if (error == 0) {
}
}
return (error);
case SIOCSCTPSOPT:
return (EFAULT);
}
return (EINVAL);
/*
* Find the correct sctp_t based on whether it is 1-N socket
* or not.
*/
if (intval != 0) {
return (error);
}
} else {
}
/* Copyin the option buffer and then call sctp_set_opt(). */
}
return (EFAULT);
}
/* The option level has to be IPPROTO_SCTP */
if (ssa) {
}
return (error);
case SIOCSCTPPEELOFF: {
struct sctp_uc_swap us;
int nfd;
return (EOPNOTSUPP);
}
return (EFAULT);
}
if (intval == 0) {
return (EINVAL);
}
/*
* Find accessvp. This is different from parent's vp,
* as the socket type is different.
*/
return (error);
}
/*
* Allocate the user fd.
*/
return (EMFILE);
}
/*
* Copy the fd out.
*/
goto err;
}
/*
* Don't use sosctp_assoc() in order to peel off disconnected
* associations.
*/
goto err;
}
goto err;
}
/*
* Upcalls to new socket are blocked for the duration of
* downcall.
*/
if (error) {
goto peelerr;
}
if (error) {
goto peelerr;
}
/*
* fill in the entries that falloc reserved
*/
return (0);
err:
return (error);
/* held in VOP_OPEN() */
return (error);
}
default:
return (EINVAL);
}
}
/*
* Allow any flags. Record FNDELAY and FNONBLOCK so that they can be inherited
* from listener to acceptor.
*/
/* ARGSUSED */
static int
{
else
else
return (0);
}
/*ARGSUSED*/
static void
{
struct sctp_sonode *ss;
struct sctp_sa_id *ssi;
struct sctp_soassoc *ssa;
int32_t i;
/*
* If no one has reclaimed the vnode, remove from the
* cache now.
*/
/*
* Drop the temporary hold by vn_rele now
*/
return;
}
/* We are the sole owner of so now */
/*
* New associations can't come in, but old ones might get
* closed in upcall. Protect against that by taking a reference
* on the association.
*/
}
}
}
}
/*
* Check socktpi_poll() on why so_lock is not held in this function.
*/
/*ARGSUSED5*/
static int
{
struct sctp_sonode *ss;
short origevents = events;
int so_state;
/*
* Not connected yet - turn off write side events
*/
}
/*
* Check for errors
*/
return (0);
}
*reventsp = 0;
/*
* Don't mark socket as writable until TX queued data is
* below watermark.
*/
}
} else {
}
}
}
}
return (0);
}