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 # 31 DATABASE=audit_event.txt 32 HEADER_FILE=audit_uevents.h 33 34 cat <<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 43 EOF 44 45 grep '^# ident' $DATABASE | sed -e 's/^#/#pragma/' \ 46 -e "s/$DATABASE/$HEADER_FILE/" >> $HEADER_FILE 47 48 cat <<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 61 extern "C" { 62 #endif 63 64 EOF 65 66 nawk -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 82 cat <<EOF >> $HEADER_FILE 83 84 #ifdef __cplusplus 85 } 86 #endif 87 88 #endif /* _BSM_AUDIT_UEVENTS_H */ 89 EOF 90 91 exit 0 92