[patch] rtld: fix fd leak with parallel dlopen and fork/exec

2012-11-04 Thread Jilles Tjoelker
Rtld does not set FD_CLOEXEC on its internal file descriptors; therefore, such a file descriptor may be passed to a process created by another thread running in parallel to dlopen() or fdlopen(). The race is easy to trigger with the below dlopen_exec_race.c that performs the two in parallel

Re: [patch] rtld: fix fd leak with parallel dlopen and fork/exec

2012-11-04 Thread Konstantin Belousov
On Sun, Nov 04, 2012 at 03:37:27PM +0100, Jilles Tjoelker wrote: Rtld does not set FD_CLOEXEC on its internal file descriptors; therefore, such a file descriptor may be passed to a process created by another thread running in parallel to dlopen() or fdlopen(). The race is easy to trigger

Re: dlopen(), atexit() crash on FreeBSD (testcase included)

2008-01-01 Thread Alexander Kabaev
dlopen()/dlclose(). The real question is whether they're interesting in supporting this model. If the Firebird folks aren't interested in having their library be accessible in that fashion, then you have little choice but to simply forgo unloading this particular library. It's a bit unfortunate

Re: dlopen(), atexit() crash on FreeBSD (testcase included)

2008-01-01 Thread Markus Hoenicka
Tim Kientzle writes: I would be curious to see the results of running your sample program (with lots of extra fprint(stderr...) calls, of course) on Linux to see whether it calls the registered exit function at dlclose time or never. I suspect the answer is never. If I'm right, the

Re: dlopen(), atexit() crash on FreeBSD (testcase included)

2008-01-01 Thread Tim Kientzle
Also, I'm wondering how other OSes handle this. I don't see this code crash on Linux, contrary to its design as you say. I would be curious to see the results of running your sample program ... on Linux to see whether it calls the registered exit function at dlclose time or never. Linux

Re: dlopen(), atexit() crash on FreeBSD (testcase included)

2008-01-01 Thread Bert JW Regeer
On Jan 1, 2008, at 19:41 , Tim Kientzle wrote: Also, I'm wondering how other OSes handle this. I don't see this code crash on Linux, contrary to its design as you say. I would be curious to see the results of running your sample program ... on Linux to see whether it calls the registered

dlopen(), atexit() crash on FreeBSD (testcase included)

2007-12-31 Thread Markus Hoenicka
Hi, I've been redirected by Giorgos Keramidas to this list after reporting a problem on the freebsd-questions list. I'd greatly appreciate if you could have a look at the following problem. Apparently programs are doomed to segfault on FreeBSD if dlopen()ed modules install exit handlers via

Re: dlopen(), atexit() crash on FreeBSD (testcase included)

2007-12-31 Thread Alexander Kabaev
are doomed to segfault on FreeBSD if dlopen()ed modules install exit handlers via atexit(). Similar problem reports have cropped up before, see e.g. http://www.imagemagick.org/pipermail/magick-developers/2006-March/002523.html My system runs: FreeBSD yeti.mininet 6.1-RELEASE FreeBSD 6.1

Re: dlopen(), atexit() crash on FreeBSD (testcase included)

2007-12-31 Thread Jason Evans
Markus Hoenicka wrote: I've been redirected by Giorgos Keramidas to this list after reporting a problem on the freebsd-questions list. I'd greatly appreciate if you could have a look at the following problem. Apparently programs are doomed to segfault on FreeBSD if dlopen()ed modules install

Re: dlopen(), atexit() crash on FreeBSD (testcase included)

2007-12-31 Thread Markus Hoenicka
Alexander Kabaev writes: As designed. atexit should not be used by shared objects that do not expect themselves to live until actual exit() happens. ELF provides proper _init/_fini sections to support shared object initialization/destruction. That is, the only real solution to this

Re: dlopen(), atexit() crash on FreeBSD (testcase included)

2007-12-31 Thread Julian Elischer
Markus Hoenicka wrote: Alexander Kabaev writes: As designed. atexit should not be used by shared objects that do not expect themselves to live until actual exit() happens. ELF provides proper _init/_fini sections to support shared object initialization/destruction. That is, the only

Re: dlopen(), atexit() crash on FreeBSD (testcase included)

2007-12-31 Thread John Baldwin
On Monday 31 December 2007 05:20:51 pm Julian Elischer wrote: Markus Hoenicka wrote: Alexander Kabaev writes: As designed. atexit should not be used by shared objects that do not expect themselves to live until actual exit() happens. ELF provides proper _init/_fini sections to

