/*
* 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.
*/
#define __NSC_GEN__
#include "../nsctl.h"
#include "nskernd.h"
struct nsc_nlwp {
void (*fn)(void *);
void *arg;
volatile int ready;
int errno;
};
void
_nsc_start_proc(void)
{
}
void
_nsc_stop_proc(void)
{
}
/*
* Create a daemon (server) proc.
*
* If 'rt' is TRUE, then increase the scheduling priority of the lwp.
* Exactly how, if at all, this feature is implemented is at the
* discretion of nskernd.
*
* Returns 0 or errno.
*/
int
{
int rc = 0;
if (nlwp) {
}
if (nsk) {
}
return (ENOMEM);
}
nsc_nlwp_top = nlwp;
/* user level returns error in nsk->data1 */
if (!rc) {
/*
* wait for the child to start and check in.
*/
}
}
/*
* remove from list of outstanding requests.
*/
break;
}
}
return (rc);
}
/*
* Child lwp calls this function when it returns to the kernel.
*
* Check if the args are still on the pending list. If they are, then
* run the required function. If they are not, then something went
* wrong, so just return back to userland and die.
*/
void
{
void (*fn)(void *);
void *fn_arg;
/*
* check that the request is still on the list of work to do
*/
/* mark as ready */
break;
}
}
if (fn) {
}
}
/*
* Create a thread that acquires an inter-node lock.
*
* mode - 0 (read), 1 (write).
* lockp - used to return the opaque address of a sync structure, which
* must be passed to nsc_do_unlock() later.
*
* Returns 0 or errno.
*/
int
{
int rc = 0;
if (nlwp) {
}
if (nsk) {
}
return (ENOMEM);
}
nsc_nlwp_top = nlwp;
/* user level returns error in nsk->data1 */
if (!rc) {
/*
* wait for the child to start and check in.
*/
}
/* retrieve errno from child's lock operation */
}
if (rc) {
/*
* error - remove from list of outstanding requests as
* child will not be checking in (nskernd_get() failed
* or user thread create failed) or will not be waiting
* (child thread lock failure).
*/
break;
}
}
return (rc);
}
/* success, return argument for nsc_do_unlock() */
return (0);
}
void
{
/* find child on work list */
/* signal unlock */
}
}
}
/*
* Lock child thread calls this function when it returns to the kernel.
*
* Check if the args are still on the pending list. If they are, then
* post the lock results and wait for the unlock. If they are not,
* then something went wrong, so just return back to userland and die.
*/
void
{
if (!arg) {
return;
}
/*
* check that the request is still on the list of work to do
*/
/* mark as ready */
break;
}
}
/*
* Error - either this request is no longer on the work
* queue, or there was an error in the userland lock code
* in which case the lock caller (currently blocked in
* nsc_do_lock() will do the cleanup.
*/
return;
}
/*
* no errors, so wait for an unlock
*/
}
/*
* remove self from list of outstanding requests.
*/
break;
}
}
/*
* cleanup
*/
}