.\" .\" Copyright (c) 1999-2007 Apple Inc. All rights reserved. .\" .\" @APPLE_LICENSE_HEADER_START@ .\" .\" This file contains Original Code and/or Modifications of Original Code .\" as defined in and that are subject to the Apple Public Source License .\" Version 2.0 (the 'License'). You may not use this file except in .\" compliance with the License. Please obtain a copy of the License at .\" http://www.opensource.apple.com/apsl/ and read it before using this .\" file. .\" .\" The Original Code and all software distributed under the License are .\" distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER .\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, .\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, .\" FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. .\" Please see the License for the specific language governing rights and .\" limitations under the License. .\" .\" @APPLE_LICENSE_HEADER_END@ .\" .\" $NetBSD: nfssvc.2,v 1.6 1995/02/27 12:35:08 cgd Exp $ .\" .\" Copyright (c) 1989, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)nfssvc.2 8.1 (Berkeley) 6/9/93 .\" .Dd January 9, 2007 .Dt NFSSVC 2 .Os .Sh NAME .Nm nfssvc .Nd NFS services .Sh SYNOPSIS .Fd #include .Fd #include .Ft int .Fn nfssvc "int flags" "void *argstructp" .Sh DESCRIPTION The .Fn nfssvc function is used by the NFS server daemon to pass information into and out of the kernel and also to enter the kernel as a server daemon. The .Fa flags argument consists of several bits that show what action is to be taken once in the kernel and the .Fa argstructp points to any corresponding data that the action may require. .Pp .Fn nfssvc is called with the flag .Dv NFSSVC_NFSD and a NULL .Fa argstructp to enter the kernel as an .Xr nfsd 8 daemon. The .Dv NFSSVC_NFSD action normally does not return until the NFS server is stopped. .Pp The .Xr nfsd 8 server daemon calls .Fn nfssvc with the flag .Dv NFSSVC_ADDSOCK and a pointer to a .Bd -literal struct nfsd_args { int sock; /* Socket to serve */ caddr_t name; /* Client address for connection based sockets */ int namelen; /* Length of name */ }; .Ed .sp to pass a server side .Tn NFS socket into the kernel for servicing by the .Xr nfsd 8 daemons. .Pp The .Xr nfsd 8 server daemon calls .Fn nfssvc with the flag .Dv NFSSVC_EXPORT and a pointer to a .Bd -literal struct nfs_export_args { uint32_t nxa_fsid; /* export FS ID */ uint32_t nxa_expid; /* export ID */ char *nxa_fspath; /* export FS path */ char *nxa_exppath; /* export sub-path */ uint32_t nxa_flags; /* export arg flags */ uint32_t nxa_netcount; /* #entries in ex_nets array */ struct nfs_export_net_args *nxa_nets; /* array of net args */ }; .Ed .sp to pass exported file system information into the kernel. .Sh RETURN VALUES Upon successful completion, a value of 0 is returned. Otherwise, -1 is returned the global variable .Va errno is set to specify the error. .Pp .Sh ERRORS .Bl -tag -width Er .It Bq Er EPERM The caller is not the super-user. .It Bq Er EINVAL The action specified by the .Fa flags argument was not valid. .It Bq EFAULT .Fa argstructp points to an invalid address. .It Bq ENOMEM A memory allocation failure prevented the action from completing. .It Bq EEXIST An attempt was made to add a UDP socket via the .Dv NFSSVC_ADDSOCK action, but the UDP socket has already been added. .El .Sh SEE ALSO .Xr nfsd 8 .Sh HISTORY The .Nm nfssvc function first appeared in 4.4BSD. .Sh BUGS The .Nm nfssvc system call is designed specifically for the .Tn NFS server daemons and as such is specific to their requirements. Several fields of the argument structures are assumed to be valid, such that .Nm nfssvc must be used with extreme care.