head	1.30;
access;
symbols
	RELENG_8_4:1.30.0.2
	RELENG_9_1_0_RELEASE:1.18.2.3.2.2
	RELENG_9_1:1.18.2.3.0.2
	RELENG_9_1_BP:1.18.2.3
	RELENG_8_3_0_RELEASE:1.12.2.4.2.1
	RELENG_8_3:1.12.2.4.0.2
	RELENG_8_3_BP:1.12.2.4
	RELENG_9_0_0_RELEASE:1.18.2.1.2.1
	RELENG_9_0:1.18.2.1.0.2
	RELENG_9_0_BP:1.18.2.1
	RELENG_9:1.18.0.2
	RELENG_9_BP:1.18
	RELENG_7_4_0_RELEASE:1.9.2.2.4.1
	RELENG_8_2_0_RELEASE:1.12.2.2.2.1
	RELENG_7_4:1.9.2.2.0.4
	RELENG_7_4_BP:1.9.2.2
	RELENG_8_2:1.12.2.2.0.2
	RELENG_8_2_BP:1.12.2.2
	RELENG_8_1_0_RELEASE:1.12.2.1.4.1
	RELENG_8_1:1.12.2.1.0.4
	RELENG_8_1_BP:1.12.2.1
	RELENG_7_3_0_RELEASE:1.9.2.2.2.1
	RELENG_7_3:1.9.2.2.0.2
	RELENG_7_3_BP:1.9.2.2
	RELENG_8_0_0_RELEASE:1.12.2.1.2.1
	RELENG_8_0:1.12.2.1.0.2
	RELENG_8_0_BP:1.12.2.1
	RELENG_8:1.12.0.2
	RELENG_8_BP:1.12
	RELENG_7_2_0_RELEASE:1.9.2.1.4.1
	RELENG_7_2:1.9.2.1.0.4
	RELENG_7_2_BP:1.9.2.1
	RELENG_7_1_0_RELEASE:1.9.2.1.2.1
	RELENG_7_1:1.9.2.1.0.2
	RELENG_7_1_BP:1.9.2.1
	RELENG_7_0_0_RELEASE:1.9
	RELENG_7_0:1.9.0.4
	RELENG_7_0_BP:1.9
	RELENG_7:1.9.0.2
	RELENG_7_BP:1.9;
locks; strict;
comment	@# @;


1.30
date	2013.03.02.01.15.55;	author svnexp;	state Exp;
branches
	1.30.2.1;
next	1.29;

1.29
date	2013.02.13.00.41.29;	author svnexp;	state Exp;
branches;
next	1.28;

1.28
date	2012.11.17.01.54.22;	author svnexp;	state Exp;
branches;
next	1.27;

1.27
date	2012.11.02.16.07.21;	author jilles;	state Exp;
branches;
next	1.26;

1.26
date	2012.09.22.12.40.00;	author jilles;	state Exp;
branches;
next	1.25;

1.25
date	2012.04.05.17.13.14;	author jhb;	state Exp;
branches;
next	1.24;

1.24
date	2012.02.23.21.08.21;	author jhb;	state Exp;
branches;
next	1.23;

1.23
date	2011.10.08.13.01.38;	author des;	state Exp;
branches;
next	1.22;

1.22
date	2011.10.08.12.28.06;	author des;	state Exp;
branches;
next	1.21;

1.21
date	2011.10.08.12.21.51;	author des;	state Exp;
branches;
next	1.20;

1.20
date	2011.10.08.11.39.00;	author des;	state Exp;
branches;
next	1.19;

1.19
date	2011.10.08.09.57.29;	author des;	state Exp;
branches;
next	1.18;

1.18
date	2011.06.17.06.12.28;	author netchild;	state Exp;
branches
	1.18.2.1;
next	1.17;

1.17
date	2011.06.06.19.00.38;	author dchagin;	state Exp;
branches;
next	1.16;

1.16
date	2010.12.02.18.24.22;	author delphij;	state Exp;
branches;
next	1.15;

1.15
date	2010.10.06.12.41.42;	author netchild;	state Exp;
branches;
next	1.14;

1.14
date	2010.09.16.11.40.41;	author rpaulo;	state Exp;
branches;
next	1.13;

1.13
date	2010.09.16.11.33.31;	author rpaulo;	state Exp;
branches;
next	1.12;

1.12
date	2008.03.12.11.51.01;	author jeff;	state Exp;
branches
	1.12.2.1;
next	1.11;

1.11
date	2008.02.23.01.01.49;	author des;	state Exp;
branches;
next	1.10;

1.10
date	2008.02.03.11.33.27;	author des;	state Exp;
branches;
next	1.9;

1.9
date	2007.04.09.19.16.24;	author emaste;	state Exp;
branches
	1.9.2.1;
next	1.8;

1.8
date	2007.01.04.04.46.59;	author rodrigc;	state Exp;
branches;
next	1.7;

1.7
date	2007.01.04.04.28.17;	author rodrigc;	state Exp;
branches;
next	1.6;

1.6
date	2007.01.04.04.18.03;	author rodrigc;	state Exp;
branches;
next	1.5;

1.5
date	2006.12.22.05.07.21;	author rodrigc;	state Exp;
branches;
next	1.4;

1.4
date	2006.09.18.13.49.57;	author maxim;	state Exp;
branches;
next	1.3;

1.3
date	2006.07.12.12.42.47;	author kib;	state Exp;
branches;
next	1.2;

1.2
date	2006.07.12.09.13.33;	author kib;	state Exp;
branches;
next	1.1;

1.1
date	2006.05.20.14.27.22;	author netchild;	state Exp;
branches;
next	;

1.30.2.1
date	2013.03.02.01.15.55;	author svnexp;	state dead;
branches;
next	1.30.2.2;

1.30.2.2
date	2013.03.28.13.06.04;	author svnexp;	state Exp;
branches;
next	;

1.18.2.1
date	2011.09.23.00.51.37;	author kensmith;	state Exp;
branches
	1.18.2.1.2.1;
next	1.18.2.2;

1.18.2.2
date	2012.03.19.21.33.23;	author jhb;	state Exp;
branches;
next	1.18.2.3;

1.18.2.3
date	2012.06.27.21.12.15;	author jhb;	state Exp;
branches
	1.18.2.3.2.1;
next	1.18.2.4;

1.18.2.4
date	2012.11.17.11.37.39;	author svnexp;	state Exp;
branches;
next	1.18.2.5;

1.18.2.5
date	2013.05.15.21.03.21;	author svnexp;	state Exp;
branches;
next	1.18.2.6;

1.18.2.6
date	2013.11.21.21.01.52;	author svnexp;	state Exp;
branches;
next	1.18.2.7;

1.18.2.7
date	2013.12.03.17.01.47;	author svnexp;	state Exp;
branches;
next	1.18.2.8;

1.18.2.8
date	2013.12.24.19.01.46;	author svnexp;	state Exp;
branches;
next	1.18.2.9;

1.18.2.9
date	2014.01.02.22.01.47;	author svnexp;	state Exp;
branches;
next	1.18.2.10;

1.18.2.10
date	2014.02.16.00.01.44;	author svnexp;	state Exp;
branches;
next	;

1.18.2.1.2.1
date	2011.11.11.04.20.22;	author kensmith;	state Exp;
branches;
next	1.18.2.1.2.2;

1.18.2.1.2.2
date	2012.11.17.08.37.35;	author svnexp;	state Exp;
branches;
next	;

1.18.2.3.2.1
date	2012.08.05.23.54.33;	author kensmith;	state Exp;
branches;
next	1.18.2.3.2.2;

1.18.2.3.2.2
date	2012.11.17.08.48.27;	author svnexp;	state Exp;
branches;
next	;

1.12.2.1
date	2009.08.03.08.13.06;	author kensmith;	state Exp;
branches
	1.12.2.1.2.1
	1.12.2.1.4.1;
next	1.12.2.2;

1.12.2.2
date	2010.12.17.19.48.54;	author delphij;	state Exp;
branches
	1.12.2.2.2.1;
next	1.12.2.3;

1.12.2.3
date	2011.06.17.18.16.23;	author dchagin;	state Exp;
branches;
next	1.12.2.4;

1.12.2.4
date	2011.06.27.11.49.58;	author netchild;	state Exp;
branches
	1.12.2.4.2.1;
next	1.12.2.5;

1.12.2.5
date	2012.03.19.21.33.35;	author jhb;	state Exp;
branches;
next	1.12.2.6;

1.12.2.6
date	2012.06.27.21.13.00;	author jhb;	state Exp;
branches;
next	1.12.2.7;

1.12.2.7
date	2012.11.17.10.37.17;	author svnexp;	state Exp;
branches;
next	1.12.2.8;

1.12.2.8
date	2013.05.15.21.22.27;	author svnexp;	state Exp;
branches;
next	;

1.12.2.1.2.1
date	2009.10.25.01.10.29;	author kensmith;	state Exp;
branches;
next	;

1.12.2.1.4.1
date	2010.06.14.02.09.06;	author kensmith;	state Exp;
branches;
next	;

1.12.2.2.2.1
date	2010.12.21.17.09.25;	author kensmith;	state Exp;
branches;
next	;

1.12.2.4.2.1
date	2012.03.03.06.15.13;	author kensmith;	state Exp;
branches;
next	1.12.2.4.2.2;

1.12.2.4.2.2
date	2012.11.17.08.25.50;	author svnexp;	state Exp;
branches;
next	;

1.9.2.1
date	2008.08.12.17.22.51;	author des;	state Exp;
branches
	1.9.2.1.2.1
	1.9.2.1.4.1;
next	1.9.2.2;

1.9.2.2
date	2009.05.26.21.40.15;	author des;	state Exp;
branches
	1.9.2.2.2.1
	1.9.2.2.4.1;
next	1.9.2.3;

1.9.2.3
date	2012.11.17.08.08.29;	author svnexp;	state Exp;
branches;
next	;

1.9.2.1.2.1
date	2008.11.25.02.59.29;	author kensmith;	state Exp;
branches;
next	;

1.9.2.1.4.1
date	2009.04.15.03.14.26;	author kensmith;	state Exp;
branches;
next	;

1.9.2.2.2.1
date	2010.02.10.00.26.20;	author kensmith;	state Exp;
branches;
next	;

1.9.2.2.4.1
date	2010.12.21.17.10.29;	author kensmith;	state Exp;
branches;
next	1.9.2.2.4.2;

1.9.2.2.4.2
date	2012.11.17.08.17.42;	author svnexp;	state Exp;
branches;
next	;


desc
@@


1.30
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/247602
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@#!/bin/sh
#
# Copyright (c) 2006 "David Kirchner" <dpk@@dpk.net>. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD: head/usr.bin/kdump/mksubr 247602 2013-03-02 00:53:12Z pjd $
#
# Generates kdump_subr.c
# mkioctls is a special-purpose script, and works fine as it is
# now, so it remains independent. The idea behind how it generates
# its list was heavily borrowed here.
#
# Some functions here are automatically generated. This can mean
# the user will see unusual kdump output or errors while building
# if the underlying .h files are changed significantly.
#
# Key:
# AUTO: Completely auto-generated with either the "or" or the "switch"
# method.
# AUTO - Special: Generated automatically, but with some extra commands
# that the auto_*_type() functions are inappropriate for.
# MANUAL: Manually entered and must therefore be manually updated.

set -e

LC_ALL=C; export LC_ALL

if [ -z "$1" ]
then
	echo "usage: sh $0 include-dir"
	exit 1
fi
include_dir=$1

