/* A single 'fd' number was written, in which case it must be for a socket of a supported family/protocol, and we use it as an nfsd listener.  */
static ssize_t __write_ports_addfd(char *buf)
/* A single 'fd' number was written, in which case it must be for a socket of a supported family/protocol, and we use it as an nfsd listener.  */
static ssize_t __write_ports_addfd(char *buf)
{
	char *mesg = buf;
	int fd, err;
	err = get_int(&mesg, &fd);
	if (err != 0 || fd < 0)
		return -EINVAL;
	err = nfsd_create_serv();
	if (err != 0)
		return err;
	err = lockd_up();
	if (err != 0)
		goto out;
	err = svc_addsock(nfsd_serv, fd, buf, SIMPLE_TRANSACTION_LIMIT);
	if (err < 0)
		lockd_down();
out:
	nfsd_serv->sv_nrthreads--;
	return err;
}