Re: dlopen(), atexit() crash on FreeBSD (testcase included)

2007-12-31 Thread Alexander Kabaev
On Mon, 31 Dec 2007 14:20:51 -0800 Julian Elischer [EMAIL PROTECTED] wrote: Markus Hoenicka wrote: Alexander Kabaev writes: As designed. atexit should not be used by shared objects that do not expect themselves to live until actual exit() happens. ELF provides proper _init/_fini

Re: dlopen(), atexit() crash on FreeBSD (testcase included)

2007-12-31 Thread Julian Elischer
Alexander Kabaev wrote: On Mon, 31 Dec 2007 14:20:51 -0800 Julian Elischer [EMAIL PROTECTED] wrote: Markus Hoenicka wrote: Alexander Kabaev writes: As designed. atexit should not be used by shared objects that do not expect themselves to live until actual exit() happens. ELF provides

Re: dlopen(), atexit() crash on FreeBSD (testcase included)

2007-12-31 Thread Markus Hoenicka
folks. I'm just trying to use their client library in a dlopen()ed module, and I was investigating whether something can be done from the FreeBSD end. I've also forwarded Alexander's reply to the Firebird folks for consideration. regards, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected

Re: dlopen(), atexit() crash on FreeBSD (testcase included)

2007-12-31 Thread Tim Kientzle
real solution to this problem is to convince the Firebird folks to remove their atexit() calls from the client libraries? I suspect they never considered that their dynamic library might be used via dlopen()/dlclose(). The real question is whether they're interesting in supporting this model

Re: dlopen: resolving external library symbols to calling program

2007-11-30 Thread Alejandro Pulver
On Fri, 30 Nov 2007 19:02:01 +0200 Kostik Belousov [EMAIL PROTECTED] wrote: On Fri, Nov 30, 2007 at 01:28:58PM -0300, Alejandro Pulver wrote: Hello. When I was updating the games/deng port, I found it failed at runtime with the following error: % doomsday While opening dynamic

Re: dlopen: resolving external library symbols to calling program

2007-11-30 Thread Kostik Belousov
, of course) would be to make dlopen() resolve these symbols to the main executable. I tried to do this with RTLD_GLOBAL without success. The port is available here (note that the application uses cmake to build): ftp://ftp.alepulver.com.ar/deng.tar.bz2 If you need any other information just ask me

dlopen: resolving external library symbols to calling program

2007-11-30 Thread Alejandro Pulver
ArgExists The files are linked with the -flat namespace and -undefined suppress flags in Mac OS X (don't know if it's relevant here). I think the simplest solution (if possible, of course) would be to make dlopen() resolve these symbols to the main executable. I tried to do this with RTLD_GLOBAL

Re: dlopen: resolving external library symbols to calling program

2007-11-30 Thread Kostik Belousov
On Fri, Nov 30, 2007 at 04:40:33PM -0300, Alejandro Pulver wrote: On Fri, 30 Nov 2007 19:02:01 +0200 Kostik Belousov [EMAIL PROTECTED] wrote: On Fri, Nov 30, 2007 at 01:28:58PM -0300, Alejandro Pulver wrote: Hello. When I was updating the games/deng port, I found it failed at

Re: dlopen: resolving external library symbols to calling program

2007-11-30 Thread Alexander Kabaev
On Fri, 30 Nov 2007 22:19:48 +0200 Kostik Belousov [EMAIL PROTECTED] wrote: On Fri, Nov 30, 2007 at 04:40:33PM -0300, Alejandro Pulver wrote: On Fri, 30 Nov 2007 19:02:01 +0200 Kostik Belousov [EMAIL PROTECTED] wrote: On Fri, Nov 30, 2007 at 01:28:58PM -0300, Alejandro Pulver wrote:

Re: [patch] Re: dlopen() and dlclose() are not MT-safe? YES, esp. for libthr

2006-03-25 Thread Alexander Kabaev
On Fri, 24 Mar 2006 10:48:34 +0200 Kostik Belousov [EMAIL PROTECTED] wrote: I did understand the purpose of the thread mask code in libexec/rtld/rtld_lock.c, or, more precisely, the condition where this code works (for the context, see the mails with same subject on freebsd-hackers). Look,

Re: [patch] Re: dlopen() and dlclose() are not MT-safe? YES, esp. for libthr

