005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil * CDDL HEADER START
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil * The contents of this file are subject to the terms of the
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil * Common Development and Distribution License (the "License").
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil * You may not use this file except in compliance with the License.
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil * or http://www.opensolaris.org/os/licensing.
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil * See the License for the specific language governing permissions
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil * and limitations under the License.
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil * When distributing Covered Code, include this CDDL HEADER in each
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil * If applicable, add the following below this CDDL HEADER, with the
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil * fields enclosed by brackets "[]" replaced with your own identifying
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil * information: Portions Copyright [yyyy] [name of copyright owner]
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil * CDDL HEADER END
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil * Use is subject to license terms.
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil/* process audit data (pad) cache */
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil * increment audit path reference count
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil * decrement audit path reference count
1a5e258f5471356ca102c7176637cdce45bac147Josef 'Jeff' Sipek if (atomic_dec_32_nv(&app->audp_ref) > 0)
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil * allocate a new auditpath
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil * newsect = increment sections count,
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil * charincr = change in strings storage
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisilau_pathdup(const struct audit_path *oldapp, int newsect, int charincr)
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil oldlen = (oldapp->audp_sect[oldapp->audp_cnt] - oldcp);
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil (oldapp->audp_cnt + newsect) * sizeof (char *) +
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil newapp->audp_cnt = oldapp->audp_cnt + newsect;
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil newcp = (char *)(&newapp->audp_sect[newapp->audp_cnt + 1]);
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil * if this is a new section, set its end
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil * if this is an extended section, reset its end
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil newapp->audp_sect[newapp->audp_cnt] = newcp + oldlen + charincr;
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil /* copy all of the old strings */
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisilau_pad_const(void *vpad, void *priv, int flags)
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil mutex_init(&pad->pad_lock, NULL, MUTEX_DEFAULT, NULL);
005d3feb53a9a10272d4a24b03991575d6a9bcb3Marek Pospisil au_pad_cache = kmem_cache_create("audit_proc",