/*
* 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.
*/
#include <sys/drctl_impl.h>
int
{
int rv;
switch (cmd) {
&setup_rqst, sizeof (setup_rqst), 0) != 0) {
"for DRCTL_IOCTL_CONNECT_SERVER");
break;
}
rv = 0;
break;
default:
}
return (rv);
}
int
{
int up_err;
int rv = 0;
if (dh)
else
return (EIO);
/*
* We don't know the size of the message the daemon
* will pass back to us. By setting rbuf to NULL,
* we force the door code to allocate a buf of the
* appropriate size. We must set rsize > 0, however,
* else the door code acts as if no response was
* expected and doesn't pass the data to us.
*/
DR_DBG_CTL("%s: msg %p size %ld obufp %p osize %p\n",
if (up_err == 0) {
goto done;
DR_DBG_KMEM("%s: (door) alloc addr %p size %ld\n",
} else {
/*
* No output buffer pointer was passed in,
* so the response buffer allocated by the
* door code must be deallocated.
*/
}
} else {
switch (up_err) {
case EINTR:
case EAGAIN:
/*
* Server process may be forking, try again.
*/
goto retry;
case EBADF:
case EINVAL:
break;
default:
DR_DBG_CTL("%s: unexpected return "
break;
}
}
done:
return (rv);
}