2006-03-25 Thread David Xu
在 Saturday 25 March 2006 23:07,Alexander Kabaev 写道: The thread mask only makes sense when flags are per-thread. I meant to use it to detect PLT recursions from locking primitives exported to rtld by the threads library as those are not allowed and threads implementations are required to take

Re: [patch] Re: dlopen() and dlclose() are not MT-safe? YES, esp. for libthr

2006-03-24 Thread Kostik Belousov
I did understand the purpose of the thread mask code in libexec/rtld/rtld_lock.c, or, more precisely, the condition where this code works (for the context, see the mails with same subject on freebsd-hackers). Look, that code assumes that blocking async signals would stop thread scheduler from

Re: [patch] Re: dlopen() and dlclose() are not MT-safe? YES, esp. for libthr

2006-03-24 Thread David Xu
在 Friday 24 March 2006 16:48,Kostik Belousov 写道: I did understand the purpose of the thread mask code in libexec/rtld/rtld_lock.c, or, more precisely, the condition where this code works (for the context, see the mails with same subject on freebsd-hackers). Look, that code assumes that

Re: [patch] Re: dlopen() and dlclose() are not MT-safe? YES, esp. for libthr

2006-03-24 Thread Kazuaki Oda
Kostik Belousov wrote: I did understand the purpose of the thread mask code in libexec/rtld/rtld_lock.c, or, more precisely, the condition where this code works (for the context, see the mails with same subject on freebsd-hackers). Look, that code assumes that blocking async signals would

Re: [patch] Re: dlopen() and dlclose() are not MT-safe? YES, esp. for libthr

2006-03-24 Thread joerg
On Fri, Mar 24, 2006 at 08:54:34PM +0900, Kazuaki Oda wrote: * The current implementation of rtld has a problem both with libpthread and libthr. It works only with libc_r. It doesn't work correctly with libc_r. Concurrent dlopen and dlclose of the same shared object doesn't work fully

Re: [patch] Re: dlopen() and dlclose() are not MT-safe? YES, esp. for libthr

