xref: /illumos-gate/usr/src/lib/libbsm/mkhdr.sh (revision 6a634c9d)
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#
22*a1292211SMarek Pospisil# Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
237c478bd9Sstevel@tonic-gate#
2445916cd2Sjpk
257c478bd9Sstevel@tonic-gate# Automagically generate the audit_uevents.h header file.
267c478bd9Sstevel@tonic-gate#
277c478bd9Sstevel@tonic-gateDATABASE=audit_event.txt
287c478bd9Sstevel@tonic-gateHEADER_FILE=audit_uevents.h
29*a1292211SMarek PospisilCR_YEAR=`/usr/bin/date '+%Y'`
307c478bd9Sstevel@tonic-gate
317c478bd9Sstevel@tonic-gatecat <<EOF > $HEADER_FILE
327c478bd9Sstevel@tonic-gate/*
33*a1292211SMarek Pospisil * CDDL HEADER START
34*a1292211SMarek Pospisil *
35*a1292211SMarek Pospisil * The contents of this file are subject to the terms of the
36*a1292211SMarek Pospisil * Common Development and Distribution License (the "License").
37*a1292211SMarek Pospisil * You may not use this file except in compliance with the License.
38*a1292211SMarek Pospisil *
39*a1292211SMarek Pospisil * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
40*a1292211SMarek Pospisil * or http://www.opensolaris.org/os/licensing.
41*a1292211SMarek Pospisil * See the License for the specific language governing permissions
42*a1292211SMarek Pospisil * and limitations under the License.
43*a1292211SMarek Pospisil *
44*a1292211SMarek Pospisil * When distributing Covered Code, include this CDDL HEADER in each
45*a1292211SMarek Pospisil * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
46*a1292211SMarek Pospisil * If applicable, add the following below this CDDL HEADER, with the
47*a1292211SMarek Pospisil * fields enclosed by brackets "[]" replaced with your own identifying
48*a1292211SMarek Pospisil * information: Portions Copyright [yyyy] [name of copyright owner]
49*a1292211SMarek Pospisil *
50*a1292211SMarek Pospisil * CDDL HEADER END
51*a1292211SMarek Pospisil */
52*a1292211SMarek Pospisil/*
53*a1292211SMarek Pospisil * Copyright (c) 1992, $CR_YEAR, Oracle and/or its affiliates. All rights reserved.
547c478bd9Sstevel@tonic-gate */
557c478bd9Sstevel@tonic-gate
567c478bd9Sstevel@tonic-gate#ifndef	_BSM_AUDIT_UEVENTS_H
577c478bd9Sstevel@tonic-gate#define	_BSM_AUDIT_UEVENTS_H
587c478bd9Sstevel@tonic-gate
59a6600459SstevelEOF
60a6600459Sstevel
61a6600459Sstevelcat <<EOF >> $HEADER_FILE
627c478bd9Sstevel@tonic-gate
637c478bd9Sstevel@tonic-gate/*
647c478bd9Sstevel@tonic-gate * User level audit event numbers.
657c478bd9Sstevel@tonic-gate *
667c478bd9Sstevel@tonic-gate *     0		Reserved as an invalid event number.
677c478bd9Sstevel@tonic-gate *     1 - 2047		Reserved for the Solaris Kernel events.
687c478bd9Sstevel@tonic-gate *  2048 - 32767	Reserved for the Solaris TCB programs.
697c478bd9Sstevel@tonic-gate * 32768 - 65535	Available for third party TCB applications.
707c478bd9Sstevel@tonic-gate *
717c478bd9Sstevel@tonic-gate */
727c478bd9Sstevel@tonic-gate
737c478bd9Sstevel@tonic-gate#ifdef	__cplusplus
747c478bd9Sstevel@tonic-gateextern "C" {
757c478bd9Sstevel@tonic-gate#endif
767c478bd9Sstevel@tonic-gate
777c478bd9Sstevel@tonic-gateEOF
787c478bd9Sstevel@tonic-gate
797c478bd9Sstevel@tonic-gatenawk -F: '{if ((NF == 4) && substr($1,0,1) != "#")
807c478bd9Sstevel@tonic-gate		if ($1 >= 2048) {
8145916cd2Sjpk			tlen = length($2);
8245916cd2Sjpk
8345916cd2Sjpk			printf("#define\t%s\t", $2)
8445916cd2Sjpk			if (tlen < 8)
8545916cd2Sjpk				printf("\t");
8645916cd2Sjpk			if (tlen < 16)
87d31ffe99Srica				printf("\t");
88d31ffe99Srica			if (tlen < 24)
89d31ffe99Srica				printf("\t");
90d31ffe99Srica			printf("%s\n", $1);
917c478bd9Sstevel@tonic-gate		}
927c478bd9Sstevel@tonic-gate	  }' \
937c478bd9Sstevel@tonic-gate< $DATABASE >> $HEADER_FILE
947c478bd9Sstevel@tonic-gate
957c478bd9Sstevel@tonic-gatecat <<EOF >> $HEADER_FILE
967c478bd9Sstevel@tonic-gate
977c478bd9Sstevel@tonic-gate#ifdef	__cplusplus
987c478bd9Sstevel@tonic-gate}
997c478bd9Sstevel@tonic-gate#endif
1007c478bd9Sstevel@tonic-gate
1017c478bd9Sstevel@tonic-gate#endif	/* _BSM_AUDIT_UEVENTS_H */
1027c478bd9Sstevel@tonic-gateEOF
1037c478bd9Sstevel@tonic-gate
1047c478bd9Sstevel@tonic-gateexit 0
105