Last change
on this file since 1699 was
1699,
checked in by Sam Hocevar, 14 years ago
|
- Put either ORIG() or NEW(() around functions, because the naming scheme is
likely to change for the Win32 port.
|
-
Property svn:keywords set to
Id
|
File size:
1.2 KB
|
Line | |
---|
1 | /* |
---|
2 | * zzuf - general purpose fuzzer |
---|
3 | * Copyright (c) 2006 Sam Hocevar <sam@zoy.org> |
---|
4 | * All Rights Reserved |
---|
5 | * |
---|
6 | * $Id: lib-load.h 1699 2007-01-23 08:45:47Z sam $ |
---|
7 | * |
---|
8 | * This program is free software. It comes without any warranty, to |
---|
9 | * the extent permitted by applicable law. You can redistribute it |
---|
10 | * and/or modify it under the terms of the Do What The Fuck You Want |
---|
11 | * To Public License, Version 2, as published by Sam Hocevar. See |
---|
12 | * http://sam.zoy.org/wtfpl/COPYING for more details. |
---|
13 | */ |
---|
14 | |
---|
15 | /* |
---|
16 | * lib-load.h: preloaded library functions |
---|
17 | */ |
---|
18 | |
---|
19 | /* The __func__ macro to get the current function name */ |
---|
20 | #if __STDC_VERSION__ < 199901L |
---|
21 | # if __GNUC__ >= 2 |
---|
22 | # define __func__ __FUNCTION__ |
---|
23 | # else |
---|
24 | # define __func__ "<?>" |
---|
25 | # endif |
---|
26 | #endif |
---|
27 | |
---|
28 | /* Symbol loading stuff */ |
---|
29 | #define STR(x) #x |
---|
30 | #define ORIG(x) x##_orig |
---|
31 | #ifdef HAVE_DLFCN_H |
---|
32 | # define NEW(x) x |
---|
33 | #else |
---|
34 | # define NEW(x) x##_new |
---|
35 | #endif |
---|
36 | |
---|
37 | /* TODO: do the Win32 part */ |
---|
38 | #ifdef HAVE_DLFCN_H |
---|
39 | # include <dlfcn.h> |
---|
40 | # define LOADSYM(x) \ |
---|
41 | do { \ |
---|
42 | if(!ORIG(x)) \ |
---|
43 | ORIG(x) = dlsym(RTLD_NEXT, STR(x)); \ |
---|
44 | if(!ORIG(x)) \ |
---|
45 | abort(); \ |
---|
46 | } while(0) |
---|
47 | #else |
---|
48 | # define LOADSYM(x) \ |
---|
49 | do { \ |
---|
50 | if(!ORIG(x)) \ |
---|
51 | abort(); \ |
---|
52 | } while(0) |
---|
53 | #endif |
---|
54 | |
---|
Note: See
TracBrowser
for help on using the repository browser.