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 (c) 2010, Oracle and/or its affiliates. All rights reserved.
29 #include "audit_msg.h"
31 #define BINDSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
32 MSG_LA_FLG_BINDTO_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
33 MSG_LA_FLG_BINDFROM_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
34 CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
37 * Ensure that Conv_la_bind_buf_t is large enough:
39 * BINDSZ is the real minimum size of the buffer required by conv_la_bind().
40 * However, Conv_la_bind_buf_t uses CONV_LA_BIND_BUFSIZE to set the
41 * buffer size. We do things this way because the definition of BINDSZ uses
42 * information that is not available in the environment of other programs
43 * that include the conv.h header file.
45 #if (CONV_LA_BIND_BUFSIZE != BINDSZ) && !defined(__lint)
46 #define REPORT_BUFSIZE BINDSZ
47 #include "report_bufsize.h"
48 #error "CONV_LA_BIND_BUFSIZE does not match BINDSZ"
52 * String conversion routine for la_objopen() return flags.
55 conv_la_bind(uint_t bind
, Conv_la_bind_buf_t
*la_bind_buf
)
57 static const Val_desc vda
[] = {
58 { LA_FLG_BINDTO
, MSG_LA_FLG_BINDTO
},
59 { LA_FLG_BINDFROM
, MSG_LA_FLG_BINDFROM
},
62 static CONV_EXPN_FIELD_ARG conv_arg
= {
63 NULL
, sizeof (la_bind_buf
->buf
), NULL
};
66 return (MSG_ORIG(MSG_GBL_ZERO
));
68 conv_arg
.buf
= la_bind_buf
->buf
;
69 conv_arg
.oflags
= conv_arg
.rflags
= bind
;
71 (void) conv_expn_field(&conv_arg
, vda
, 0);
73 return ((const char *)la_bind_buf
->buf
);
76 #define SEARCHSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
77 MSG_LA_SER_ORIG_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
78 MSG_LA_SER_LIBPATH_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
79 MSG_LA_SER_RUNPATH_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
80 MSG_LA_SER_DEFAULT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
81 MSG_LA_SER_CONFIG_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
82 MSG_LA_SER_SECURE_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
83 CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
86 * Ensure that Conv_la_search_buf_t is large enough:
88 * SEARCHSZ is the real minimum size of the buffer required by conv_la_search().
89 * However, Conv_la_search_buf_t uses CONV_LA_SEARCH_BUFSIZE to set the
90 * buffer size. We do things this way because the definition of SEARCHSZ uses
91 * information that is not available in the environment of other programs
92 * that include the conv.h header file.
94 #if (CONV_LA_SEARCH_BUFSIZE != SEARCHSZ) && !defined(__lint)
95 #define REPORT_BUFSIZE SEARCHSZ
96 #include "report_bufsize.h"
97 #error "CONV_LA_SEARCH_BUFSIZE does not match SEARCHSZ"
101 * String conversion routine for la_objsearch() flags.
104 conv_la_search(uint_t search
, Conv_la_search_buf_t
*la_search_buf
)
106 static const Val_desc vda
[] = {
107 { LA_SER_ORIG
, MSG_LA_SER_ORIG
},
108 { LA_SER_LIBPATH
, MSG_LA_SER_LIBPATH
},
109 { LA_SER_RUNPATH
, MSG_LA_SER_RUNPATH
},
110 { LA_SER_DEFAULT
, MSG_LA_SER_DEFAULT
},
111 { LA_SER_CONFIG
, MSG_LA_SER_CONFIG
},
112 { LA_SER_SECURE
, MSG_LA_SER_SECURE
},
115 static CONV_EXPN_FIELD_ARG conv_arg
= {
116 NULL
, sizeof (la_search_buf
->buf
), NULL
};
119 return (MSG_ORIG(MSG_GBL_NULL
));
121 conv_arg
.buf
= la_search_buf
->buf
;
122 conv_arg
.oflags
= conv_arg
.rflags
= search
;
124 (void) conv_expn_field(&conv_arg
, vda
, 0);
126 return ((const char *)la_search_buf
->buf
);
130 * String conversion routine for la_objopen() return flags.
134 * String conversion routine for la_activity() flags.
137 conv_la_activity(uint_t request
, Conv_fmt_flags_t fmt_flags
,
138 Conv_inv_buf_t
*inv_buf
)
140 static const Msg requests
[LA_ACT_MAX
] = {
141 MSG_LA_ACT_CONSISTENT
, /* MSG_ORIG(MSG_LA_ACT_CONSISTENT) */
142 MSG_LA_ACT_ADD
, /* MSG_ORIG(MSG_LA_ACT_ADD) */
143 MSG_LA_ACT_DELETE
/* MSG_ORIG(MSG_LA_ACT_DELETE) */
145 static const conv_ds_msg_t ds_requests
= {
146 CONV_DS_MSG_INIT(LA_ACT_CONSISTENT
, requests
) };
148 static const conv_ds_t
*ds
[] = { CONV_DS_ADDR(ds_requests
), NULL
};
150 return (conv_map_ds(ELFOSABI_NONE
, EM_NONE
, request
, ds
, fmt_flags
,
154 #define SYMBSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
155 MSG_LA_SYMB_NOPLTENTER_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
156 MSG_LA_SYMB_NOPLTEXIT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
157 MSG_LA_SYMB_STRUCTCALL_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
158 MSG_LA_SYMB_DLSYM_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
159 MSG_LA_SYMB_ALTVALUE_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
160 CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
163 * Ensure that Conv_la_symbind_buf_t is large enough:
165 * SYMBSZ is the real minimum size of the buffer required by conv_la_symbind().
166 * However, Conv_la_symbind_buf_t uses CONV_LA_SYMB_BUFSIZE to set the
167 * buffer size. We do things this way because the definition of SYMBSZ uses
168 * information that is not available in the environment of other programs
169 * that include the conv.h header file.
171 #if (CONV_LA_SYMBIND_BUFSIZE != SYMBSZ) && !defined(__lint)
172 #define REPORT_BUFSIZE SYMBSZ
173 #include "report_bufsize.h"
174 #error "CONV_LA_SYMBIND_BUFSIZE does not match SYMBSZ"
178 * String conversion routine for la_symbind() flags.
181 conv_la_symbind(uint_t symbind
, Conv_la_symbind_buf_t
*la_symbind_buf
)
183 static const Val_desc vda
[] = {
184 { LA_SYMB_NOPLTENTER
, MSG_LA_SYMB_NOPLTENTER
},
185 { LA_SYMB_NOPLTEXIT
, MSG_LA_SYMB_NOPLTEXIT
},
186 { LA_SYMB_STRUCTCALL
, MSG_LA_SYMB_STRUCTCALL
},
187 { LA_SYMB_DLSYM
, MSG_LA_SYMB_DLSYM
},
188 { LA_SYMB_ALTVALUE
, MSG_LA_SYMB_ALTVALUE
},
191 static CONV_EXPN_FIELD_ARG conv_arg
= {
192 NULL
, sizeof (la_symbind_buf
->buf
), NULL
};
195 return (MSG_ORIG(MSG_GBL_NULL
));
197 conv_arg
.buf
= la_symbind_buf
->buf
;
198 conv_arg
.oflags
= conv_arg
.rflags
= symbind
;
200 (void) conv_expn_field(&conv_arg
, vda
, 0);
202 return ((const char *)la_symbind_buf
->buf
);