/*
* 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 "../nsctl.h"
#include "../nsctl/nsc_ioctl.h"
#include "nskernd.h"
void *proc_nskernd;
int nskernd_iscluster;
static volatile int nskernd_k_wait;
static volatile int nskernd_u_wait;
static int nskernd_norun;
static volatile int nskernd_ask;
void
nskernd_init(void)
{
nskernd_norun = 0;
}
void
nskernd_deinit(void)
{
}
static int
{
int rc = 0;
if (proc_nskernd != NULL) {
rc = 1;
} else if (nskernd_norun != 0) {
rc = 2;
} else {
}
return (rc);
}
/*
* must be called with nskernd_lock held.
*/
void
nskernd_cleanup(void)
{
proc_nskernd = NULL;
}
void
nskernd_stop(void)
{
if (proc_nskernd == NULL) {
nskernd_norun = 1;
return;
}
while (nskernd_u_wait == 0) {
if (proc_nskernd == NULL) {
return;
}
}
}
int
{
if (proc_nskernd == NULL) {
return (ENXIO);
}
while (nskernd_u_wait == 0 || nskernd_ask) {
if (proc_nskernd == NULL) {
return (ENXIO);
}
}
nskernd_ask++;
if (proc_nskernd == NULL) {
nskernd_ask--;
return (ENXIO);
}
nskernd_ask--;
if (nskernd_k_wait > 0)
return (0);
}
int
{
int rc;
*rvalp = 0;
rc = 0;
return (EFAULT);
}
case NSKERND_START: /* User program start */
break;
case NSKERND_STOP: /* User program requesting stop */
break;
case NSKERND_WAIT:
if (nskernd_ask > 0)
/*
* woken by cv_signal() or cv_broadcast()
*/
} else {
/*
* signal - the user process has blocked all
* signals except for SIGTERM and the
* uncatchables, so the process is about to die
* and we need to clean up.
*/
}
break;
}
break;
case NSKERND_NEWLWP:
/* save kmem by freeing the udata structure */
break;
case NSKERND_LOCK:
/* save kmem by freeing the udata structure */
break;
default:
break;
}
}
return (rc);
}
/*
* This function is included for SV ioctl processing only.
*/
int
nskernd_isdaemon(void)
{
void *this_proc;
if (proc_nskernd == NULL)
return (0);
return (0);
return (proc_nskernd == this_proc);
}