diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2013-07-03 23:04:35 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2013-07-03 23:04:35 +0000 |
commit | 72f62f23d4e14f972d9c80b5416c6b7532447279 (patch) | |
tree | f00e58ed010d2d4ec2ba2429d02b1a550922aaa1 /usr.bin/kdump/mksubr | |
parent | a77b3dc16f227405dc95fa34d4a2bf29659ec695 (diff) |
For consistency, move the functions that aren't generated at build-time
from mksubr to kdump.c
ok otto@ millert@
Diffstat (limited to 'usr.bin/kdump/mksubr')
-rw-r--r-- | usr.bin/kdump/mksubr | 182 |
1 files changed, 1 insertions, 181 deletions
diff --git a/usr.bin/kdump/mksubr b/usr.bin/kdump/mksubr index 83d439d466e..4f423769204 100644 --- a/usr.bin/kdump/mksubr +++ b/usr.bin/kdump/mksubr @@ -1,5 +1,5 @@ #!/bin/sh -# $OpenBSD: mksubr,v 1.16 2013/07/01 17:16:46 guenther Exp $ +# $OpenBSD: mksubr,v 1.17 2013/07/03 23:04:34 guenther Exp $ # # Copyright (c) 2006 David Kirchner <dpk@dpk.net> # @@ -278,186 +278,6 @@ cat <<_EOF_ #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 ("%s", str); } \\ - while (0) -#define if_print_or(i,flag,orflag) do { \\ - if ((i & flag) == flag) \\ - print_or(#flag,orflag); } \\ - while (0) - -/* MANUAL */ -extern const char *const sys_signame[NSIG]; -void -signame (int sig) -{ - if (sig > 0 && sig < NSIG) - (void)printf("SIG%s", sys_signame[sig]); - else - (void)printf("SIG %d", sig); -} - -/* MANUAL */ -void -sigset (int ss) -{ - int or = 0; - int cnt = 0; - int i; - - for (i = 1; i < NSIG; i++) - if (sigismember(&ss, i)) - cnt++; - if (cnt > (NSIG-1)/2) { - ss = ~ss; - putchar('~'); - } - - if (ss == 0) { - (void)printf("0<>"); - return; - } - - printf("%#x<", ss); - for (i = 1; i < NSIG; i++) - if (sigismember(&ss, i)) { - if (or) putchar('|'); else or=1; - signame(i); - } - printf(">"); -} - -/* 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) { - flagsname (flags); - if ((flags & O_CREAT) == O_CREAT) { - (void)putchar(','); - modename (mode); - } else if (!fancy) { - (void)putchar(','); - if (decimal) { - (void)printf("<unused>%ld", (long)mode); - } else { - (void)printf("<unused>%#lx", (long)mode); - } - } -} - -void -clockname (int clockid) -{ - clocktypename(__CLOCK_TYPE(clockid)); - if (__CLOCK_PTID(clockid) != 0) - printf("(%d)", __CLOCK_PTID(clockid)); -} - -/* - * 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) -{ - if (level == SOL_SOCKET) { - (void)printf("SOL_SOCKET"); - } else { - if (decimal) { - (void)printf("%ld", (long)level); - } else { - (void)printf("%#lx", (long)level); - } - } -} - _EOF_ auto_orz_type "modename" "S_[A-Z]+[[:space:]]+[0-6]{7}" "sys/stat.h" |