diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2014-10-13 03:46:34 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2014-10-13 03:46:34 +0000 |
commit | ffc6b86b7582a148e5ed504fb596d3ffba5d5016 (patch) | |
tree | 83421af24e070e3cfecf441a94ab9753d76ed6bb /usr.bin | |
parent | 9a400f48e1a763df7f76112c9dc97e89e0e2f8c4 (diff) |
Add dumping of struct dqblk done by quotactl(2)
ok millert@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/kdump/kdump.c | 6 | ||||
-rw-r--r-- | usr.bin/kdump/kdump_subr.h | 3 | ||||
-rw-r--r-- | usr.bin/kdump/ktrstruct.c | 24 | ||||
-rw-r--r-- | usr.bin/kdump/mksubr | 22 |
4 files changed, 50 insertions, 5 deletions
diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c index 610793e442e..69a71b817a7 100644 --- a/usr.bin/kdump/kdump.c +++ b/usr.bin/kdump/kdump.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kdump.c,v 1.90 2014/10/08 04:02:46 doug Exp $ */ +/* $OpenBSD: kdump.c,v 1.91 2014/10/13 03:46:33 guenther Exp $ */ /*- * Copyright (c) 1988, 1993 @@ -912,6 +912,10 @@ ktrsyscall(struct ktr_syscall *ktr) case SYS_getitimer: pn(itimername); break; + case SYS_quotactl: + pn(NULL); + pn(quotactlcmdname); + break; } nonnative: diff --git a/usr.bin/kdump/kdump_subr.h b/usr.bin/kdump/kdump_subr.h index 03945bddc2d..d1cda77d6de 100644 --- a/usr.bin/kdump/kdump_subr.h +++ b/usr.bin/kdump/kdump_subr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: kdump_subr.h,v 1.13 2014/09/17 19:12:55 guenther Exp $ */ +/* $OpenBSD: kdump_subr.h,v 1.14 2014/10/13 03:46:33 guenther Exp $ */ /* * Copyright(c) 2006 2006 David Kirchner <dpk@dpk.net> * @@ -80,6 +80,7 @@ void sigprocmaskhowname(int); void lio_listioname(int); void minheritname(int); void quotactlname(int); +void quotactlcmdname(int); void ptraceopname(int); void sigill_name(int); void sigtrap_name(int); diff --git a/usr.bin/kdump/ktrstruct.c b/usr.bin/kdump/ktrstruct.c index d794c3056ac..6d7fc99005b 100644 --- a/usr.bin/kdump/ktrstruct.c +++ b/usr.bin/kdump/ktrstruct.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ktrstruct.c,v 1.5 2014/07/11 21:49:13 tedu Exp $ */ +/* $OpenBSD: ktrstruct.c,v 1.6 2014/10/13 03:46:33 guenther Exp $ */ /*- * Copyright (c) 1988, 1993 @@ -35,6 +35,7 @@ #include <sys/stat.h> #include <sys/time.h> #include <sys/un.h> +#include <ufs/ufs/quota.h> #include <netinet/in.h> #include <arpa/inet.h> @@ -327,6 +328,20 @@ ktrrusage(const struct rusage *rup) rup->ru_nvcsw, rup->ru_nivcsw); } +static void +ktrquota(const struct dqblk *quota) +{ + printf("struct dqblk { bhardlimit=%u, bsoftlimit=%u, curblocks=%u," + " ihardlimit=%u, isoftlimit=%u, curinodes=%u, btime=", + quota->dqb_bhardlimit, quota->dqb_bsoftlimit, + quota->dqb_curblocks, quota->dqb_ihardlimit, + quota->dqb_isoftlimit, quota->dqb_curinodes); + print_time(quota->dqb_btime, 0); + printf(", itime="); + print_time(quota->dqb_itime, 0); + printf(" }\n"); +} + void ktrstruct(char *buf, size_t buflen) { @@ -417,6 +432,13 @@ ktrstruct(char *buf, size_t buflen) memcpy(fds, data, datalen); ktrfdset(fds, datalen); free(fds); + } else if (strcmp(name, "quota") == 0) { + struct dqblk quota; + + if (datalen != sizeof(quota)) + goto invalid; + memcpy("a, data, datalen); + ktrquota("a); } else { printf("unknown structure %s\n", name); } diff --git a/usr.bin/kdump/mksubr b/usr.bin/kdump/mksubr index 4e8f5d6e5ca..850ff26cce3 100644 --- a/usr.bin/kdump/mksubr +++ b/usr.bin/kdump/mksubr @@ -1,5 +1,5 @@ #!/bin/sh -# $OpenBSD: mksubr,v 1.22 2014/09/17 19:12:55 guenther Exp $ +# $OpenBSD: mksubr,v 1.23 2014/10/13 03:46:33 guenther Exp $ # # Copyright (c) 2006 David Kirchner <dpk@dpk.net> # @@ -344,7 +344,7 @@ auto_switch_type "sigsegv_name" "SEGV_[A-Z]+[[:space:]]+[0-9]+" "sys/siginfo.h" auto_switch_type "sigchld_name" "CLD_[A-Z]+[[:space:]]+[0-9]+" "sys/siginfo.h" #auto_switch_type "lio_listioname" "LIO_(NO)?WAIT[[:space:]]+[0-9]+" "aio.h" auto_switch_type "minheritname" "MAP_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_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" @@ -486,4 +486,22 @@ sockflagsname (int arg) dosocktypename(arg, 0); } +void +quotactlcmdname(int cmd) +{ + printf("QCMD("); + quotactlname(cmd >> SUBCMDSHIFT); + switch (cmd & SUBCMDMASK) { + case USRQUOTA: + printf(",%s)", "USRQUOTA"); + break; + case GRPQUOTA: + printf(",%s)", "GRPQUOTA"); + break; + default: + printf(",<invalid>%#x)", cmd & SUBCMDMASK); + break; + } +} + _EOF_ |