DragonFly BSD
DragonFly commits List (threaded) for 2012-01
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

git: rtld: Make thread-safe by replacing libc printf functions


From: John Marino <marino@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 23 Jan 2012 08:15:10 -0800 (PST)

commit abfcd5b1045e58aecb0f84d4e269d0d1b3b20d6e
Author: John Marino <draco@marino.st>
Date:   Sat Jan 21 16:07:30 2012 +0100

    rtld: Make thread-safe by replacing libc printf functions
    
    The dynamic linker is linked with the specially built static pic libc to
    get some C runtime services such as printf().  Unfortunately, the
    multithread-safeness measures in libc do now work in the rtld environment.
    
    The dynlinker now uses FreeBSD's kernel printf() implementation instead of
    libc's version.  This printf does not require any shared global data and
    thus is mt-safe.  This commit replaces printf() and related functions with
    rtld_ versions, and also removes calls to err(3).
    
    Currently stdio is still pulled from libc within the libmap implementation
    that uses fopen().  This is safe, yet not optimal, and is a candidate for
    future change.
    
    The makefile was cleaned up to remove the unused bits to building an
    executable dynlinker and also require gnu99.
    
    Taken-from: FreeBSD SVN 225152

Summary of changes:
 libexec/rtld-elf/Makefile      |   18 +-
 libexec/rtld-elf/debug.c       |   24 +-
 libexec/rtld-elf/malloc.c      |   26 +--
 libexec/rtld-elf/rtld.c        |   27 ++-
 libexec/rtld-elf/rtld.h        |    1 +
 libexec/rtld-elf/rtld_lock.c   |    2 -
 libexec/rtld-elf/rtld_printf.c |  487 ++++++++++++++++++++++++++++++++++++++++
 libexec/rtld-elf/rtld_printf.h |   44 ++++
 libexec/rtld-elf/xmalloc.c     |   16 +-
 9 files changed, 580 insertions(+), 65 deletions(-)
 create mode 100644 libexec/rtld-elf/rtld_printf.c
 create mode 100644 libexec/rtld-elf/rtld_printf.h

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/abfcd5b1045e58aecb0f84d4e269d0d1b3b20d6e


-- 
DragonFly BSD source repository



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]