2006-03-24 Thread Kostik Belousov
On Fri, Mar 24, 2006 at 08:54:34PM +0900, Kazuaki Oda wrote: Kostik Belousov wrote: I did understand the purpose of the thread mask code in libexec/rtld/rtld_lock.c, or, more precisely, the condition where this code works (for the context, see the mails with same subject on

Re: [patch] Re: dlopen() and dlclose() are not MT-safe? YES, esp. for libthr

2006-03-24 Thread Kostik Belousov
. Concurrent dlopen and dlclose of the same shared object doesn't work fully corretly ATM, but the patch isn't the best approach either. Joerg You promised the patch. Anyway, part of my patch that touched rtld_lock.c shall be discarded. pgpTpwnFEZHaM.pgp Description: PGP signature

[patch] Re: dlopen() and dlclose() are not MT-safe?

2006-03-23 Thread Kostik Belousov
, try the following patch and report results. I can run (modified *) version of your test for some time without crash with both libpthread and libthr. [* You need to allow for errors in dlopen and just continue the loop.] Patch protects access to the list of unloading objects by bind lock, and marks

Re: [patch] Re: dlopen() and dlclose() are not MT-safe?

2006-03-23 Thread joerg
On Thu, Mar 23, 2006 at 12:54:40PM +0200, Kostik Belousov wrote: On Thu, Mar 23, 2006 at 05:57:24AM +0900, Kazuaki Oda wrote: BTW do you know the reason why lock is released before calling objlist_call_fini()? If we don't release the lock, what problem will occur? deadlock? The reasoning

Re: [patch] Re: dlopen() and dlclose() are not MT-safe?

2006-03-23 Thread Kazuaki Oda
(modified *) version of your test for some time without crash with both libpthread and libthr. [* You need to allow for errors in dlopen and just continue the loop.] Patch protects access to the list of unloading objects by bind lock, and marks the objects that are running finalizers to prevent

dlopen() and dlclose() are not MT-safe?

2006-03-22 Thread Kazuaki Oda
*/ exit(0); } void *func(void *dummy) { void *h; for (;;) { if ((h = dlopen(/usr/lib/libm.so, RTLD_NOW)) == NULL) errx(1, dlopen: %s, dlerror()); if (dlclose(h) == -1) errx(1, dlclose: %s, dlerror()); } /* NOTREACHED */ return (NULL

Re: dlopen() and dlclose() are not MT-safe?

2006-03-22 Thread Kostik Belousov
, pthread_create); } for (;;) sleep(1); /* NOTREACHED */ exit(0); } void *func(void *dummy) { void *h; for (;;) { if ((h = dlopen(/usr/lib/libm.so, RTLD_NOW)) == NULL) errx(1, dlopen: %s, dlerror()); if (dlclose(h) == -1

Re: dlopen() and dlclose() are not MT-safe?

2006-03-22 Thread Kostik Belousov
= pthread_create(tids[i], NULL, func, NULL); if (error) errc(1, error, pthread_create); } for (;;) sleep(1); /* NOTREACHED */ exit(0); } void *func(void *dummy) { void *h; for (;;) { if ((h = dlopen(/usr/lib/libm.so

Re: dlopen() and dlclose() are not MT-safe?

2006-03-22 Thread Kazuaki Oda
Kostik Belousov wrote: Oops. Completely reversed condition in the if. :(. Also, I don't think it shall returns the error in this situation. New take: Index: libexec/rtld-elf/rtld.c === RCS file:

dlopen() and -pg flag

2003-12-03 Thread Sergey Lyubka
Below is a little snipper that tries to dlopen(argv[1]). It works fine until it is compiled with profiling support, -pg flag. Compiled with -pg, dlopen() reports Service unavailable. How to fix that ? -sergey #include dlfcn.h #include stdlib.h #include stdio.h int main(int argc, char *argv

Re: dlopen() and -pg flag

2003-12-03 Thread Lev Walkin
-pg on your system implies static linking. dlopen() is not available in statically linked binaries on FreeBSD and many other systems. Consider building your binary dynamic by making sure there is a dynamic version of libc with profiling support (something like /usr/lib/libc_p.so). Otherwise

Re: dlopen() and -pg flag

2003-12-03 Thread Sergey Lyubka
Absolutely. thanks, that helps! On Wed, Dec 03, 2003 at 02:23:18AM -0800, Lev Walkin wrote: -pg on your system implies static linking. dlopen() is not available in statically linked binaries on FreeBSD and many other systems. Consider building your binary dynamic by making sure

dlopen()/dlsym()/etc sources ?

2003-01-12 Thread Aurelien Nephtali
Hi, I would like to know where are the dlopen()/dlsym()/etc sources ? There's nothing in the libc sources :/ (I'm using the HEAD tree) -- Aurelien msg39153/pgp0.pgp Description: PGP signature

Re: dlopen()/dlsym()/etc sources ?

2003-01-12 Thread Terry Lambert
Aurelien Nephtali wrote: I would like to know where are the dlopen()/dlsym()/etc sources ? There's nothing in the libc sources :/ (I'm using the HEAD tree) src/lib/csu/common/crtbegin.c src/lib/csu/i386/crt0.c src/lib/csu/i386-elf/crt1.c That's the glue. The actual functions are mapped

dlopen(), ld.so, and library wrappers

2002-04-02 Thread E.B. Dreger
Greetings all, I wish to accomplish the following: 1. Program foo loads shared object bar using dlopen() and dlsym() 2. bar needs certain symbols resolved, which foo intercepts. For example, foo might wrap malloc() or open() to provide its own behavior... much like subclassing window

Re: dlopen(), ld.so, and library wrappers

2002-04-02 Thread Alfred Perlstein
* E.B. Dreger [EMAIL PROTECTED] [020402 10:29] wrote: Greetings all, I wish to accomplish the following: 1. Program foo loads shared object bar using dlopen() and dlsym() 2. bar needs certain symbols resolved, which foo intercepts. For example, foo might wrap malloc() or open

Re: dlopen(), ld.so, and library wrappers

2002-04-02 Thread E.B. Dreger
Date: Tue, 2 Apr 2002 11:05:52 -0800 From: Alfred Perlstein [EMAIL PROTECTED] From the dlopen manpage: I reread that right before initial post. If dlsym() is called with the special handle RTLD_NEXT, then the search for the symbol is limited to the shared objects which were

Re: dlopen(), ld.so, and library wrappers

2002-04-02 Thread E.B. Dreger
Date: Tue, 2 Apr 2002 11:05:52 -0800 From: Alfred Perlstein [EMAIL PROTECTED] From the dlopen manpage: [ snip ] Works great, less coding. Looks like I just misunderstood the manpage and/or the workings of the dynamic linker. Time for me to have some fun. And, no, I'm not using wrappers

Re: dlopen(), ld.so, and library wrappers

2002-04-02 Thread Terry Lambert
. This is arguably a linker bug, since it's not reporting missing symbols at link time. You can recreate this without shared objects that you are going to dlopen, simply by creating a shared library that references symbols in a second shared library (no static data references!), and then using

Re: problem w/ dlopen(); bug or feature?

2002-02-12 Thread Bjoern Fischer
Hello John, John, is it possible to find out in dlopen() which object in the linked list has issued the dlopen() call? Then a fix would be easy. Yes, it's possible to find out which shared object the dlopen call was made from. There's already a function obj_from_addr() in rtld.c which

Re: problem w/ dlopen(); bug or feature?

2002-02-06 Thread Peter Jeremy
On Fri, 1 Feb 2002 20:24:33 -0800 (PST), John Polstra [EMAIL PROTECTED] wrote: If you're talking about efficiency, it doesn't matter very much. It's a rare program that loads more than, say, 20 shared libraries. We have an application toolchain which basically puts each object into its own

Re: problem w/ dlopen(); bug or feature?

2002-02-02 Thread Bjoern Fischer
Hello John, Yes, it's possible to find out which shared object the dlopen call was made from. There's already a function obj_from_addr() in rtld.c which does that. But as far as I know, it is not standard behavior to search the RPATH of the object which issued the dlopen call. I only have

Re: problem w/ dlopen(); bug or feature?

2002-02-02 Thread Terry Lambert
Bjoern Fischer wrote: Yes, it's possible to find out which shared object the dlopen call was made from. There's already a function obj_from_addr() in rtld.c which does that. But as far as I know, it is not standard behavior to search the RPATH of the object which issued the dlopen call

problem w/ dlopen(); bug or feature?

2002-02-01 Thread Bjoern Fischer
Hello there, I have a problem with dlopen() on FreeBSD: When dlopen()ed shared objects dlopen() a shared object themselves, the DT_RPATH, that is hardcoded into the first dlopen()ed object is *not* searched. This can be easily demonstated with the tiny (0.8k) example I attached to this mail

Re: problem w/ dlopen(); bug or feature?

2002-02-01 Thread Bjoern Fischer
On Fri, Feb 01, 2002 at 09:10:18PM +0100, Bjoern Fischer wrote: I have a problem with dlopen() on FreeBSD: When dlopen()ed shared objects dlopen() a shared object themselves, the DT_RPATH, that is hardcoded into the first dlopen()ed object is *not* searched. Ok, I've looked into /usr/src

Re: problem w/ dlopen(); bug or feature?

2002-02-01 Thread John Polstra
In article [EMAIL PROTECTED], Bjoern Fischer [EMAIL PROTECTED] wrote: On Fri, Feb 01, 2002 at 09:10:18PM +0100, Bjoern Fischer wrote: I have a problem with dlopen() on FreeBSD: When dlopen()ed shared objects dlopen() a shared object themselves, the DT_RPATH, that is hardcoded

Re: BSD dlopen and such

2001-01-07 Thread Pascal Hofstee
On Thu, Jan 04, 2001 at 10:19:56AM -0800, Doug White wrote: No. The linux compatbility is through the image activator. The syscalls have to be translated, otherwise if you were running as root and loaded a linux lib into a freebsd binary, then that lib called fcntl(), your system would

Re: BSD dlopen and such

2001-01-05 Thread David O'Brien
On Thu, Jan 04, 2001 at 10:19:56AM -0800, Doug White wrote: 1) Can a native binary dlopen a Linux ELF GL, yes or no? No. The linux compatbility is through the image activator. The syscalls have to be translated, otherwise if you were running as root and loaded a linux lib into a freebsd

Re: BSD dlopen and such

2001-01-04 Thread Doug White
On Tue, 2 Jan 2001, Rafael Barrero wrote: Hi all, Two questions: 0) Are native binaries for OpenBSD different from FreeBSD? Yes. 1) Can a native binary dlopen a Linux ELF GL, yes or no? No. The linux compatbility is through the image activator. The syscalls have to be translated

BSD dlopen and such

2001-01-02 Thread Rafael Barrero
Hi all, Two questions: 0) Are native binaries for OpenBSD different from FreeBSD? 1) Can a native binary dlopen a Linux ELF GL, yes or no? Rafael Barrero [EMAIL PROTECTED] "You know ... you take the killing for granted. And then it's gone, and you're like, 'I wish I'd appreciated it