#
# Automatically generates a C function that will print out the
# numeric input as a pipe-delimited string of the appropriate
# #define keys. ex:
# S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH
# The XOR is necessary to prevent including the "0"-value in every
# line.
#
auto_or_type () {
	local name grep file
	name=$1
	grep=$2
	file=$3

	cat <<_EOF_
/* AUTO */
void
$name(intmax_t arg)
{
	int or = 0;
	printf("%#jx<", (uintmax_t)arg);
_EOF_
	egrep "^#[[:space:]]*define[[:space:]]+"${grep}"[[:space:]]*" \
		$include_dir/$file | \
	awk '{ for (i = 1; i <= NF; i++) \
		if ($i ~ /define/) \
			break; \
		++i; \
		printf "\tif (!((arg > 0) ^ ((%s) > 0)))\n\t\tif_print_or(arg, %s, or);\n", $i, $i }'
cat <<_EOF_
	printf(">");
	if (or == 0)
		printf("<invalid>%jd", arg);
}

_EOF_
}

#
# Automatically generates a C function used when the argument
# maps to a single, specific #definition
#
auto_switch_type () {
	local name grep file
	name=$1
	grep=$2
	file=$3

	cat <<_EOF_
/* AUTO */
void
$name(intmax_t arg)
{
	switch (arg) {
_EOF_
	egrep "^#[[:space:]]*define[[:space:]]+"${grep}"[[:space:]]*" \
		$include_dir/$file | \
	awk '{ for (i = 1; i <= NF; i++) \
		if ($i ~ /define/) \
			break; \
		++i; \
		printf "\tcase %s:\n\t\tprintf(\"%s\");\n\t\tbreak;\n", $i, $i }'
cat <<_EOF_
	default: /* Should not reach */
		printf("<invalid=%jd>", arg);
	}
}

_EOF_
}

#
# Automatically generates a C function used when the argument
# maps to a #definition
#
auto_if_type () {
	local name grep file
	name=$1
	grep=$2
	file=$3

	cat <<_EOF_
/* AUTO */
void
$name(intmax_t arg)
{
_EOF_
	egrep "^#[[:space:]]*define[[:space:]]+"${grep}"[[:space:]]*" \
		$include_dir/$file | \
	awk '{ printf "\t"; \
		if (NR > 1) \
			printf "else " ; \
		printf "if (arg == %s) \n\t\tprintf(\"%s\");\n", $2, $2 }'
cat <<_EOF_
	else /* Should not reach */
		printf("<invalid=%jd>", arg);
}

_EOF_
}

# C start

cat <<_EOF_
#include <stdint.h>
#include <stdio.h>
#include <sys/fcntl.h>
#include <sys/stat.h>
#include <sys/unistd.h>
#include <sys/mman.h>
#include <sys/wait.h>
#define _KERNEL
#include <sys/socket.h>
#undef _KERNEL
#include <netinet/in.h>
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/ptrace.h>
#include <sys/resource.h>
#include <sys/reboot.h>
#include <sched.h>
#include <sys/linker.h>
#define _KERNEL
#include <sys/thr.h>
#undef _KERNEL
#include <sys/extattr.h>
#include <sys/acl.h>
#include <aio.h>
#include <sys/sem.h>
#include <sys/ipc.h>
#include <sys/rtprio.h>
#include <sys/shm.h>
#include <nfsserver/nfs.h>
#include <ufs/ufs/quota.h>
#include <sys/capability.h>
#include <vm/vm.h>
#include <vm/vm_param.h>

#include "kdump_subr.h"

/*
 * These are simple support macros. print_or utilizes a variable
 * defined in the calling function to track whether or not it should
 * print a logical-OR character ('|') before a string. if_print_or
 * simply handles the necessary "if" statement used in many lines
 * of this file.
 */
#define print_or(str,orflag) do {                  \\
	if (orflag) putchar('|'); else orflag = 1; \\
	printf (str); }                            \\
	while (0)
