/*
* 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 (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Portions of this source code were derived from Berkeley 4.3 BSD
* under license from the Regents of the University of California.
*/
/*
* This module provides the user level support for the NFSv4
* callback program. It is modeled after nfsd. When a nfsv4
* mount occurs, the mount command forks and the child runs
* start_nfs4_callback. If this is the first mount, then the
* process will hang around listening for incoming connection
* requests from the nfsv4 server.
*
* For connection-less protocols, the krpc is started immediately.
* For connection oriented protocols, the kernel module is informed
* of netid and universal address that it can give this
* information to the server during setclientid.
*/
#include <syslog.h>
#include <tiuser.h>
#include <errno.h>
#include <thread.h>
#include <sys/resource.h>
#include <stdio.h>
#include <stdlib.h>
#include <netconfig.h>
#include <netdir.h>
#include <string.h>
#include <unistd.h>
#include <stropts.h>
#include "nfs_tbind.h"
#include "thrpool.h"
#include <rpcsvc/nfs4_prot.h>
#include <netdb.h>
#include <signal.h>
#include <strings.h>
#include <priv_utils.h>
#include <rpcsvc/daemon_utils.h>
struct netbuf *);
extern int _nfssys(int, void *);
static char *MyName;
/*
* The following are all globals used by routines in nfs_tbind.c.
*/
/* used by cots_listen_event() */
int
{
int pid;
int i;
struct flock f;
MyName = "nfs4cbd";
#ifndef DEBUG
/*
* standard input, output, and error, and detach from
* controlling terminal.
*/
closefrom(0);
(void) dup(1);
(void) setsid();
#endif
/*
* create a child to continue our work
* Parent's exit will tell mount command we're ready to go
*/
exit(0);
}
if (pi == -1) {
"Could not start NFS4_CALLBACK service");
exit(1);
}
svcsetprio();
" privileges\n", argv[0]);
exit(1);
}
/* Basic privileges we don't need, remove from E/P. */
/*
* establish our lock on the lock file and write our pid to it.
* exit if some other process holds the lock, or if there's any
*/
switch (pid) {
case 0:
break;
case -1:
exit(2);
default:
/* daemon was already running */
exit(0);
}
cb_svcpool.maxthreads = 0;
cb_svcpool.redline = 0;
cb_svcpool.qsize = 0;
cb_svcpool.timeout = 0;
cb_svcpool.stksize = 0;
cb_svcpool.max_same_xprt = 0;
/* create a SVC_POOL for the nfsv4 callback deamon */
exit(1);
}
/*
* Set up blocked thread to do LWP creation on behalf of the kernel.
*/
if (svcwait(NFS_CB_SVCPOOL_ID)) {
"Can't set up NFS_CB LWP creator: Exiting");
exit(1);
}
/*
* Build a protocol block list for registration.
*/
exit(1);
}
if (num_fds == 0) {
"Could not start NFS4_CALLBACK service for any protocol");
exit(1);
}
/*
* Poll for non-data control events on the transport descriptors.
*/
/*
* If we get here, something failed in poll_for_action().
*/
return (1);
}
char *
{
#ifdef DEBUG
#endif
return (NULL);
}
#ifdef DEBUG
netdir_perror("netdir_getbyname");
#endif
return (NULL);
}
#ifdef DEBUG
#endif
return (NULL);
}
#ifdef DEBUG
netdir_perror("netdir_options");
#endif
return (NULL);
}
return (mua);
}
/*
* Establish NFS4 callback service thread.
*/
static int
{
char *ua;
int error;
"binding for transport %s - delegations will not be "
return (0);
}
#ifdef DEBUG
if (cmd & NFS4_KRPC_START)
else
#endif
if (addrmask)
else
return (error);
}