Re: BSD dlopen and such

2001-01-02 Thread Christian Weisgerber
Rafael Barrero [EMAIL PROTECTED] wrote: 0) Are native binaries for OpenBSD different from FreeBSD? Yes. -- Christian "naddy" Weisgerber [EMAIL PROTECTED] To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message

dlopen()

2000-11-23 Thread Dmitry Sychov
Greetings. Is it safe to remove the *.so file after it is loaded into the process space and addresses to its functions are gotten? I've tested this and have no problems so far. I need this to implement the "hot swap" of the dynamic loading libraries. Thanks, Dmitry To Unsubscribe: send

Re: dlopen()

2000-11-23 Thread Konstantin Chuguev
Dmitry Sychov wrote: Greetings. Is it safe to remove the *.so file after it is loaded into the process space and addresses to its functions are gotten? It's safe to remove it as soon as it's been opened. The file will still exist in the filesystem, only there won't be any references to it

Re: dlopen()

2000-11-23 Thread Peter Pentchev
On Thu, Nov 23, 2000 at 01:40:34PM +, Konstantin Chuguev wrote: Dmitry Sychov wrote: Greetings. Is it safe to remove the *.so file after it is loaded into the process space and addresses to its functions are gotten? It's safe to remove it as soon as it's been opened. The file

