patrick keshishian <sids...@boxsoft.com> writes: > On Tue, Jan 28, 2014 at 09:02:31PM -0800, Philip Guenther wrote: >> On Tue, Jan 28, 2014 at 4:55 PM, patrick keshishian <sids...@boxsoft.com> >> wrote: >> > Not sure if anyone is interested in this panic as the >> > snapshot is a bit old. >> > >> > Happend while gdb-ing a process. >> > >> > (typing off images; expect typos) >> > >> > login: panic: kernel diagnostic assertion "__mp_lock_held(&sched_lock) == >> > 0" failed: file "../../../../lock.c", line 126 >> >> That's the bug I was working on at the start of the n2k14 hackathon. >> I've managed to simplify some of the bits underneath it, so maybe I >> can get the intermediate problem (recursive tsleep() usage) >> resolved... > > Thanks. > >> > Side note 1: >> > Incidentally, I couldn't figure out how to correctly leave >> > a symbol unresolved while compiling myapp, until dlopen() >> > time. >> >> If you can include the shared-object/library in the link command line, >> then the symbol can be referenced at link time. That lets you refer >> to the symbols directly as if they were in the executable itself, >> though you must still declare them for the compiler to know what type >> they are, etc. > > A bit of a chicken-and-egg situation for this case. Unless > I do some ugly "hopping" around in Makefiles, it would be > difficult to include the object on the link line for the > main program. > >> If you need to delay the loading of the shared-object until after >> process startup via dlopen(), then the executable should use dlsym() >> to get the symbol address, passing it the handle that dlopen() >> returned. > > Yes. I do that right now with a bit of "dance". However, > reading a bit about __attribute__((weak)) on-line, I > thought, there may be an easier way to achieve this. But, > I quite possibly misunderstood the use of that attribute.
It sounds like you're not using dlsym as intended, then. If you used: void (*my_function)(void); my_function = dlsym(handle, "target_function"); if (my_function == NULL) oops(); (*my_function)(); then your program wouldn't need to reference target_function at all. [...] -- jca | PGP: 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE (previous: 0x06A11494 / 61DB D9A0 00A4 67CF 2A90 8961 6191 8FBF 06A1 1494)