8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / lib / libproc / common / pr_door.c
blobad4a2de30c4560dd0155f7667f0c3d4eb8644b27
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
29 #include <stdlib.h>
30 #include <unistd.h>
31 #include <errno.h>
32 #include <door.h>
33 #include "libproc.h"
36 * door() system calls -- executed by subject process
39 int
40 pr_door_info(struct ps_prochandle *Pr, int did, door_info_t *di)
42 sysret_t rval; /* return value from door_info() */
43 argdes_t argd[6]; /* arg descriptors for door_info() */
44 argdes_t *adp = &argd[0]; /* first argument */
45 int error;
47 if (Pr == NULL) /* no subject process */
48 return (door_info(did, di));
50 adp->arg_value = did;
51 adp->arg_object = NULL;
52 adp->arg_type = AT_BYVAL;
53 adp->arg_inout = AI_INPUT;
54 adp->arg_size = 0;
55 adp++; /* move to door_info_t argument */
57 adp->arg_value = 0;
58 adp->arg_object = di;
59 adp->arg_type = AT_BYREF;
60 adp->arg_inout = AI_OUTPUT;
61 adp->arg_size = sizeof (door_info_t);
62 adp++; /* move to unused argument */
64 adp->arg_value = 0;
65 adp->arg_object = NULL;
66 adp->arg_type = AT_BYVAL;
67 adp->arg_inout = AI_INPUT;
68 adp->arg_size = 0;
69 adp++; /* move to unused argument */
71 adp->arg_value = 0;
72 adp->arg_object = NULL;
73 adp->arg_type = AT_BYVAL;
74 adp->arg_inout = AI_INPUT;
75 adp->arg_size = 0;
76 adp++; /* move to unused argument */
78 adp->arg_value = 0;
79 adp->arg_object = NULL;
80 adp->arg_type = AT_BYVAL;
81 adp->arg_inout = AI_INPUT;
82 adp->arg_size = 0;
83 adp++; /* move to subcode argument */
85 adp->arg_value = DOOR_INFO;
86 adp->arg_object = NULL;
87 adp->arg_type = AT_BYVAL;
88 adp->arg_inout = AI_INPUT;
89 adp->arg_size = 0;
91 error = Psyscall(Pr, &rval, SYS_door, 6, &argd[0]);
93 if (error) {
94 errno = (error < 0)? ENOSYS : error;
95 return (-1);
97 return (0);