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]
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
28 * stub module for kwarnd.
36 #include <sys/types.h>
37 #include <sys/devops.h>
42 #include <sys/sunddi.h>
46 extern CLIENT
*getkwarnd_handle(void);
47 extern void resetkwarnd_handle(void);
50 kwarn_add_warning(WARNING_NAME_T warning_name
, int cred_exp_time
)
52 kwarn_add_warning_arg args
;
53 kwarn_add_warning_res res
;
55 boolean_t first
= TRUE
;
58 /* check the input/output parameters */
59 if (warning_name
== NULL
|| cred_exp_time
== 0)
63 /* get the client handle to kwarnd */
64 if ((clnt
= getkwarnd_handle()) == NULL
) {
66 * Let app output if an error occurs but we'll syslog to
67 * DEBUG to get error details if needed.
69 syslog(LOG_DEBUG
, "%s",
70 clnt_spcreateerror("getkwarnd_handle"));
74 /* set the rpc parameters */
75 args
.cred_exp_time
= cred_exp_time
;
76 args
.warning_name
= warning_name
;
78 /* call the remote procedure */
79 memset(&res
, 0, sizeof (res
));
80 ret
= kwarn_add_warning_1(&args
, &res
, clnt
);
81 if (ret
!= RPC_SUCCESS
) {
83 * Could have timed out due to the process restarting for
84 * various reasons. Should attempt to rebind in the case
85 * process is actually running.
87 if (ret
== RPC_TIMEDOUT
&& first
) {
101 kwarn_del_warning(WARNING_NAME_T warning_name
)
103 kwarn_del_warning_arg args
;
104 kwarn_del_warning_res res
;
106 boolean_t first
= TRUE
;
109 /* check the output parameters */
110 if (warning_name
== NULL
)
114 /* get the client GSSD handle */
115 if ((clnt
= getkwarnd_handle()) == NULL
) {
117 * Let app output if an error occurs but we'll syslog to
118 * DEBUG to get error details if needed.
120 syslog(LOG_DEBUG
, "%s",
121 clnt_spcreateerror("getkwarnd_handle"));
125 /* set the input parameters */
126 args
.warning_name
= warning_name
;
128 /* call the remote procedure */
129 memset(&res
, 0, sizeof (res
));
130 ret
= kwarn_del_warning_1(&args
, &res
, clnt
);
131 if (ret
!= RPC_SUCCESS
) {
133 * Could have timed out due to the process restarting for
134 * various reasons. Should attempt to rebind in the case
135 * process is actually running.
137 if (ret
== RPC_TIMEDOUT
&& first
) {
138 resetkwarnd_handle();
145 /* nothing to free */