4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 1997-2000 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include <sys/types.h>
36 * ioctl() system call -- executed by subject process.
39 pr_ioctl(struct ps_prochandle
*Pr
, int fd
, int code
, void *buf
, size_t size
)
41 sysret_t rval
; /* return value from ioctl() */
42 argdes_t argd
[3]; /* arg descriptors for ioctl() */
43 argdes_t
*adp
= &argd
[0]; /* first argument */
46 if (Pr
== NULL
) /* no subject process */
47 return (ioctl(fd
, code
, buf
));
50 adp
->arg_object
= NULL
;
51 adp
->arg_type
= AT_BYVAL
;
52 adp
->arg_inout
= AI_INPUT
;
54 adp
++; /* move to code argument */
56 adp
->arg_value
= code
;
57 adp
->arg_object
= NULL
;
58 adp
->arg_type
= AT_BYVAL
;
59 adp
->arg_inout
= AI_INPUT
;
61 adp
++; /* move to buffer argument */
64 adp
->arg_value
= (long)buf
;
65 adp
->arg_object
= NULL
;
66 adp
->arg_type
= AT_BYVAL
;
67 adp
->arg_inout
= AI_INPUT
;
71 adp
->arg_object
= buf
;
72 adp
->arg_type
= AT_BYREF
;
73 adp
->arg_inout
= AI_INOUT
;
77 error
= Psyscall(Pr
, &rval
, SYS_ioctl
, 3, &argd
[0]);
80 errno
= (error
> 0)? error
: ENOSYS
;
83 return (rval
.sys_rval1
);