2002-07-15 Jeff Johnston <jjohnstn@redhat.com>
* libc/sys/linux/Makefile.am: Add new files. * libc/sys/linux/Makefile.in: Regenerated. * libc/sys/linux/bp-sym.h: Moved to include directory. * libc/sys/linux/mmap.c: Add weak aliases: __mmap, __munmap, __mremap. * libc/sys/linux/inode.c: Set _LIBC to 1. * libc/sys/linux/mq_close.c: Ditto. * libc/sys/linux/mq_getattr.c: Ditto. * libc/sys/linux/mq_open.c: Ditto. * libc/sys/linux/mq_receive.c: Ditto. * libc/sys/linux/mq_send.c: Ditto. * libc/sys/linux/mq_setattr.c: Ditto. * libc/sys/linux/mq_unlink.c: Ditto. * libc/sys/linux/calloc.c: New file. * libc/sys/linux/callocr.c: Ditto. * libc/sys/linux/cfreer.c: Ditto. * libc/sys/linux/config.h: Ditto. * libc/sys/linux/free.c: Ditto. * libc/sys/linux/freer.c: Ditto. * libc/sys/linux/msize.c: Ditto. * libc/sys/linux/msizer.c: Ditto. * libc/sys/linux/mstats.c: Ditto. * libc/sys/linux/mtrim.c: Ditto. * libc/sys/linux/mtrimr.c: Ditto. * libc/sys/linux/pvallocr.c: Ditto. * libc/sys/linux/realloc.c: Ditto. * libc/sys/linux/reallocr.c: Ditto. * libc/sys/linux/thread-m.h: Ditto. * libc/sys/linux/vallocr.c: Ditto. * libc/sys/linux/bp-checks.h: Ditto. * libc/sys/linux/libc-symbols.h: Ditto. * libc/sys/linux/libc-tsd.h: Ditto. * libc/sys/linux/libintl.h: Ditto. * libc/sys/linux/malign.c: Ditto. * libc/sys/linux/malignr.c: Ditto. * libc/sys/linux/mallinfor.c: Ditto. * libc/sys/linux/malloc.c: Ditto. * libc/sys/linux/mallocr.c: Ditto. * libc/sys/linux/malloptr.c: Ditto. * libc/sys/linux/mallstatsr.c: Ditto. * libc/sys/linux/mcheck.c: Ditto. * libc/sys/linux/mhooks.h: Ditto. * libc/sys/linux/include/bp-sym.h: Ditto. * libc/sys/linux/include/malloc.h: Ditto. * libc/sys/linux/include/mcheck.h: Ditto. * libc/sys/linux/machine/i386/getpagesize.c: New file. * libc/sys/linux/machine/i386/Makefile.am: Add getpagesize.c. * libc/sys/linux/machine/i386/Makefile.in: Regenerated. * libc/sys/linux/machine/i386/sysdep.h: New file. * libc/sys/linux/machine/i386/weakalias.h: Add weak_function support. * libc/sys/linux/sys/dirent.h: Set _LIBC to 1. * libc/sys/linux/sys/types.h: Add new types.
This commit is contained in:
parent
315fb3afb0
commit
edba3282e8
|
@ -1,3 +1,61 @@
|
|||
2002-07-15 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* libc/sys/linux/Makefile.am: Add new files.
|
||||
* libc/sys/linux/Makefile.in: Regenerated.
|
||||
* libc/sys/linux/bp-sym.h: Moved to include directory.
|
||||
* libc/sys/linux/mmap.c: Add weak aliases: __mmap, __munmap, __mremap.
|
||||
* libc/sys/linux/inode.c: Set _LIBC to 1.
|
||||
* libc/sys/linux/mq_close.c: Ditto.
|
||||
* libc/sys/linux/mq_getattr.c: Ditto.
|
||||
* libc/sys/linux/mq_open.c: Ditto.
|
||||
* libc/sys/linux/mq_receive.c: Ditto.
|
||||
* libc/sys/linux/mq_send.c: Ditto.
|
||||
* libc/sys/linux/mq_setattr.c: Ditto.
|
||||
* libc/sys/linux/mq_unlink.c: Ditto.
|
||||
* libc/sys/linux/calloc.c: New file.
|
||||
* libc/sys/linux/callocr.c: Ditto.
|
||||
* libc/sys/linux/cfreer.c: Ditto.
|
||||
* libc/sys/linux/config.h: Ditto.
|
||||
* libc/sys/linux/free.c: Ditto.
|
||||
* libc/sys/linux/freer.c: Ditto.
|
||||
* libc/sys/linux/msize.c: Ditto.
|
||||
* libc/sys/linux/msizer.c: Ditto.
|
||||
* libc/sys/linux/mstats.c: Ditto.
|
||||
* libc/sys/linux/mtrim.c: Ditto.
|
||||
* libc/sys/linux/mtrimr.c: Ditto.
|
||||
* libc/sys/linux/pvallocr.c: Ditto.
|
||||
* libc/sys/linux/realloc.c: Ditto.
|
||||
* libc/sys/linux/reallocr.c: Ditto.
|
||||
* libc/sys/linux/thread-m.h: Ditto.
|
||||
* libc/sys/linux/vallocr.c: Ditto.
|
||||
* libc/sys/linux/bp-checks.h: Ditto.
|
||||
* libc/sys/linux/libc-symbols.h: Ditto.
|
||||
* libc/sys/linux/libc-tsd.h: Ditto.
|
||||
* libc/sys/linux/libintl.h: Ditto.
|
||||
* libc/sys/linux/malign.c: Ditto.
|
||||
* libc/sys/linux/malignr.c: Ditto.
|
||||
* libc/sys/linux/mallinfor.c: Ditto.
|
||||
* libc/sys/linux/malloc.c: Ditto.
|
||||
* libc/sys/linux/mallocr.c: Ditto.
|
||||
* libc/sys/linux/malloptr.c: Ditto.
|
||||
* libc/sys/linux/mallstatsr.c: Ditto.
|
||||
* libc/sys/linux/mcheck.c: Ditto.
|
||||
* libc/sys/linux/mhooks.h: Ditto.
|
||||
* libc/sys/linux/include/bp-sym.h: Ditto.
|
||||
* libc/sys/linux/include/malloc.h: Ditto.
|
||||
* libc/sys/linux/include/mcheck.h: Ditto.
|
||||
* libc/sys/linux/linuxthreads/machine/i386/Makefile.am: Remove
|
||||
getpagesize.c.
|
||||
* libc/sys/linux/linuxthreads/machine/i386/Makefile.in: Regenerated.
|
||||
* libc/sys/linux/linuxthreads/machine/i386/getpagesize.c: Moved.
|
||||
* libc/sys/linux/machine/i386/getpagesize.c: New file.
|
||||
* libc/sys/linux/machine/i386/Makefile.am: Add getpagesize.c.
|
||||
* libc/sys/linux/machine/i386/Makefile.in: Regenerated.
|
||||
* libc/sys/linux/machine/i386/sysdep.h: New file.
|
||||
* libc/sys/linux/machine/i386/weakalias.h: Add weak_function support.
|
||||
* libc/sys/linux/sys/dirent.h: Set _LIBC to 1.
|
||||
* libc/sys/linux/sys/lock.h: Include <machine/weakalias.h>.
|
||||
|
||||
2002-07-12 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* libc/sys/linux/include/mqueue.h: Change to use <bits/siginfo.h>
|
||||
|
|
|
@ -12,11 +12,16 @@ SUBLIBS = \
|
|||
LIB_SOURCES = \
|
||||
aio.c \
|
||||
brk.c \
|
||||
calloc.c \
|
||||
callocr.c \
|
||||
cfreer.c \
|
||||
cfspeed.c \
|
||||
clock_getres.c \
|
||||
clock_gettime.c \
|
||||
clock_settime.c \
|
||||
flockfile.c \
|
||||
free.c \
|
||||
freer.c \
|
||||
ftok.c \
|
||||
funlockfile.c \
|
||||
getdate.c \
|
||||
|
@ -30,6 +35,12 @@ LIB_SOURCES = \
|
|||
io64.c \
|
||||
ipc.c \
|
||||
linux.c \
|
||||
malign.c \
|
||||
malignr.c \
|
||||
mallinfor.c \
|
||||
mallocr.c \
|
||||
malloptr.c \
|
||||
mallstatsr.c \
|
||||
mmap.c \
|
||||
mq_close.c \
|
||||
mq_getattr.c \
|
||||
|
@ -39,14 +50,22 @@ LIB_SOURCES = \
|
|||
mq_send.c \
|
||||
mq_setattr.c \
|
||||
mq_unlink.c \
|
||||
msize.c \
|
||||
msizer.c \
|
||||
mstats.c \
|
||||
mtrim.c \
|
||||
mtrimr.c \
|
||||
ntp_gettime.c \
|
||||
pread.c \
|
||||
pread64.c \
|
||||
process.c \
|
||||
psignal.c \
|
||||
pvallocr.c \
|
||||
pwrite.c \
|
||||
pwrite64.c \
|
||||
raise.c \
|
||||
realloc.c \
|
||||
reallocr.c \
|
||||
realpath.c \
|
||||
rename.c \
|
||||
resource.c \
|
||||
|
@ -77,6 +96,7 @@ LIB_SOURCES = \
|
|||
time.c \
|
||||
usleep.c \
|
||||
utimes.c \
|
||||
vallocr.c \
|
||||
wait.c
|
||||
|
||||
# This will handle both /usr/src/linux-2.4/include/asm/signal.h (in Red Hat Linux 7.1)
|
||||
|
@ -86,6 +106,8 @@ SIGNAL_H = /usr/src/$(shell ls /usr/src/ | grep ^linux | head -n 1)/include/asm/
|
|||
liblinux_la_LDFLAGS = -Xcompiler -nostdlib
|
||||
|
||||
ADD_OBJS = \
|
||||
malloc.$(oext) \
|
||||
mcheck.$(oext) \
|
||||
$(LINUX_MACH_LIB)
|
||||
|
||||
if USE_LIBTOOL
|
||||
|
@ -93,12 +115,14 @@ noinst_LTLIBRARIES = liblinux.la
|
|||
liblinux_la_SOURCES = $(LIB_SOURCES)
|
||||
liblinux_la_LIBADD = $(ADD_OBJS)
|
||||
liblinux_la_DEPENDENCIES = $(ADD_OBJS)
|
||||
LIBC_COMPILE = $(LTCOMPILE)
|
||||
noinst_DATA = objectlist.awk.in
|
||||
else
|
||||
noinst_LIBRARIES = lib.a
|
||||
lib_a_SOURCES = $(LIB_SOURCES)
|
||||
lib_a_LIBADD = $(ADD_OBJS)
|
||||
lib_a_DEPENDENCIES = $(ADD_OBJS)
|
||||
LIBC_COMPILE = $(COMPILE)
|
||||
noinst_DATA =
|
||||
|
||||
lib.a: $(ADD_OBJS) $(lib_a_OBJECTS)
|
||||
|
@ -126,6 +150,11 @@ crt0.o: machine/crt0.o
|
|||
|
||||
machine/crt0.o: ; @true
|
||||
|
||||
malloc.$(oext): $(srcdir)/malloc.c
|
||||
$(LIBC_COMPILE) -D_LIBC=1 -c $< -o $@
|
||||
|
||||
mcheck.$(oext): $(srcdir)/mcheck.c
|
||||
$(LIBC_COMPILE) -D_LIBC=1 -c $< -o $@
|
||||
|
||||
sig.$(oext): siglist.inc
|
||||
|
||||
|
|
|
@ -109,11 +109,16 @@ SUBLIBS = \
|
|||
LIB_SOURCES = \
|
||||
aio.c \
|
||||
brk.c \
|
||||
calloc.c \
|
||||
callocr.c \
|
||||
cfreer.c \
|
||||
cfspeed.c \
|
||||
clock_getres.c \
|
||||
clock_gettime.c \
|
||||
clock_settime.c \
|
||||
flockfile.c \
|
||||
free.c \
|
||||
freer.c \
|
||||
ftok.c \
|
||||
funlockfile.c \
|
||||
getdate.c \
|
||||
|
@ -127,6 +132,12 @@ LIB_SOURCES = \
|
|||
io64.c \
|
||||
ipc.c \
|
||||
linux.c \
|
||||
malign.c \
|
||||
malignr.c \
|
||||
mallinfor.c \
|
||||
mallocr.c \
|
||||
malloptr.c \
|
||||
mallstatsr.c \
|
||||
mmap.c \
|
||||
mq_close.c \
|
||||
mq_getattr.c \
|
||||
|
@ -136,14 +147,22 @@ LIB_SOURCES = \
|
|||
mq_send.c \
|
||||
mq_setattr.c \
|
||||
mq_unlink.c \
|
||||
msize.c \
|
||||
msizer.c \
|
||||
mstats.c \
|
||||
mtrim.c \
|
||||
mtrimr.c \
|
||||
ntp_gettime.c \
|
||||
pread.c \
|
||||
pread64.c \
|
||||
process.c \
|
||||
psignal.c \
|
||||
pvallocr.c \
|
||||
pwrite.c \
|
||||
pwrite64.c \
|
||||
raise.c \
|
||||
realloc.c \
|
||||
reallocr.c \
|
||||
realpath.c \
|
||||
rename.c \
|
||||
resource.c \
|
||||
|
@ -174,6 +193,7 @@ LIB_SOURCES = \
|
|||
time.c \
|
||||
usleep.c \
|
||||
utimes.c \
|
||||
vallocr.c \
|
||||
wait.c
|
||||
|
||||
|
||||
|
@ -184,6 +204,8 @@ SIGNAL_H = /usr/src/$(shell ls /usr/src/ | grep ^linux | head -n 1)/include/asm/
|
|||
liblinux_la_LDFLAGS = -Xcompiler -nostdlib
|
||||
|
||||
ADD_OBJS = \
|
||||
malloc.$(oext) \
|
||||
mcheck.$(oext) \
|
||||
$(LINUX_MACH_LIB)
|
||||
|
||||
|
||||
|
@ -191,6 +213,8 @@ ADD_OBJS = \
|
|||
@USE_LIBTOOL_TRUE@liblinux_la_SOURCES = @USE_LIBTOOL_TRUE@$(LIB_SOURCES)
|
||||
@USE_LIBTOOL_TRUE@liblinux_la_LIBADD = @USE_LIBTOOL_TRUE@$(ADD_OBJS)
|
||||
@USE_LIBTOOL_TRUE@liblinux_la_DEPENDENCIES = @USE_LIBTOOL_TRUE@$(ADD_OBJS)
|
||||
@USE_LIBTOOL_TRUE@LIBC_COMPILE = @USE_LIBTOOL_TRUE@$(LTCOMPILE)
|
||||
@USE_LIBTOOL_FALSE@LIBC_COMPILE = @USE_LIBTOOL_FALSE@$(COMPILE)
|
||||
@USE_LIBTOOL_TRUE@noinst_DATA = @USE_LIBTOOL_TRUE@objectlist.awk.in
|
||||
@USE_LIBTOOL_FALSE@noinst_DATA =
|
||||
@USE_LIBTOOL_FALSE@noinst_LIBRARIES = @USE_LIBTOOL_FALSE@lib.a
|
||||
|
@ -211,22 +235,29 @@ DEFS = @DEFS@ -I. -I$(srcdir)
|
|||
CPPFLAGS = @CPPFLAGS@
|
||||
LIBS = @LIBS@
|
||||
@USE_LIBTOOL_FALSE@lib_a_OBJECTS = aio.$(OBJEXT) brk.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@calloc.$(OBJEXT) callocr.$(OBJEXT) cfreer.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@cfspeed.$(OBJEXT) clock_getres.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@clock_gettime.$(OBJEXT) clock_settime.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@flockfile.$(OBJEXT) ftok.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@funlockfile.$(OBJEXT) getdate.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@getdate_err.$(OBJEXT) gethostname.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@getoptlong.$(OBJEXT) getreent.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@ids.$(OBJEXT) inode.$(OBJEXT) io.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@io64.$(OBJEXT) ipc.$(OBJEXT) linux.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@flockfile.$(OBJEXT) free.$(OBJEXT) freer.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@ftok.$(OBJEXT) funlockfile.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@getdate.$(OBJEXT) getdate_err.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@gethostname.$(OBJEXT) getoptlong.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@getreent.$(OBJEXT) ids.$(OBJEXT) inode.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@io.$(OBJEXT) io64.$(OBJEXT) ipc.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@linux.$(OBJEXT) malign.$(OBJEXT) malignr.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@mallinfor.$(OBJEXT) mallocr.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@malloptr.$(OBJEXT) mallstatsr.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@mmap.$(OBJEXT) mq_close.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@mq_getattr.$(OBJEXT) mq_notify.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@mq_open.$(OBJEXT) mq_receive.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@mq_send.$(OBJEXT) mq_setattr.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@mq_unlink.$(OBJEXT) ntp_gettime.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@pread.$(OBJEXT) pread64.$(OBJEXT) process.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@psignal.$(OBJEXT) pwrite.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@pwrite64.$(OBJEXT) raise.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@mq_unlink.$(OBJEXT) msize.$(OBJEXT) msizer.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@mstats.$(OBJEXT) mtrim.$(OBJEXT) mtrimr.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@ntp_gettime.$(OBJEXT) pread.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@pread64.$(OBJEXT) process.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@psignal.$(OBJEXT) pvallocr.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@pwrite.$(OBJEXT) pwrite64.$(OBJEXT) raise.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@realloc.$(OBJEXT) reallocr.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@realpath.$(OBJEXT) rename.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@resource.$(OBJEXT) sched.$(OBJEXT) select.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@seteuid.$(OBJEXT) sethostname.$(OBJEXT) \
|
||||
|
@ -238,26 +269,30 @@ LIBS = @LIBS@
|
|||
@USE_LIBTOOL_FALSE@sysconf.$(OBJEXT) sysctl.$(OBJEXT) systat.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@system.$(OBJEXT) tcdrain.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@tcsendbrk.$(OBJEXT) termios.$(OBJEXT) time.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@usleep.$(OBJEXT) utimes.$(OBJEXT) wait.$(OBJEXT)
|
||||
@USE_LIBTOOL_FALSE@usleep.$(OBJEXT) utimes.$(OBJEXT) vallocr.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@wait.$(OBJEXT)
|
||||
LTLIBRARIES = $(noinst_LTLIBRARIES)
|
||||
|
||||
@USE_LIBTOOL_TRUE@liblinux_la_OBJECTS = aio.lo brk.lo cfspeed.lo \
|
||||
@USE_LIBTOOL_TRUE@clock_getres.lo clock_gettime.lo clock_settime.lo \
|
||||
@USE_LIBTOOL_TRUE@flockfile.lo ftok.lo funlockfile.lo getdate.lo \
|
||||
@USE_LIBTOOL_TRUE@liblinux_la_OBJECTS = aio.lo brk.lo calloc.lo \
|
||||
@USE_LIBTOOL_TRUE@callocr.lo cfreer.lo cfspeed.lo clock_getres.lo \
|
||||
@USE_LIBTOOL_TRUE@clock_gettime.lo clock_settime.lo flockfile.lo \
|
||||
@USE_LIBTOOL_TRUE@free.lo freer.lo ftok.lo funlockfile.lo getdate.lo \
|
||||
@USE_LIBTOOL_TRUE@getdate_err.lo gethostname.lo getoptlong.lo \
|
||||
@USE_LIBTOOL_TRUE@getreent.lo ids.lo inode.lo io.lo io64.lo ipc.lo \
|
||||
@USE_LIBTOOL_TRUE@linux.lo mmap.lo mq_close.lo mq_getattr.lo \
|
||||
@USE_LIBTOOL_TRUE@mq_notify.lo mq_open.lo mq_receive.lo mq_send.lo \
|
||||
@USE_LIBTOOL_TRUE@mq_setattr.lo mq_unlink.lo ntp_gettime.lo pread.lo \
|
||||
@USE_LIBTOOL_TRUE@pread64.lo process.lo psignal.lo pwrite.lo \
|
||||
@USE_LIBTOOL_TRUE@pwrite64.lo raise.lo realpath.lo rename.lo \
|
||||
@USE_LIBTOOL_TRUE@resource.lo sched.lo select.lo seteuid.lo \
|
||||
@USE_LIBTOOL_TRUE@sethostname.lo shm_open.lo shm_unlink.lo sig.lo \
|
||||
@USE_LIBTOOL_TRUE@sigaction.lo sigqueue.lo signal.lo siglongjmp.lo \
|
||||
@USE_LIBTOOL_TRUE@sigset.lo sigwait.lo socket.lo sleep.lo stack.lo \
|
||||
@USE_LIBTOOL_TRUE@strsignal.lo sysconf.lo sysctl.lo systat.lo system.lo \
|
||||
@USE_LIBTOOL_TRUE@tcdrain.lo tcsendbrk.lo termios.lo time.lo usleep.lo \
|
||||
@USE_LIBTOOL_TRUE@utimes.lo wait.lo
|
||||
@USE_LIBTOOL_TRUE@linux.lo malign.lo malignr.lo mallinfor.lo mallocr.lo \
|
||||
@USE_LIBTOOL_TRUE@malloptr.lo mallstatsr.lo mmap.lo mq_close.lo \
|
||||
@USE_LIBTOOL_TRUE@mq_getattr.lo mq_notify.lo mq_open.lo mq_receive.lo \
|
||||
@USE_LIBTOOL_TRUE@mq_send.lo mq_setattr.lo mq_unlink.lo msize.lo \
|
||||
@USE_LIBTOOL_TRUE@msizer.lo mstats.lo mtrim.lo mtrimr.lo ntp_gettime.lo \
|
||||
@USE_LIBTOOL_TRUE@pread.lo pread64.lo process.lo psignal.lo pvallocr.lo \
|
||||
@USE_LIBTOOL_TRUE@pwrite.lo pwrite64.lo raise.lo realloc.lo reallocr.lo \
|
||||
@USE_LIBTOOL_TRUE@realpath.lo rename.lo resource.lo sched.lo select.lo \
|
||||
@USE_LIBTOOL_TRUE@seteuid.lo sethostname.lo shm_open.lo shm_unlink.lo \
|
||||
@USE_LIBTOOL_TRUE@sig.lo sigaction.lo sigqueue.lo signal.lo \
|
||||
@USE_LIBTOOL_TRUE@siglongjmp.lo sigset.lo sigwait.lo socket.lo sleep.lo \
|
||||
@USE_LIBTOOL_TRUE@stack.lo strsignal.lo sysconf.lo sysctl.lo systat.lo \
|
||||
@USE_LIBTOOL_TRUE@system.lo tcdrain.lo tcsendbrk.lo termios.lo time.lo \
|
||||
@USE_LIBTOOL_TRUE@usleep.lo utimes.lo vallocr.lo wait.lo
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
|
@ -286,7 +321,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
|||
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in \
|
||||
../../../acinclude.m4 ../../../aclocal.m4
|
||||
../../../acinclude.m4 ../../../aclocal.m4 \
|
||||
../../../libtool.m4
|
||||
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
|
||||
config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
|
@ -623,6 +659,12 @@ crt0.o: machine/crt0.o
|
|||
|
||||
machine/crt0.o: ; @true
|
||||
|
||||
malloc.$(oext): $(srcdir)/malloc.c
|
||||
$(LIBC_COMPILE) -D_LIBC=1 -c $< -o $@
|
||||
|
||||
mcheck.$(oext): $(srcdir)/mcheck.c
|
||||
$(LIBC_COMPILE) -D_LIBC=1 -c $< -o $@
|
||||
|
||||
sig.$(oext): siglist.inc
|
||||
|
||||
siglist.inc:
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
/* Bounded-pointer checking macros for C.
|
||||
Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Greg McGary <greg@mcgary.org>
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#ifndef _bp_checks_h_
|
||||
#define _bp_checks_h_ 1
|
||||
|
||||
#if __BOUNDED_POINTERS__
|
||||
|
||||
# define BOUNDS_VIOLATED (__builtin_trap (), 0)
|
||||
|
||||
/* Verify that pointer's value >= low. Return pointer value. */
|
||||
# define CHECK_BOUNDS_LOW(ARG) \
|
||||
(((__ptrvalue (ARG) < __ptrlow (ARG)) && BOUNDS_VIOLATED), \
|
||||
__ptrvalue (ARG))
|
||||
|
||||
/* Verify that pointer's value < high. Return pointer value. */
|
||||
# define CHECK_BOUNDS_HIGH(ARG) \
|
||||
(((__ptrvalue (ARG) > __ptrhigh (ARG)) && BOUNDS_VIOLATED), \
|
||||
__ptrvalue (ARG))
|
||||
|
||||
# define _CHECK_N(ARG, N, COND) \
|
||||
(((COND) \
|
||||
&& (__ptrvalue (ARG) < __ptrlow (ARG) \
|
||||
|| __ptrvalue (ARG) + (N) > __ptrhigh (ARG)) \
|
||||
&& BOUNDS_VIOLATED), \
|
||||
__ptrvalue (ARG))
|
||||
|
||||
extern void *__unbounded __ubp_memchr (const void *__unbounded, int, unsigned);
|
||||
|
||||
# define _CHECK_STRING(ARG, COND) \
|
||||
(((COND) \
|
||||
&& (__ptrvalue (ARG) < __ptrlow (ARG) \
|
||||
|| !__ubp_memchr (__ptrvalue (ARG), '\0', \
|
||||
(__ptrhigh (ARG) - __ptrvalue (ARG)))) \
|
||||
&& BOUNDS_VIOLATED), \
|
||||
__ptrvalue (ARG))
|
||||
|
||||
/* Check bounds of a pointer seated to an array of N objects. */
|
||||
# define CHECK_N(ARG, N) _CHECK_N ((ARG), (N), 1)
|
||||
/* Same as CHECK_N, but tolerate ARG == NULL. */
|
||||
# define CHECK_N_NULL_OK(ARG, N) _CHECK_N ((ARG), (N), __ptrvalue (ARG))
|
||||
|
||||
/* Check bounds of a pointer seated to a single object. */
|
||||
# define CHECK_1(ARG) CHECK_N ((ARG), 1)
|
||||
/* Same as CHECK_1, but tolerate ARG == NULL. */
|
||||
# define CHECK_1_NULL_OK(ARG) CHECK_N_NULL_OK ((ARG), 1)
|
||||
|
||||
/* Check for NUL-terminator within string's bounds. */
|
||||
# define CHECK_STRING(ARG) _CHECK_STRING ((ARG), 1)
|
||||
/* Same as CHECK_STRING, but tolerate ARG == NULL. */
|
||||
# define CHECK_STRING_NULL_OK(ARG) _CHECK_STRING ((ARG), __ptrvalue (ARG))
|
||||
|
||||
/* Check bounds of signal syscall args with type sigset_t. */
|
||||
# define CHECK_SIGSET(SET) CHECK_N ((SET), _NSIG / (8 * sizeof *(SET)))
|
||||
/* Same as CHECK_SIGSET, but tolerate SET == NULL. */
|
||||
# define CHECK_SIGSET_NULL_OK(SET) CHECK_N_NULL_OK ((SET), _NSIG / (8 * sizeof *(SET)))
|
||||
|
||||
# if defined (_IOC_SIZESHIFT) && defined (_IOC_SIZEBITS)
|
||||
/* Extract the size of the ioctl data and check its bounds. */
|
||||
# define CHECK_IOCTL(ARG, CMD) \
|
||||
CHECK_N ((const char *) (ARG), \
|
||||
(((CMD) >> _IOC_SIZESHIFT) & ((1 << _IOC_SIZEBITS) - 1)))
|
||||
# else
|
||||
/* We don't know the size of the ioctl data, so the best we can do
|
||||
is check that the first byte is within bounds. */
|
||||
# define CHECK_IOCTL(ARG, CMD) CHECK_1 ((const char *) ARG)
|
||||
# endif
|
||||
|
||||
/* Check bounds of `struct flock *' for the locking fcntl commands. */
|
||||
# define CHECK_FCNTL(ARG, CMD) \
|
||||
(((CMD) == F_GETLK || (CMD) == F_SETLK || (CMD) == F_SETLKW) \
|
||||
? CHECK_1 ((struct flock *) ARG) : (unsigned long) (ARG))
|
||||
|
||||
/* Check bounds of an array of mincore residency-status flags that
|
||||
cover a region of NBYTES. Such a vector occupies one byte per page
|
||||
of memory. */
|
||||
# define CHECK_N_PAGES(ARG, NBYTES) \
|
||||
({ int _page_size_ = sysconf (_SC_PAGE_SIZE); \
|
||||
CHECK_N ((const char *) (ARG), \
|
||||
((NBYTES) + _page_size_ - 1) / _page_size_); })
|
||||
|
||||
/* Return a bounded pointer with value PTR that satisfies CHECK_N (PTR, N). */
|
||||
# define BOUNDED_N(PTR, N) \
|
||||
({ __typeof (PTR) __bounded _p_; \
|
||||
__ptrvalue _p_ = __ptrlow _p_ = __ptrvalue (PTR); \
|
||||
__ptrhigh _p_ = __ptrvalue _p_ + (N); \
|
||||
_p_; })
|
||||
|
||||
#else /* !__BOUNDED_POINTERS__ */
|
||||
|
||||
/* Do nothing if not compiling with -fbounded-pointers. */
|
||||
|
||||
# define BOUNDS_VIOLATED
|
||||
# define CHECK_BOUNDS_LOW(ARG) (ARG)
|
||||
# define CHECK_BOUNDS_HIGH(ARG) (ARG)
|
||||
# define CHECK_1(ARG) (ARG)
|
||||
# define CHECK_1_NULL_OK(ARG) (ARG)
|
||||
# define CHECK_N(ARG, N) (ARG)
|
||||
# define CHECK_N_NULL_OK(ARG, N) (ARG)
|
||||
# define CHECK_STRING(ARG) (ARG)
|
||||
# define CHECK_SIGSET(SET) (SET)
|
||||
# define CHECK_SIGSET_NULL_OK(SET) (SET)
|
||||
# define CHECK_IOCTL(ARG, CMD) (ARG)
|
||||
# define CHECK_FCNTL(ARG, CMD) (ARG)
|
||||
# define CHECK_N_PAGES(ARG, NBYTES) (ARG)
|
||||
# define BOUNDED_N(PTR, N) (PTR)
|
||||
|
||||
#endif /* !__BOUNDED_POINTERS__ */
|
||||
|
||||
#define BOUNDED_1(PTR) BOUNDED_N (PTR, 1)
|
||||
|
||||
#endif /* _bp_checks_h_ */
|
|
@ -0,0 +1 @@
|
|||
/* dummy file to override one object in stdlib directory */
|
|
@ -0,0 +1 @@
|
|||
/* dummy file to override one object in stdlib directory */
|
|
@ -0,0 +1,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
void
|
||||
_cfree_r (struct _reent *ptr, void *mem)
|
||||
{
|
||||
return cfree (mem);
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
#define HAVE_WEAK_SYMBOLS 1
|
||||
#define HAVE_GNU_LD 1
|
||||
#define HAVE_ELF 1
|
||||
#define __ASSUME_REALTIME_SIGNALS 1
|
||||
#define ASM_GLOBAL_DIRECTIVE .global
|
||||
|
||||
#define TEMP_FAILURE_RETRY(expression) \
|
||||
(__extension__ \
|
||||
({ long int __result; \
|
||||
do __result = (long int) (expression); \
|
||||
while (__result == -1L && errno == EINTR); \
|
||||
__result; }))
|
||||
|
||||
#define UINT32_C(c) c ## U
|
||||
|
||||
#define __set_errno(x) (errno = (x))
|
||||
|
||||
#include <machine/sysdep.h>
|
|
@ -0,0 +1 @@
|
|||
/* dummy file to override one object in stdlib directory */
|
|
@ -0,0 +1,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
void
|
||||
_free_r (struct _reent *ptr, void *addr)
|
||||
{
|
||||
free (addr);
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef __BP_SYM_H__
|
||||
#define __BP_SYM_H__
|
||||
|
||||
#define BP_SYM(NAME) NAME
|
||||
|
||||
#endif
|
|
@ -0,0 +1,266 @@
|
|||
/* Prototypes and definition for malloc implementation.
|
||||
Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#ifndef _MALLOC_H
|
||||
#define _MALLOC_H 1
|
||||
|
||||
#include <features.h>
|
||||
|
||||
/*
|
||||
`ptmalloc', a malloc implementation for multiple threads without
|
||||
lock contention, by Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>.
|
||||
See the files `ptmalloc.c' or `COPYRIGHT' for copying conditions.
|
||||
|
||||
VERSION 2.6.4-pt Wed Dec 4 00:35:54 MET 1996
|
||||
|
||||
This work is mainly derived from malloc-2.6.4 by Doug Lea
|
||||
<dl@cs.oswego.edu>, which is available from:
|
||||
|
||||
ftp://g.oswego.edu/pub/misc/malloc.c
|
||||
|
||||
This trimmed-down header file only provides function prototypes and
|
||||
the exported data structures. For more detailed function
|
||||
descriptions and compile-time options, see the source file
|
||||
`ptmalloc.c'.
|
||||
*/
|
||||
|
||||
#if defined(__STDC__) || defined (__cplusplus)
|
||||
# include <stddef.h>
|
||||
# define __malloc_ptr_t void *
|
||||
#else
|
||||
# undef size_t
|
||||
# define size_t unsigned int
|
||||
# undef ptrdiff_t
|
||||
# define ptrdiff_t int
|
||||
# define __malloc_ptr_t char *
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Used by GNU libc internals. */
|
||||
# define __malloc_size_t size_t
|
||||
# define __malloc_ptrdiff_t ptrdiff_t
|
||||
#elif !defined __attribute_malloc__
|
||||
# define __attribute_malloc__
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
/* GCC can always grok prototypes. For C++ programs we add throw()
|
||||
to help it optimize the function calls. But this works only with
|
||||
gcc 2.8.x and egcs. */
|
||||
# if defined __cplusplus && (__GNUC__ >= 3 || __GNUC_MINOR__ >= 8)
|
||||
# define __THROW throw ()
|
||||
# else
|
||||
# define __THROW
|
||||
# endif
|
||||
# define __MALLOC_P(args) args __THROW
|
||||
/* This macro will be used for functions which might take C++ callback
|
||||
functions. */
|
||||
# define __MALLOC_PMT(args) args
|
||||
|
||||
#else /* Not GCC. */
|
||||
|
||||
# define __THROW
|
||||
|
||||
# if (defined __STDC__ && __STDC__) || defined __cplusplus
|
||||
|
||||
# define __MALLOC_P(args) args
|
||||
# define __MALLOC_PMT(args) args
|
||||
|
||||
# else /* Not ANSI C or C++. */
|
||||
|
||||
# define __MALLOC_P(args) () /* No prototypes. */
|
||||
# define __MALLOC_PMT(args) ()
|
||||
|
||||
# endif /* ANSI C or C++. */
|
||||
|
||||
#endif /* GCC. */
|
||||
|
||||
#ifndef NULL
|
||||
# ifdef __cplusplus
|
||||
# define NULL 0
|
||||
# else
|
||||
# define NULL ((__malloc_ptr_t) 0)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _reent;
|
||||
|
||||
/* Nonzero if the malloc is already initialized. */
|
||||
#ifdef _LIBC
|
||||
/* In the GNU libc we rename the global variable
|
||||
`__malloc_initialized' to `__libc_malloc_initialized'. */
|
||||
# define __malloc_initialized __libc_malloc_initialized
|
||||
#endif
|
||||
extern int __malloc_initialized;
|
||||
|
||||
/* Initialize global configuration. Not needed with GNU libc. */
|
||||
#ifndef __GLIBC__
|
||||
extern void ptmalloc_init __MALLOC_P ((void));
|
||||
#endif
|
||||
|
||||
/* Allocate SIZE bytes of memory. */
|
||||
extern __malloc_ptr_t malloc __MALLOC_P ((size_t __size)) __attribute_malloc__;
|
||||
extern __malloc_ptr_t _malloc_r __MALLOC_P ((struct _reent * __r, size_t __size)) __attribute_malloc__;
|
||||
|
||||
/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */
|
||||
extern __malloc_ptr_t calloc __MALLOC_P ((size_t __nmemb, size_t __size))
|
||||
__attribute_malloc__;
|
||||
extern __malloc_ptr_t _calloc_r __MALLOC_P ((struct _reent * __r,
|
||||
size_t __nmemb, size_t __size))
|
||||
__attribute_malloc__;
|
||||
|
||||
/* Re-allocate the previously allocated block in __ptr, making the new
|
||||
block SIZE bytes long. */
|
||||
extern __malloc_ptr_t realloc __MALLOC_P ((__malloc_ptr_t __ptr,
|
||||
size_t __size))
|
||||
__attribute_malloc__;
|
||||
extern __malloc_ptr_t _realloc_r __MALLOC_P ((struct _reent * __r,
|
||||
__malloc_ptr_t __ptr,
|
||||
size_t __size))
|
||||
__attribute_malloc__;
|
||||
|
||||
/* Free a block allocated by `malloc', `realloc' or `calloc'. */
|
||||
extern void free __MALLOC_P ((__malloc_ptr_t __ptr));
|
||||
extern void _free_r __MALLOC_P ((struct _reent * __r, __malloc_ptr_t __ptr));
|
||||
|
||||
/* Free a block allocated by `calloc'. */
|
||||
extern void cfree __MALLOC_P ((__malloc_ptr_t __ptr));
|
||||
|
||||
/* Allocate SIZE bytes allocated to ALIGNMENT bytes. */
|
||||
extern __malloc_ptr_t memalign __MALLOC_P ((size_t __alignment, size_t __size));
|
||||
extern __malloc_ptr_t _memalign_r __MALLOC_P ((struct _reent *__r,
|
||||
size_t __alignment,
|
||||
size_t __size));
|
||||
|
||||
/* Allocate SIZE bytes on a page boundary. */
|
||||
extern __malloc_ptr_t valloc __MALLOC_P ((size_t __size)) __attribute_malloc__;
|
||||
extern __malloc_ptr_t _valloc_r __MALLOC_P ((struct _reent *__r,
|
||||
size_t __size))
|
||||
__attribute_malloc__;
|
||||
|
||||
/* Equivalent to valloc(minimum-page-that-holds(n)), that is, round up
|
||||
__size to nearest pagesize. */
|
||||
extern __malloc_ptr_t pvalloc __MALLOC_P ((size_t __size))
|
||||
__attribute_malloc__;
|
||||
extern __malloc_ptr_t _pvalloc_r __MALLOC_P ((struct _reent *__r,
|
||||
size_t __size))
|
||||
__attribute_malloc__;
|
||||
|
||||
/* Underlying allocation function; successive calls should return
|
||||
contiguous pieces of memory. */
|
||||
extern __malloc_ptr_t (*__morecore) __MALLOC_PMT ((ptrdiff_t __size));
|
||||
|
||||
/* Default value of `__morecore'. */
|
||||
extern __malloc_ptr_t __default_morecore __MALLOC_P ((ptrdiff_t __size))
|
||||
__attribute_malloc__;
|
||||
|
||||
/* SVID2/XPG mallinfo structure */
|
||||
struct mallinfo {
|
||||
int arena; /* total space allocated from system */
|
||||
int ordblks; /* number of non-inuse chunks */
|
||||
int smblks; /* unused -- always zero */
|
||||
int hblks; /* number of mmapped regions */
|
||||
int hblkhd; /* total space in mmapped regions */
|
||||
int usmblks; /* unused -- always zero */
|
||||
int fsmblks; /* unused -- always zero */
|
||||
int uordblks; /* total allocated space */
|
||||
int fordblks; /* total non-inuse space */
|
||||
int keepcost; /* top-most, releasable (via malloc_trim) space */
|
||||
};
|
||||
|
||||
/* Returns a copy of the updated current mallinfo. */
|
||||
extern struct mallinfo mallinfo __MALLOC_P ((void));
|
||||
extern struct mallinfo _mallinfo_r __MALLOC_P ((struct _reent *__r));
|
||||
|
||||
/* SVID2/XPG mallopt options */
|
||||
#ifndef M_MXFAST
|
||||
# define M_MXFAST 1 /* UNUSED in this malloc */
|
||||
#endif
|
||||
#ifndef M_NLBLKS
|
||||
# define M_NLBLKS 2 /* UNUSED in this malloc */
|
||||
#endif
|
||||
#ifndef M_GRAIN
|
||||
# define M_GRAIN 3 /* UNUSED in this malloc */
|
||||
#endif
|
||||
#ifndef M_KEEP
|
||||
# define M_KEEP 4 /* UNUSED in this malloc */
|
||||
#endif
|
||||
|
||||
/* mallopt options that actually do something */
|
||||
#define M_TRIM_THRESHOLD -1
|
||||
#define M_TOP_PAD -2
|
||||
#define M_MMAP_THRESHOLD -3
|
||||
#define M_MMAP_MAX -4
|
||||
#define M_CHECK_ACTION -5
|
||||
|
||||
/* General SVID/XPG interface to tunable parameters. */
|
||||
extern int mallopt __MALLOC_P ((int __param, int __val));
|
||||
extern int _mallopt_r __MALLOC_P ((struct _reent *__r, int __param, int __val));
|
||||
|
||||
/* Release all but __pad bytes of freed top-most memory back to the
|
||||
system. Return 1 if successful, else 0. */
|
||||
extern int malloc_trim __MALLOC_P ((size_t __pad));
|
||||
|
||||
/* Report the number of usable allocated bytes associated with allocated
|
||||
chunk __ptr. */
|
||||
extern size_t malloc_usable_size __MALLOC_P ((__malloc_ptr_t __ptr));
|
||||
|
||||
/* Prints brief summary statistics on stderr. */
|
||||
extern void malloc_stats __MALLOC_P ((void));
|
||||
extern void _malloc_stats_r __MALLOC_P ((struct _reent *__r));
|
||||
|
||||
/* Record the state of all malloc variables in an opaque data structure. */
|
||||
extern __malloc_ptr_t malloc_get_state __MALLOC_P ((void));
|
||||
|
||||
/* Restore the state of all malloc variables from data obtained with
|
||||
malloc_get_state(). */
|
||||
extern int malloc_set_state __MALLOC_P ((__malloc_ptr_t __ptr));
|
||||
|
||||
#if defined __GLIBC__ || defined MALLOC_HOOKS
|
||||
/* Called once when malloc is initialized; redefining this variable in
|
||||
the application provides the preferred way to set up the hook
|
||||
pointers. */
|
||||
extern void (*__malloc_initialize_hook) __MALLOC_PMT ((void));
|
||||
/* Hooks for debugging and user-defined versions. */
|
||||
extern void (*__free_hook) __MALLOC_PMT ((__malloc_ptr_t __ptr,
|
||||
__const __malloc_ptr_t));
|
||||
extern __malloc_ptr_t (*__malloc_hook) __MALLOC_PMT ((size_t __size,
|
||||
__const __malloc_ptr_t));
|
||||
extern __malloc_ptr_t (*__realloc_hook) __MALLOC_PMT ((__malloc_ptr_t __ptr,
|
||||
size_t __size,
|
||||
__const __malloc_ptr_t));
|
||||
extern __malloc_ptr_t (*__memalign_hook) __MALLOC_PMT ((size_t __alignment,
|
||||
size_t __size,
|
||||
__const __malloc_ptr_t));
|
||||
extern void (*__after_morecore_hook) __MALLOC_PMT ((void));
|
||||
|
||||
/* Activate a standard set of debugging hooks. */
|
||||
extern void __malloc_check_init __MALLOC_P ((void));
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}; /* end of extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* malloc.h */
|
|
@ -0,0 +1,62 @@
|
|||
/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
/* Modified for newlib, July 9, 2002 by Jeff Johnston */
|
||||
|
||||
#ifndef _MCHECK_H
|
||||
#define _MCHECK_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Return values for `mprobe': these are the kinds of inconsistencies that
|
||||
`mcheck' enables detection of. */
|
||||
enum mcheck_status
|
||||
{
|
||||
MCHECK_DISABLED = -1, /* Consistency checking is not turned on. */
|
||||
MCHECK_OK, /* Block is fine. */
|
||||
MCHECK_FREE, /* Block freed twice. */
|
||||
MCHECK_HEAD, /* Memory before the block was clobbered. */
|
||||
MCHECK_TAIL /* Memory after the block was clobbered. */
|
||||
};
|
||||
|
||||
|
||||
/* Activate a standard collection of debugging hooks. This must be called
|
||||
before `malloc' is ever called. ABORTFUNC is called with an error code
|
||||
(see enum above) when an inconsistency is detected. If ABORTFUNC is
|
||||
null, the standard function prints on stderr and then calls `abort'. */
|
||||
extern int mcheck (void (*__abortfunc) (enum mcheck_status));
|
||||
|
||||
/* Similar to `mcheck´ but performs checks for all block whenever one of
|
||||
the memory handling functions is called. This can be very slow. */
|
||||
extern int mcheck_pedantic (void (*__abortfunc) (enum mcheck_status));
|
||||
|
||||
/* Force check of all blocks now. */
|
||||
extern void mcheck_check_all (void);
|
||||
|
||||
/* Check for aberrations in a particular malloc'd block. You must have
|
||||
called `mcheck' already. These are the same checks that `mcheck' does
|
||||
when you free or reallocate a block. */
|
||||
extern enum mcheck_status mprobe (void *__ptr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* mcheck.h */
|
|
@ -11,7 +11,7 @@
|
|||
#include <linux/dirent.h>
|
||||
#include <machine/syscall.h>
|
||||
|
||||
#define _LIBC
|
||||
#define _LIBC 1
|
||||
#include <sys/lock.h>
|
||||
|
||||
__LOCK_INIT(static, umask_lock);
|
||||
|
|
|
@ -0,0 +1,352 @@
|
|||
/* Support macros for making weak and strong aliases for symbols,
|
||||
and for using symbol sets and linker warnings with GNU ld.
|
||||
Copyright (C) 1995,1996,1997,1998,2000,2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#ifndef _LIBC_SYMBOLS_H
|
||||
#define _LIBC_SYMBOLS_H 1
|
||||
|
||||
/* This file's macros are included implicitly in the compilation of every
|
||||
file in the C library by -imacros.
|
||||
|
||||
We include config.h which is generated by configure.
|
||||
It should define for us the following symbols:
|
||||
|
||||
* HAVE_ASM_SET_DIRECTIVE if we have `.set B, A' instead of `A = B'.
|
||||
* ASM_GLOBAL_DIRECTIVE with `.globl' or `.global'.
|
||||
* HAVE_GNU_LD if using GNU ld, with support for weak symbols in a.out,
|
||||
and for symbol set and warning messages extensions in a.out and ELF.
|
||||
* HAVE_ELF if using ELF, which supports weak symbols using `.weak'.
|
||||
* HAVE_ASM_WEAK_DIRECTIVE if we have weak symbols using `.weak'.
|
||||
* HAVE_ASM_WEAKEXT_DIRECTIVE if we have weak symbols using `.weakext'.
|
||||
|
||||
*/
|
||||
|
||||
/* This is defined for the compilation of all C library code. features.h
|
||||
tests this to avoid inclusion of stubs.h while compiling the library,
|
||||
before stubs.h has been generated. Some library code that is shared
|
||||
with other packages also tests this symbol to see if it is being
|
||||
compiled as part of the C library. We must define this before including
|
||||
config.h, because it makes some definitions conditional on whether libc
|
||||
itself is being compiled, or just some generator program. */
|
||||
#define _LIBC 1
|
||||
|
||||
/* Enable declarations of GNU extensions, since we are compiling them. */
|
||||
#define _GNU_SOURCE 1
|
||||
/* And we also need the data for the reentrant functions. */
|
||||
#define _REENTRANT 1
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* The symbols in all the user (non-_) macros are C symbols.
|
||||
HAVE_GNU_LD without HAVE_ELF implies a.out. */
|
||||
|
||||
#if defined HAVE_ASM_WEAK_DIRECTIVE || defined HAVE_ASM_WEAKEXT_DIRECTIVE
|
||||
# define HAVE_WEAK_SYMBOLS
|
||||
#endif
|
||||
|
||||
#ifndef __SYMBOL_PREFIX
|
||||
# ifdef NO_UNDERSCORES
|
||||
# define __SYMBOL_PREFIX
|
||||
# else
|
||||
# define __SYMBOL_PREFIX "_"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef C_SYMBOL_NAME
|
||||
# ifdef NO_UNDERSCORES
|
||||
# define C_SYMBOL_NAME(name) name
|
||||
# else
|
||||
# define C_SYMBOL_NAME(name) _##name
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef ASM_LINE_SEP
|
||||
# define ASM_LINE_SEP ;
|
||||
#endif
|
||||
|
||||
#ifndef C_SYMBOL_DOT_NAME
|
||||
# define C_SYMBOL_DOT_NAME(name) .##name
|
||||
#endif
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
/* GCC understands weak symbols and aliases; use its interface where
|
||||
possible, instead of embedded assembly language. */
|
||||
|
||||
/* Define ALIASNAME as a strong alias for NAME. */
|
||||
# define strong_alias(name, aliasname) _strong_alias(name, aliasname)
|
||||
# define _strong_alias(name, aliasname) \
|
||||
extern __typeof (name) aliasname __attribute__ ((alias (#name)));
|
||||
|
||||
/* This comes between the return type and function name in
|
||||
a function definition to make that definition weak. */
|
||||
# define weak_function __attribute__ ((weak))
|
||||
# define weak_const_function __attribute__ ((weak, __const__))
|
||||
|
||||
# ifdef HAVE_WEAK_SYMBOLS
|
||||
|
||||
/* Define ALIASNAME as a weak alias for NAME.
|
||||
If weak aliases are not available, this defines a strong alias. */
|
||||
# define weak_alias(name, aliasname) _weak_alias (name, aliasname)
|
||||
# define _weak_alias(name, aliasname) \
|
||||
extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
|
||||
|
||||
/* Declare SYMBOL as weak undefined symbol (resolved to 0 if not defined). */
|
||||
# define weak_extern(symbol) _weak_extern (symbol)
|
||||
# ifdef HAVE_ASM_WEAKEXT_DIRECTIVE
|
||||
# define _weak_extern(symbol) asm (".weakext " __SYMBOL_PREFIX #symbol);
|
||||
# else
|
||||
# define _weak_extern(symbol) asm (".weak " __SYMBOL_PREFIX #symbol);
|
||||
# endif
|
||||
|
||||
# else
|
||||
|
||||
# define weak_alias(name, aliasname) strong_alias(name, aliasname)
|
||||
# define weak_extern(symbol) /* Nothing. */
|
||||
|
||||
# endif
|
||||
|
||||
#else /* __ASSEMBLER__ */
|
||||
|
||||
# ifdef HAVE_ASM_SET_DIRECTIVE
|
||||
# define strong_alias(original, alias) \
|
||||
ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \
|
||||
.set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original)
|
||||
# else
|
||||
# ifdef HAVE_ASM_GLOBAL_DOT_NAME
|
||||
# define strong_alias(original, alias) \
|
||||
ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \
|
||||
C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \
|
||||
ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \
|
||||
C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original)
|
||||
# else
|
||||
# define strong_alias(original, alias) \
|
||||
ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \
|
||||
C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifdef HAVE_WEAK_SYMBOLS
|
||||
# ifdef HAVE_ASM_WEAKEXT_DIRECTIVE
|
||||
# define weak_alias(original, alias) \
|
||||
.weakext C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original)
|
||||
# define weak_extern(symbol) \
|
||||
.weakext C_SYMBOL_NAME (symbol)
|
||||
|
||||
# else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
|
||||
|
||||
# ifdef HAVE_ASM_GLOBAL_DOT_NAME
|
||||
# define weak_alias(original, alias) \
|
||||
.weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \
|
||||
C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \
|
||||
ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \
|
||||
C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original)
|
||||
# else
|
||||
# define weak_alias(original, alias) \
|
||||
.weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \
|
||||
C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
|
||||
# endif
|
||||
|
||||
# define weak_extern(symbol) \
|
||||
.weak C_SYMBOL_NAME (symbol)
|
||||
|
||||
# endif /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
|
||||
|
||||
# else /* ! HAVE_WEAK_SYMBOLS */
|
||||
|
||||
# define weak_alias(original, alias) strong_alias(original, alias)
|
||||
# define weak_extern(symbol) /* Nothing */
|
||||
# endif /* ! HAVE_WEAK_SYMBOLS */
|
||||
|
||||
#endif /* __ASSEMBLER__ */
|
||||
|
||||
/* On some platforms we can make internal function calls (i.e., calls of
|
||||
functions not exported) a bit faster by using a different calling
|
||||
convention. */
|
||||
#ifndef internal_function
|
||||
# define internal_function /* empty */
|
||||
#endif
|
||||
|
||||
/* Prepare for the case that `__builtin_expect' is not available. */
|
||||
#ifndef HAVE_BUILTIN_EXPECT
|
||||
# define __builtin_expect(expr, val) (expr)
|
||||
#endif
|
||||
|
||||
/* Determine the return address. */
|
||||
#define RETURN_ADDRESS(nr) \
|
||||
__builtin_extract_return_addr (__builtin_return_address (nr))
|
||||
|
||||
/* When a reference to SYMBOL is encountered, the linker will emit a
|
||||
warning message MSG. */
|
||||
#ifdef HAVE_GNU_LD
|
||||
# ifdef HAVE_ELF
|
||||
|
||||
/* We want the .gnu.warning.SYMBOL section to be unallocated. */
|
||||
# ifdef HAVE_ASM_PREVIOUS_DIRECTIVE
|
||||
# define __make_section_unallocated(section_string) \
|
||||
asm (".section " section_string "\n\t.previous");
|
||||
# elif defined HAVE_ASM_POPSECTION_DIRECTIVE
|
||||
# define __make_section_unallocated(section_string) \
|
||||
asm (".pushsection " section_string "\n\t.popsection");
|
||||
# else
|
||||
# define __make_section_unallocated(section_string)
|
||||
# endif
|
||||
|
||||
/* Tacking on "\n\t#" to the section name makes gcc put it's bogus
|
||||
section attributes on what looks like a comment to the assembler. */
|
||||
# ifdef HAVE_SECTION_QUOTES
|
||||
# define link_warning(symbol, msg) \
|
||||
__make_section_unallocated (".gnu.warning." #symbol) \
|
||||
static const char __evoke_link_warning_##symbol[] \
|
||||
__attribute__ ((section (".gnu.warning." #symbol "\"\n\t#\""))) = msg;
|
||||
# else
|
||||
# define link_warning(symbol, msg) \
|
||||
__make_section_unallocated (".gnu.warning." #symbol) \
|
||||
static const char __evoke_link_warning_##symbol[] \
|
||||
__attribute__ ((section (".gnu.warning." #symbol "\n\t#"))) = msg;
|
||||
# endif
|
||||
# else /* Not ELF: a.out */
|
||||
# ifdef HAVE_XCOFF
|
||||
/* XCOFF does not support .stabs.
|
||||
The native aix linker will remove the .stab and .stabstr sections
|
||||
The gnu linker will have a fatal error if there is a relocation for
|
||||
symbol in the .stab section. Silently disable this macro. */
|
||||
# define link_warning(symbol, msg)
|
||||
# else
|
||||
# define link_warning(symbol, msg) \
|
||||
asm (".stabs \"" msg "\",30,0,0,0\n\t" \
|
||||
".stabs \"" __SYMBOL_PREFIX #symbol "\",1,0,0,0\n");
|
||||
# endif /* XCOFF */
|
||||
# endif
|
||||
#else
|
||||
/* We will never be heard; they will all die horribly. */
|
||||
# define link_warning(symbol, msg)
|
||||
#endif
|
||||
|
||||
/* A canned warning for sysdeps/stub functions. */
|
||||
#define stub_warning(name) \
|
||||
link_warning (name, \
|
||||
"warning: " #name " is not implemented and will always fail")
|
||||
|
||||
/*
|
||||
|
||||
*/
|
||||
|
||||
#ifdef HAVE_GNU_LD
|
||||
|
||||
/* Symbol set support macros. */
|
||||
|
||||
# ifdef HAVE_ELF
|
||||
|
||||
/* Make SYMBOL, which is in the text segment, an element of SET. */
|
||||
# define text_set_element(set, symbol) _elf_set_element(set, symbol)
|
||||
/* Make SYMBOL, which is in the data segment, an element of SET. */
|
||||
# define data_set_element(set, symbol) _elf_set_element(set, symbol)
|
||||
/* Make SYMBOL, which is in the bss segment, an element of SET. */
|
||||
# define bss_set_element(set, symbol) _elf_set_element(set, symbol)
|
||||
|
||||
/* These are all done the same way in ELF.
|
||||
There is a new section created for each set. */
|
||||
# ifdef SHARED
|
||||
/* When building a shared library, make the set section writable,
|
||||
because it will need to be relocated at run time anyway. */
|
||||
# define _elf_set_element(set, symbol) \
|
||||
static const void *__elf_set_##set##_element_##symbol##__ \
|
||||
__attribute__ ((unused, section (#set))) = &(symbol)
|
||||
# else
|
||||
# define _elf_set_element(set, symbol) \
|
||||
static const void *const __elf_set_##set##_element_##symbol##__ \
|
||||
__attribute__ ((unused, section (#set))) = &(symbol)
|
||||
# endif
|
||||
|
||||
/* Define SET as a symbol set. This may be required (it is in a.out) to
|
||||
be able to use the set's contents. */
|
||||
# define symbol_set_define(set) symbol_set_declare(set)
|
||||
|
||||
/* Declare SET for use in this module, if defined in another module. */
|
||||
# define symbol_set_declare(set) \
|
||||
extern void *const __start_##set __attribute__ ((__weak__)); \
|
||||
extern void *const __stop_##set __attribute__ ((__weak__)); \
|
||||
weak_extern (__start_##set) weak_extern (__stop_##set)
|
||||
|
||||
/* Return a pointer (void *const *) to the first element of SET. */
|
||||
# define symbol_set_first_element(set) (&__start_##set)
|
||||
|
||||
/* Return true iff PTR (a void *const *) has been incremented
|
||||
past the last element in SET. */
|
||||
# define symbol_set_end_p(set, ptr) ((ptr) >= &__stop_##set)
|
||||
|
||||
# else /* Not ELF: a.out. */
|
||||
|
||||
# ifdef HAVE_XCOFF
|
||||
/* XCOFF does not support .stabs.
|
||||
The native aix linker will remove the .stab and .stabstr sections
|
||||
The gnu linker will have a fatal error if there is a relocation for
|
||||
symbol in the .stab section. Silently disable these macros. */
|
||||
# define text_set_element(set, symbol)
|
||||
# define data_set_element(set, symbol)
|
||||
# define bss_set_element(set, symbol)
|
||||
# else
|
||||
# define text_set_element(set, symbol) \
|
||||
asm (".stabs \"" __SYMBOL_PREFIX #set "\",23,0,0," __SYMBOL_PREFIX #symbol)
|
||||
# define data_set_element(set, symbol) \
|
||||
asm (".stabs \"" __SYMBOL_PREFIX #set "\",25,0,0," __SYMBOL_PREFIX #symbol)
|
||||
# define bss_set_element(set, symbol) ?error Must use initialized data.
|
||||
# endif /* XCOFF */
|
||||
# define symbol_set_define(set) void *const (set)[1];
|
||||
# define symbol_set_declare(set) extern void *const (set)[1];
|
||||
|
||||
# define symbol_set_first_element(set) &(set)[1]
|
||||
# define symbol_set_end_p(set, ptr) (*(ptr) == 0)
|
||||
|
||||
# endif /* ELF. */
|
||||
#else
|
||||
/* We cannot do anything in generial. */
|
||||
# define text_set_element(set, symbol) asm ("")
|
||||
# define data_set_element(set, symbol) asm ("")
|
||||
# define bss_set_element(set, symbol) asm ("")
|
||||
# define symbol_set_define(set) void *const (set)[1];
|
||||
# define symbol_set_declare(set) extern void *const (set)[1];
|
||||
|
||||
# define symbol_set_first_element(set) &(set)[1]
|
||||
# define symbol_set_end_p(set, ptr) (*(ptr) == 0)
|
||||
#endif /* Have GNU ld. */
|
||||
|
||||
#if DO_VERSIONING
|
||||
# define symbol_version(real, name, version) \
|
||||
_symbol_version(real, name, version)
|
||||
# define default_symbol_version(real, name, version) \
|
||||
_default_symbol_version(real, name, version)
|
||||
# ifdef __ASSEMBLER__
|
||||
# define _symbol_version(real, name, version) \
|
||||
.symver real, name##@##version
|
||||
# define _default_symbol_version(real, name, version) \
|
||||
.symver real, name##@##@##version
|
||||
# else
|
||||
# define _symbol_version(real, name, version) \
|
||||
__asm__ (".symver " #real "," #name "@" #version)
|
||||
# define _default_symbol_version(real, name, version) \
|
||||
__asm__ (".symver " #real "," #name "@@" #version)
|
||||
# endif
|
||||
#else
|
||||
# define symbol_version(real, name, version)
|
||||
# define default_symbol_version(real, name, version) \
|
||||
strong_alias(real, name)
|
||||
#endif
|
||||
|
||||
#endif /* libc-symbols.h */
|
|
@ -0,0 +1,44 @@
|
|||
/* libc-internal interface for thread-specific data. LinuxThreads version.
|
||||
Copyright (C) 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _BITS_LIBC_TSD_H
|
||||
#define _BITS_LIBC_TSD_H 1
|
||||
|
||||
|
||||
/* Fast thread-specific data internal to libc. */
|
||||
enum __libc_tsd_key_t { _LIBC_TSD_KEY_MALLOC = 0,
|
||||
_LIBC_TSD_KEY_DL_ERROR,
|
||||
_LIBC_TSD_KEY_RPC_VARS,
|
||||
_LIBC_TSD_KEY_N };
|
||||
|
||||
extern void *(*__libc_internal_tsd_get) (enum __libc_tsd_key_t) __THROW;
|
||||
extern int (*__libc_internal_tsd_set) (enum __libc_tsd_key_t,
|
||||
__const void *) __THROW;
|
||||
|
||||
#define __libc_tsd_define(CLASS, KEY) CLASS void *__libc_tsd_##KEY##_data;
|
||||
#define __libc_tsd_get(KEY) \
|
||||
(__libc_internal_tsd_get != NULL \
|
||||
? __libc_internal_tsd_get (_LIBC_TSD_KEY_##KEY) \
|
||||
: __libc_tsd_##KEY##_data)
|
||||
#define __libc_tsd_set(KEY, VALUE) \
|
||||
(__libc_internal_tsd_set != NULL \
|
||||
? __libc_internal_tsd_set (_LIBC_TSD_KEY_##KEY, (VALUE)) \
|
||||
: ((__libc_tsd_##KEY##_data = (VALUE)), 0))
|
||||
|
||||
#endif /* bits/libc-tsd.h */
|
|
@ -0,0 +1,9 @@
|
|||
/* temporary internal libintl.h to ignore message translation for now */
|
||||
|
||||
#ifndef _LIBINTL_H
|
||||
#define _LIBINTL_H 1
|
||||
|
||||
#undef _
|
||||
#define _(x) (x)
|
||||
|
||||
#endif
|
|
@ -4,7 +4,7 @@ AUTOMAKE_OPTIONS = cygnus
|
|||
|
||||
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
|
||||
|
||||
LIB_SOURCES = get_clockfreq.c hp-timing.c setjmp.S sigaction.c
|
||||
LIB_SOURCES = get_clockfreq.c getpagesize.c hp-timing.c setjmp.S sigaction.c
|
||||
|
||||
liblinuxi386_la_LDFLAGS = -Xcompiler -nostdlib
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ AUTOMAKE_OPTIONS = cygnus
|
|||
|
||||
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
|
||||
|
||||
LIB_SOURCES = get_clockfreq.c hp-timing.c setjmp.S sigaction.c
|
||||
LIB_SOURCES = get_clockfreq.c getpagesize.c hp-timing.c setjmp.S sigaction.c
|
||||
|
||||
liblinuxi386_la_LDFLAGS = -Xcompiler -nostdlib
|
||||
|
||||
|
@ -123,13 +123,13 @@ CPPFLAGS = @CPPFLAGS@
|
|||
LIBS = @LIBS@
|
||||
lib_a_LIBADD =
|
||||
@USE_LIBTOOL_FALSE@lib_a_OBJECTS = get_clockfreq.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@hp-timing.$(OBJEXT) setjmp.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@sigaction.$(OBJEXT)
|
||||
@USE_LIBTOOL_FALSE@getpagesize.$(OBJEXT) hp-timing.$(OBJEXT) \
|
||||
@USE_LIBTOOL_FALSE@setjmp.$(OBJEXT) sigaction.$(OBJEXT)
|
||||
LTLIBRARIES = $(noinst_LTLIBRARIES)
|
||||
|
||||
liblinuxi386_la_LIBADD =
|
||||
@USE_LIBTOOL_TRUE@liblinuxi386_la_OBJECTS = get_clockfreq.lo \
|
||||
@USE_LIBTOOL_TRUE@hp-timing.lo setjmp.lo sigaction.lo
|
||||
@USE_LIBTOOL_TRUE@getpagesize.lo hp-timing.lo setjmp.lo sigaction.lo
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
/* default pagesize */
|
||||
int __getpagesize ()
|
||||
{
|
||||
return 4096;
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
#define NO_UNDERSCORES
|
|
@ -1,4 +1,8 @@
|
|||
#define weak_alias(name, aliasname) \
|
||||
extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
|
||||
|
||||
#define weak_extern(symbol) _weak_extern (symbol)
|
||||
#define _weak_extern(symbol) asm (".weak " #symbol);
|
||||
|
||||
#define weak_function __attribute__ ((weak))
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
/* dummy file to override one object in stdlib directory */
|
|
@ -0,0 +1,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
void *
|
||||
_memalign_r (struct _reent *ptr, size_t alignment, size_t bytes)
|
||||
{
|
||||
return memalign (alignment, bytes);
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
#include <malloc.h>
|
||||
|
||||
struct mallinfo
|
||||
_mallinfo_r (struct _reent *ptr)
|
||||
{
|
||||
return mallinfo ();
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
void *
|
||||
_malloc_r (struct _reent *ptr, size_t size)
|
||||
{
|
||||
return malloc (size);
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
_mallopt_r (struct _reent *ptr, int param_number, int value)
|
||||
{
|
||||
return mallopt (param_number, value);
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
void
|
||||
_malloc_stats_r (struct _reent *ptr)
|
||||
{
|
||||
malloc_stats ();
|
||||
}
|
|
@ -0,0 +1,356 @@
|
|||
/* Standard debugging hooks for `malloc'.
|
||||
Copyright (C) 1990-1997, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Written May 1989 by Mike Haertel.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
/* Modified for newlib, July 9, 2002 by Jeff Johnston */
|
||||
|
||||
#ifndef _MALLOC_INTERNAL
|
||||
# define _MALLOC_INTERNAL
|
||||
# include <malloc.h>
|
||||
# include <mcheck.h>
|
||||
# include <stdint.h>
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <libintl.h>
|
||||
# include <sys/cdefs.h>
|
||||
#endif
|
||||
|
||||
/* Old hook values. */
|
||||
static void (*old_free_hook) __P ((__ptr_t ptr, __const __ptr_t));
|
||||
static __ptr_t (*old_malloc_hook) __P ((__malloc_size_t size, const __ptr_t));
|
||||
static __ptr_t (*old_realloc_hook) __P ((__ptr_t ptr, __malloc_size_t size,
|
||||
__const __ptr_t));
|
||||
|
||||
/* Function to call when something awful happens. */
|
||||
static void (*abortfunc) __P ((enum mcheck_status));
|
||||
|
||||
/* Arbitrary magical numbers. */
|
||||
#define MAGICWORD 0xfedabeeb
|
||||
#define MAGICFREE 0xd8675309
|
||||
#define MAGICBYTE ((char) 0xd7)
|
||||
#define MALLOCFLOOD ((char) 0x93)
|
||||
#define FREEFLOOD ((char) 0x95)
|
||||
|
||||
struct hdr
|
||||
{
|
||||
__malloc_size_t size; /* Exact size requested by user. */
|
||||
unsigned long int magic; /* Magic number to check header integrity. */
|
||||
struct hdr *prev;
|
||||
struct hdr *next;
|
||||
};
|
||||
|
||||
/* This is the beginning of the list of all memory blocks allocated.
|
||||
It is only constructed if the pedantic testing is requested. */
|
||||
static struct hdr *root;
|
||||
|
||||
static int mcheck_used;
|
||||
|
||||
/* Nonzero if pedentic checking of all blocks is requested. */
|
||||
static int pedantic;
|
||||
|
||||
#if defined _LIBC || defined STDC_HEADERS || defined USG
|
||||
# include <string.h>
|
||||
# define flood memset
|
||||
#else
|
||||
static void flood __P ((__ptr_t, int, __malloc_size_t));
|
||||
static void
|
||||
flood (ptr, val, size)
|
||||
__ptr_t ptr;
|
||||
int val;
|
||||
__malloc_size_t size;
|
||||
{
|
||||
char *cp = ptr;
|
||||
while (size--)
|
||||
*cp++ = val;
|
||||
}
|
||||
#endif
|
||||
|
||||
static enum mcheck_status checkhdr __P ((const struct hdr *));
|
||||
static enum mcheck_status
|
||||
checkhdr (hdr)
|
||||
const struct hdr *hdr;
|
||||
{
|
||||
enum mcheck_status status;
|
||||
|
||||
if (!mcheck_used)
|
||||
/* Maybe the mcheck used is disabled? This happens when we find
|
||||
an error and report it. */
|
||||
return MCHECK_OK;
|
||||
|
||||
switch (hdr->magic ^ ((uintptr_t) hdr->prev + (uintptr_t) hdr->next))
|
||||
{
|
||||
default:
|
||||
status = MCHECK_HEAD;
|
||||
break;
|
||||
case MAGICFREE:
|
||||
status = MCHECK_FREE;
|
||||
break;
|
||||
case MAGICWORD:
|
||||
if (((char *) &hdr[1])[hdr->size] != MAGICBYTE)
|
||||
status = MCHECK_TAIL;
|
||||
else
|
||||
status = MCHECK_OK;
|
||||
break;
|
||||
}
|
||||
if (status != MCHECK_OK)
|
||||
{
|
||||
mcheck_used = 0;
|
||||
(*abortfunc) (status);
|
||||
mcheck_used = 1;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
void
|
||||
mcheck_check_all ()
|
||||
{
|
||||
/* Walk through all the active blocks and test whether they were tempered
|
||||
with. */
|
||||
struct hdr *runp = root;
|
||||
|
||||
/* Temporarily turn off the checks. */
|
||||
pedantic = 0;
|
||||
|
||||
while (runp != NULL)
|
||||
{
|
||||
(void) checkhdr (runp);
|
||||
|
||||
runp = runp->next;
|
||||
}
|
||||
|
||||
/* Turn checks on again. */
|
||||
pedantic = 1;
|
||||
}
|
||||
|
||||
static void unlink_blk __P ((struct hdr *ptr));
|
||||
static void
|
||||
unlink_blk (ptr)
|
||||
struct hdr *ptr;
|
||||
{
|
||||
if (ptr->next != NULL)
|
||||
{
|
||||
ptr->next->prev = ptr->prev;
|
||||
ptr->next->magic = MAGICWORD ^ ((uintptr_t) ptr->next->prev
|
||||
+ (uintptr_t) ptr->next->next);
|
||||
}
|
||||
if (ptr->prev != NULL)
|
||||
{
|
||||
ptr->prev->next = ptr->next;
|
||||
ptr->prev->magic = MAGICWORD ^ ((uintptr_t) ptr->prev->prev
|
||||
+ (uintptr_t) ptr->prev->next);
|
||||
}
|
||||
else
|
||||
root = ptr->next;
|
||||
}
|
||||
|
||||
static void link_blk __P ((struct hdr *ptr));
|
||||
static void
|
||||
link_blk (hdr)
|
||||
struct hdr *hdr;
|
||||
{
|
||||
hdr->prev = NULL;
|
||||
hdr->next = root;
|
||||
root = hdr;
|
||||
hdr->magic = MAGICWORD ^ (uintptr_t) hdr->next;
|
||||
|
||||
/* And the next block. */
|
||||
if (hdr->next != NULL)
|
||||
{
|
||||
hdr->next->prev = hdr;
|
||||
hdr->next->magic = MAGICWORD ^ ((uintptr_t) hdr
|
||||
+ (uintptr_t) hdr->next->next);
|
||||
}
|
||||
}
|
||||
|
||||
static void freehook __P ((__ptr_t, const __ptr_t));
|
||||
static void
|
||||
freehook (ptr, caller)
|
||||
__ptr_t ptr;
|
||||
const __ptr_t caller;
|
||||
{
|
||||
if (pedantic)
|
||||
mcheck_check_all ();
|
||||
if (ptr)
|
||||
{
|
||||
struct hdr *hdr = ((struct hdr *) ptr) - 1;
|
||||
checkhdr (hdr);
|
||||
hdr->magic = MAGICFREE;
|
||||
unlink_blk (hdr);
|
||||
hdr->prev = hdr->next = NULL;
|
||||
flood (ptr, FREEFLOOD, hdr->size);
|
||||
ptr = (__ptr_t) hdr;
|
||||
}
|
||||
__free_hook = old_free_hook;
|
||||
if (old_free_hook != NULL)
|
||||
(*old_free_hook) (ptr, caller);
|
||||
else
|
||||
free (ptr);
|
||||
__free_hook = freehook;
|
||||
}
|
||||
|
||||
static __ptr_t mallochook __P ((__malloc_size_t, const __ptr_t));
|
||||
static __ptr_t
|
||||
mallochook (size, caller)
|
||||
__malloc_size_t size;
|
||||
const __ptr_t caller;
|
||||
{
|
||||
struct hdr *hdr;
|
||||
|
||||
if (pedantic)
|
||||
mcheck_check_all ();
|
||||
|
||||
__malloc_hook = old_malloc_hook;
|
||||
if (old_malloc_hook != NULL)
|
||||
hdr = (struct hdr *) (*old_malloc_hook) (sizeof (struct hdr) + size + 1,
|
||||
caller);
|
||||
else
|
||||
hdr = (struct hdr *) malloc (sizeof (struct hdr) + size + 1);
|
||||
__malloc_hook = mallochook;
|
||||
if (hdr == NULL)
|
||||
return NULL;
|
||||
|
||||
hdr->size = size;
|
||||
link_blk (hdr);
|
||||
((char *) &hdr[1])[size] = MAGICBYTE;
|
||||
flood ((__ptr_t) (hdr + 1), MALLOCFLOOD, size);
|
||||
return (__ptr_t) (hdr + 1);
|
||||
}
|
||||
|
||||
static __ptr_t reallochook __P ((__ptr_t, __malloc_size_t, const __ptr_t));
|
||||
static __ptr_t
|
||||
reallochook (ptr, size, caller)
|
||||
__ptr_t ptr;
|
||||
__malloc_size_t size;
|
||||
const __ptr_t caller;
|
||||
{
|
||||
struct hdr *hdr;
|
||||
__malloc_size_t osize;
|
||||
|
||||
if (pedantic)
|
||||
mcheck_check_all ();
|
||||
|
||||
if (ptr)
|
||||
{
|
||||
hdr = ((struct hdr *) ptr) - 1;
|
||||
osize = hdr->size;
|
||||
|
||||
checkhdr (hdr);
|
||||
unlink_blk (hdr);
|
||||
if (size < osize)
|
||||
flood ((char *) ptr + size, FREEFLOOD, osize - size);
|
||||
}
|
||||
else
|
||||
{
|
||||
osize = 0;
|
||||
hdr = NULL;
|
||||
}
|
||||
__free_hook = old_free_hook;
|
||||
__malloc_hook = old_malloc_hook;
|
||||
__realloc_hook = old_realloc_hook;
|
||||
if (old_realloc_hook != NULL)
|
||||
hdr = (struct hdr *) (*old_realloc_hook) ((__ptr_t) hdr,
|
||||
sizeof (struct hdr) + size + 1,
|
||||
caller);
|
||||
else
|
||||
hdr = (struct hdr *) realloc ((__ptr_t) hdr,
|
||||
sizeof (struct hdr) + size + 1);
|
||||
__free_hook = freehook;
|
||||
__malloc_hook = mallochook;
|
||||
__realloc_hook = reallochook;
|
||||
if (hdr == NULL)
|
||||
return NULL;
|
||||
|
||||
hdr->size = size;
|
||||
link_blk (hdr);
|
||||
((char *) &hdr[1])[size] = MAGICBYTE;
|
||||
if (size > osize)
|
||||
flood ((char *) (hdr + 1) + osize, MALLOCFLOOD, size - osize);
|
||||
return (__ptr_t) (hdr + 1);
|
||||
}
|
||||
|
||||
static void mabort __P ((enum mcheck_status status))
|
||||
__attribute__ ((noreturn));
|
||||
static void
|
||||
mabort (status)
|
||||
enum mcheck_status status;
|
||||
{
|
||||
const char *msg;
|
||||
switch (status)
|
||||
{
|
||||
case MCHECK_OK:
|
||||
msg = _("memory is consistent, library is buggy\n");
|
||||
break;
|
||||
case MCHECK_HEAD:
|
||||
msg = _("memory clobbered before allocated block\n");
|
||||
break;
|
||||
case MCHECK_TAIL:
|
||||
msg = _("memory clobbered past end of allocated block\n");
|
||||
break;
|
||||
case MCHECK_FREE:
|
||||
msg = _("block freed twice\n");
|
||||
break;
|
||||
default:
|
||||
msg = _("bogus mcheck_status, library is buggy\n");
|
||||
break;
|
||||
}
|
||||
fprintf (stderr, "mcheck: %s", msg);
|
||||
fflush (stderr);
|
||||
abort ();
|
||||
}
|
||||
|
||||
int
|
||||
mcheck (func)
|
||||
void (*func) __P ((enum mcheck_status));
|
||||
{
|
||||
abortfunc = (func != NULL) ? func : &mabort;
|
||||
|
||||
/* These hooks may not be safely inserted if malloc is already in use. */
|
||||
if (__malloc_initialized <= 0 && !mcheck_used)
|
||||
{
|
||||
/* We call malloc() once here to ensure it is initialized. */
|
||||
void *p = malloc (0);
|
||||
free (p);
|
||||
|
||||
old_free_hook = __free_hook;
|
||||
__free_hook = freehook;
|
||||
old_malloc_hook = __malloc_hook;
|
||||
__malloc_hook = mallochook;
|
||||
old_realloc_hook = __realloc_hook;
|
||||
__realloc_hook = reallochook;
|
||||
mcheck_used = 1;
|
||||
}
|
||||
|
||||
return mcheck_used ? 0 : -1;
|
||||
}
|
||||
|
||||
int
|
||||
mcheck_pedantic (func)
|
||||
void (*func) __P ((enum mcheck_status));
|
||||
{
|
||||
int res = mcheck (func);
|
||||
if (res == 0)
|
||||
pedantic = 1;
|
||||
return res;
|
||||
}
|
||||
|
||||
enum mcheck_status
|
||||
mprobe (__ptr_t ptr)
|
||||
{
|
||||
return mcheck_used ? checkhdr (((struct hdr *) ptr) - 1) : MCHECK_DISABLED;
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
/* Functions used by mcheck/mprobe */
|
||||
extern void (*__malloc_initialize_hook) (void);
|
||||
extern void (*__free_hook) (void * __ptr, const void *);
|
||||
extern void * (*__malloc_hook) (size_t __size, const void *);
|
||||
extern void * (*__realloc_hook) (void * __ptr, size_t __size, const void *);
|
||||
extern void * (*__memalign_hook) (size_t __alignment, size_t __size,
|
||||
const void *);
|
||||
extern void (*__after_morecore_hook) (void);
|
||||
extern void __malloc_check_init (void);
|
||||
|
||||
extern int __malloc_initialized;
|
|
@ -14,3 +14,7 @@ _syscall2(int,munlock,const void *,addr,size_t,len);
|
|||
_syscall3(int,mprotect,void *,addr,size_t,len,int,prot);
|
||||
_syscall3(int,msync,void *,addr,size_t,len,int,flags);
|
||||
_syscall4(void *,mremap,void *,addr,size_t,oldlen,size_t,newlen,int,maymove);
|
||||
|
||||
weak_alias(__libc_mmap,__mmap)
|
||||
weak_alias(__libc_munmap,__munmap)
|
||||
weak_alias(__libc_mremap,__mremap)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <mqueue.h>
|
||||
#include <errno.h>
|
||||
#include <sys/sem.h>
|
||||
#define _LIBC
|
||||
#define _LIBC 1
|
||||
#include <sys/lock.h>
|
||||
#undef _LIBC
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <errno.h>
|
||||
#include <sys/sem.h>
|
||||
#include <string.h>
|
||||
#define _LIBC
|
||||
#define _LIBC 1
|
||||
#include <sys/lock.h>
|
||||
#undef _LIBC
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <time.h>
|
||||
#include <stdarg.h>
|
||||
#include <machine/weakalias.h>
|
||||
#define _LIBC
|
||||
#define _LIBC 1
|
||||
#include <sys/lock.h>
|
||||
#undef _LIBC
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include <sys/ipc.h>
|
||||
#include <sys/sem.h>
|
||||
#include <string.h>
|
||||
#define _LIBC
|
||||
#define _LIBC 1
|
||||
#include <sys/lock.h>
|
||||
#undef _LIBC
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include <sys/sem.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#define _LIBC
|
||||
#define _LIBC 1
|
||||
#include <sys/lock.h>
|
||||
#undef _LIBC
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <errno.h>
|
||||
#include <sys/sem.h>
|
||||
#include <string.h>
|
||||
#define _LIBC
|
||||
#define _LIBC 1
|
||||
#include <sys/lock.h>
|
||||
#undef _LIBC
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <machine/weakalias.h>
|
||||
#define _LIBC
|
||||
#define _LIBC 1
|
||||
#include <sys/lock.h>
|
||||
#undef _LIBC
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
/* dummy file to override one object in stdlib directory */
|
|
@ -0,0 +1,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
size_t
|
||||
_malloc_usable_size_r (struct _reent *ptr, void *mem)
|
||||
{
|
||||
return malloc_usable_size (mem);
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
/* dummy file to override one object in stdlib directory */
|
|
@ -0,0 +1 @@
|
|||
/* dummy file to override one object in stdlib directory */
|
|
@ -0,0 +1,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
void *
|
||||
_malloc_trim_r (struct _reent *ptr, size_t pad)
|
||||
{
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
void *
|
||||
_pvalloc_r (struct _reent *ptr, size_t bytes)
|
||||
{
|
||||
return pvalloc (bytes);
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
/* dummy file to override one object in stdlib directory */
|
|
@ -0,0 +1,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
void *
|
||||
_realloc_r (struct _reent *ptr, void *old, size_t newlen)
|
||||
{
|
||||
return realloc (old, newlen);
|
||||
}
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include <sys/types.h>
|
||||
#include <linux/dirent.h>
|
||||
#define _LIBC
|
||||
#define _LIBC 1
|
||||
#include <sys/lock.h>
|
||||
#undef _LIBC
|
||||
|
||||
|
|
|
@ -147,4 +147,36 @@ typedef long fd_mask;
|
|||
typedef __uint32_t uintptr_t;
|
||||
typedef __int32_t intptr_t;
|
||||
|
||||
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
|
||||
typedef struct _physadr {
|
||||
int r[1];
|
||||
} *physadr;
|
||||
|
||||
typedef struct label_t {
|
||||
int val[6];
|
||||
} label_t;
|
||||
#endif
|
||||
|
||||
typedef unsigned int vm_offset_t;
|
||||
typedef __int64_t vm_ooffset_t;
|
||||
typedef unsigned int vm_pindex_t;
|
||||
typedef unsigned int vm_size_t;
|
||||
|
||||
typedef __int32_t register_t;
|
||||
typedef __uint32_t u_register_t;
|
||||
|
||||
#ifdef _KERNEL
|
||||
typedef int intfptr_t;
|
||||
typedef unsigned int uintfptr_t;
|
||||
#endif
|
||||
|
||||
/* Critical section value */
|
||||
typedef register_t critical_t;
|
||||
|
||||
/* Interrupt mask (spl, xxx_imask, etc) */
|
||||
typedef __uint32_t intrmask_t;
|
||||
|
||||
/* Interrupt handler function type. */
|
||||
typedef void ointhand2_t(int _device_id);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,241 @@
|
|||
/* Basic platform-independent macro definitions for mutexes and
|
||||
thread-specific data.
|
||||
Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>, 1996.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
/* $Id$
|
||||
One out of _LIBC, USE_PTHREADS, USE_THR or USE_SPROC should be
|
||||
defined, otherwise the token NO_THREADS and dummy implementations
|
||||
of the macros will be defined. */
|
||||
|
||||
#ifndef _THREAD_M_H
|
||||
#define _THREAD_M_H
|
||||
|
||||
#undef thread_atfork_static
|
||||
|
||||
#if defined(_LIBC) /* The GNU C library, a special case of Posix threads */
|
||||
|
||||
#include <bits/libc-lock.h>
|
||||
|
||||
#ifdef PTHREAD_MUTEX_INITIALIZER
|
||||
|
||||
typedef pthread_t thread_id;
|
||||
|
||||
/* mutex */
|
||||
typedef pthread_mutex_t mutex_t;
|
||||
|
||||
#define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
|
||||
|
||||
/* Even if not linking with libpthread, ensure usability of mutex as
|
||||
an `in use' flag, see also the NO_THREADS case below. Assume
|
||||
pthread_mutex_t is at least one int wide. */
|
||||
|
||||
#define mutex_init(m) \
|
||||
(__pthread_mutex_init != NULL \
|
||||
? __pthread_mutex_init (m, NULL) : (*(int *)(m) = 0))
|
||||
#define mutex_lock(m) \
|
||||
(__pthread_mutex_lock != NULL \
|
||||
? __pthread_mutex_lock (m) : ((*(int *)(m) = 1), 0))
|
||||
#define mutex_trylock(m) \
|
||||
(__pthread_mutex_trylock != NULL \
|
||||
? __pthread_mutex_trylock (m) : (*(int *)(m) ? 1 : ((*(int *)(m) = 1), 0)))
|
||||
#define mutex_unlock(m) \
|
||||
(__pthread_mutex_unlock != NULL \
|
||||
? __pthread_mutex_unlock (m) : (*(int*)(m) = 0))
|
||||
|
||||
#define thread_atfork(prepare, parent, child) \
|
||||
(__pthread_atfork != NULL ? __pthread_atfork(prepare, parent, child) : 0)
|
||||
|
||||
#elif defined(MUTEX_INITIALIZER)
|
||||
/* Assume hurd, with cthreads */
|
||||
|
||||
/* Cthreads `mutex_t' is a pointer to a mutex, and malloc wants just the
|
||||
mutex itself. */
|
||||
#undef mutex_t
|
||||
#define mutex_t struct mutex
|
||||
|
||||
#undef mutex_init
|
||||
#define mutex_init(m) (__mutex_init(m), 0)
|
||||
|
||||
#undef mutex_lock
|
||||
#define mutex_lock(m) (__mutex_lock(m), 0)
|
||||
|
||||
#undef mutex_unlock
|
||||
#define mutex_unlock(m) (__mutex_unlock(m), 0)
|
||||
|
||||
#define mutex_trylock(m) (!__mutex_trylock(m))
|
||||
|
||||
#define thread_atfork(prepare, parent, child) do {} while(0)
|
||||
#define thread_atfork_static(prepare, parent, child) \
|
||||
text_set_element(_hurd_fork_prepare_hook, prepare); \
|
||||
text_set_element(_hurd_fork_parent_hook, parent); \
|
||||
text_set_element(_hurd_fork_child_hook, child);
|
||||
|
||||
/* No we're *not* using pthreads. */
|
||||
#define __pthread_initialize ((void (*)(void))0)
|
||||
|
||||
#else
|
||||
|
||||
#define NO_THREADS
|
||||
|
||||
#endif /* MUTEX_INITIALIZER && PTHREAD_MUTEX_INITIALIZER */
|
||||
|
||||
#ifndef NO_THREADS
|
||||
|
||||
/* thread specific data for glibc */
|
||||
|
||||
#include <libc-tsd.h>
|
||||
|
||||
typedef int tsd_key_t[1]; /* no key data structure, libc magic does it */
|
||||
__libc_tsd_define (, MALLOC) /* declaration/common definition */
|
||||
#define tsd_key_create(key, destr) ((void) (key))
|
||||
#define tsd_setspecific(key, data) __libc_tsd_set (MALLOC, (data))
|
||||
#define tsd_getspecific(key, vptr) ((vptr) = __libc_tsd_get (MALLOC))
|
||||
|
||||
#endif
|
||||
|
||||
#elif defined(USE_PTHREADS) /* Posix threads */
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
typedef pthread_t thread_id;
|
||||
|
||||
/* mutex */
|
||||
typedef pthread_mutex_t mutex_t;
|
||||
|
||||
#define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
|
||||
#define mutex_init(m) pthread_mutex_init(m, NULL)
|
||||
#define mutex_lock(m) pthread_mutex_lock(m)
|
||||
#define mutex_trylock(m) pthread_mutex_trylock(m)
|
||||
#define mutex_unlock(m) pthread_mutex_unlock(m)
|
||||
|
||||
/* thread specific data */
|
||||
#if defined(__sgi) || defined(USE_TSD_DATA_HACK)
|
||||
|
||||
/* Hack for thread-specific data, e.g. on Irix 6.x. We can't use
|
||||
pthread_setspecific because that function calls malloc() itself.
|
||||
The hack only works when pthread_t can be converted to an integral
|
||||
type. */
|
||||
|
||||
typedef void *tsd_key_t[256];
|
||||
#define tsd_key_create(key, destr) do { \
|
||||
int i; \
|
||||
for(i=0; i<256; i++) (*key)[i] = 0; \
|
||||
} while(0)
|
||||
#define tsd_setspecific(key, data) \
|
||||
(key[(unsigned)pthread_self() % 256] = (data))
|
||||
#define tsd_getspecific(key, vptr) \
|
||||
(vptr = key[(unsigned)pthread_self() % 256])
|
||||
|
||||
#else
|
||||
|
||||
typedef pthread_key_t tsd_key_t;
|
||||
|
||||
#define tsd_key_create(key, destr) pthread_key_create(key, destr)
|
||||
#define tsd_setspecific(key, data) pthread_setspecific(key, data)
|
||||
#define tsd_getspecific(key, vptr) (vptr = pthread_getspecific(key))
|
||||
|
||||
#endif
|
||||
|
||||
/* at fork */
|
||||
#define thread_atfork(prepare, parent, child) \
|
||||
pthread_atfork(prepare, parent, child)
|
||||
|
||||
#elif USE_THR /* Solaris threads */
|
||||
|
||||
#include <thread.h>
|
||||
|
||||
typedef thread_t thread_id;
|
||||
|
||||
#define MUTEX_INITIALIZER { 0 }
|
||||
#define mutex_init(m) mutex_init(m, USYNC_THREAD, NULL)
|
||||
|
||||
/*
|
||||
* Hack for thread-specific data on Solaris. We can't use thr_setspecific
|
||||
* because that function calls malloc() itself.
|
||||
*/
|
||||
typedef void *tsd_key_t[256];
|
||||
#define tsd_key_create(key, destr) do { \
|
||||
int i; \
|
||||
for(i=0; i<256; i++) (*key)[i] = 0; \
|
||||
} while(0)
|
||||
#define tsd_setspecific(key, data) (key[(unsigned)thr_self() % 256] = (data))
|
||||
#define tsd_getspecific(key, vptr) (vptr = key[(unsigned)thr_self() % 256])
|
||||
|
||||
#define thread_atfork(prepare, parent, child) do {} while(0)
|
||||
|
||||
#elif USE_SPROC /* SGI sproc() threads */
|
||||
|
||||
#include <sys/wait.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/prctl.h>
|
||||
#include <abi_mutex.h>
|
||||
|
||||
typedef int thread_id;
|
||||
|
||||
typedef abilock_t mutex_t;
|
||||
|
||||
#define MUTEX_INITIALIZER { 0 }
|
||||
#define mutex_init(m) init_lock(m)
|
||||
#define mutex_lock(m) (spin_lock(m), 0)
|
||||
#define mutex_trylock(m) acquire_lock(m)
|
||||
#define mutex_unlock(m) release_lock(m)
|
||||
|
||||
typedef int tsd_key_t;
|
||||
int tsd_key_next;
|
||||
#define tsd_key_create(key, destr) ((*key) = tsd_key_next++)
|
||||
#define tsd_setspecific(key, data) (((void **)(&PRDA->usr_prda))[key] = data)
|
||||
#define tsd_getspecific(key, vptr) (vptr = ((void **)(&PRDA->usr_prda))[key])
|
||||
|
||||
#define thread_atfork(prepare, parent, child) do {} while(0)
|
||||
|
||||
#else /* no _LIBC or USE_... are defined */
|
||||
|
||||
#define NO_THREADS
|
||||
|
||||
#endif /* defined(_LIBC) */
|
||||
|
||||
#ifdef NO_THREADS /* No threads, provide dummy macros */
|
||||
|
||||
typedef int thread_id;
|
||||
|
||||
/* The mutex functions used to do absolutely nothing, i.e. lock,
|
||||
trylock and unlock would always just return 0. However, even
|
||||
without any concurrently active threads, a mutex can be used
|
||||
legitimately as an `in use' flag. To make the code that is
|
||||
protected by a mutex async-signal safe, these macros would have to
|
||||
be based on atomic test-and-set operations, for example. */
|
||||
typedef int mutex_t;
|
||||
|
||||
#define MUTEX_INITIALIZER 0
|
||||
#define mutex_init(m) (*(m) = 0)
|
||||
#define mutex_lock(m) ((*(m) = 1), 0)
|
||||
#define mutex_trylock(m) (*(m) ? 1 : ((*(m) = 1), 0))
|
||||
#define mutex_unlock(m) (*(m) = 0)
|
||||
|
||||
typedef void *tsd_key_t;
|
||||
#define tsd_key_create(key, destr) do {} while(0)
|
||||
#define tsd_setspecific(key, data) ((key) = (data))
|
||||
#define tsd_getspecific(key, vptr) (vptr = (key))
|
||||
|
||||
#define thread_atfork(prepare, parent, child) do {} while(0)
|
||||
|
||||
#endif /* defined(NO_THREADS) */
|
||||
|
||||
#endif /* !defined(_THREAD_M_H) */
|
|
@ -0,0 +1,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
void *
|
||||
_valloc_r (struct _reent *ptr, size_t bytes)
|
||||
{
|
||||
return valloc (bytes);
|
||||
}
|
Loading…
Reference in New Issue