Re: dlopen()

2000-11-23 Thread Max Khon
hi, there! On Wed, 22 Nov 2000, Dmitry Sychov wrote: Is it safe to remove the *.so file after it is loaded into the process space and addresses to its functions are gotten? yes /fjoe To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the

Re: dlopen()

2000-11-23 Thread Konstantin Chuguev
FreeBSD box nearby): For all dynamically loaded modules: dlopen() opens the file (gets a file descriptor) and mmaps it (possibly excluding the debug and some other sections). dlclose() unmaps and closes it. For shared libraries: __init() code of the binary executable dlopen()'s all the libraries

Re: dlopen()

2000-11-23 Thread John Polstra
modules: dlopen() opens the file (gets a file descriptor) and mmaps it (possibly excluding the debug and some other sections). dlclose() unmaps and closes it. Not quite. The dynamic linker opens the file, mmaps it, and closes it immediately. A mapping created by mmap endures even after you close

dlopen() objc initializer...

2000-10-03 Thread mirko . viviani
Ciao! I have an ObjC shared object compiled in this way: gcc -shared -rdynamic -o Bundle BreakTest.o SetTestCase.o -lSenFoundation -lSenTestingKit When I load this object with dlopen() the __objc_exec_class() initializer of the libraries's classes are called first than the objc initializers

Re: dlopen() objc initializer...

2000-10-03 Thread jdp
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: I have an ObjC shared object compiled in this way: gcc -shared -rdynamic -o Bundle BreakTest.o SetTestCase.o -lSenFoundation -lSenTestingKit When I load this object with dlopen() the __objc_exec_class() initializer

Re: dlopen()

2000-09-05 Thread Bjoern Fischer
On Mon, Sep 04, 2000 at 11:16:17PM -0500, Michael Owens wrote: [...] -Wl,export-dynamic, but still have not seemed to resolve the problem: when the program calls dlopen to load the library, it returns ./libcircle.so: Undefined symbol "__pure_virtual" It seems that this is a li

dlopen()

2000-09-04 Thread Michael Owens
I am trying an example I got from a magazine originally written for Linux which dynamically loads shared libraries and instantiates C++ classes within them. Being a recent FreeBSD convert, I intended to run this example on it. However, I am having a problem. I did read the man page for dlopen

RE: dlopen() and friends from a statically-linked binary?

2000-08-07 Thread Raymond Wiker
Daniel O'Connor writes: On 20-Jul-00 Raymond Wiker wrote: Is it possible, at all, to use dlopen etc from a statically-linked executable? My experiments with FreeBSD-4.0 (see below) indicate that it's not possible. You can't do it from a statically linked binary, however

RE: dlopen() and friends from a statically-linked binary?

2000-07-25 Thread Andrzej Bialecki
On Sat, 22 Jul 2000, Daniel O'Connor wrote: On 20-Jul-00 Raymond Wiker wrote: Is it possible, at all, to use dlopen etc from a statically-linked executable? My experiments with FreeBSD-4.0 (see below) indicate that it's not possible. You can't do it from a statically linked

dlopen() and friends from a statically-linked binary?