#define if_print_or(i,flag,orflag) do {            \\
	if ((i & flag) == flag)                    \\
	print_or(#flag,orflag); }                  \\
	while (0)

/* MANUAL */
extern char *signames[]; /* from kdump.c */
void
signame(int sig)
{
	if (sig > 0 && sig < NSIG)
		printf("SIG%s",signames[sig]);
	else
		printf("SIG %d", sig);
}

/* MANUAL */
void
semctlname(int cmd)
{
	switch (cmd) {
	case GETNCNT:
		printf("GETNCNT");
		break;
	case GETPID:
		printf("GETPID");
		break;
	case GETVAL:
		printf("GETVAL");
		break;
	case GETALL:
		printf("GETALL");
		break;
	case GETZCNT:
		printf("GETZCNT");
		break;
	case SETVAL:
		printf("SETVAL");
		break;
	case SETALL:
		printf("SETALL");
		break;
	case IPC_RMID:
		printf("IPC_RMID");
		break;
	case IPC_SET:
		printf("IPC_SET");
		break;
	case IPC_STAT:
		printf("IPC_STAT");
		break;
	default: /* Should not reach */
		printf("<invalid=%d>", cmd);
	}
}

/* MANUAL */
void
shmctlname(int cmd)
{
	switch (cmd) {
	case IPC_RMID:
		printf("IPC_RMID");
		break;
	case IPC_SET:
		printf("IPC_SET");
		break;
	case IPC_STAT:
		printf("IPC_STAT");
		break;
	default: /* Should not reach */
		printf("<invalid=%d>", cmd);
	}
}

/* MANUAL */
void
semgetname(int flag)
{
	int or = 0;
	if_print_or(flag, IPC_CREAT, or);
	if_print_or(flag, IPC_EXCL, or);
	if_print_or(flag, SEM_R, or);
	if_print_or(flag, SEM_A, or);
	if_print_or(flag, (SEM_R>>3), or);
	if_print_or(flag, (SEM_A>>3), or);
	if_print_or(flag, (SEM_R>>6), or);
	if_print_or(flag, (SEM_A>>6), or);
}

/*
 * MANUAL
 *
 * Only used by SYS_open. Unless O_CREAT is set in flags, the
 * mode argument is unused (and often bogus and misleading).
 */
void
flagsandmodename(int flags, int mode, int decimal)
{
	flagsname(flags);
	putchar(',');
	if ((flags & O_CREAT) == O_CREAT) {
		modename (mode);
	} else {
		if (decimal) {
			printf("<unused>%d", mode);
		} else {
			printf("<unused>%#x", (unsigned int)mode);
		}
	}
}

/*
 * MANUAL
 *
 * [g|s]etsockopt's level argument can either be SOL_SOCKET or a value
 * referring to a line in /etc/protocols . It might be appropriate
 * to use getprotoent(3) here.
 */
void
sockoptlevelname(int level, int decimal)
{
	if (level == SOL_SOCKET) {
		printf("SOL_SOCKET");
	} else {
		if (decimal) {
			printf("%d", level);
		} else {
			printf("%#x", (unsigned int)level);
		}
	}
}

/*
 * MANUAL
 *
 * Used for page fault type.  Cannot use auto_or_type since the macro
 * values contain a cast.  Also, VM_PROT_NONE has to be handled specially.
 */
void
vmprotname (int type)
{
	int	or = 0;

	if (type == VM_PROT_NONE) {
		(void)printf("VM_PROT_NONE");
		return;
	}
	if_print_or(type, VM_PROT_READ, or);
	if_print_or(type, VM_PROT_WRITE, or);
	if_print_or(type, VM_PROT_EXECUTE, or);
	if_print_or(type, VM_PROT_COPY, or);
}
_EOF_

auto_or_type     "accessmodename"      "[A-Z]_OK[[:space:]]+0?x?[0-9A-Fa-f]+"         "sys/unistd.h"
auto_switch_type "acltypename"         "ACL_TYPE_[A-Z4_]+[[:space:]]+0x[0-9]+"        "sys/acl.h"
auto_or_type     "capname"             "CAP_[A-Z]+[[:space:]]+0x[01248]{16}ULL"       "sys/capability.h"
auto_or_type     "capfcntlname"        "CAP_FCNTL_[A-Z]+[[:space:]]+\(1"              "sys/capability.h"
auto_switch_type "extattrctlname"      "EXTATTR_NAMESPACE_[A-Z]+[[:space:]]+0x[0-9]+" "sys/extattr.h"
auto_switch_type "fadvisebehavname"    "POSIX_FADV_[A-Z]+[[:space:]]+[0-9]+"          "sys/fcntl.h"
auto_or_type     "flagsname"           "O_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+"           "sys/fcntl.h"
auto_or_type     "flockname"           "LOCK_[A-Z]+[[:space:]]+0x[0-9]+"              "sys/fcntl.h"
auto_or_type     "getfsstatflagsname"  "MNT_[A-Z]+[[:space:]]+[1-9][0-9]*"            "sys/mount.h"
auto_switch_type "kldsymcmdname"       "KLDSYM_[A-Z]+[[:space:]]+[0-9]+"              "sys/linker.h"
auto_switch_type "kldunloadfflagsname" "LINKER_UNLOAD_[A-Z]+[[:space:]]+[0-9]+"       "sys/linker.h"
auto_switch_type "lio_listioname"      "LIO_(NO)?WAIT[[:space:]]+[0-9]+"              "aio.h"
auto_switch_type "madvisebehavname"    "_?MADV_[A-Z]+[[:space:]]+[0-9]+"              "sys/mman.h"
auto_switch_type "minheritname"        "INHERIT_[A-Z]+[[:space:]]+[0-9]+"             "sys/mman.h"
auto_or_type     "mlockallname"        "MCL_[A-Z]+[[:space:]]+0x[0-9]+"               "sys/mman.h"
auto_or_type     "mmapflagsname"       "MAP_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+"         "sys/mman.h"
auto_or_type     "mmapprotname"        "PROT_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+"        "sys/mman.h"
auto_or_type     "modename"            "S_[A-Z]+[[:space:]]+[0-6]{7}"                 "sys/stat.h"
auto_or_type     "mountflagsname"      "MNT_[A-Z]+[[:space:]]+0x[0-9]+"               "sys/mount.h"
auto_switch_type "msyncflagsname"      "MS_[A-Z]+[[:space:]]+0x[0-9]+"                "sys/mman.h"
auto_or_type     "nfssvcname"          "NFSSVC_[A-Z0-9]+[[:space:]]+0x[0-9]+"            "nfs/nfssvc.h"
auto_switch_type "prioname"            "PRIO_[A-Z]+[[:space:]]+[0-9]"                 "sys/resource.h"
auto_switch_type "ptraceopname"        "PT_[[:alnum:]_]+[[:space:]]+[0-9]+"           "sys/ptrace.h"
auto_switch_type "quotactlname"        "Q_[A-Z]+[[:space:]]+0x[0-9]+"                 "ufs/ufs/quota.h"
auto_or_type     "rebootoptname"       "RB_[A-Z]+[[:space:]]+0x[0-9]+"                "sys/reboot.h"
auto_or_type     "rforkname"           "RF[A-Z]+[[:space:]]+\([0-9]+<<[0-9]+\)"       "sys/unistd.h"
auto_switch_type "rlimitname"          "RLIMIT_[A-Z]+[[:space:]]+[0-9]+"              "sys/resource.h"
auto_switch_type "schedpolicyname"     "SCHED_[A-Z]+[[:space:]]+[0-9]+"               "sched.h"
auto_switch_type "sendfileflagsname"   "SF_[A-Z]+[[:space:]]+[0-9]+"                  "sys/socket.h"
auto_or_type     "shmatname"           "SHM_[A-Z]+[[:space:]]+[0-9]{6}+"              "sys/shm.h"
auto_switch_type "shutdownhowname"     "SHUT_[A-Z]+[[:space:]]+[0-9]+"                "sys/socket.h"
auto_switch_type "sigbuscodename"      "BUS_[A-Z]+[[:space:]]+[0-9]+"                 "sys/signal.h"
auto_switch_type "sigchldcodename"     "CLD_[A-Z]+[[:space:]]+[0-9]+"                 "sys/signal.h"
auto_switch_type "sigfpecodename"      "FPE_[A-Z]+[[:space:]]+[0-9]+"                 "sys/signal.h"
auto_switch_type "sigprocmaskhowname"  "SIG_[A-Z]+[[:space:]]+[0-9]+"                 "sys/signal.h"
auto_switch_type "sigillcodename"      "ILL_[A-Z]+[[:space:]]+[0-9]+"                 "sys/signal.h"
auto_switch_type "sigsegvcodename"     "SEGV_[A-Z]+[[:space:]]+[0-9]+"                 "sys/signal.h"
auto_switch_type "sigtrapcodename"     "TRAP_[A-Z]+[[:space:]]+[0-9]+"                 "sys/signal.h"
auto_if_type     "sockdomainname"      "PF_[[:alnum:]]+[[:space:]]+"                  "sys/socket.h"
auto_if_type     "sockfamilyname"      "AF_[[:alnum:]]+[[:space:]]+"                  "sys/socket.h"
auto_if_type     "sockipprotoname"     "IPPROTO_[[:alnum:]]+[[:space:]]+"             "netinet/in.h"
auto_switch_type "sockoptname"         "SO_[A-Z]+[[:space:]]+0x[0-9]+"                "sys/socket.h"
auto_switch_type "socktypename"        "SOCK_[A-Z]+[[:space:]]+[1-9]+[0-9]*"          "sys/socket.h"
auto_or_type     "thrcreateflagsname"  "THR_[A-Z]+[[:space:]]+0x[0-9]+"               "sys/thr.h"
auto_switch_type "vmresultname"        "KERN_[A-Z]+[[:space:]]+[0-9]+"                "vm/vm_param.h"
auto_or_type     "wait4optname"        "W[A-Z]+[[:space:]]+[0-9]+"                    "sys/wait.h"
auto_switch_type "whencename"          "SEEK_[A-Z]+[[:space:]]+[0-9]+"                "sys/unistd.h"

cat <<_EOF_
/*
 * AUTO - Special
 * F_ is used to specify fcntl commands as well as arguments. Both sets are
 * grouped in fcntl.h, and this awk script grabs the first group.
 */
void
fcntlcmdname(int cmd, int arg, int decimal)
{
	switch (cmd) {
_EOF_
egrep "^#[[:space:]]*define[[:space:]]+F_[A-Z0-9_]+[[:space:]]+[0-9]+[[:space:]]*" \
	$include_dir/sys/fcntl.h | \
	awk 'BEGIN { o=0 } { for (i = 1; i <= NF; i++) \
		if ($i ~ /define/) \
			break; \
		++i; \
		if (o <= $(i+1)) \
			printf "\tcase %s:\n\t\tprintf(\"%s\");\n\t\tbreak;\n", $i, $i; \
		else \
			exit; \
		o = $(i+1) }'
cat <<_EOF_
	default: /* Should not reach */
		printf("<invalid=%d>", cmd);
	}
	putchar(',');
	if (cmd == F_GETFD || cmd == F_SETFD) {
		if (arg == FD_CLOEXEC)
			printf("FD_CLOEXEC");
		else if (arg == 0)
			printf("0");
		else {
			if (decimal)
				printf("<invalid>%d", arg);
			else
				printf("<invalid>%#x", (unsigned int)arg);
		}
	} else if (cmd == F_SETFL) {
		flagsname(arg);
	} else {
		if (decimal)
			printf("%d", arg);
		else
			printf("%#x", (unsigned int)arg);
	}
}

/*
 * AUTO - Special
 *
 * The only reason this is not fully automated is due to the
 * grep -v RTP_PRIO statement. A better egrep line should
 * make this capable of being a auto_switch_type() function.
 */
void
rtprioname(int func)
{
	switch (func) {
_EOF_
egrep "^#[[:space:]]*define[[:space:]]+RTP_[A-Z]+[[:space:]]+0x[0-9]+[[:space:]]*" \
	$include_dir/sys/rtprio.h | grep -v RTP_PRIO | \
	awk '{ for (i = 1; i <= NF; i++) \
		if ($i ~ /define/) \
			break; \
		++i; \
		printf "\tcase %s:\n\t\tprintf(\"%s\");\n\t\tbreak;\n", $i, $i }'
cat <<_EOF_
	default: /* Should not reach */
		printf("<invalid=%d>", func);
	}
}

/*
 * AUTO - Special
 *
 * The send and recv functions have a flags argument which can be
 * set to 0. There is no corresponding #define. The auto_ functions
 * detect this as "invalid", which is incorrect here.
 */
void
sendrecvflagsname(int flags)
{
	int or = 0;

	if (flags == 0) {
		printf("0");
		return;
	}

	printf("%#x<", flags);
_EOF_
egrep "^#[[:space:]]*define[[:space:]]+MSG_[A-Z]+[[:space:]]+0x[0-9]+[[:space:]]*" $include_dir/sys/socket.h | \
	awk '{ for (i = 1; i <= NF; i++) \
		if ($i ~ /define/) \
			break; \
		++i; \
		printf "\tif(!((flags>0)^((%s)>0)))\n\t\tif_print_or(flags, %s, or);\n", $i, $i }'
cat <<_EOF_
	printf(">");
}

/*
 * AUTO - Special
 *
 * Check general codes first, then defer to signal-specific codes.
 */
void
sigcodename(int sig, int code)
{
	switch (code) {
_EOF_
egrep "^#[[:space:]]*define[[:space:]]+SI_[A-Z]+[[:space:]]+0(x[0-9abcdef]+)?[[:space:]]*" \
	$include_dir/sys/signal.h | grep -v SI_UNDEFINED | \
	awk '{ for (i = 1; i <= NF; i++) \
		if ($i ~ /define/) \
			break; \
		++i; \
		printf "\tcase %s:\n\t\tprintf(\"%s\");\n\t\tbreak;\n", $i, $i }'
cat <<_EOF_
	default:
		switch (sig) {
		case SIGILL:
			sigillcodename(code);
			break;
		case SIGBUS:
			sigbuscodename(code);
			break;
		case SIGSEGV:
			sigsegvcodename(code);
			break;
		case SIGFPE:
			sigfpecodename(code);
			break;
		case SIGTRAP:
			sigtrapcodename(code);
			break;
		case SIGCHLD:
			sigchldcodename(code);
			break;
		default:
			printf("<invalid=%#x>", code);
		}
	}
}
@


1.30.2.1
log
@file mksubr was added on branch RELENG_8_4 on 2013-03-28 13:06:04 +0000
@
text
@d1 553
@


1.30.2.2
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/248810
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@a0 494
#!/bin/sh
#
# Copyright (c) 2006 "David Kirchner" <dpk@@dpk.net>. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD: releng/8.4/usr.bin/kdump/mksubr 237664 2012-06-27 21:13:00Z jhb $
#
# Generates kdump_subr.c
# mkioctls is a special-purpose script, and works fine as it is
# now, so it remains independent. The idea behind how it generates
# its list was heavily borrowed here.
#
# Some functions here are automatically generated. This can mean
# the user will see unusual kdump output or errors while building
# if the underlying .h files are changed significantly.
#
# Key:
# AUTO: Completely auto-generated with either the "or" or the "switch"
# method.
# AUTO - Special: Generated automatically, but with some extra commands
# that the auto_*_type() functions are inappropriate for.
# MANUAL: Manually entered and must therefore be manually updated.

set -e

LC_ALL=C; export LC_ALL

if [ -z "$1" ]
then
	echo "usage: sh $0 include-dir"
	exit 1
fi
include_dir=$1

#
# Automatically generates a C function that will print out the
# numeric input as a pipe-delimited string of the appropriate
# #define keys. ex:
# S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH
# The XOR is necessary to prevent including the "0"-value in every
# line.
#
auto_or_type () {
	local name grep file
	name=$1
	grep=$2
	file=$3

	cat <<_EOF_
/* AUTO */
void
$name (int arg)
{
	int	or = 0;
_EOF_
	egrep "^#[[:space:]]*define[[:space:]]+"${grep}"[[:space:]]*" \
		$include_dir/$file | \
	awk '{ for (i = 1; i <= NF; i++) \
		if ($i ~ /define/) \
			break; \
		++i; \
		printf "\tif(!((arg>0)^((%s)>0)))\n\t\tif_print_or(arg, %s, or);\n", $i, $i }'
cat <<_EOF_
	if (or == 0)
		(void)printf("<invalid>%ld", (long)arg);
}

_EOF_
}

#
# Automatically generates a C function used when the argument
# maps to a single, specific #definition
#
auto_switch_type () {
	local name grep file
	name=$1
	grep=$2
	file=$3

	cat <<_EOF_
/* AUTO */
void
$name (int arg)
{
	switch (arg) {
_EOF_
	egrep "^#[[:space:]]*define[[:space:]]+"${grep}"[[:space:]]*" \
		$include_dir/$file | \
	awk '{ for (i = 1; i <= NF; i++) \
		if ($i ~ /define/) \
			break; \
		++i; \
		printf "\tcase %s:\n\t\t(void)printf(\"%s\");\n\t\tbreak;\n", $i, $i }'
cat <<_EOF_
	default: /* Should not reach */
		(void)printf("<invalid=%ld>", (long)arg);
	}
}

_EOF_
}

#
# Automatically generates a C function used when the argument
# maps to a #definition
#
auto_if_type () {
	local name grep file
	name=$1
	grep=$2
	file=$3

	cat <<_EOF_
/* AUTO */
void
$name (int arg)
{
_EOF_
	egrep "^#[[:space:]]*define[[:space:]]+"${grep}"[[:space:]]*" \
		$include_dir/$file | \
	awk '{ printf "\t"; \
		if (NR > 1) \
			printf "else " ; \
		printf "if (arg == %s) \n\t\tprintf(\"%s\");\n", $2, $2 }'
cat <<_EOF_
	else /* Should not reach */
		(void)printf("<invalid=%ld>", (long)arg);
}

_EOF_
}

# C start

cat <<_EOF_
#include <stdio.h>
#include <sys/fcntl.h>
#include <sys/stat.h>
#include <sys/unistd.h>
#include <sys/mman.h>
#include <sys/wait.h>
#define _KERNEL
#include <sys/socket.h>
#undef _KERNEL
#include <netinet/in.h>
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/ptrace.h>
#include <sys/resource.h>
#include <sys/reboot.h>
#include <sched.h>
#include <sys/linker.h>
#define _KERNEL
#include <sys/thr.h>
#undef _KERNEL
#include <sys/extattr.h>
#include <sys/acl.h>
#include <aio.h>
#include <sys/sem.h>
#include <sys/ipc.h>
#include <sys/rtprio.h>
#include <sys/shm.h>
#include <nfsserver/nfs.h>
#include <ufs/ufs/quota.h>
#include <vm/vm.h>
#include <vm/vm_param.h>

#include "kdump_subr.h"

/*
 * These are simple support macros. print_or utilizes a variable
 * defined in the calling function to track whether or not it should
 * print a logical-OR character ('|') before a string. if_print_or
 * simply handles the necessary "if" statement used in many lines
 * of this file.
 */
#define print_or(str,orflag) do {                  \\
	if (orflag) putchar('|'); else orflag = 1; \\
	printf (str); }                            \\
	while (0)
