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) 2000 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #pragma ident "%Z%%M% %I% %E% SMI"
39 #include <fcode/private.h>
40 #include <fcode/log.h>
42 #include <fcdriver/fcdriver.h>
44 #define FCC_MAX_CELLS 10
47 fc_run_priv(common_data_t
*cdp
, char *service
, int nin
, int nout
, ...)
51 fc_cell_t fc_req
[FCC_FIXED_CELLS
+FCC_MAX_CELLS
];
52 struct fc_client_interface
*cip
= (struct fc_client_interface
*)fc_req
;
56 no_err
= nin
& FCRP_NOERROR
;
59 bzero(fc_req
, sizeof (fc_req
));
60 if (nin
+ nout
> FCC_MAX_CELLS
) {
61 log_message(MSG_ERROR
, "%s: too many ins (%d) and outs (%d)\n",
63 nin
= min(nin
, FCC_MAX_CELLS
);
64 nout
= FCC_MAX_CELLS
- nin
;
67 cip
->svc_name
= fc_ptr2cell(service
);
68 cip
->nargs
= fc_int2cell(nin
);
69 cip
->nresults
= fc_int2cell(nout
);
70 for (i
= 0; i
< nin
; i
++)
71 fc_arg(cip
, i
) = va_arg(ap
, fc_cell_t
);
72 error
= ioctl(cdp
->fcode_fd
, FC_RUN_PRIV
, cip
);
73 for (i
= 0; i
< nout
; i
++) {
74 fcp
= va_arg(ap
, fc_cell_t
*);
75 *fcp
= fc_result(cip
, i
);
80 error_msg
= strerror(errno
);
81 else if (cip
->priv_error
) {
82 error_msg
= "Priv violation";
84 } else if (cip
->error
) {
88 if ((error
& !no_err
) ||
89 (get_interpreter_debug_level() & DEBUG_REG_ACCESS
)) {
91 log_message(MSG_ERROR
, "%s: FC_RUN_PRIV: %s: ",
92 cdp
->Progname
, error_msg
);
93 log_message(MSG_ERROR
, "%s ( ", service
);
94 for (i
= 0; i
< nin
; i
++)
95 log_message(MSG_ERROR
, "%llx ",
96 (uint64_t)fc_arg(cip
, i
));
97 log_message(MSG_ERROR
, ")");
101 log_message(MSG_ERROR
, " ->");
102 for (i
= 0; i
< nout
; i
++)
103 log_message(MSG_ERROR
, " %llx",
104 (uint64_t)fc_result(cip
, i
));
106 log_message(MSG_ERROR
, " OK");
107 log_message(MSG_ERROR
, "\n");