OpenBSD manual page server

Manual Page Search Parameters

NFSSVC(2) System Calls Manual NFSSVC(2)

nfssvcNFS services

#include <unistd.h>
#include <nfs/nfs.h>

int
nfssvc(int flags, void *argstructp);

The () function is used by NFS daemons to pass information into the kernel and also to enter the kernel as a server daemon. The flags argument consists of several bits that show what action is to be taken once in the kernel and the argstructp points to one of two structures depending on which bits are set in flags.

To enter an nfsd(8) daemon into the kernel, () is called with the flag NFSSVC_NFSD and a pointer to a structure:

struct nfsd_srvargs {
        struct nfsd     *nsd_nfsd;   /* Pointer to in kernel nfsd struct */
        uid_t           nsd_uid;        /* Effective uid mapped to cred */
        u_int32_t       nsd_haddr;      /* IP address of client */
        struct ucred    nsd_cr;         /* Cred. uid maps to */
        int             nsd_authlen;    /* Length of auth string (ret) */
        u_char          *nsd_authstr;   /* Auth string (ret) */
        int             nsd_verflen;    /* and the verifier */
        u_char          *nsd_verfstr;
        struct timeval  nsd_timestamp;  /* timestamp from verifier */
        u_int32_t       nsd_ttl;        /* credential ttl (sec) */
        NFSKERBKEY_T    nsd_key;        /* Session key */
};

To add further sockets for processing by the nfsd(8) server daemons the master nfsd(8) daemon calls () with the flag NFSSVC_ADDSOCK and a pointer to a structure:

struct nfsd_args {
        int     sock;     /* Socket to serve */
        caddr_t name;     /* Client address for connection based sockets */
        int     namelen;  /* Length of name */
};

Normally nfssvc does not return unless the server is terminated by a signal when a value of 0 is returned. Otherwise, -1 is returned and the global variable errno is set to specify the error.

[]
The caller is not the superuser.
[]
The flag argument consisted of incompatible or otherwise unsupported bits.

mount_nfs(8), nfsd(8), sysctl(8)

The nfssvc function first appeared in 4.4BSD.

The nfssvc system call is designed specifically for the NFS support daemons and as such is specific to their requirements. Several fields of the argument structures are assumed to be valid and sometimes to be unchanged from a previous call, such that nfssvc() must be used with extreme care.

May 31, 2007 OpenBSD-5.4