#define if_print_or(i,flag,orflag) do {            \\
	if ((i & flag) == flag)                    \\
	print_or(#flag,orflag); }                  \\
	while (0)

/* MANUAL */
extern char *signames[]; /* from kdump.c */
void
signame (int sig)
{
	if (sig > 0 && sig < NSIG)
		(void)printf("SIG%s",signames[sig]);
	else
		(void)printf("SIG %d", sig);
}

/* MANUAL */
void
semctlname (int cmd)
{
	switch (cmd) {
	case GETNCNT:
		(void)printf("GETNCNT");
		break;
	case GETPID:
		(void)printf("GETPID");
		break;
	case GETVAL:
		(void)printf("GETVAL");
		break;
	case GETALL:
		(void)printf("GETALL");
		break;
	case GETZCNT:
		(void)printf("GETZCNT");
		break;
	case SETVAL:
		(void)printf("SETVAL");
		break;
	case SETALL:
		(void)printf("SETALL");
		break;
	case IPC_RMID:
		(void)printf("IPC_RMID");
		break;
	case IPC_SET:
		(void)printf("IPC_SET");
		break;
	case IPC_STAT:
		(void)printf("IPC_STAT");
		break;
	default: /* Should not reach */
		(void)printf("<invalid=%ld>", (long)cmd);
	}
}

/* MANUAL */
void
shmctlname (int cmd) {
	switch (cmd) {
	case IPC_RMID:
		(void)printf("IPC_RMID");
		break;
	case IPC_SET:
		(void)printf("IPC_SET");
		break;
	case IPC_STAT:
		(void)printf("IPC_STAT");
		break;
	default: /* Should not reach */
		(void)printf("<invalid=%ld>", (long)cmd);
	}
}

/* MANUAL */
void
semgetname (int flag) {
	int	or = 0;
	if_print_or(flag, IPC_CREAT, or);
	if_print_or(flag, IPC_EXCL, or);
	if_print_or(flag, SEM_R, or);
	if_print_or(flag, SEM_A, or);
	if_print_or(flag, (SEM_R>>3), or);
	if_print_or(flag, (SEM_A>>3), or);
	if_print_or(flag, (SEM_R>>6), or);
	if_print_or(flag, (SEM_A>>6), or);
}

/*
 * MANUAL
 *
 * Only used by SYS_open. Unless O_CREAT is set in flags, the
 * mode argument is unused (and often bogus and misleading).
 */
void
flagsandmodename (int flags, int mode, int decimal) {
	flagsname (flags);
	(void)putchar(',');
	if ((flags & O_CREAT) == O_CREAT) {
		modename (mode);
	} else {
		if (decimal) {
			(void)printf("<unused>%ld", (long)mode);
		} else {
			(void)printf("<unused>%#lx", (long)mode);
		}
	}
}

/*
 * MANUAL
 *
 * [g|s]etsockopt's level argument can either be SOL_SOCKET or a value
 * referring to a line in /etc/protocols . It might be appropriate
 * to use getprotoent(3) here.
 */
void
sockoptlevelname (int level, int decimal)
{
	if (level == SOL_SOCKET) {
		(void)printf("SOL_SOCKET");
	} else {
		if (decimal) {
			(void)printf("%ld", (long)level);
		} else {
			(void)printf("%#lx", (long)level);
		}
	}
}

/*
 * MANUAL
 *
 * Used for page fault type.  Cannot use auto_or_type since the macro
 * values contain a cast.  Also, VM_PROT_NONE has to be handled specially.
 */
void
vmprotname (int type)
{
	int	or = 0;

	if (type == VM_PROT_NONE) {
		(void)printf("VM_PROT_NONE");
		return;
	}
	if_print_or(type, VM_PROT_READ, or);
	if_print_or(type, VM_PROT_WRITE, or);
	if_print_or(type, VM_PROT_EXECUTE, or);
	if_print_or(type, VM_PROT_OVERRIDE_WRITE, or);
}
_EOF_

auto_or_type "modename" "S_[A-Z]+[[:space:]]+[0-6]{7}" "sys/stat.h"
auto_or_type "flagsname" "O_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "sys/fcntl.h"
auto_or_type "accessmodename" "[A-Z]_OK[[:space:]]+0?x?[0-9A-Fa-f]+" "sys/unistd.h"
auto_or_type "mmapprotname" "PROT_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "sys/mman.h"
auto_or_type "mmapflagsname" "MAP_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "sys/mman.h"
auto_or_type "wait4optname" "W[A-Z]+[[:space:]]+[0-9]+" "sys/wait.h"
auto_or_type "getfsstatflagsname" "MNT_[A-Z]+[[:space:]]+[1-9][0-9]*" "sys/mount.h"
auto_or_type "mountflagsname" "MNT_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mount.h"
auto_or_type "rebootoptname" "RB_[A-Z]+[[:space:]]+0x[0-9]+" "sys/reboot.h"
auto_or_type "flockname" "LOCK_[A-Z]+[[:space:]]+0x[0-9]+" "sys/fcntl.h"
auto_or_type "thrcreateflagsname" "THR_[A-Z]+[[:space:]]+0x[0-9]+" "sys/thr.h"
auto_or_type "mlockallname" "MCL_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mman.h"
auto_or_type "shmatname" "SHM_[A-Z]+[[:space:]]+[0-9]{6}+" "sys/shm.h"
auto_or_type "rforkname" "RF[A-Z]+[[:space:]]+\([0-9]+<<[0-9]+\)" "sys/unistd.h"
auto_or_type "nfssvcname" "NFSSVC_[A-Z]+[[:space:]]+0x[0-9]+" "nfsserver/nfs.h"

auto_switch_type "whencename" "SEEK_[A-Z]+[[:space:]]+[0-9]+" "sys/unistd.h"
auto_switch_type "rlimitname" "RLIMIT_[A-Z]+[[:space:]]+[0-9]+" "sys/resource.h"
auto_switch_type "shutdownhowname" "SHUT_[A-Z]+[[:space:]]+0x[0-9]+" "sys/socket.h"
auto_switch_type "prioname" "PRIO_[A-Z]+[[:space:]]+[0-9]" "sys/resource.h"
auto_switch_type "fadvisebehavname" "POSIX_FADV_[A-Z]+[[:space:]]+[0-9]+" "sys/fcntl.h"
auto_switch_type "madvisebehavname" "_?MADV_[A-Z]+[[:space:]]+[0-9]+" "sys/mman.h"
auto_switch_type "msyncflagsname" "MS_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mman.h"
auto_switch_type "schedpolicyname" "SCHED_[A-Z]+[[:space:]]+[0-9]+" "sched.h"
auto_switch_type "kldunloadfflagsname" "LINKER_UNLOAD_[A-Z]+[[:space:]]+[0-9]+" "sys/linker.h"
auto_switch_type "extattrctlname" "EXTATTR_NAMESPACE_[A-Z]+[[:space:]]+0x[0-9]+" "sys/extattr.h"
auto_switch_type "kldsymcmdname" "KLDSYM_[A-Z]+[[:space:]]+[0-9]+" "sys/linker.h"
auto_switch_type "sendfileflagsname" "SF_[A-Z]+[[:space:]]+[0-9]+" "sys/socket.h"
auto_switch_type "acltypename" "ACL_TYPE_[A-Z]+[[:space:]]+0x[0-9]+" "sys/acl.h"
auto_switch_type "sigprocmaskhowname" "SIG_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h"
auto_switch_type "lio_listioname" "LIO_(NO)?WAIT[[:space:]]+[0-9]+" "aio.h"
auto_switch_type "minheritname" "INHERIT_[A-Z]+[[:space:]]+[0-9]+" "sys/mman.h"
auto_switch_type "quotactlname" "Q_[A-Z]+[[:space:]]+0x[0-9]+" "ufs/ufs/quota.h"
auto_if_type "sockdomainname" "PF_[[:alnum:]]+[[:space:]]+" "sys/socket.h"
auto_if_type "sockfamilyname" "AF_[[:alnum:]]+[[:space:]]+" "sys/socket.h"
auto_if_type "sockipprotoname" "IPPROTO_[[:alnum:]]+[[:space:]]+" "netinet/in.h"
auto_switch_type "sockoptname" "SO_[A-Z]+[[:space:]]+0x[0-9]+" "sys/socket.h"
auto_switch_type "socktypename" "SOCK_[A-Z]+[[:space:]]+[1-9]+[0-9]*" "sys/socket.h"
auto_switch_type "ptraceopname" "PT_[[:alnum:]_]+[[:space:]]+[0-9]+" "sys/ptrace.h"
auto_switch_type "vmresultname" "KERN_[A-Z]+[[:space:]]+[0-9]+" "vm/vm_param.h"

cat <<_EOF_
/*
 * AUTO - Special
 * F_ is used to specify fcntl commands as well as arguments. Both sets are
 * grouped in fcntl.h, and this awk script grabs the first group.
 */
void
fcntlcmdname (int cmd, int arg, int decimal)
{
	switch (cmd) {
_EOF_
egrep "^#[[:space:]]*define[[:space:]]+F_[A-Z]+[[:space:]]+[0-9]+[[:space:]]*" \
	$include_dir/sys/fcntl.h | \
	awk 'BEGIN { o=0 } { for (i = 1; i <= NF; i++) \
		if ($i ~ /define/) \
			break; \
		++i; \
		if (o <= $(i+1)) \
			printf "\tcase %s:\n\t\t(void)printf(\"%s\");\n\t\tbreak;\n", $i, $i; \
		else \
			exit; \
		o = $(i+1) }'
cat <<_EOF_
	default: /* Should not reach */
		(void)printf("<invalid=%ld>", (long)cmd);
	}
	(void)putchar(',');
	if (cmd == F_GETFD || cmd == F_SETFD) {
		if (arg == FD_CLOEXEC)
			(void)printf("FD_CLOEXEC");
		else if (arg == 0)
			(void)printf("0");
		else {
			if (decimal)
				(void)printf("<invalid>%ld", (long)arg);
			else
				(void)printf("<invalid>%#lx", (long)arg);
		}
	} else if (cmd == F_SETFL) {
		flagsname(arg);
	} else {
		if (decimal)
			(void)printf("%ld", (long)arg);
		else
			(void)printf("%#lx", (long)arg);
	}
}

/*
 * AUTO - Special
 *
 * The only reason this is not fully automated is due to the
 * grep -v RTP_PRIO statement. A better egrep line should
 * make this capable of being a auto_switch_type() function.
 */
void
rtprioname (int func)
{
	switch (func) {
_EOF_
egrep "^#[[:space:]]*define[[:space:]]+RTP_[A-Z]+[[:space:]]+0x[0-9]+[[:space:]]*" \
	$include_dir/sys/rtprio.h | grep -v RTP_PRIO | \
	awk '{ for (i = 1; i <= NF; i++) \
		if ($i ~ /define/) \
			break; \
		++i; \
		printf "\tcase %s:\n\t\t(void)printf(\"%s\");\n\t\tbreak;\n", $i, $i }'
cat <<_EOF_
	default: /* Should not reach */
		(void)printf("<invalid=%ld>", (long)func);
	}
}

/*
 * AUTO - Special
 *
 * The send and recv functions have a flags argument which can be
 * set to 0. There is no corresponding #define. The auto_ functions
 * detect this as "invalid", which is incorrect here.
 */
void
sendrecvflagsname (int flags)
{
	int	or = 0;

	if (flags == 0) {
		(void)printf("0");
		return;
	}
_EOF_
egrep "^#[[:space:]]*define[[:space:]]+MSG_[A-Z]+[[:space:]]+0x[0-9]+[[:space:]]*" $include_dir/sys/socket.h | \
	awk '{ for (i = 1; i <= NF; i++) \
		if ($i ~ /define/) \
			break; \
		++i; \
		printf "\tif(!((flags>0)^((%s)>0)))\n\t\tif_print_or(flags, %s, or);\n", $i, $i }'
cat <<_EOF_
}

_EOF_
@


1.29
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/246711
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d26 1
a26 1
# $FreeBSD: head/usr.bin/kdump/mksubr 246711 2013-02-12 13:01:34Z pluknet $
d364 1
@


1.28
log
@Switching exporter and resync
@
text
@d26 1
a26 1
# $FreeBSD: head/usr.bin/kdump/mksubr 242482 2012-11-02 16:07:21Z jilles $
d380 1
a380 1
auto_or_type     "nfssvcname"          "NFSSVC_[A-Z]+[[:space:]]+0x[0-9]+"            "nfsserver/nfs.h"
@


1.27
log
@SVN rev 242482 on 2012-11-02 16:07:21Z by jilles

kdump: Also decode fcntl commands containing underscores and digits.

The commands F_SETLK_REMOTE, F_DUPFD_CLOEXEC and F_DUP2FD_CLOEXEC were not
decoded.
@
text
@d26 1
a26 1
# $FreeBSD$
@


1.26
log
@SVN rev 240820 on 2012-09-22 12:40:00Z by jilles

kdump: Pretty-print signal codes.

MFC after:	1 week
@
text
@d419 1
a419 1
egrep "^#[[:space:]]*define[[:space:]]+F_[A-Z]+[[:space:]]+[0-9]+[[:space:]]*" \
@


1.25
log
@SVN rev 233925 on 2012-04-05 17:13:14Z by jhb

Add new ktrace records for the start and end of VM faults.  This gives
a pair of records similar to syscall entry and return that a user can
use to determine how long page faults take.  The new ktrace records are
enabled via the 'p' trace type, and are enabled in the default set of
trace points.

Reviewed by:	kib
MFC after:	2 weeks
@
text
@d391 3
d395 3
d510 9
d520 33
@


1.24
log
@SVN rev 232072 on 2012-02-23 21:08:21Z by jhb

Pretty-print the advice constants passed to posix_fadvise(2).

MFC after:	2 weeks
@
text
@d190 2
d339 20
d398 1
@


1.23
log
@SVN rev 226159 on 2011-10-08 13:01:38Z by des

Teach kdump(1) to decode capability bitmasks.

MFC after:	3 weeks
@
text
@d343 1
@


1.22
log
@SVN rev 226153 on 2011-10-08 12:28:06Z by des

I appreciate the logic behind using a (void) cast to indicate that the
return value is intentionally ignored, but frankly, all it does is
get in the way of the code.

Also fix a few other incorrect casts, such as (void *)malloc(foo) and
passing signed values to %x.
@
text
@d189 1
d341 1
@


1.21
log
@SVN rev 226151 on 2011-10-08 12:21:51Z by des

Fix casting.
@
text
@d87 1
a87 1
		(void)printf("<invalid>%jd", arg);
d116 1
a116 1
		printf "\tcase %s:\n\t\t(void)printf(\"%s\");\n\t\tbreak;\n", $i, $i }'
