From 97f35a0237f0ab2ff6566c886d74993437812b2f Mon Sep 17 00:00:00 2001 From: Nick Alcock Date: Wed, 31 Jul 2013 16:17:30 +0100 Subject: [PATCH] Re-enable DTrace ioctl()-size debugging. We move the shared user/kernel ioctl-debugging function to a new header, to avoid problems with other users. Signed-off-by: Nick Alcock --- dtrace/dtrace_dev.c | 4 ++ .../include/uapi/linux/dtrace/ioctl_debug.h | 50 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 dtrace/include/uapi/linux/dtrace/ioctl_debug.h diff --git a/dtrace/dtrace_dev.c b/dtrace/dtrace_dev.c index 2f5c24aed7a2..a00049f7dacf 100644 --- a/dtrace/dtrace_dev.c +++ b/dtrace/dtrace_dev.c @@ -38,6 +38,7 @@ #include "ctf_api.h" #include "dtrace.h" #include "dtrace_dev.h" +#include uint32_t dtrace_helptrace_next = 0; uint32_t dtrace_helptrace_nlocals; @@ -103,6 +104,9 @@ static int dtrace_open(struct inode *inode, struct file *file) if (priv == DTRACE_PRIV_NONE) return -EACCES; +#ifdef CONFIG_DT_DEBUG + dtrace_ioctl_sizes(); +#endif mutex_lock(&dtrace_provider_lock); dtrace_probe_provide(NULL, NULL); mutex_unlock(&dtrace_provider_lock); diff --git a/dtrace/include/uapi/linux/dtrace/ioctl_debug.h b/dtrace/include/uapi/linux/dtrace/ioctl_debug.h new file mode 100644 index 000000000000..90c326b30de7 --- /dev/null +++ b/dtrace/include/uapi/linux/dtrace/ioctl_debug.h @@ -0,0 +1,50 @@ +/* Copyright (C) 2013 Oracle, Inc. */ + +#ifndef _LINUX_DTRACE_IOCTL_DEBUG_H_ +#define _LINUX_DTRACE_IOCTL_DEBUG_H_ + +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + * + * Copyright 2013 Oracle, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#include + +void dtrace_size_dbg_print(const char *type, size_t size); + +static void dtrace_ioctl_sizes(void) { +#define DBG_PRINT(x) dtrace_size_dbg_print(#x, sizeof(x)) + DBG_PRINT(dtrace_providerdesc_t); + DBG_PRINT(dtrace_probedesc_t); + DBG_PRINT(dtrace_bufdesc_t); + DBG_PRINT(dtrace_eprobedesc_t); + DBG_PRINT(dtrace_argdesc_t); + DBG_PRINT(dtrace_conf_t); + DBG_PRINT(dtrace_status_t); + DBG_PRINT(processorid_t); + DBG_PRINT(dtrace_aggdesc_t); + DBG_PRINT(dtrace_fmtdesc_t); + DBG_PRINT(dof_hdr_t); +#undef DBG_PRINT +} + +#endif /* _LINUX_DTRACE_IOCTL_DEBUG_H */ -- 2.50.1