1#!/bin/sh 2# 3# CDDL HEADER START 4# 5# The contents of this file are subject to the terms of the 6# Common Development and Distribution License (the "License"). 7# You may not use this file except in compliance with the License. 8# 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. 13# 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] 19# 20# CDDL HEADER END 21# 22# 23# Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24# Use is subject to license terms. 25# 26# ident "%Z%%M% %I% %E% SMI" 27# 28 29# Automagically generate the audit_uevents.h header file. 30# 31DATABASE=audit_event.txt 32HEADER_FILE=audit_uevents.h 33 34cat <<EOF > $HEADER_FILE 35/* 36 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 37 * Use is subject to license terms. 38 */ 39 40#ifndef _BSM_AUDIT_UEVENTS_H 41#define _BSM_AUDIT_UEVENTS_H 42 43EOF 44 45grep '^# ident' $DATABASE | sed -e 's/^#/#pragma/' \ 46 -e "s/$DATABASE/$HEADER_FILE/" >> $HEADER_FILE 47 48cat <<EOF >> $HEADER_FILE 49 50/* 51 * User level audit event numbers. 52 * 53 * 0 Reserved as an invalid event number. 54 * 1 - 2047 Reserved for the Solaris Kernel events. 55 * 2048 - 32767 Reserved for the Solaris TCB programs. 56 * 32768 - 65535 Available for third party TCB applications. 57 * 58 */ 59 60#ifdef __cplusplus 61extern "C" { 62#endif 63 64EOF 65 66nawk -F: '{if ((NF == 4) && substr($1,0,1) != "#") 67 if ($1 >= 2048) { 68 tlen = length($2); 69 70 printf("#define\t%s\t", $2) 71 if (tlen < 8) 72 printf("\t"); 73 if (tlen < 16) 74 printf("\t"); 75 if (tlen < 24) 76 printf("\t"); 77 printf("%s\n", $1); 78 } 79 }' \ 80< $DATABASE >> $HEADER_FILE 81 82cat <<EOF >> $HEADER_FILE 83 84#ifdef __cplusplus 85} 86#endif 87 88#endif /* _BSM_AUDIT_UEVENTS_H */ 89EOF 90 91exit 0 92