d119 1
a119 1
		(void)printf("<invalid=%jd>", arg);
d150 1
a150 1
		(void)printf("<invalid=%jd>", arg);
d214 1
a214 1
		(void)printf("SIG%s",signames[sig]);
d216 1
a216 1
		(void)printf("SIG %d", sig);
d225 1
a225 1
		(void)printf("GETNCNT");
d228 1
a228 1
		(void)printf("GETPID");
d231 1
a231 1
		(void)printf("GETVAL");
d234 1
a234 1
		(void)printf("GETALL");
d237 1
a237 1
		(void)printf("GETZCNT");
d240 1
a240 1
		(void)printf("SETVAL");
d243 1
a243 1
		(void)printf("SETALL");
d246 1
a246 1
		(void)printf("IPC_RMID");
d249 1
a249 1
		(void)printf("IPC_SET");
d252 1
a252 1
		(void)printf("IPC_STAT");
d255 1
a255 1
		(void)printf("<invalid=%d>", cmd);
d265 1
a265 1
		(void)printf("IPC_RMID");
d268 1
a268 1
		(void)printf("IPC_SET");
d271 1
a271 1
		(void)printf("IPC_STAT");
d274 1
a274 1
		(void)printf("<invalid=%d>", cmd);
d303 1
a303 1
	(void)putchar(',');
d308 1
a308 1
			(void)printf("<unused>%d", mode);
d310 1
a310 1
			(void)printf("<unused>%#x", (unsigned int)mode);
d326 1
a326 1
		(void)printf("SOL_SOCKET");
d329 1
a329 1
			(void)printf("%d", level);
d331 1
a331 1
			(void)printf("%#x", (unsigned int)level);
d394 1
a394 1
			printf "\tcase %s:\n\t\t(void)printf(\"%s\");\n\t\tbreak;\n", $i, $i; \
d400 1
a400 1
		(void)printf("<invalid=%d>", cmd);
d402 1
a402 1
	(void)putchar(',');
d405 1
a405 1
			(void)printf("FD_CLOEXEC");
d407 1
a407 1
			(void)printf("0");
d410 1
a410 1
				(void)printf("<invalid>%d", arg);
d412 1
a412 1
				(void)printf("<invalid>%#x", (unsigned int)arg);
d418 1
a418 1
			(void)printf("%d", arg);
d420 1
a420 1
			(void)printf("%#x", (unsigned int)arg);
d442 1
a442 1
		printf "\tcase %s:\n\t\t(void)printf(\"%s\");\n\t\tbreak;\n", $i, $i }'
d445 1
a445 1
		(void)printf("<invalid=%d>", func);
d462 1
a462 1
		(void)printf("0");
@


1.20
log
@SVN rev 226147 on 2011-10-08 11:39:00Z by des

Sort and line up.
@
text
@d255 1
a255 1
		(void)printf("<invalid=%ld>", (long)cmd);
d274 1
a274 1
		(void)printf("<invalid=%ld>", (long)cmd);
d308 1
a308 1
			(void)printf("<unused>%ld", (long)mode);
d310 1
a310 1
			(void)printf("<unused>%#lx", (long)mode);
d329 1
a329 1
			(void)printf("%ld", (long)level);
d331 1
a331 1
			(void)printf("%#lx", (long)level);
d400 1
a400 1
		(void)printf("<invalid=%ld>", (long)cmd);
d410 1
a410 1
				(void)printf("<invalid>%ld", (long)arg);
d412 1
a412 1
				(void)printf("<invalid>%#lx", (long)arg);
d418 1
a418 1
			(void)printf("%ld", (long)arg);
d420 1
a420 1
			(void)printf("%#lx", (long)arg);
d445 1
a445 1
		(void)printf("<invalid=%ld>", (long)func);
@


1.19
log
@SVN rev 226145 on 2011-10-08 09:57:29Z by des

1) Some of the #defines or enums for which we auto-generate naming
   functions may be wider than int, so use intmax_t throughout.  Also
   add missing casts in printf() calls.

2) Clean up some of the auto-generated code to improve readability.

3) Auto-generate kdump_subr.h.  Note that this requires a semi-ugly hack
   in the Makefile to make sure it is generated before make(1) tries to
   build kdump.c, or preprocess it for 'make depend'.

MFC after:	3 weeks
@
text
@d338 37
a374 38
auto_or_type "modename" "S_[A-Z]+[[:space:]]+[0-6]{7}" "sys/stat.h"
auto_or_type "flagsname" "O_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "sys/fcntl.h"
auto_or_type "accessmodename" "[A-Z]_OK[[:space:]]+0?x?[0-9A-Fa-f]+" "sys/unistd.h"
auto_or_type "mmapprotname" "PROT_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "sys/mman.h"
auto_or_type "mmapflagsname" "MAP_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "sys/mman.h"
auto_or_type "wait4optname" "W[A-Z]+[[:space:]]+[0-9]+" "sys/wait.h"
auto_or_type "getfsstatflagsname" "MNT_[A-Z]+[[:space:]]+[1-9][0-9]*" "sys/mount.h"
auto_or_type "mountflagsname" "MNT_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mount.h"
auto_or_type "rebootoptname" "RB_[A-Z]+[[:space:]]+0x[0-9]+" "sys/reboot.h"
auto_or_type "flockname" "LOCK_[A-Z]+[[:space:]]+0x[0-9]+" "sys/fcntl.h"
auto_or_type "thrcreateflagsname" "THR_[A-Z]+[[:space:]]+0x[0-9]+" "sys/thr.h"
auto_or_type "mlockallname" "MCL_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mman.h"
auto_or_type "shmatname" "SHM_[A-Z]+[[:space:]]+[0-9]{6}+" "sys/shm.h"
auto_or_type "rforkname" "RF[A-Z]+[[:space:]]+\([0-9]+<<[0-9]+\)" "sys/unistd.h"
auto_or_type "nfssvcname" "NFSSVC_[A-Z]+[[:space:]]+0x[0-9]+" "nfsserver/nfs.h"

auto_switch_type "whencename" "SEEK_[A-Z]+[[:space:]]+[0-9]+" "sys/unistd.h"
auto_switch_type "rlimitname" "RLIMIT_[A-Z]+[[:space:]]+[0-9]+" "sys/resource.h"
auto_switch_type "shutdownhowname" "SHUT_[A-Z]+[[:space:]]+[0-9]+" "sys/socket.h"
auto_switch_type "prioname" "PRIO_[A-Z]+[[:space:]]+[0-9]" "sys/resource.h"
auto_switch_type "madvisebehavname" "_?MADV_[A-Z]+[[:space:]]+[0-9]+" "sys/mman.h"
auto_switch_type "msyncflagsname" "MS_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mman.h"
auto_switch_type "schedpolicyname" "SCHED_[A-Z]+[[:space:]]+[0-9]+" "sched.h"
auto_switch_type "kldunloadfflagsname" "LINKER_UNLOAD_[A-Z]+[[:space:]]+[0-9]+" "sys/linker.h"
auto_switch_type "extattrctlname" "EXTATTR_NAMESPACE_[A-Z]+[[:space:]]+0x[0-9]+" "sys/extattr.h"
auto_switch_type "kldsymcmdname" "KLDSYM_[A-Z]+[[:space:]]+[0-9]+" "sys/linker.h"
auto_switch_type "sendfileflagsname" "SF_[A-Z]+[[:space:]]+[0-9]+" "sys/socket.h"
auto_switch_type "acltypename" "ACL_TYPE_[A-Z4_]+[[:space:]]+0x[0-9]+" "sys/acl.h"
auto_switch_type "sigprocmaskhowname" "SIG_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h"
auto_switch_type "lio_listioname" "LIO_(NO)?WAIT[[:space:]]+[0-9]+" "aio.h"
auto_switch_type "minheritname" "INHERIT_[A-Z]+[[:space:]]+[0-9]+" "sys/mman.h"
auto_switch_type "quotactlname" "Q_[A-Z]+[[:space:]]+0x[0-9]+" "ufs/ufs/quota.h"
auto_if_type "sockdomainname" "PF_[[:alnum:]]+[[:space:]]+" "sys/socket.h"
auto_if_type "sockfamilyname" "AF_[[:alnum:]]+[[:space:]]+" "sys/socket.h"
auto_if_type "sockipprotoname" "IPPROTO_[[:alnum:]]+[[:space:]]+" "netinet/in.h"
auto_switch_type "sockoptname" "SO_[A-Z]+[[:space:]]+0x[0-9]+" "sys/socket.h"
auto_switch_type "socktypename" "SOCK_[A-Z]+[[:space:]]+[1-9]+[0-9]*" "sys/socket.h"
auto_switch_type "ptraceopname" "PT_[[:alnum:]_]+[[:space:]]+[0-9]+" "sys/ptrace.h"
@