2000-07-21 Thread Raymond Wiker
[ Re-sent, as it seemed to get lost on my first try. ] Is it possible, at all, to use dlopen etc from a statically-linked executable? My experiments with FreeBSD-4.0 (see below) indicate that it's not possible. The reason that I'd like this to work is that SBCL (a Common

Re: dlopen() and friends from a statically-linked binary?

2000-07-21 Thread Martin Hopkins
"Raymond" == Raymond Wiker [EMAIL PROTECTED] writes: Raymond raw : ~ $ cat dltest.c Raymond #include dlfcn.h Raymond #include stdio.h Raymond main() Raymond { Raymond void *handle; Raymond void *sym; Raymond handle = dlopen(0, RTLD_LAZY);

RE: dlopen() and friends from a statically-linked binary?

2000-07-21 Thread Daniel O'Connor
On 20-Jul-00 Raymond Wiker wrote: Is it possible, at all, to use dlopen etc from a statically-linked executable? My experiments with FreeBSD-4.0 (see below) indicate that it's not possible. You can't do it from a statically linked binary, however you can create a dynamic executable

Re: dlopen() and friends from a statically-linked binary?

2000-07-21 Thread Raymond Wiker
passing 0 for handle should have the same effect as passing 0 as the path to dlopen; i.e, to access the symbol table for the running program. -- Raymond Wiker To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message

Re: RTLD_NODELETE, RTLD_NOLOAD dlopen mode flags

2000-05-28 Thread John Polstra
In article [EMAIL PROTECTED], Max Khon [EMAIL PROTECTED] wrote: Are there any plans to implement RTLD_NODELETE and RTLD_NOLOAD mode flags for dlopen? I wasn't aware of them, but it looks like they would be easy to implement. Could you please file a PR with send-pr and tell me the PR number

Re: RTLD_NODELETE, RTLD_NOLOAD dlopen mode flags

2000-05-27 Thread Jeroen Ruigrok van der Werven
-On [2526 16:22], Max Khon ([EMAIL PROTECTED]) wrote: Are there any plans to implement RTLD_NODELETE and RTLD_NOLOAD mode flags for dlopen? Not sure, buy maybe John Polstra can answer this one. CC:'d. from Solaris 2.6 man 3X dlopen: The following modes provide additional capabilities

RTLD_NODELETE, RTLD_NOLOAD dlopen mode flags

2000-05-26 Thread Max Khon
hi, there! Are there any plans to implement RTLD_NODELETE and RTLD_NOLOAD mode flags for dlopen? from Solaris 2.6 man 3X dlopen: The following modes provide additional capabilities outside of relocation processing: RTLD_NODELETE The specified object will not be deleted

Help me understand dlopen/dlsy

2000-02-14 Thread Pradesh Chanderpaul
#include stdlib.h #include dlfcn.h int main() { void *handle; void (*myhellofunc)(void); char *c; handle = dlopen(NULL, 1); c = dlerror(); if (c) abort_with_error(c); myhellofunc = dlsym(handle, "_helloworld"); c = dlerror(); if(c

Re: Help me understand dlopen/dlsy

2000-02-14 Thread Alfred Perlstein
ing of two source files and a makefile file1.c --- #include stdio.h #include stdlib.h #include dlfcn.h int main() { void *handle; void (*myhellofunc)(void); char *c; handle = dlopen(NULL, 1); c = dlerror(); if (c) abort_with_error(c); m

Re: RTLD_GLOBAL/RTLD_LOCAL dlopen mode flags

1999-11-02 Thread Max Khon
hi, there! On Mon, 1 Nov 1999, John Polstra wrote: Are there any plans to implement RTLD_GLOBAL/RTLD_LOCAL mode flags for dlopen? RTLD_GLOBAL has been supported in -current since around the beginning of September. great. I think that manpage should be brought up to date with -current

Re: RTLD_GLOBAL/RTLD_LOCAL dlopen mode flags

1999-11-01 Thread John Polstra
In article [EMAIL PROTECTED], Max Khon [EMAIL PROTECTED] wrote: Are there any plans to implement RTLD_GLOBAL/RTLD_LOCAL mode flags for dlopen? RTLD_GLOBAL has been supported in -current since around the beginning of September. What is RTLD_LOCAL, and which OS supports it? I've never heard

RTLD_GLOBAL/RTLD_LOCAL dlopen mode flags

1999-10-28 Thread Max Khon
hi, there! Are there any plans to implement RTLD_GLOBAL/RTLD_LOCAL mode flags for dlopen? /fjoe To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message

Re: dlopen returns non NULL

1999-06-30 Thread John Polstra
In article pine.bsf.4.05.9906291726460.1300-100...@iclub.nsu.ru, Max Khon f...@iclub.nsu.ru wrote: in the following code `dlopen' returns NULL on the first iteration (because g() is not defined) -- it's ok but on the second iteration `dlopen' returns valid dlh ELF or a.out? Which version

Re: dlopen returns non NULL

1999-06-30 Thread Max Khon
hi, there! On Wed, 30 Jun 1999, John Polstra wrote: in the following code `dlopen' returns NULL on the first iteration (because g() is not defined) -- it's ok but on the second iteration `dlopen' returns valid dlh ELF or a.out? Which version of FreeBSD? For a.out, it's a known bug

Re: dlopen returns non NULL

1999-06-30 Thread John Polstra
as the resposible person. Please be sure to state that it's the ELF dynamic linker. If you're in a big hurry and would like to work on it yourself, the relevant code is in src/libexec/rtld-elf/rtld.c in the function dlopen() near the comment that says XXX - Clean up properly after an error

dlopen returns non NULL

1999-06-29 Thread Max Khon
hi, there! in the following code `dlopen' returns NULL on the first iteration (because g() is not defined) -- it's ok but on the second iteration `dlopen' returns "valid" dlh I need the code like this to load some functions dynamically. The code below shows that it's unable to ensur

dlopen returns non NULL

1999-06-29 Thread Max Khon
hi, there! in the following code `dlopen' returns NULL on the first iteration (because g() is not defined) -- it's ok but on the second iteration `dlopen' returns valid dlh I need the code like this to load some functions dynamically. The code below shows that it's unable to ensure that all

Re: dlopen failure

1999-05-22 Thread John Polstra
In article 37458ff0.fc9b2...@cablenet.net, Damian Hamill dam...@cablenet.net wrote: I have found the problem and it is a problem with make. By chance I did an ls -l of the directory and noticed the shared object was only 371 bytes and thought no that can't be right. Thanks for

Re: dlopen failure

1999-05-21 Thread Doug Rabson
trap. #0 0x800b728 in _kill () (gdb) bt #0 0x800b728 in _kill () #1 0x800b34c in abort () #2 0x8004aa2 in __assert () #3 0x8003b4b in map_object () #4 0x8002e9e in find_symdef () #5 0x800334d in dlopen () #6 0x8049a68 in Get_SQL_Driver (name=0x804c7e4 mysql) at Vdb.c:150 #7

Re: dlopen failure

1999-05-21 Thread John Polstra
with signal 6, Abort trap. #0 0x800b728 in _kill () (gdb) bt #0 0x800b728 in _kill () #1 0x800b34c in abort () #2 0x8004aa2 in __assert () #3 0x8003b4b in map_object () #4 0x8002e9e in find_symdef () #5 0x800334d in dlopen () #6 0x8049a68 in Get_SQL_Driver (name=0x804c7e4

Re: dlopen failure

1999-05-21 Thread Damian Hamill
. #0 0x800b728 in _kill () (gdb) bt #0 0x800b728 in _kill () #1 0x800b34c in abort () #2 0x8004aa2 in __assert () #3 0x8003b4b in map_object () #4 0x8002e9e in find_symdef () #5 0x800334d in dlopen () #6 0x8049a68 in Get_SQL_Driver (name=0x804c7e4 mysql) at Vdb.c

Re: dlopen failure

1999-05-20 Thread John Polstra
0x800b728 in _kill () #1 0x800b34c in abort () #2 0x8004aa2 in __assert () #3 0x8003b4b in map_object () #4 0x8002e9e in find_symdef () #5 0x800334d in dlopen () #6 0x8049a68 in Get_SQL_Driver (name=0x804c7e4 mysql) at Vdb.c:150 #7 0x8049ff9 in GetDefaultDriver () at Vdb.c:254 #8

dlopen failure

1999-05-14 Thread Damian Hamill
in map_object () #4 0x8002e9e in find_symdef () #5 0x800334d in dlopen () #6 0x8049a68 in Get_SQL_Driver (name=0x804c7e4 mysql) at Vdb.c:150 #7 0x8049ff9 in GetDefaultDriver () at Vdb.c:254 #8 0x804a141 in VdbInit (user=0x804bfb1 nobody, passwd=0x0) at Vdb.c:329 #9 0x8049316 in main () #10 0x8048be5

Re: dlopen failure

1999-05-14 Thread Nate Williams
- and here's the ld line for the shared object I am loading; ld -Bshareable -o $@ $ -u _floor ../../lib/libV.a /usr/local/lib/mysql/libmysqlclient.a /usr/lib/libm.a This is probably unrelated to the bug (but it might be related). Are