1
0
Files
irix-657m-src/eoe/cmd/pcp/pmns/Make.stdpmid
2022-09-29 17:59:04 +03:00

168 lines
3.9 KiB
Bash
Executable File

#!/bin/sh
#
# Copyright 1995, Silicon Graphics, Inc.
# ALL RIGHTS RESERVED
#
# UNPUBLISHED -- Rights reserved under the copyright laws of the United
# States. Use of a copyright notice is precautionary only and does not
# imply publication or disclosure.
#
# U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
# Use, duplication or disclosure by the Government is subject to restrictions
# as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
# in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
# in similar or successor clauses in the FAR, or the DOD or NASA FAR
# Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
# 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
#
# THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
# INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
# DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
# PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
# GRAPHICS, INC.
#
# $Id: Make.stdpmid,v 1.5 1999/03/24 10:23:42 kenmcd Exp $
# Some degree of paranoia here ...
PATH=/usr/sbin:/usr/bsd:/sbin:/usr/bin:/bin:/usr/pcp/bin
export PATH
tmp=/tmp/$$
status=1
rm -f $tmp.*
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
prog=`basename $0`
OLD=stdpmid
NEW=$tmp.new
SOURCE=""
for file in `echo stdpmid.*`
do
case $file
in
stdpmid.'*'|stdpmid.O|stdpmid.O.*|stdpmid.N|stdpmid.N.*|stdpmid.rpmorig|stdpmid.*.rpmorig)
;;
*)
SOURCE="$SOURCE $file"
;;
esac
done
if [ -z "$SOURCE" ]
then
echo "$prog: Error: no stdpmid.* files, cannot rebuilt \"stdpmid\""
exit
fi
# post-processing with sed ...
# - removes comments
# - maps white space to a single space
# - performs domain re-numbering that occured for LAB and ASH
# between PCP 2.0 and PCP 2.1 to avoid duplicates in the interim
#
for file in $SOURCE
do
sed <$file \
-e '/^#/d' \
-e 's/[ ][ ]*/ /' \
-e '/^LAB /s/254/246/' \
-e '/^ASH /s/7/11/'
done \
| sort -n +1 -2 \
| uniq >$tmp.tmp
error=false
# scan for duplicate domain name, but different domain number
#
nawk '{ print $1 }' <$tmp.tmp \
| sort \
| uniq -c \
| while read cnt domain
do
[ $cnt -eq 1 ] && continue
echo "$prog: Error: duplicate for domain name \"$domain\" ..."
grep "^$domain[ ]" $SOURCE | sed -e 's/^/ /'
error=true
done
# scan for duplicate domain number, but different domain name
#
nawk '{ print $2 }' <$tmp.tmp \
| sort \
| uniq -c \
| while read cnt number
do
[ $cnt -eq 1 ] && continue
echo "$prog: Error: duplicate for domain number \"$number\" ..."
grep "[ ]$number\$" $SOURCE | sed -e 's/^/ /'
error=true
done
$error && exit
# preamble
#
cat <<'End-of-File' >$NEW
/*
* NOTE:
* Do not edit this file (it is re-created by Make.stdpmid).
* To make changes, edit one of the stdpmid.* files, most probably
* stdpmid.local, and as root
* # make stdpmid
*
* The following domain number assignments are assumed to apply
*
* Domain Number Range Use
* 0 reserved -- DO NOT USE
* 1-31 production PMDAs from PCP base product
* and/or IRIX
* 32-39 ORACLE DBMS PMDAs
* 40-47 Sybase DBMS PMDAs
* 48-55 Informix DBMS PMDAs
* 56-63 SNMP Gateway PMDA
* 64-127 ISV PMDAs
* 129-254 End-User PMDAs and demo PMDAs
* 255 reserved -- DO NOT USE
*
* A Performance Metrics Identifier (PMID) is internally encoded as
* 2 bits - reserved
* 8 bits - the Performance Metric Domain Agent (PMDA) domain number
* from the list below
* 12 bits - cluster within domain
* 10 bits - serial within cluster
*/
#ifndef __STDPMID
#define __STDPMID
End-of-File
cat $tmp.tmp \
| while read domain number
do
echo "#define $domain $number" >>$NEW
done
echo '
#endif' >>$NEW
# only update if it has changed
#
if [ -f $OLD ]
then
if cmp -s $OLD $NEW >/dev/null 2>&1
then
rm -f $NEW
fi
fi
if [ -f $NEW ]
then
cp $NEW $OLD
chmod 444 $NEW
fi
status=0
exit