17c478bd9Sstevel@tonic-gate#!/bin/sh 27c478bd9Sstevel@tonic-gate# 37c478bd9Sstevel@tonic-gate# CDDL HEADER START 47c478bd9Sstevel@tonic-gate# 57c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 645916cd2Sjpk# Common Development and Distribution License (the "License"). 745916cd2Sjpk# You may not use this file except in compliance with the License. 87c478bd9Sstevel@tonic-gate# 97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate# and limitations under the License. 137c478bd9Sstevel@tonic-gate# 147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate# 207c478bd9Sstevel@tonic-gate# CDDL HEADER END 217c478bd9Sstevel@tonic-gate# 227c478bd9Sstevel@tonic-gate# 2345916cd2Sjpk# Copyright 2006 Sun Microsystems, Inc. All rights reserved. 2445916cd2Sjpk# Use is subject to license terms. 2545916cd2Sjpk# 267c478bd9Sstevel@tonic-gate# ident "%Z%%M% %I% %E% SMI" 277c478bd9Sstevel@tonic-gate# 2845916cd2Sjpk 297c478bd9Sstevel@tonic-gate# Automagically generate the audit_uevents.h header file. 307c478bd9Sstevel@tonic-gate# 317c478bd9Sstevel@tonic-gateDATABASE=audit_event.txt 327c478bd9Sstevel@tonic-gateHEADER_FILE=audit_uevents.h 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gatecat <<EOF > $HEADER_FILE 357c478bd9Sstevel@tonic-gate/* 3645916cd2Sjpk * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 3745916cd2Sjpk * Use is subject to license terms. 387c478bd9Sstevel@tonic-gate */ 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gate#ifndef _BSM_AUDIT_UEVENTS_H 417c478bd9Sstevel@tonic-gate#define _BSM_AUDIT_UEVENTS_H 427c478bd9Sstevel@tonic-gate 43*a6600459SstevelEOF 44*a6600459Sstevel 45*a6600459Sstevelgrep '^# ident' $DATABASE | sed -e 's/^#/#pragma/' \ 46*a6600459Sstevel -e "s/$DATABASE/$HEADER_FILE/" >> $HEADER_FILE 47*a6600459Sstevel 48*a6600459Sstevelcat <<EOF >> $HEADER_FILE 497c478bd9Sstevel@tonic-gate 507c478bd9Sstevel@tonic-gate/* 517c478bd9Sstevel@tonic-gate * User level audit event numbers. 527c478bd9Sstevel@tonic-gate * 537c478bd9Sstevel@tonic-gate * 0 Reserved as an invalid event number. 547c478bd9Sstevel@tonic-gate * 1 - 2047 Reserved for the Solaris Kernel events. 557c478bd9Sstevel@tonic-gate * 2048 - 32767 Reserved for the Solaris TCB programs. 567c478bd9Sstevel@tonic-gate * 32768 - 65535 Available for third party TCB applications. 577c478bd9Sstevel@tonic-gate * 587c478bd9Sstevel@tonic-gate */ 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate#ifdef __cplusplus 617c478bd9Sstevel@tonic-gateextern "C" { 627c478bd9Sstevel@tonic-gate#endif 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gateEOF 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gatenawk -F: '{if ((NF == 4) && substr($1,0,1) != "#") 677c478bd9Sstevel@tonic-gate if ($1 >= 2048) { 6845916cd2Sjpk # compute total output line length first 6945916cd2Sjpk tlen = length($2); 7045916cd2Sjpk llen = 8 + tlen; 7145916cd2Sjpk llen += 8 - (llen % 8); 7245916cd2Sjpk if (llen < 32) 7345916cd2Sjpk llen = 32; 7445916cd2Sjpk llen += length($1); 7545916cd2Sjpk llen += 8 - (llen % 8); 7645916cd2Sjpk llen += 5 + length($4) + length($3) + 3; 7745916cd2Sjpk 7845916cd2Sjpk # if line is too long, then print the comment first 7945916cd2Sjpk if (llen > 80) 8045916cd2Sjpk printf("/* =%s %s */\n", $4, $3); 8145916cd2Sjpk 8245916cd2Sjpk printf("#define\t%s\t", $2) 8345916cd2Sjpk if (tlen < 8) 8445916cd2Sjpk printf("\t"); 8545916cd2Sjpk if (tlen < 16) 8645916cd2Sjpk printf("\t") 8745916cd2Sjpk printf("%s", $1); 8845916cd2Sjpk 8945916cd2Sjpk if (llen > 80) 9045916cd2Sjpk printf("\n"); 9145916cd2Sjpk else 9245916cd2Sjpk printf("\t/* =%s %s */\n", $4, $3); 937c478bd9Sstevel@tonic-gate } 947c478bd9Sstevel@tonic-gate }' \ 957c478bd9Sstevel@tonic-gate< $DATABASE >> $HEADER_FILE 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gatecat <<EOF >> $HEADER_FILE 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gate#ifdef __cplusplus 1007c478bd9Sstevel@tonic-gate} 1017c478bd9Sstevel@tonic-gate#endif 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate#endif /* _BSM_AUDIT_UEVENTS_H */ 1047c478bd9Sstevel@tonic-gateEOF 1057c478bd9Sstevel@tonic-gate 1067c478bd9Sstevel@tonic-gateexit 0 107