268b2f343f7ae960f9a729c383f5c37cdd25c82b
1 /* Implementation header.
2 Copyright (C) 2019 Free Software Foundation, Inc.
4 This file is part of libctf.
6 libctf is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
11 This program is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 See the GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; see the file COPYING. If not see
18 <http://www.gnu.org/licenses/>. */
24 #include <sys/errno.h>
26 #include <sys/types.h>
40 /* Compiler attributes. */
42 #if defined (__GNUC__)
44 /* GCC. We assume that all compilers claiming to be GCC support sufficiently
45 many GCC attributes that the code below works. If some non-GCC compilers
46 masquerading as GCC in fact do not implement these attributes, version checks
49 /* We use the _libctf_*_ pattern to avoid clashes with any future attribute
50 macros glibc may introduce, which have names of the pattern
51 __attribute_blah__. */
53 #define _libctf_printflike_(string_index,first_to_check) \
54 __attribute__ ((__format__ (__printf__, (string_index), (first_to_check))))
55 #define _libctf_unlikely_(x) __builtin_expect ((x), 0)
56 #define _libctf_unused_ __attribute__ ((__unused__))
57 #define _libctf_malloc_ __attribute__((__malloc__))
61 typedef struct ctf_list
63 struct ctf_list
*l_prev
; /* Previous pointer or tail pointer. */
64 struct ctf_list
*l_next
; /* Next pointer or head pointer. */
67 #define ctf_list_prev(elem) ((void *)(((ctf_list_t *)(elem))->l_prev))
68 #define ctf_list_next(elem) ((void *)(((ctf_list_t *)(elem))->l_next))
70 extern void ctf_list_append (ctf_list_t
*, void *);
71 extern void ctf_list_prepend (ctf_list_t
*, void *);
72 extern void ctf_list_delete (ctf_list_t
*, void *);
74 extern const char *ctf_strraw (ctf_file_t
*, uint32_t);
75 extern const char *ctf_strptr (ctf_file_t
*, uint32_t);
77 extern void *ctf_set_open_errno (int *, int);
78 extern long ctf_set_errno (ctf_file_t
*, int);
81 extern void *ctf_data_alloc (size_t);
82 extern void ctf_data_free (void *, size_t);
83 extern void ctf_data_protect (void *, size_t);
86 extern void *ctf_mmap (size_t length
, size_t offset
, int fd
);
87 extern void ctf_munmap (void *, size_t);
88 extern ssize_t
ctf_pread (int fd
, void *buf
, ssize_t count
, off_t offset
);
91 extern void *ctf_alloc (size_t);
92 extern void ctf_free (void *);
95 extern char *ctf_strdup (const char *);
96 extern char *ctf_str_append (char *, const char *);
97 extern const char *ctf_strerror (int);
99 _libctf_printflike_ (1, 2)
100 extern void ctf_dprintf (const char *, ...);
101 extern void libctf_init_debug (void);
103 extern Elf64_Sym
*ctf_sym_to_elf64 (const Elf32_Sym
*src
, Elf64_Sym
*dst
);
105 extern int _libctf_debug
; /* debugging messages enabled */
111 #endif /* _CTF_IMPL_H */
This page took 0.035111 seconds and 4 git commands to generate.