1 0 stevel #!/bin/sh 2 0 stevel # 3 0 stevel # CDDL HEADER START 4 0 stevel # 5 0 stevel # The contents of this file are subject to the terms of the 6 1676 jpk # Common Development and Distribution License (the "License"). 7 1676 jpk # You may not use this file except in compliance with the License. 8 0 stevel # 9 0 stevel # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 0 stevel # or http://www.opensolaris.org/os/licensing. 11 0 stevel # See the License for the specific language governing permissions 12 0 stevel # and limitations under the License. 13 0 stevel # 14 0 stevel # When distributing Covered Code, include this CDDL HEADER in each 15 0 stevel # file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 0 stevel # If applicable, add the following below this CDDL HEADER, with the 17 0 stevel # fields enclosed by brackets "[]" replaced with your own identifying 18 0 stevel # information: Portions Copyright [yyyy] [name of copyright owner] 19 0 stevel # 20 0 stevel # CDDL HEADER END 21 0 stevel # 22 0 stevel # 23 1676 jpk # Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24 1676 jpk # Use is subject to license terms. 25 1676 jpk # 26 0 stevel # ident "%Z%%M% %I% %E% SMI" 27 0 stevel # 28 1676 jpk 29 0 stevel # Automagically generate the audit_uevents.h header file. 30 0 stevel # 31 0 stevel DATABASE=audit_event.txt 32 0 stevel HEADER_FILE=audit_uevents.h 33 0 stevel 34 0 stevel cat <<EOF > $HEADER_FILE 35 0 stevel /* 36 1676 jpk * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 37 1676 jpk * Use is subject to license terms. 38 0 stevel */ 39 0 stevel 40 0 stevel #ifndef _BSM_AUDIT_UEVENTS_H 41 0 stevel #define _BSM_AUDIT_UEVENTS_H 42 0 stevel 43 2026 stevel EOF 44 2026 stevel 45 2026 stevel grep '^# ident' $DATABASE | sed -e 's/^#/#pragma/' \ 46 2026 stevel -e "s/$DATABASE/$HEADER_FILE/" >> $HEADER_FILE 47 2026 stevel 48 2026 stevel cat <<EOF >> $HEADER_FILE 49 0 stevel 50 0 stevel /* 51 0 stevel * User level audit event numbers. 52 0 stevel * 53 0 stevel * 0 Reserved as an invalid event number. 54 0 stevel * 1 - 2047 Reserved for the Solaris Kernel events. 55 0 stevel * 2048 - 32767 Reserved for the Solaris TCB programs. 56 0 stevel * 32768 - 65535 Available for third party TCB applications. 57 0 stevel * 58 0 stevel */ 59 0 stevel 60 0 stevel #ifdef __cplusplus 61 0 stevel extern "C" { 62 0 stevel #endif 63 0 stevel 64 0 stevel EOF 65 0 stevel 66 0 stevel nawk -F: '{if ((NF == 4) && substr($1,0,1) != "#") 67 0 stevel if ($1 >= 2048) { 68 1676 jpk tlen = length($2); 69 1676 jpk 70 1676 jpk printf("#define\t%s\t", $2) 71 1676 jpk if (tlen < 8) 72 1676 jpk printf("\t"); 73 1676 jpk if (tlen < 16) 74 2640 rica printf("\t"); 75 2640 rica if (tlen < 24) 76 2640 rica printf("\t"); 77 2640 rica printf("%s\n", $1); 78 0 stevel } 79 0 stevel }' \ 80 0 stevel < $DATABASE >> $HEADER_FILE 81 0 stevel 82 0 stevel cat <<EOF >> $HEADER_FILE 83 0 stevel 84 0 stevel #ifdef __cplusplus 85 0 stevel } 86 0 stevel #endif 87 0 stevel 88 0 stevel #endif /* _BSM_AUDIT_UEVENTS_H */ 89 0 stevel EOF 90 0 stevel 91 0 stevel exit 0 92