summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/pseudo
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2011-11-02 15:23:59 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-11-08 21:44:36 +0000
commite1e8910b9f43ee13f1a7688da23bd6b3ffca88f8 (patch)
tree4b42db09a769629d37712364669acb68ee8c0b05 /meta/recipes-devtools/pseudo
parent3f854ed61898edc48235d43470b0eaec08c62b16 (diff)
downloadpoky-e1e8910b9f43ee13f1a7688da23bd6b3ffca88f8.tar.gz
pseudo: Uprev pseudo to version 1.2
This adds a new feature, PSEUDO_UNLOAD, which can be used to eliminate overhead of LD_PRELOAD when no longer necessary. Also the, clone(2), support on Linux has been updated to resolve some potential defects in the previous implementation. (From OE-Core rev: 77fe9dd8fa0393132ac6aba00d5659c6781fbbde) Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/pseudo')
-rw-r--r--meta/recipes-devtools/pseudo/pseudo/realpath_fix.patch165
-rw-r--r--meta/recipes-devtools/pseudo/pseudo_1.1.1.bb11
-rw-r--r--meta/recipes-devtools/pseudo/pseudo_1.2.bb10
-rw-r--r--meta/recipes-devtools/pseudo/pseudo_git.bb6
4 files changed, 13 insertions, 179 deletions
diff --git a/meta/recipes-devtools/pseudo/pseudo/realpath_fix.patch b/meta/recipes-devtools/pseudo/pseudo/realpath_fix.patch
deleted file mode 100644
index 4a107e006c..0000000000
--- a/meta/recipes-devtools/pseudo/pseudo/realpath_fix.patch
+++ /dev/null
@@ -1,165 +0,0 @@
1commit c2f7c5ad8ef0f9c94a2a8382c109c8c6e16c8b18
2Author: Peter Seebach <peter.seebach@windriver.com>
3Date: Thu Jun 9 10:53:32 2011 -0500
4
5 Fix realpath(name, NULL) when PSEUDO_DISABLED=1
6
7 On some Linux systems, dlsym("realpath", RTLD_NEXT) prefers
8 for reasons of its own to give a symbol that is also known
9 as old_realpath, which fails and yields EINVAL when called
10 with a null pointer as the second argument. This can be
11 avoided, on some systems, by using dlvsym() to request
12 the GLIBC_2.3 version of the symbol.
13
14 The wrapper logic is enhanced to allow for specifying
15 versions, although this currently only works for Linux
16 (Darwin has no dlvsym, apparently?). The test case is
17 a trivial program which calls realpath(name, NULL) run
18 with PSEUDO_DISABLED=1.
19
20diff --git a/ChangeLog.txt b/ChangeLog.txt
21index 7ffb74a..a2bbb61 100644
22--- a/ChangeLog.txt
23+++ b/ChangeLog.txt
24@@ -1,3 +1,8 @@
25+2011-06-08:
26+ * (seebs) Get the modern realpath from glibc instead of the old
27+ one inexplicably proferred by RTLD_NEXT. Fixes realpath(path, NULL)
28+ when PSEUDO_DISABLED=1.
29+
30 2011-06-06:
31 * (seebs) revise system() handler substantially. It now
32 pollutes the environment but works.
33diff --git a/makewrappers b/makewrappers
34index 6dcf889..20bbf2b 100755
35--- a/makewrappers
36+++ b/makewrappers
37@@ -211,6 +211,7 @@ class Function:
38 self.flags = '0'
39 self.port = port
40 self.directory = ''
41+ self.version = 'NULL'
42 # On Darwin, some functions are SECRETLY converted to foo$INODE64
43 # when called. So we have to look those up for real_*
44 self.inode64 = None
45diff --git a/ports/unix/wrapfuncs.in b/ports/unix/wrapfuncs.in
46index 74bad89..e06e404 100644
47--- a/ports/unix/wrapfuncs.in
48+++ b/ports/unix/wrapfuncs.in
49@@ -18,7 +18,7 @@ int lutimes(const char *path, const struct timeval *tv);
50 char *mkdtemp(char *template);
51 char *mktemp(char *template);
52 long pathconf(const char *path, int name);
53-char *realpath(const char *name, char *resolved_name);
54+char *realpath(const char *name, char *resolved_name); /* version="GLIBC_2.3" */
55 int remove(const char *path); /* flags=AT_SYMLINK_NOFOLLOW */
56 DIR *opendir(const char *path);
57 char *tempnam(const char *template, const char *pfx);
58diff --git a/pseudo_wrappers.c b/pseudo_wrappers.c
59index 600a918..07a4429 100644
60--- a/pseudo_wrappers.c
61+++ b/pseudo_wrappers.c
62@@ -90,6 +90,42 @@ pseudo_reinit_libpseudo(void) {
63 _libpseudo_init();
64 }
65
66+static void
67+pseudo_init_one_wrapper(pseudo_function *func) {
68+ int (*f)(void) = (int (*)(void)) NULL;
69+ char *e;
70+ if (*func->real != NULL) {
71+ /* already initialized */
72+ return;
73+ }
74+ dlerror();
75+
76+#if PSEUDO_PORT_LINUX
77+ if (func->version)
78+ f = dlvsym(RTLD_NEXT, func->name, func->version);
79+ /* fall through to the general case, if that failed */
80+ if (!f)
81+#endif
82+ f = dlsym(RTLD_NEXT, func->name);
83+ if (f) {
84+ *func->real = f;
85+ } else {
86+ e = dlerror();
87+#ifdef PSEUDO_NO_REAL_AT_FUNCTIONS
88+ char *s = func->name;
89+ s += strlen(s) - 2;
90+ /* *at() don't have to exist */
91+ if (!strcmp(s, "at")) {
92+ continue;
93+ }
94+#else
95+ if (e != NULL) {
96+ pseudo_diag("No real function for %s: %s\n", func->name, e);
97+ }
98+#endif
99+ }
100+}
101+
102 void
103 pseudo_init_wrappers(void) {
104 int i;
105@@ -103,29 +139,7 @@ pseudo_init_wrappers(void) {
106 */
107 if (!done) {
108 for (i = 0; pseudo_functions[i].name; ++i) {
109- if (*pseudo_functions[i].real == NULL) {
110- int (*f)(void);
111- char *e;
112- dlerror();
113- f = dlsym(RTLD_NEXT, pseudo_functions[i].name);
114- if (f) {
115- *pseudo_functions[i].real = f;
116- } else {
117- e = dlerror();
118-#ifdef PSEUDO_NO_REAL_AT_FUNCTIONS
119- char *s = pseudo_functions[i].name;
120- s += strlen(s) - 2;
121- /* *at() don't have to exist */
122- if (!strcmp(s, "at")) {
123- continue;
124- }
125-#else
126- if (e != NULL) {
127- pseudo_diag("No real function for %s: %s\n", pseudo_functions[i].name, e);
128- }
129-#endif
130- }
131- }
132+ pseudo_init_one_wrapper(&pseudo_functions[i]);
133 }
134 done = 1;
135 }
136diff --git a/templates/wrapper_table b/templates/wrapper_table
137index 2e79fcd..bb30530 100644
138--- a/templates/wrapper_table
139+++ b/templates/wrapper_table
140@@ -4,17 +4,21 @@
141
142 /* This file is generated and should not be modified. See the makewrappers
143 * script if you want to modify this. */
144-static struct {
145+typedef struct {
146 char *name; /* the name */
147 int (**real)(void); /* the underlying syscall */
148 int (*wrapper)(void); /* the wrapper from guts/name.c */
149-} pseudo_functions[] = {
150+ char *version; /* the version, if we know and care */
151+} pseudo_function;
152+
153+static pseudo_function pseudo_functions[] = {
154 @body
155 { /* ${comment}; */
156 "${name}${maybe_inode64}",
157 (int (**)(void)) &real_${name},
158- (int (*)(void)) wrap_${name}
159+ (int (*)(void)) wrap_${name},
160+ ${version}
161 },
162 @footer
163- { NULL, NULL, NULL },
164+ { NULL, NULL, NULL, NULL },
165 };
diff --git a/meta/recipes-devtools/pseudo/pseudo_1.1.1.bb b/meta/recipes-devtools/pseudo/pseudo_1.1.1.bb
deleted file mode 100644
index 0a61aecf19..0000000000
--- a/meta/recipes-devtools/pseudo/pseudo_1.1.1.bb
+++ /dev/null
@@ -1,11 +0,0 @@
1require pseudo.inc
2
3PR = "r2"
4
5SRC_URI = "http://www.yoctoproject.org/downloads/${BPN}/${BPN}-${PV}.tar.bz2 \
6 file://oe-config.patch \
7 file://realpath_fix.patch \
8 file://static_sqlite.patch"
9
10SRC_URI[md5sum] = "dd59766c17e199fe6144fce8a2c67802"
11SRC_URI[sha256sum] = "c697f643577d661c3ce826504b9dcd11fa98e78a5d10e3c83931da8942f6bfad"
diff --git a/meta/recipes-devtools/pseudo/pseudo_1.2.bb b/meta/recipes-devtools/pseudo/pseudo_1.2.bb
new file mode 100644
index 0000000000..1d5fe1a702
--- /dev/null
+++ b/meta/recipes-devtools/pseudo/pseudo_1.2.bb
@@ -0,0 +1,10 @@
1require pseudo.inc
2
3PR = "r3"
4
5SRC_URI = "http://www.yoctoproject.org/downloads/${BPN}/${BPN}-${PV}.tar.bz2 \
6 file://oe-config.patch \
7 file://static_sqlite.patch"
8
9SRC_URI[md5sum] = "a2819084bab7e991f06626d02cf55048"
10SRC_URI[sha256sum] = "4749a22df687f44d24c26e97170d4781a1bd52d5ee092364a40877e4d96ff058"
diff --git a/meta/recipes-devtools/pseudo/pseudo_git.bb b/meta/recipes-devtools/pseudo/pseudo_git.bb
index c1f0432d59..5ed8cf7b8e 100644
--- a/meta/recipes-devtools/pseudo/pseudo_git.bb
+++ b/meta/recipes-devtools/pseudo/pseudo_git.bb
@@ -1,8 +1,8 @@
1require pseudo.inc 1require pseudo.inc
2 2
3SRCREV = "c2f7c5ad8ef0f9c94a2a8382c109c8c6e16c8b18" 3SRCREV = "17c2233f93692f79684792750001ee6d13e03925"
4PV = "1.1.1+git${SRCPV}" 4PV = "1.2+git${SRCPV}"
5PR = "r19" 5PR = "r20"
6 6
7DEFAULT_PREFERENCE = "-1" 7DEFAULT_PREFERENCE = "-1"
8 8