1.18
log
@SVN rev 223173 on 2011-06-17 06:12:28Z by netchild

Add 2-clause BSD license.

Approved by:	David Kirchner <dpk@@dpk.net> (initial author)
Requested by:	Otto Moerbeek <otto@@drijf.net>
MFC after:	1 week
@
text
@d72 1
a72 1
$name (int arg)
d74 2
a75 2
	int	or = 0;
	printf("%#x<", arg);
d83 1
a83 1
		printf "\tif(!((arg>0)^((%s)>0)))\n\t\tif_print_or(arg, %s, or);\n", $i, $i }'
d87 1
a87 1
		(void)printf("<invalid>%ld", (long)arg);
d106 1
a106 1
$name (int arg)
d119 1
a119 1
		(void)printf("<invalid=%ld>", (long)arg);
d139 1
a139 1
$name (int arg)
d150 1
a150 1
		(void)printf("<invalid=%ld>", (long)arg);
d159 1
d211 1
a211 1
signame (int sig)
d221 1
a221 1
semctlname (int cmd)
d261 2
a262 1
shmctlname (int cmd) {
d280 3
a282 2
semgetname (int flag) {
	int	or = 0;
d300 3
a302 2
flagsandmodename (int flags, int mode, int decimal) {
	flagsname (flags);
d323 1
a323 1
sockoptlevelname (int level, int decimal)
d384 1
a384 1
fcntlcmdname (int cmd, int arg, int decimal)
d433 1
a433 1
rtprioname (int func)
d458 1
a458 1
sendrecvflagsname (int flags)
d460 1
a460 1
	int	or = 0;
@


1.18.2.1
log
@SVN rev 225736 on 2011-09-23 00:51:37Z by kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by:	re (implicit)
@
text
@@


1.18.2.2
log
@SVN rev 233205 on 2012-03-19 21:33:23Z by jhb

MFC 232072: Pretty-print the advice constants passed to posix_fadvise(2).
@
text
@a353 1
auto_switch_type "fadvisebehavname" "POSIX_FADV_[A-Z]+[[:space:]]+[0-9]+" "sys/fcntl.h"
@


1.18.2.3
log
@SVN rev 237663 on 2012-06-27 21:12:15Z by jhb

MFC 233925,236357:
Add new ktrace records for the start and end of VM faults.  This gives
a pair of records similar to syscall entry and return that a user can
use to determine how long page faults take.  The new ktrace records are
enabled via the 'p' trace type, but are not enabled in the default set of
trace points.
@
text
@a187 2
#include <vm/vm.h>
#include <vm/vm_param.h>
a331 20
/*
 * MANUAL
 *
 * Used for page fault type.  Cannot use auto_or_type since the macro
 * values contain a cast.  Also, VM_PROT_NONE has to be handled specially.
 */
void
vmprotname (int type)
{
	int	or = 0;

	if (type == VM_PROT_NONE) {
		(void)printf("VM_PROT_NONE");
		return;
	}
	if_print_or(type, VM_PROT_READ, or);
	if_print_or(type, VM_PROT_WRITE, or);
	if_print_or(type, VM_PROT_EXECUTE, or);
	if_print_or(type, VM_PROT_COPY, or);
}
a372 1
auto_switch_type "vmresultname" "KERN_[A-Z]+[[:space:]]+[0-9]+" "vm/vm_param.h"
@


1.18.2.4
log
@## SVN ##
## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/ 242902
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ## r242902 | dteske | 2012-11-11 23:29:45 +0000 (Sun, 11 Nov 2012) | 10 lines
## SVN ##
## SVN ## Fix a regression introduced by SVN r211417 that saw the breakage of a feature
## SVN ## documented in usr.sbin/sysinstall/help/shortcuts.hlp (reproduced below):
## SVN ##
## SVN ## If /usr/sbin/sysinstall is linked to another filename, say
## SVN ## `/usr/local/bin/configPackages', then the basename will be used
## SVN ## as an implicit command name.
## SVN ##
## SVN ## Reviewed by:	adrian (co-mentor)
## SVN ## Approved by:	adrian (co-mentor)
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ##
@
text
@d26 1
a26 1
# $FreeBSD: stable/9/usr.bin/kdump/mksubr 237663 2012-06-27 21:12:15Z jhb $
@


1.18.2.5
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/250678
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d26 1
a26 1
# $FreeBSD: stable/9/usr.bin/kdump/mksubr 250678 2013-05-15 21:02:18Z pluknet $
d370 1
a370 1
auto_or_type "nfssvcname" "NFSSVC_[A-Z0-9]+[[:space:]]+0x[0-9]+" "nfs/nfssvc.h"
@


1.18.2.6
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/258442
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d26 1
a26 1
# $FreeBSD: stable/9/usr.bin/kdump/mksubr 258442 2013-11-21 20:09:44Z jhb $
d72 1
a72 1
$name(intmax_t arg)
d74 2
a75 2
	int or = 0;
	printf("%#jx<", (uintmax_t)arg);
d83 1
a83 1
		printf "\tif (!((arg > 0) ^ ((%s) > 0)))\n\t\tif_print_or(arg, %s, or);\n", $i, $i }'
d87 1
a87 1
		printf("<invalid>%jd", arg);
d106 1
a106 1
$name(intmax_t arg)
d116 1
a116 1
		printf "\tcase %s:\n\t\tprintf(\"%s\");\n\t\tbreak;\n", $i, $i }'
d119 1
a119 1
		printf("<invalid=%jd>", arg);
d139 1
a139 1
$name(intmax_t arg)
d150 1
a150 1
		printf("<invalid=%jd>", arg);
a158 1
#include <stdint.h>
d212 1
a212 1
signame(int sig)
d215 1
a215 1
		printf("SIG%s",signames[sig]);
d217 1
a217 1
		printf("SIG %d", sig);
d222 1
a222 1
semctlname(int cmd)
d226 1
a226 1
		printf("GETNCNT");
d229 1
a229 1
		printf("GETPID");
d232 1
a232 1
		printf("GETVAL");
d235 1
a235 1
		printf("GETALL");
d238 1
a238 1
		printf("GETZCNT");
d241 1
a241 1
		printf("SETVAL");
d244 1
a244 1
		printf("SETALL");
d247 1
a247 1
		printf("IPC_RMID");
d250 1
a250 1
		printf("IPC_SET");
d253 1
a253 1
		printf("IPC_STAT");
d256 1
a256 1
		printf("<invalid=%d>", cmd);
d262 1
a262 2
shmctlname(int cmd)
{
d265 1
a265 1
		printf("IPC_RMID");
d268 1
a268 1
		printf("IPC_SET");
d271 1
a271 1
		printf("IPC_STAT");
d274 1
a274 1
		printf("<invalid=%d>", cmd);
d280 2
a281 3
semgetname(int flag)
{
	int or = 0;
d299 3
a301 4
flagsandmodename(int flags, int mode, int decimal)
{
	flagsname(flags);
	putchar(',');
d306 1
a306 1
			printf("<unused>%d", mode);
d308 1
a308 1
			printf("<unused>%#x", (unsigned int)mode);
d321 1
a321 1
sockoptlevelname(int level, int decimal)
d324 1
a324 1
		printf("SOL_SOCKET");
d327 1
a327 1
			printf("%d", level);
d329 1
a329 1
			printf("%#x", (unsigned int)level);
d356 40
a395 39
auto_or_type     "accessmodename"      "[A-Z]_OK[[:space:]]+0?x?[0-9A-Fa-f]+"         "sys/unistd.h"
auto_switch_type "acltypename"         "ACL_TYPE_[A-Z4_]+[[:space:]]+0x[0-9]+"        "sys/acl.h"
auto_switch_type "extattrctlname"      "EXTATTR_NAMESPACE_[A-Z]+[[:space:]]+0x[0-9]+" "sys/extattr.h"
auto_switch_type "fadvisebehavname"    "POSIX_FADV_[A-Z]+[[:space:]]+[0-9]+"          "sys/fcntl.h"
auto_or_type     "flagsname"           "O_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+"           "sys/fcntl.h"
auto_or_type     "flockname"           "LOCK_[A-Z]+[[:space:]]+0x[0-9]+"              "sys/fcntl.h"
auto_or_type     "getfsstatflagsname"  "MNT_[A-Z]+[[:space:]]+[1-9][0-9]*"            "sys/mount.h"
auto_switch_type "kldsymcmdname"       "KLDSYM_[A-Z]+[[:space:]]+[0-9]+"              "sys/linker.h"
auto_switch_type "kldunloadfflagsname" "LINKER_UNLOAD_[A-Z]+[[:space:]]+[0-9]+"       "sys/linker.h"
auto_switch_type "lio_listioname"      "LIO_(NO)?WAIT[[:space:]]+[0-9]+"              "aio.h"
auto_switch_type "madvisebehavname"    "_?MADV_[A-Z]+[[:space:]]+[0-9]+"              "sys/mman.h"
auto_switch_type "minheritname"        "INHERIT_[A-Z]+[[:space:]]+[0-9]+"             "sys/mman.h"
auto_or_type     "mlockallname"        "MCL_[A-Z]+[[:space:]]+0x[0-9]+"               "sys/mman.h"
auto_or_type     "mmapflagsname"       "MAP_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+"         "sys/mman.h"
auto_or_type     "mmapprotname"        "PROT_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+"        "sys/mman.h"
auto_or_type     "modename"            "S_[A-Z]+[[:space:]]+[0-6]{7}"                 "sys/stat.h"
auto_or_type     "mountflagsname"      "MNT_[A-Z]+[[:space:]]+0x[0-9]+"               "sys/mount.h"
auto_switch_type "msyncflagsname"      "MS_[A-Z]+[[:space:]]+0x[0-9]+"                "sys/mman.h"
auto_or_type     "nfssvcname"          "NFSSVC_[A-Z0-9]+[[:space:]]+0x[0-9]+"         "nfs/nfssvc.h"
auto_switch_type "prioname"            "PRIO_[A-Z]+[[:space:]]+[0-9]"                 "sys/resource.h"
auto_switch_type "ptraceopname"        "PT_[[:alnum:]_]+[[:space:]]+[0-9]+"           "sys/ptrace.h"
auto_switch_type "quotactlname"        "Q_[A-Z]+[[:space:]]+0x[0-9]+"                 "ufs/ufs/quota.h"
auto_or_type     "rebootoptname"       "RB_[A-Z]+[[:space:]]+0x[0-9]+"                "sys/reboot.h"
auto_or_type     "rforkname"           "RF[A-Z]+[[:space:]]+\([0-9]+<<[0-9]+\)"       "sys/unistd.h"
auto_switch_type "rlimitname"          "RLIMIT_[A-Z]+[[:space:]]+[0-9]+"              "sys/resource.h"
auto_switch_type "schedpolicyname"     "SCHED_[A-Z]+[[:space:]]+[0-9]+"               "sched.h"
auto_switch_type "sendfileflagsname"   "SF_[A-Z]+[[:space:]]+[0-9]+"                  "sys/socket.h"
auto_or_type     "shmatname"           "SHM_[A-Z]+[[:space:]]+[0-9]{6}+"              "sys/shm.h"
auto_switch_type "shutdownhowname"     "SHUT_[A-Z]+[[:space:]]+[0-9]+"                "sys/socket.h"
auto_switch_type "sigprocmaskhowname"  "SIG_[A-Z]+[[:space:]]+[0-9]+"                 "sys/signal.h"
auto_if_type     "sockdomainname"      "PF_[[:alnum:]]+[[:space:]]+"                  "sys/socket.h"
auto_if_type     "sockfamilyname"      "AF_[[:alnum:]]+[[:space:]]+"                  "sys/socket.h"
auto_if_type     "sockipprotoname"     "IPPROTO_[[:alnum:]]+[[:space:]]+"             "netinet/in.h"
auto_switch_type "sockoptname"         "SO_[A-Z]+[[:space:]]+0x[0-9]+"                "sys/socket.h"
auto_switch_type "socktypename"        "SOCK_[A-Z]+[[:space:]]+[1-9]+[0-9]*"          "sys/socket.h"
auto_or_type     "thrcreateflagsname"  "THR_[A-Z]+[[:space:]]+0x[0-9]+"               "sys/thr.h"
auto_switch_type "vmresultname"        "KERN_[A-Z]+[[:space:]]+[0-9]+"                "vm/vm_param.h"
auto_or_type     "wait4optname"        "W[A-Z]+[[:space:]]+[0-9]+"                    "sys/wait.h"
auto_switch_type "whencename"          "SEEK_[A-Z]+[[:space:]]+[0-9]+"                "sys/unistd.h"
d404 1
a404 1
fcntlcmdname(int cmd, int arg, int decimal)
d415 1
a415 1
			printf "\tcase %s:\n\t\tprintf(\"%s\");\n\t\tbreak;\n", $i, $i; \
d421 1
a421 1
		printf("<invalid=%d>", cmd);
d423 1
a423 1
	putchar(',');
d426 1
a426 1
			printf("FD_CLOEXEC");
d428 1
a428 1
			printf("0");
d431 1
a431 1
				printf("<invalid>%d", arg);
d433 1
a433 1
				printf("<invalid>%#x", (unsigned int)arg);
d439 1
a439 1
			printf("%d", arg);
d441 1
a441 1
			printf("%#x", (unsigned int)arg);
d453 1
a453 1
rtprioname(int func)
d463 1
a463 1
		printf "\tcase %s:\n\t\tprintf(\"%s\");\n\t\tbreak;\n", $i, $i }'
d466 1
a466 1
		printf("<invalid=%d>", func);
d478 1
a478 1
sendrecvflagsname(int flags)
d480 1
a480 1
	int or = 0;
d483 1
a483 1
		printf("0");
@


1.18.2.7
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/258870
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d26 1
a26 1
# $FreeBSD: stable/9/usr.bin/kdump/mksubr 258870 2013-12-03 16:07:56Z jhb $
d373 1
a450 34
 * The MAP_ALIGNED flag requires special handling.
 */
void
mmapflagsname(int flags)
{
	int align;
	int or = 0;
	printf("%#x<", flags);
_EOF_
egrep "^#[[:space:]]*define[[:space:]]+MAP_[A-Z_]+[[:space:]]+0x[0-9A-Fa-f]+[[:space:]]*" \
	$include_dir/sys/mman.h | grep -v MAP_ALIGNED | \
	awk '{ for (i = 1; i <= NF; i++) \
		if ($i ~ /define/) \
			break; \
		++i; \
		printf "\tif (!((flags > 0) ^ ((%s) > 0)))\n\t\tif_print_or(flags, %s, or);\n", $i, $i }'
cat <<_EOF_
	align = flags & MAP_ALIGNMENT_MASK;
	if (align != 0) {
		if (align == MAP_ALIGNED_SUPER)
			print_or("MAP_ALIGNED_SUPER", or);
		else {
			print_or("MAP_ALIGNED", or);
			printf("(%d)", align >> MAP_ALIGNMENT_SHIFT);
		}
	}
	printf(">");
	if (or == 0)
		printf("<invalid>%d", flags);
}

/*
 * AUTO - Special
 *
@


1.18.2.8
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/259829
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d26 1
a26 1
# $FreeBSD: stable/9/usr.bin/kdump/mksubr 259829 2013-12-24 18:41:17Z jhb $
a316 62
/* MANUAL */
void
idtypename(idtype_t idtype, int decimal)
{
	switch(idtype) {
	case P_PID:
		printf("P_PID");
		break;
	case P_PPID:
		printf("P_PPID");
		break;
	case P_PGID:
		printf("P_PGID");
		break;
	case P_SID:
		printf("P_SID");
		break;
	case P_CID:
		printf("P_CID");
		break;
	case P_UID:
		printf("P_UID");
		break;
	case P_GID:
		printf("P_GID");
		break;
	case P_ALL:
		printf("P_ALL");
		break;
	case P_LWPID:
		printf("P_LWPID");
		break;
	case P_TASKID:
		printf("P_TASKID");
		break;
	case P_PROJID:
		printf("P_PROJID");
		break;
	case P_POOLID:
		printf("P_POOLID");
		break;
	case P_JAILID:
		printf("P_JAILID");
		break;
	case P_CTID:
		printf("P_CTID");
		break;
	case P_CPUID:
		printf("P_CPUID");
		break;
	case P_PSETID:
		printf("P_PSETID");
		break;
	default:
		if (decimal) {
			printf("%d", idtype);
		} else {
			printf("%#x", idtype);
		}
	}
}

d396 1
a396 1
auto_or_type     "wait6optname"        "W[A-Z]+[[:space:]]+[0-9]+"                    "sys/wait.h"
@


1.18.2.9
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/260208
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d26 1
a26 1
# $FreeBSD: stable/9/usr.bin/kdump/mksubr 260208 2014-01-02 21:57:03Z jhb $
a171 1
#include <sys/procctl.h>
a440 1
auto_switch_type "procctlcmdname"      "PROC_[A-Z]+[[:space:]]+[0-9]"                 "sys/procctl.h"
@


1.18.2.10
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/261952
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d26 1
a26 1
# $FreeBSD: stable/9/usr.bin/kdump/mksubr 261952 2014-02-15 23:23:13Z jilles $
d474 1
a474 1
egrep "^#[[:space:]]*define[[:space:]]+F_[A-Z0-9_]+[[:space:]]+[0-9]+[[:space:]]*" \
@


1.18.2.3.2.1
log
@SVN rev 239080 on 2012-08-05 23:54:33Z by kensmith

Copy stable/9 to releng/9.1 as part of the 9.1-RELEASE release process.

Approved by:	re (implicit)
@
text
@@


1.18.2.3.2.2
log
@Switch importer
@
text
@d26 1
a26 1
# $FreeBSD: releng/9.1/usr.bin/kdump/mksubr 237663 2012-06-27 21:12:15Z jhb $
@


1.18.2.1.2.1
log
@SVN rev 227445 on 2011-11-11 04:20:22Z by kensmith

Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
cycle.

Approved by:	re (implicit)
@
text
@@


1.18.2.1.2.2
log
@Switch importer
@
text
@d26 1
a26 1
# $FreeBSD: releng/9.0/usr.bin/kdump/mksubr 223173 2011-06-17 06:12:28Z netchild $
@


1.17
log
@SVN rev 222768 on 2011-06-06 19:00:38Z by dchagin

Fix regex for ptraceopname().

PR:		bin/157663
Submitted by:	jason wright <jason@@thought.net>
MFC after:	10 days
@
text
@d3 23
@


1.16
log
@SVN rev 216130 on 2010-12-02 18:24:22Z by delphij

Decode IPC_CREAT and IPC_EXCL for semget(2).

PR:		bin/152781
Submitted by:	Anton Yuzhaninov <citrin citrin ru>
MFC after:	2 weeks
@
text
@d348 1
a348 1
auto_switch_type "ptraceopname" "PT_[[:alnum:]]+[[:space:]]+[0-9]+" "sys/ptrace.h"
@


1.15
log
@SVN rev 213479 on 2010-10-06 12:41:42Z by netchild

Fix regex for some socket- and acl-related syscall values.

Submitted by:	Mikhail <hidden.node@@gmail.com>
PR:		149295
MFC-after:	2 weeks
@
text
@d257 2
@


1.14
log
@SVN rev 212728 on 2010-09-16 11:40:41Z by rpaulo

Fix indenting of the previous commit.
@
text
@d327 1
a327 1
auto_switch_type "shutdownhowname" "SHUT_[A-Z]+[[:space:]]+0x[0-9]+" "sys/socket.h"
d336 1
a336 1
auto_switch_type "acltypename" "ACL_TYPE_[A-Z]+[[:space:]]+0x[0-9]+" "sys/acl.h"
@


1.13
log
@SVN rev 212727 on 2010-09-16 11:33:31Z by rpaulo

When generating functions to print the arguments of system calls with
bitwise parameters (e.g. mmap), print the syscall parameter value first.
The resulting output looks like the %b specifier of printf(9).

Before:
mmap(0,0x8000,PROT_READ|PROT_WRITE,...
After:
mmap(0,0x8000,0x3<PROT_READ|PROT_WRITE>,...

Submitted by:	Norberto Lopes <nlopes.ml at gmail.com>
Idea from:	freebsd-arch/2006-April/005116.html
@
text
@d52 1
a52 1
        printf("%#x<", arg);
d62 1
a62 1
        printf(">");
d438 1
a438 1
        printf("%#x<", flags);
d447 1
a447 1
        printf(">");
@


1.12
log
@ - Remove ksethrcmdname.
@
text
@d52 1
d62 1
d437 2
d447 1
@


1.12.2.1
log
@SVN rev 196045 on 2009-08-03 08:13:06Z by kensmith

Copy head to stable/8 as part of 8.0 Release cycle.

Approved by:	re (Implicit)
@
text
@@


1.12.2.2
log
@SVN rev 216506 on 2010-12-17 19:48:54Z by delphij

MFC r216130:

Decode IPC_CREAT and IPC_EXCL for semget(2).

PR:		bin/152781
Submitted by:	Anton Yuzhaninov <citrin citrin ru>
Approved by:	re (kib)
@
text
@a254 2
	if_print_or(flag, IPC_CREAT, or);
	if_print_or(flag, IPC_EXCL, or);
@


1.12.2.3
log
@SVN rev 223194 on 2011-06-17 18:16:23Z by dchagin

MFC r222768:

Fix regex for ptraceopname().

PR:		bin/157663
Submitted by:	jason wright <jason@@thought.net>
@
text
@d346 1
a346 1
auto_switch_type "ptraceopname" "PT_[[:alnum:]_]+[[:space:]]+[0-9]+" "sys/ptrace.h"
@


1.12.2.4
log
@SVN rev 223592 on 2011-06-27 11:49:58Z by netchild

MFC r223173:
  Add 2-clause BSD license.

  Approved by:        David Kirchner <dpk@@dpk.net> (initial author)
  Requested by:       Otto Moerbeek <otto@@drijf.net>
@
text
@a2 23
# Copyright (c) 2006 "David Kirchner" <dpk@@dpk.net>. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
@


1.12.2.5
log
@SVN rev 233206 on 2012-03-19 21:33:35Z by jhb

MFC 232072: Pretty-print the advice constants passed to posix_fadvise(2).
@
text
@a351 1
auto_switch_type "fadvisebehavname" "POSIX_FADV_[A-Z]+[[:space:]]+[0-9]+" "sys/fcntl.h"
@


1.12.2.6
log
@SVN rev 237664 on 2012-06-27 21:13:00Z by jhb

MFC 233925,236357:
Add new ktrace records for the start and end of VM faults.  This gives
a pair of records similar to syscall entry and return that a user can
use to determine how long page faults take.  The new ktrace records are
enabled via the 'p' trace type, but are not enabled in the default set of
trace points.
@
text
@a185 2
#include <vm/vm.h>
#include <vm/vm_param.h>
a329 20
/*
 * MANUAL
 *
 * Used for page fault type.  Cannot use auto_or_type since the macro
 * values contain a cast.  Also, VM_PROT_NONE has to be handled specially.
 */
void
vmprotname (int type)
{
	int	or = 0;

	if (type == VM_PROT_NONE) {
		(void)printf("VM_PROT_NONE");
		return;
	}
	if_print_or(type, VM_PROT_READ, or);
	if_print_or(type, VM_PROT_WRITE, or);
	if_print_or(type, VM_PROT_EXECUTE, or);
	if_print_or(type, VM_PROT_OVERRIDE_WRITE, or);
}
a370 1
auto_switch_type "vmresultname" "KERN_[A-Z]+[[:space:]]+[0-9]+" "vm/vm_param.h"
@


1.12.2.7
log
@## SVN ##
## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/ 242909
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ## r242909 | dim | 2012-11-12 07:47:19 +0000 (Mon, 12 Nov 2012) | 20 lines
## SVN ##
## SVN ## MFC r242625:
## SVN ##
## SVN ## Remove duplicate const specifiers in many drivers (I hope I got all of
## SVN ## them, please let me know if not).  Most of these are of the form:
## SVN ##
## SVN ## static const struct bzzt_type {
## SVN ##       [...list of members...]
## SVN ## } const bzzt_devs[] = {
## SVN ##       [...list of initializers...]
## SVN ## };
## SVN ##
## SVN ## The second const is unnecessary, as arrays cannot be modified anyway,
## SVN ## and if the elements are const, the whole thing is const automatically
## SVN ## (e.g. it is placed in .rodata).
## SVN ##
## SVN ## I have verified this does not change the binary output of a full kernel
## SVN ## build (except for build timestamps embedded in the object files).
## SVN ##
## SVN ## Reviewed by:	yongari, marius
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ##
@
text
@d26 1
a26 1
# $FreeBSD: stable/8/usr.bin/kdump/mksubr 237664 2012-06-27 21:13:00Z jhb $
@


1.12.2.8
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/250679
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d26 1
a26 1
# $FreeBSD: stable/8/usr.bin/kdump/mksubr 250679 2013-05-15 21:05:25Z pluknet $
d368 1
a368 1
auto_or_type "nfssvcname" "NFSSVC_[A-Z0-9]+[[:space:]]+0x[0-9]+" "nfs/nfssvc.h"
@


1.12.2.4.2.1
log
@SVN rev 232438 on 2012-03-03 06:15:13Z by kensmith

Copy stable/8 to releng/8.3 as part of 8.3-RELEASE release cycle.

Approved by:	re (implicit)
@
text
@@


1.12.2.4.2.2
log
@Switch importer
@
text
@d26 1
a26 1
# $FreeBSD: releng/8.3/usr.bin/kdump/mksubr 223592 2011-06-27 11:49:58Z netchild $
@


1.12.2.2.2.1
log
@SVN rev 216617 on 2010-12-21 17:09:25Z by kensmith

Copy stable/8 to releng/8.2 in preparation for FreeBSD-8.2 release.

Approved by:	re (implicit)
@
text
@@


1.12.2.1.4.1
log
@SVN rev 209145 on 2010-06-14 02:09:06Z by kensmith

Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.

Approved by:	re (implicit)
@
text
@@


1.12.2.1.2.1
log
@SVN rev 198460 on 2009-10-25 01:10:29Z by kensmith

Copy stable/8 to releng/8.0 as part of 8.0-RELEASE release procedure.

Approved by:	re (implicit)
@
text
@@


1.11
log
@This patch adds a new ktrace(2) record type, KTR_STRUCT, whose payload
consists of the null-terminated name and the contents of any structure
you wish to record.  A new ktrstruct() function constructs and emits a
KTR_STRUCT record.  It is accompanied by convenience macros for struct
stat and struct sockaddr.

In kdump(1), KTR_STRUCT records are handled by a dispatcher function
that runs stringent sanity checks on its contents before handing it
over to individual decoding funtions for each type of structure.
Currently supported structures are struct stat and struct sockaddr for
the AF_INET, AF_INET6 and AF_UNIX families; support for AF_APPLETALK
and AF_IPX is present but disabled, as I am unable to test it properly.

Since 's' was already taken, the letter 't' is used by ktrace(1) to
enable KTR_STRUCT trace points, and in kdump(1) to enable their
decoding.

Derived from patches by Andrew Li <andrew2.li@@citi.com>.

PR:		kern/117836
MFC after:	3 weeks
@
text
@a153 1
#include <sys/kse.h>
a330 1
auto_switch_type "ksethrcmdname" "KSE_INTR_[A-Z]+[[:space:]]+[0-9]+" "sys/kse.h"
@


1.10
log
@These are files are shell scripts; give smart editors a chance to figure
it out by adding the usual shebang.

MFC after:	2 weeks
@
text
@d342 1
@


1.9
log
@Remove static ptrace_ops array and extract ptrace op names from
sys/ptrace.h with mksubr.
@
text
@d1 4
a4 2
set -e

d21 1
a21 1
# $FreeBSD$
d431 1
a431 1
	
@


1.9.2.1
log
@SVN rev 181632 on 2008-08-12 17:22:51Z by des

MFH r176471 (KTR_STRUCT, support for struct stat and struct sockaddr)
@
text
@a339 1
auto_if_type "sockfamilyname" "AF_[[:alnum:]]+[[:space:]]+" "sys/socket.h"
@


1.9.2.2
log
@SVN rev 192860 on 2009-05-26 21:40:15Z by des

MFC r175936: add shebang.
@
text
@d1 2
a2 4
#!/bin/sh
#
# $FreeBSD$
#
d19 1
a19 1
set -e
d430 1
a430 1

@


1.9.2.3
log
@Switch importer
@
text
@d3 1
a3 1
# $FreeBSD: stable/7/usr.bin/kdump/mksubr 192860 2009-05-26 21:40:15Z des $
@


1.9.2.2.4.1
log
@SVN rev 216618 on 2010-12-21 17:10:29Z by kensmith

Copy stable/7 to releng/7.4 in preparation for FreeBSD-7.4 release.

Approved by:	re (implicit)
@
text
@@


1.9.2.2.4.2
log
@Switch importer
@
text
@d3 1
a3 1
# $FreeBSD: releng/7.4/usr.bin/kdump/mksubr 192860 2009-05-26 21:40:15Z des $
@


1.9.2.2.2.1
log
@SVN rev 203736 on 2010-02-10 00:26:20Z by kensmith

Copy stable/7 to releng/7.3 as part of the 7.3-RELEASE process.

Approved by:	re (implicit)
@
text
@@


1.9.2.1.4.1
log
@SVN rev 191087 on 2009-04-15 03:14:26Z by kensmith

Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.

Approved by:	re (implicit)
@
text
@@


1.9.2.1.2.1
log
@SVN rev 185281 on 2008-11-25 02:59:29Z by kensmith

Create releng/7.1 in preparation for moving into RC phase of 7.1 release
cycle.

Approved by:	re (implicit)
@
text
@@


1.8
log
@Add sockipprotoname() function.  Decode the third parameter (protocol)
of a socket() call with sockipprotoname() if the first parameter (domain)
is PF_INET or PF_INET6.

Old parsing behavior before this change:
ping6    CALL  socket(PF_INET6,SOCK_RAW,0x3a)

New behavior after this change:
ping6    CALL  socket(PF_INET6,SOCK_RAW,IPPROTO_ICMPV6)
@
text
@d144 1
d343 1
@


1.7
log
@Generate sockdomainname() function with auto_if_type() instead
of auto_or_type.

The old parsing code would incorrectly decode a socket() call in the
ping6 program as:
  CALL  socket(PF_PUP|PF_ECMA|PF_APPLETALK|PF_COIP|PF_SIP,SOCK_DGRAM,0)

The new parsing code decodes the same socket() call as:
  CALL  socket(PF_INET6,SOCK_DGRAM,0)
@
text
@d141 1
d339 1
@


1.6
log
@Add auto_if_type() function, which is similar to auto_switch_type().
However, auto_if_type() uses if/else statements in C instead
of a single switch statement, when mapping an integer value to
a #define.  For certain cases where multiple #define constants
alias to a single integer value, auto_if_type() makes things easier
to parse than auto_switch_type().
@
text
@a313 1
auto_or_type "sockdomainname" "PF_[A-Z]+[[:space:]]+" "sys/socket.h"
d337 1
@


1.5
log
@The second argument (type) to socket(2) is an enum, not a bitmask, so parse
it as an enum.

If an SCTP SOCK_SEQPACKET socket was opened, kdump would display this
wrong output:
 socket(PF_INET,SOCK_STREAM|SOCK_RDM|SOCK_SEQPACKET,0x84)

instead of this correct output:
 socket(PF_INET,SOCK_SEQPACKET,0x84)

MFC after:	2 weeks
@
text
@d99 30
@


1.4
log
@o optname, the third {set,get}sockopt(2) argument, is an enum, not a bitmap.
Treat it accordingly.

PR:		bin/101642
MFC after:	3 weeks
@
text
@a284 1
auto_or_type "socktypename" "SOCK_[A-Z]+[[:space:]]+[1-9]+[0-9]*" "sys/socket.h"
d309 1
@


1.3
log
@Remove slipped in spaces.

Pointed out by:	maxim
Approved by:	pjd (mentor)
@
text
@a283 1
auto_or_type "sockoptname" "SO_[A-Z]+[[:space:]]+0x[0-9]+" "sys/socket.h"
d309 1
@


1.2
log
@Check that the signal number is in range.

Submitted by:	Michiel Boland <michiel boland org>
MFC after:	1 week
Approved by:	pjd (mentor)
@
text
@d154 3
a156 3
	if (sig > 0 && sig < NSIG)                                             
		(void)printf("SIG%s",signames[sig]);                            
	else                                                                    
@


1.1
log
@Change kdump to print more useful information, i.e. it changes from
 32229 telnet   CALL  mmap(0,0x8000,0x3,0x1002,0xffffffff,0,0,0)
 32229 telnet   CALL  open(0x2807bc28,0,0x1b6)
 32229 telnet   CALL  socket(0x2,0x2,0)
to
 32229 telnet   CALL mmap(0,0x8000,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,0xffffffff,0,0,0)
 32229 telnet   CALL  open(0x2807bc28,O_RDONLY,<unused>0x1b6)
 32229 telnet   CALL  socket(PF_INET,SOCK_DGRAM,0)

David wanted to implement the suggestions which came up at the review from
arch@@ too, but real life rejected this proposal. So I commit what we already
got and let another volunteer pick the remaining work from the ideas list.

Submitted by:	"David Kirchner" <dpk@@dpk.net>
Suggested by:	FreeBSD ideas list page
Reviewed by:	arch
@
text
@d154 4
a157 1
	(void)printf("SIG%s",signames[sig]);
@

