* Make-lang.in (F95_OBJS, F95_PARSER_OBJS): Alpabetize. Move data.c
[official-gcc.git] / libmudflap / mf-runtime.h.in
blob7b0467b5e5653b3318cdc3510eb157c3e5a5ed5e
1 /* Public libmudflap declarations -*- C -*- */
3 #ifndef MF_RUNTIME_H
4 #define MF_RUNTIME_H
6 #if @MF_HAVE_STDINT_H@ /* autoconf HAVE_STDINT_H */
7 #include <stdint.h>
8 #endif
9 #include <sys/types.h>
10 #if ! @MF_HAVE_UINTPTR_T@
11 typedef unsigned long uintptr_t;
12 #define HAVE_UINTPTR_T 1
13 /* Define this here, in case an autoconf application was run
14 without CFLAGS=-fmudflap but is being compiled with -fmudflap. */
15 #endif
18 /* Global declarations used by instrumentation. */
20 struct __mf_cache { uintptr_t low; uintptr_t high; };
21 extern struct __mf_cache __mf_lookup_cache [];
22 extern uintptr_t __mf_lc_mask;
23 extern unsigned char __mf_lc_shift;
25 /* Multithreading support. */
26 #ifdef _MUDFLAPTH
27 /* extern pthread_mutex_t __mf_biglock; */
28 #define _REENTRANT
29 #define _THREAD_SAFE
30 #endif
32 /* Codes to describe the type of access to check: __mf_check arg 3 */
34 #define __MF_CHECK_READ 0
35 #define __MF_CHECK_WRITE 1
38 /* Codes to describe a region of memory being registered: __mf_*register arg 3 */
40 #define __MF_TYPE_NOACCESS 0
41 #define __MF_TYPE_HEAP 1
42 #define __MF_TYPE_HEAP_I 2
43 #define __MF_TYPE_STACK 3
44 #define __MF_TYPE_STATIC 4
45 #define __MF_TYPE_GUESS 5
48 /* The public mudflap API */
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
54 extern void __mf_check (void *ptr, size_t sz, int type, const char *location)
55 __attribute((nothrow));
56 extern void __mf_register (void *ptr, size_t sz, int type, const char *name)
57 __attribute((nothrow));
58 extern void __mf_unregister (void *ptr, size_t sz) __attribute((nothrow));
59 extern unsigned __mf_watch (void *ptr, size_t sz);
60 extern unsigned __mf_unwatch (void *ptr, size_t sz);
61 extern void __mf_report ();
62 extern int __mf_set_options (const char *opts);
65 /* Redirect some standard library functions to libmudflap. These are
66 done by simple #define rather than linker wrapping, since only
67 instrumented modules are meant to be affected. */
69 #ifdef _MUDFLAP
70 #pragma redefine_extname memcpy __mfwrap_memcpy
71 #pragma redefine_extname memmove __mfwrap_memmove
72 #pragma redefine_extname memset __mfwrap_memset
73 #pragma redefine_extname memcmp __mfwrap_memcmp
74 #pragma redefine_extname memchr __mfwrap_memchr
75 #pragma redefine_extname memrchr __mfwrap_memrchr
76 #pragma redefine_extname strcpy __mfwrap_strcpy
77 #pragma redefine_extname strncpy __mfwrap_strncpy
78 #pragma redefine_extname strcat __mfwrap_strcat
79 #pragma redefine_extname strncat __mfwrap_strncat
80 #pragma redefine_extname strcmp __mfwrap_strcmp
81 #pragma redefine_extname strcasecmp __mfwrap_strcasecmp
82 #pragma redefine_extname strncmp __mfwrap_strncmp
83 #pragma redefine_extname strncasecmp __mfwrap_strncasecmp
84 #pragma redefine_extname strdup __mfwrap_strdup
85 #pragma redefine_extname strndup __mfwrap_strndup
86 #pragma redefine_extname strchr __mfwrap_strchr
87 #pragma redefine_extname strrchr __mfwrap_strrchr
88 #pragma redefine_extname strstr __mfwrap_strstr
89 #pragma redefine_extname memmem __mfwrap_memmem
90 #pragma redefine_extname strlen __mfwrap_strlen
91 #pragma redefine_extname strnlen __mfwrap_strnlen
92 #pragma redefine_extname bzero __mfwrap_bzero
93 #pragma redefine_extname bcopy __mfwrap_bcopy
94 #pragma redefine_extname bcmp __mfwrap_bcmp
95 #pragma redefine_extname index __mfwrap_index
96 #pragma redefine_extname rindex __mfwrap_rindex
97 #pragma redefine_extname asctime __mfwrap_asctime
98 #pragma redefine_extname ctime __mfwrap_ctime
99 #pragma redefine_extname gmtime __mfwrap_gmtime
100 #pragma redefine_extname localtime __mfwrap_localtime
101 #pragma redefine_extname time __mfwrap_time
102 #pragma redefine_extname strerror __mfwrap_strerror
103 #pragma redefine_extname fopen __mfwrap_fopen
104 #pragma redefine_extname fclose __mfwrap_fclose
105 #pragma redefine_extname fread __mfwrap_fread
106 #pragma redefine_extname fwrite __mfwrap_fwrite
107 #pragma redefine_extname fgetc __mfwrap_fgetc
108 #pragma redefine_extname fgets __mfwrap_fgets
109 #pragma redefine_extname getc __mfwrap_getc
110 #pragma redefine_extname gets __mfwrap_gets
111 #pragma redefine_extname ungetc __mfwrap_ungetc
112 #pragma redefine_extname fputc __mfwrap_fputc
113 #pragma redefine_extname fputs __mfwrap_fputs
114 #pragma redefine_extname putc __mfwrap_putc
115 #pragma redefine_extname puts __mfwrap_puts
116 #pragma redefine_extname clearerr __mfwrap_clearerr
117 #pragma redefine_extname feof __mfwrap_feof
118 #pragma redefine_extname ferror __mfwrap_ferror
119 #pragma redefine_extname fileno __mfwrap_fileno
120 #pragma redefine_extname printf __mfwrap_printf
121 #pragma redefine_extname fprintf __mfwrap_fprintf
122 #pragma redefine_extname sprintf __mfwrap_sprintf
123 #pragma redefine_extname snprintf __mfwrap_snprintf
124 #pragma redefine_extname vprintf __mfwrap_vprintf
125 #pragma redefine_extname vfprintf __mfwrap_vfprintf
126 #pragma redefine_extname vsprintf __mfwrap_vsprintf
127 #pragma redefine_extname vsnprintf __mfwrap_vsnprintf
128 #pragma redefine_extname access __mfwrap_access
129 #pragma redefine_extname remove __mfwrap_remove
130 #pragma redefine_extname fflush __mfwrap_fflush
131 #pragma redefine_extname fseek __mfwrap_fseek
132 #pragma redefine_extname ftell __mfwrap_ftell
133 #pragma redefine_extname rewind __mfwrap_rewind
134 #pragma redefine_extname fgetpos __mfwrap_fgetpos
135 #pragma redefine_extname fsetpos __mfwrap_fsetpos
136 #pragma redefine_extname stat __mfwrap_stat
137 #pragma redefine_extname fstat __mfwrap_fstat
138 #pragma redefine_extname lstat __mfwrap_lstat
139 #pragma redefine_extname mkfifo __mfwrap_mkfifo
140 #pragma redefine_extname setvbuf __mfwrap_setvbuf
141 #pragma redefine_extname setbuf __mfwrap_setbuf
142 #pragma redefine_extname opendir __mfwrap_opendir
143 #pragma redefine_extname closedir __mfwrap_closedir
144 #pragma redefine_extname readdir __mfwrap_readdir
145 #pragma redefine_extname recv __mfwrap_recv
146 #pragma redefine_extname recvfrom __mfwrap_recvfrom
147 #pragma redefine_extname recvmsg __mfwrap_recvmsg
148 #pragma redefine_extname send __mfwrap_send
149 #pragma redefine_extname sendto __mfwrap_sendto
150 #pragma redefine_extname sendmsg __mfwrap_sendmsg
151 #pragma redefine_extname setsockopt __mfwrap_setsockopt
152 #pragma redefine_extname getsockopt __mfwrap_getsockopt
153 #pragma redefine_extname accept __mfwrap_accept
154 #pragma redefine_extname bind __mfwrap_bind
155 #pragma redefine_extname connect __mfwrap_connect
156 #pragma redefine_extname gethostname __mfwrap_gethostname
157 #pragma redefine_extname sethostname __mfwrap_sethostname
158 #pragma redefine_extname gethostbyname __mfwrap_gethostbyname
159 #pragma redefine_extname wait __mfwrap_wait
160 #pragma redefine_extname waitpid __mfwrap_waitpid
161 #pragma redefine_extname popen __mfwrap_popen
162 #pragma redefine_extname pclose __mfwrap_pclose
163 #pragma redefine_extname execve __mfwrap_execve
164 #pragma redefine_extname execv __mfwrap_execv
165 #pragma redefine_extname execvp __mfwrap_execvp
166 #pragma redefine_extname system __mfwrap_system
167 #pragma redefine_extname dlopen __mfwrap_dlopen
168 #pragma redefine_extname dlerror __mfwrap_dlerror
169 #pragma redefine_extname dlsym __mfwrap_dlsym
170 #pragma redefine_extname dlclose __mfwrap_dlclose
171 #pragma redefine_extname fopen64 __mfwrap_fopen64
172 #pragma redefine_extname stat64 __mfwrap_stat64
173 #pragma redefine_extname fseeko64 __mfwrap_fseeko64
174 #pragma redefine_extname ftello64 __mfwrap_ftello64
175 #pragma redefine_extname semop __mfwrap_semop
176 #pragma redefine_extname semctl __mfwrap_semctl
177 #pragma redefine_extname shmctl __mfwrap_shmctl
178 #pragma redefine_extname shmat __mfwrap_shmat
179 #pragma redefine_extname shmdt __mfwrap_shmdt
180 #pragma redefine_extname __ctype_b_loc __mfwrap___ctype_b_loc
181 #pragma redefine_extname __ctype_toupper_loc __mfwrap___ctype_toupper_loc
182 #pragma redefine_extname __ctype_tolower_loc __mfwrap___ctype_tolower_loc
184 /* Disable glibc macros. */
185 #define __NO_STRING_INLINES
187 #endif /* _MUDFLAP */
190 #ifdef __cplusplus
192 #endif
194 #endif /* MF_RUNTIME_H */