xref: /titanic_51/usr/src/lib/libbsm/mkhdr.sh (revision 749f21d359d8fbd020c974a1a5227316221bfc9c)
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, Version 1.0 only
7# (the "License").  You may not use this file except in compliance
8# with the License.
9#
10# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11# or http://www.opensolaris.org/os/licensing.
12# See the License for the specific language governing permissions
13# and limitations under the License.
14#
15# When distributing Covered Code, include this CDDL HEADER in each
16# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17# If applicable, add the following below this CDDL HEADER, with the
18# fields enclosed by brackets "[]" replaced with your own identifying
19# information: Portions Copyright [yyyy] [name of copyright owner]
20#
21# CDDL HEADER END
22#
23#
24# ident	"%Z%%M%	%I%	%E% SMI"
25#
26# Automagically generate the audit_uevents.h header file.
27#
28DATABASE=audit_event.txt
29HEADER_FILE=audit_uevents.h
30
31cat <<EOF > $HEADER_FILE
32/*
33 * Copyright (c) 1993-2001, Sun Microsystems, Inc.
34 * All Rights Reserved.
35 */
36
37#ifndef	_BSM_AUDIT_UEVENTS_H
38#define	_BSM_AUDIT_UEVENTS_H
39
40#pragma ident	"%Z%$HEADER_FILE	%I%	%E% SMI"
41
42/*
43 * User level audit event numbers.
44 *
45 *     0		Reserved as an invalid event number.
46 *     1 - 2047		Reserved for the Solaris Kernel events.
47 *  2048 - 32767	Reserved for the Solaris TCB programs.
48 * 32768 - 65535	Available for third party TCB applications.
49 *
50 */
51
52#ifdef	__cplusplus
53extern "C" {
54#endif
55
56EOF
57
58nawk -F: '{if ((NF == 4) && substr($1,0,1) != "#")
59		if ($1 >= 2048) {
60			printf("#define	%s	",$2)
61			if (length($2) < 8)
62				printf("	")
63			if (length($2) < 16)
64				printf("	")
65			printf("%s	/* =%s %s */\n",$1,$4,$3)
66		}
67	  }' \
68< $DATABASE >> $HEADER_FILE
69
70cat <<EOF >> $HEADER_FILE
71
72#ifdef	__cplusplus
73}
74#endif
75
76#endif	/* _BSM_AUDIT_UEVENTS_H */
77EOF
78
79exit 0
80