FreeBSD/Linux Kernel Cross Reference
sys/sys/ksyms.h
1 /* $NetBSD: ksyms.h,v 1.8 2003/11/17 10:16:18 cube Exp $ */
2 /*
3 * Copyright (c) 2001, 2003 Anders Magnusson (ragge@ludd.luth.se).
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 #ifndef _SYS_KSYMS_H_
30 #define _SYS_KSYMS_H_
31
32 /*
33 * Do a lookup of a symbol using the in-kernel lookup algorithm.
34 */
35 struct ksyms_gsymbol {
36 const char *kg_name;
37 union {
38 void *ku_sym; /* Normally Elf_Sym */
39 unsigned long *ku_value;
40 } _un;
41 #define kg_sym _un.ku_sym
42 #define kg_value _un.ku_value
43 };
44
45 #define KIOCGSYMBOL _IOW('l', 1, struct ksyms_gsymbol)
46 #define KIOCGVALUE _IOW('l', 2, struct ksyms_gsymbol)
47 #define KIOCGSIZE _IOR('l', 3, int)
48
49 #ifdef _KERNEL
50 /*
51 * Definitions used in ksyms_getname() and ksyms_getval().
52 */
53 #define KSYMS_CLOSEST 0001 /* Nearest lower match */
54 #define KSYMS_EXACT 0002 /* Only exact match allowed */
55 #define KSYMS_EXTERN 0000 /* Only external symbols (pseudo) */
56 #define KSYMS_PROC 0100 /* Procedures only */
57 #define KSYMS_ANY 0200 /* Also local symbols (DDB use only) */
58
59 /*
60 * Prototypes
61 */
62 int ksyms_getname(const char **, char **, vaddr_t, int);
63 int ksyms_getval(const char *, char *, unsigned long *, int, int);
64 #define ksyms_getval_from_kernel(a,b,c,d) ksyms_getval(a,b,c,d,0)
65 #define ksyms_getval_from_userland(a,b,c,d) ksyms_getval(a,b,c,d,1)
66 int ksyms_addsymtab(const char *, void *, vsize_t, char *, vsize_t);
67 int ksyms_delsymtab(const char *);
68 int ksyms_rensymtab(const char *, const char*);
69 void ksyms_init(int, void *, void *);
70 #ifdef DDB
71 int ksyms_sift(char *, char *, int);
72 #endif
73 #endif /* _KERNEL */
74 #endif /* _SYS_KSYMS_H_ */
Cache object: d4128571287a8c51f8dff968b0673c72
|