2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A
2N/A/*
2N/A * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A
2N/A#include <stdlib.h>
2N/A#include <unistd.h>
2N/A#include <errno.h>
2N/A#include <door.h>
2N/A#include "libproc.h"
2N/A
2N/A/*
2N/A * door() system calls -- executed by subject process
2N/A */
2N/A
2N/Aint
2N/Apr_door_info(struct ps_prochandle *Pr, int did, door_info_t *di)
2N/A{
2N/A sysret_t rval; /* return value from door_info() */
2N/A argdes_t argd[6]; /* arg descriptors for door_info() */
2N/A argdes_t *adp = &argd[0]; /* first argument */
2N/A int error;
2N/A
2N/A if (Pr == NULL) /* no subject process */
2N/A return (door_info(did, di));
2N/A
2N/A adp->arg_value = did;
2N/A adp->arg_object = NULL;
2N/A adp->arg_type = AT_BYVAL;
2N/A adp->arg_inout = AI_INPUT;
2N/A adp->arg_size = 0;
2N/A adp++; /* move to door_info_t argument */
2N/A
2N/A adp->arg_value = 0;
2N/A adp->arg_object = di;
2N/A adp->arg_type = AT_BYREF;
2N/A adp->arg_inout = AI_OUTPUT;
2N/A adp->arg_size = sizeof (door_info_t);
2N/A adp++; /* move to unused argument */
2N/A
2N/A adp->arg_value = 0;
2N/A adp->arg_object = NULL;
2N/A adp->arg_type = AT_BYVAL;
2N/A adp->arg_inout = AI_INPUT;
2N/A adp->arg_size = 0;
2N/A adp++; /* move to unused argument */
2N/A
2N/A adp->arg_value = 0;
2N/A adp->arg_object = NULL;
2N/A adp->arg_type = AT_BYVAL;
2N/A adp->arg_inout = AI_INPUT;
2N/A adp->arg_size = 0;
2N/A adp++; /* move to unused argument */
2N/A
2N/A adp->arg_value = 0;
2N/A adp->arg_object = NULL;
2N/A adp->arg_type = AT_BYVAL;
2N/A adp->arg_inout = AI_INPUT;
2N/A adp->arg_size = 0;
2N/A adp++; /* move to subcode argument */
2N/A
2N/A adp->arg_value = DOOR_INFO;
2N/A adp->arg_object = NULL;
2N/A adp->arg_type = AT_BYVAL;
2N/A adp->arg_inout = AI_INPUT;
2N/A adp->arg_size = 0;
2N/A
2N/A error = Psyscall(Pr, &rval, SYS_door, 6, &argd[0]);
2N/A
2N/A if (error) {
2N/A errno = (error < 0)? ENOSYS : error;
2N/A return (-1);
2N/A }
2N/A return (0);
2N/A}