ctf_subr.c

来自「Sun Solaris 10 中的 DTrace 组件的源代码。请参看: htt」· C语言 代码 · 共 68 行

C
68
字号
/* * Copyright 2005 Sun Microsystems, Inc.  All rights reserved. * * The contents of this file are subject to the terms of the * Common Development and Distribution License, Version 1.0 only. * See the file usr/src/LICENSING.NOTICE in this distribution or * http://www.opensolaris.org/license/ for details. */#pragma ident	"@(#)ctf_subr.c	1.1	03/09/02 SMI"#include <ctf_impl.h>#include <libctf.h>#include <sys/mman.h>#include <stdarg.h>void *ctf_data_alloc(size_t size){	return (mmap(NULL, size, PROT_READ | PROT_WRITE,	    MAP_PRIVATE | MAP_ANON, -1, 0));}voidctf_data_free(void *buf, size_t size){	(void) munmap(buf, size);}voidctf_data_protect(void *buf, size_t size){	(void) mprotect(buf, size, PROT_READ);}void *ctf_alloc(size_t size){	return (malloc(size));}/*ARGSUSED*/voidctf_free(void *buf, size_t size){	free(buf);}const char *ctf_strerror(int err){	return (strerror(err));}/*PRINTFLIKE1*/voidctf_dprintf(const char *format, ...){	if (_libctf_debug) {		va_list alist;		va_start(alist, format);		(void) fputs("libctf DEBUG: ", stderr);		(void) vfprintf(stderr, format, alist);		va_end(alist);	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?