libreplace on Linux was (Re: Changing back to per-thread credentials on Linux (fixing native AIO).)

Jelmer Vernooij jelmer at
Thu Jun 28 01:39:03 MDT 2012

On Thu, Jun 28, 2012 at 08:42:56AM +1000, Andrew Bartlett wrote:
> On Wed, 2012-06-27 at 09:51 -0700, Jeremy Allison wrote:
> > Hi all,

> > Back in 2008 tridge noticed a lost-wakeup problem with our
> > implementation using POSIX aio on Linux.

> > Comments please ! I'm planning to push this
> > soon if people are ok with is and I'll create
> > a bug to get it back-ported for 3.6.x (and
> > maybe 3.5.x) to fix the lost-wakeup issue
> > with Linux glibc aio.

> Jeremy,

> I think you developed this under autconf, because the wscript replace
> mechanism doesn't look right.  You need it to look like the snprintf
> tests, where we check for behaviour, not just missing functions (because
> they are not missing).

> The other concern I have is that libreplace has in general been about
> ensuring that the Linux interface is available everywhere, but this
> isn't the Linux interface, it is a custom Samba interface being called
> by the Linux name.  

> The distinction matters, because on Linux, we had actually got to the
> point where with waf, libreplace actually became a no-op (libbsd is used
> for the strl* functions).  (Jelmer was keen on this). 
Yes, let's not put utility code into libreplace. Originally we had a
bunch of portability wrappers scattered all over lib/; the goal of
libreplace was to split out the portability code from the
Samba-specific utility code and make sure that the rest of the code
didn't have to worry about portability as much rather than remember to
call e.g. sys_select().

From libreplace's README:

This subsystem ensures that we can always use a certain core set of
functions and types, that are either provided by the OS or by replacement
functions / definitions in this subsystem. The aim is to try to stick
to POSIX functions in here as much as possible. Convenience functions
that are available on no platform at all belong in other subsystems
(such as LIBUTIL).

Things in libreplace are standard POSIX, standard Linux or standard
BSD (strlcat and strlcpy only) APIs. On modern platforms it should be


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <>

More information about the samba-technical mailing list