[OpenAFS-devel] Re: segfault in process.c:savecontext() during lwp init -- how to debug?

Russ Allbery rra@stanford.edu
Mon, 29 Jun 2009 23:09:30 -0700


Adam Megacz <megacz@hcoop.net> writes:

> Ah, forgive me -- clearly I have made a mistake.  I thought that the
> LWP-vs-pthreads choice was made once-and-for-all at the time that the
> openafs libraries get compiled.  How do I select between LWP and
> pthreads?  If I omit the "-llwp" during linking I wind up with a bunch
> of unresolved symbols (LWP_XXX) that only seem to appear in liblwp.a
> and nowhere else...

The simple answer is to link with libafsauthent and libafsrpc, which are
pthreaded, instead of the other mess of libraries.

> Also, if I choose to "build it with the pthread package", will
> problems arise when some other program which was "built with the LWP
> package" loads my shared library (keeping in mind that at the moment I
> am linking all the AFS libraries statically)?  For example, this would
> happen if some userland AFS tool were to invoke getpwnam() when nscd
> wasn't running.

I *think* you're okay in that case, but I'm not positive.  Basically,
the problem as I understand it is if the process starts using threads,
the LWP code explodes.  But if the process isn't using threads, both LWP
and pthread work.

> Of course, using nscd avoids all these problems, which is why I urge
> that it always be used with libnss-afs.

It's a shame that nscd is so buggy, although if you don't use it for DNS
you can avoid the worst disasters.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>