URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
Compare Revisions
- This comparison shows the changes necessary to convert path
/or1k/trunk/newlib-1.10.0/newlib/libc/reent
- from Rev 1010 to Rev 1765
- ↔ Reverse comparison
Rev 1010 → Rev 1765
/signalr.c
0,0 → 1,100
/* Reentrant versions of syscalls need to support signal/raise. |
These implementations just call the usual system calls. */ |
|
#include <reent.h> |
#include <signal.h> |
#include <unistd.h> |
#include <_syslist.h> |
|
/* Some targets provides their own versions of these functions. Those |
targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS. */ |
|
#ifdef _REENT_ONLY |
#ifndef REENTRANT_SYSCALLS_PROVIDED |
#define REENTRANT_SYSCALLS_PROVIDED |
#endif |
#endif |
|
#ifdef REENTRANT_SYSCALLS_PROVIDED |
|
int _dummy_link_syscalls = 1; |
|
#else |
|
/* We use the errno variable used by the system dependent layer. */ |
#undef errno |
extern int errno; |
|
/* |
FUNCTION |
<<_kill_r>>---Reentrant version of kill |
|
INDEX |
_kill_r |
|
ANSI_SYNOPSIS |
#include <reent.h> |
int _kill_r(struct _reent *<[ptr]>, int <[pid]>, int <[sig]>); |
|
TRAD_SYNOPSIS |
#include <reent.h> |
int _kill_r(<[ptr]>, <[pid]>, <[sig]>) |
struct _reent *<[ptr]>; |
int <[pid]>; |
int <[sig]>; |
|
DESCRIPTION |
This is a reentrant version of <<kill>>. It |
takes a pointer to the global data block, which holds |
<<errno>>. |
*/ |
|
int |
_kill_r (ptr, pid, sig) |
struct _reent *ptr; |
int pid; |
int sig; |
{ |
int ret; |
|
errno = 0; |
if ((ret = _kill (pid, sig)) == -1 && errno != 0) |
ptr->_errno = errno; |
return ret; |
} |
|
/* |
FUNCTION |
<<_getpid_r>>---Reentrant version of getpid |
|
INDEX |
_getpid_r |
|
ANSI_SYNOPSIS |
#include <reent.h> |
int _getpid_r(struct _reent *<[ptr]>); |
|
TRAD_SYNOPSIS |
#include <reent.h> |
int _getpid_r(<[ptr]>) |
struct _reent *<[ptr]>; |
|
DESCRIPTION |
This is a reentrant version of <<getpid>>. It |
takes a pointer to the global data block, which holds |
<<errno>>. |
|
We never need <<errno>>, of course, but for consistency we |
still must have the reentrant pointer argument. |
*/ |
|
int |
_getpid_r (ptr) |
struct _reent *ptr; |
{ |
int ret; |
ret = _getpid (); |
return ret; |
} |
|
#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */ |
/impure.c
0,0 → 1,13
#include <reent.h> |
|
/* Note that there is a copy of this in sys/reent.h. */ |
#ifndef __ATTRIBUTE_IMPURE_PTR__ |
#define __ATTRIBUTE_IMPURE_PTR__ |
#endif |
|
#ifndef __ATTRIBUTE_IMPURE_DATA__ |
#define __ATTRIBUTE_IMPURE_DATA__ |
#endif |
|
static struct _reent __ATTRIBUTE_IMPURE_DATA__ impure_data = _REENT_INIT (impure_data); |
struct _reent *__ATTRIBUTE_IMPURE_PTR__ _impure_ptr = &impure_data; |
/Makefile.in
0,0 → 1,405
# Makefile.in generated automatically by automake 1.4 from Makefile.am |
|
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. |
# This Makefile.in is free software; the Free Software Foundation |
# gives unlimited permission to copy and/or distribute it, |
# with or without modifications, as long as this notice is preserved. |
|
# This program is distributed in the hope that it will be useful, |
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without |
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
# PARTICULAR PURPOSE. |
|
|
|
SHELL = @SHELL@ |
|
srcdir = @srcdir@ |
top_srcdir = @top_srcdir@ |
VPATH = @srcdir@ |
prefix = @prefix@ |
exec_prefix = @exec_prefix@ |
|
bindir = @bindir@ |
sbindir = @sbindir@ |
libexecdir = @libexecdir@ |
datadir = @datadir@ |
sysconfdir = @sysconfdir@ |
sharedstatedir = @sharedstatedir@ |
localstatedir = @localstatedir@ |
libdir = @libdir@ |
infodir = @infodir@ |
mandir = @mandir@ |
includedir = @includedir@ |
oldincludedir = /usr/include |
|
DESTDIR = |
|
pkgdatadir = $(datadir)/@PACKAGE@ |
pkglibdir = $(libdir)/@PACKAGE@ |
pkgincludedir = $(includedir)/@PACKAGE@ |
|
top_builddir = .. |
|
ACLOCAL = @ACLOCAL@ |
AUTOCONF = @AUTOCONF@ |
AUTOMAKE = @AUTOMAKE@ |
AUTOHEADER = @AUTOHEADER@ |
|
INSTALL = @INSTALL@ |
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) |
INSTALL_DATA = @INSTALL_DATA@ |
INSTALL_SCRIPT = @INSTALL_SCRIPT@ |
transform = @program_transform_name@ |
|
NORMAL_INSTALL = : |
PRE_INSTALL = : |
POST_INSTALL = : |
NORMAL_UNINSTALL = : |
PRE_UNINSTALL = : |
POST_UNINSTALL = : |
host_alias = @host_alias@ |
host_triplet = @host@ |
AR = @AR@ |
AS = @AS@ |
CC = @CC@ |
CPP = @CPP@ |
CRT0 = @CRT0@ |
DLLTOOL = @DLLTOOL@ |
EXEEXT = @EXEEXT@ |
LDFLAGS = @LDFLAGS@ |
LIBC_MACHINE_LIB = @LIBC_MACHINE_LIB@ |
LIBC_POSIX_LIB = @LIBC_POSIX_LIB@ |
LIBC_SIGNAL_DEF = @LIBC_SIGNAL_DEF@ |
LIBC_SIGNAL_LIB = @LIBC_SIGNAL_LIB@ |
LIBC_SYSCALL_LIB = @LIBC_SYSCALL_LIB@ |
LIBC_SYS_LIB = @LIBC_SYS_LIB@ |
LIBC_UNIX_LIB = @LIBC_UNIX_LIB@ |
LIBTOOL = @LIBTOOL@ |
LN_S = @LN_S@ |
MAINT = @MAINT@ |
MAKEINFO = @MAKEINFO@ |
NEWLIB_CFLAGS = @NEWLIB_CFLAGS@ |
OBJDUMP = @OBJDUMP@ |
PACKAGE = @PACKAGE@ |
RANLIB = @RANLIB@ |
VERSION = @VERSION@ |
aext = @aext@ |
libm_machine_dir = @libm_machine_dir@ |
machine_dir = @machine_dir@ |
newlib_basedir = @newlib_basedir@ |
oext = @oext@ |
sys_dir = @sys_dir@ |
|
AUTOMAKE_OPTIONS = cygnus |
|
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) |
|
LIB_SOURCES = \ |
closer.c \ |
reent.c \ |
impure.c \ |
execr.c \ |
fstatr.c \ |
linkr.c \ |
lseekr.c \ |
openr.c \ |
readr.c \ |
signalr.c \ |
signgam.c \ |
sbrkr.c \ |
statr.c \ |
timer.c \ |
unlinkr.c \ |
writer.c |
|
|
libreent_la_LDFLAGS = -Xcompiler -nostdlib |
|
@USE_LIBTOOL_TRUE@noinst_LTLIBRARIES = @USE_LIBTOOL_TRUE@libreent.la |
@USE_LIBTOOL_TRUE@libreent_la_SOURCES = @USE_LIBTOOL_TRUE@$(LIB_SOURCES) |
@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 |
@USE_LIBTOOL_FALSE@lib_a_SOURCES = @USE_LIBTOOL_FALSE@$(LIB_SOURCES) |
|
CHEWOUT_FILES = \ |
closer.def \ |
reent.def \ |
execr.def \ |
fstatr.def \ |
linkr.def \ |
lseekr.def \ |
openr.def \ |
readr.def \ |
signalr.def \ |
sbrkr.def \ |
statr.def \ |
timer.def \ |
unlinkr.def \ |
writer.def |
|
|
SUFFIXES = .def .h |
|
CHEW = ../../doc/makedoc -f $(srcdir)/../../doc/doc.str |
|
TARGETDOC = ../tmp.texi |
|
CLEANFILES = $(CHEWOUT_FILES) *.ref |
mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs |
CONFIG_CLEAN_FILES = |
LIBRARIES = $(noinst_LIBRARIES) |
|
|
DEFS = @DEFS@ -I. -I$(srcdir) |
CPPFLAGS = @CPPFLAGS@ |
LIBS = @LIBS@ |
lib_a_LIBADD = |
@USE_LIBTOOL_FALSE@lib_a_OBJECTS = closer.o reent.o impure.o execr.o \ |
@USE_LIBTOOL_FALSE@fstatr.o linkr.o lseekr.o openr.o readr.o signalr.o \ |
@USE_LIBTOOL_FALSE@signgam.o sbrkr.o statr.o timer.o unlinkr.o writer.o |
LTLIBRARIES = $(noinst_LTLIBRARIES) |
|
libreent_la_LIBADD = |
@USE_LIBTOOL_TRUE@libreent_la_OBJECTS = closer.lo reent.lo impure.lo \ |
@USE_LIBTOOL_TRUE@execr.lo fstatr.lo linkr.lo lseekr.lo openr.lo \ |
@USE_LIBTOOL_TRUE@readr.lo signalr.lo signgam.lo sbrkr.lo statr.lo \ |
@USE_LIBTOOL_TRUE@timer.lo unlinkr.lo writer.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) |
CCLD = $(CC) |
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ |
DATA = $(noinst_DATA) |
|
DIST_COMMON = Makefile.am Makefile.in |
|
|
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) |
|
TAR = gtar |
GZIP_ENV = --best |
SOURCES = $(lib_a_SOURCES) $(libreent_la_SOURCES) |
OBJECTS = $(lib_a_OBJECTS) $(libreent_la_OBJECTS) |
|
all: all-redirect |
.SUFFIXES: |
.SUFFIXES: .S .c .def .h .lo .o .s |
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/../../Makefile.shared |
cd $(top_srcdir) && $(AUTOMAKE) --cygnus reent/Makefile |
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status |
cd $(top_builddir) \ |
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status |
|
|
mostlyclean-noinstLIBRARIES: |
|
clean-noinstLIBRARIES: |
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) |
|
distclean-noinstLIBRARIES: |
|
maintainer-clean-noinstLIBRARIES: |
|
.c.o: |
$(COMPILE) -c $< |
|
.s.o: |
$(COMPILE) -c $< |
|
.S.o: |
$(COMPILE) -c $< |
|
mostlyclean-compile: |
-rm -f *.o core *.core |
|
clean-compile: |
|
distclean-compile: |
-rm -f *.tab.c |
|
maintainer-clean-compile: |
|
.c.lo: |
$(LIBTOOL) --mode=compile $(COMPILE) -c $< |
|
.s.lo: |
$(LIBTOOL) --mode=compile $(COMPILE) -c $< |
|
.S.lo: |
$(LIBTOOL) --mode=compile $(COMPILE) -c $< |
|
mostlyclean-libtool: |
-rm -f *.lo |
|
clean-libtool: |
-rm -rf .libs _libs |
|
distclean-libtool: |
|
maintainer-clean-libtool: |
|
lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES) |
-rm -f lib.a |
$(AR) cru lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD) |
$(RANLIB) lib.a |
|
mostlyclean-noinstLTLIBRARIES: |
|
clean-noinstLTLIBRARIES: |
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) |
|
distclean-noinstLTLIBRARIES: |
|
maintainer-clean-noinstLTLIBRARIES: |
|
libreent.la: $(libreent_la_OBJECTS) $(libreent_la_DEPENDENCIES) |
$(LINK) $(libreent_la_LDFLAGS) $(libreent_la_OBJECTS) $(libreent_la_LIBADD) $(LIBS) |
|
tags: TAGS |
|
ID: $(HEADERS) $(SOURCES) $(LISP) |
list='$(SOURCES) $(HEADERS)'; \ |
unique=`for i in $$list; do echo $$i; done | \ |
awk ' { files[$$0] = 1; } \ |
END { for (i in files) print i; }'`; \ |
here=`pwd` && cd $(srcdir) \ |
&& mkid -f$$here/ID $$unique $(LISP) |
|
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) |
tags=; \ |
here=`pwd`; \ |
list='$(SOURCES) $(HEADERS)'; \ |
unique=`for i in $$list; do echo $$i; done | \ |
awk ' { files[$$0] = 1; } \ |
END { for (i in files) print i; }'`; \ |
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ |
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) |
|
mostlyclean-tags: |
|
clean-tags: |
|
distclean-tags: |
-rm -f TAGS ID |
|
maintainer-clean-tags: |
|
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) |
|
subdir = reent |
|
distdir: $(DISTFILES) |
@for file in $(DISTFILES); do \ |
if test -f $$file; then d=.; else d=$(srcdir); fi; \ |
if test -d $$d/$$file; then \ |
cp -pr $$d/$$file $(distdir)/$$file; \ |
else \ |
test -f $(distdir)/$$file \ |
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \ |
|| cp -p $$d/$$file $(distdir)/$$file || :; \ |
fi; \ |
done |
info-am: |
info: info-am |
dvi-am: |
dvi: dvi-am |
check-am: |
check: check-am |
installcheck-am: |
installcheck: installcheck-am |
install-info-am: |
install-info: install-info-am |
install-exec-am: |
install-exec: install-exec-am |
|
install-data-am: |
install-data: install-data-am |
|
install-am: all-am |
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am |
install: install-am |
uninstall-am: |
uninstall: uninstall-am |
all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA) |
all-redirect: all-am |
install-strip: |
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install |
installdirs: |
|
|
mostlyclean-generic: |
|
clean-generic: |
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) |
|
distclean-generic: |
-rm -f Makefile $(CONFIG_CLEAN_FILES) |
-rm -f config.cache config.log stamp-h stamp-h[0-9]* |
|
maintainer-clean-generic: |
mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ |
mostlyclean-libtool mostlyclean-noinstLTLIBRARIES \ |
mostlyclean-tags mostlyclean-generic |
|
mostlyclean: mostlyclean-am |
|
clean-am: clean-noinstLIBRARIES clean-compile clean-libtool \ |
clean-noinstLTLIBRARIES clean-tags clean-generic \ |
mostlyclean-am |
|
clean: clean-am |
|
distclean-am: distclean-noinstLIBRARIES distclean-compile \ |
distclean-libtool distclean-noinstLTLIBRARIES \ |
distclean-tags distclean-generic clean-am |
-rm -f libtool |
|
distclean: distclean-am |
|
maintainer-clean-am: maintainer-clean-noinstLIBRARIES \ |
maintainer-clean-compile maintainer-clean-libtool \ |
maintainer-clean-noinstLTLIBRARIES \ |
maintainer-clean-tags maintainer-clean-generic \ |
distclean-am |
@echo "This command is intended for maintainers to use;" |
@echo "it deletes files that may require special tools to rebuild." |
|
maintainer-clean: maintainer-clean-am |
|
.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ |
clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ |
mostlyclean-compile distclean-compile clean-compile \ |
maintainer-clean-compile mostlyclean-libtool distclean-libtool \ |
clean-libtool maintainer-clean-libtool mostlyclean-noinstLTLIBRARIES \ |
distclean-noinstLTLIBRARIES clean-noinstLTLIBRARIES \ |
maintainer-clean-noinstLTLIBRARIES tags mostlyclean-tags distclean-tags \ |
clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \ |
check-am installcheck-am installcheck install-info-am install-info \ |
install-exec-am install-exec install-data-am install-data install-am \ |
install uninstall-am uninstall all-redirect all-am all installdirs \ |
mostlyclean-generic distclean-generic clean-generic \ |
maintainer-clean-generic clean mostlyclean distclean maintainer-clean |
|
|
objectlist.awk.in: $(noinst_LTLIBRARIES) |
-rm -f objectlist.awk.in |
for i in `ls *.lo` ; \ |
do \ |
echo $$i `pwd`/$$i >> objectlist.awk.in ; \ |
done |
|
.c.def: |
$(CHEW) < $< > $*.def 2> $*.ref |
touch stmp-def |
|
doc: $(CHEWOUT_FILES) |
cat $(srcdir)/reent.tex >> $(TARGETDOC) |
|
impure.$(oext): $(srcdir)/impure.c $(srcdir)/../include/sys/reent.h |
|
# Tell versions [3.59,3.63) of GNU make to not export all variables. |
# Otherwise a system limit (for SysV at least) may be exceeded. |
.NOEXPORT: |
/fstatr.c
0,0 → 1,67
/* Reentrant versions of fstat system call. This implementation just |
calls the fstat system call. */ |
|
#include <reent.h> |
#include <unistd.h> |
#include <sys/stat.h> |
#include <_syslist.h> |
|
/* Some targets provides their own versions of these functions. Those |
targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS. */ |
|
#ifdef _REENT_ONLY |
#ifndef REENTRANT_SYSCALLS_PROVIDED |
#define REENTRANT_SYSCALLS_PROVIDED |
#endif |
#endif |
|
#ifdef REENTRANT_SYSCALLS_PROVIDED |
|
int _dummy_fstat_syscalls = 1; |
|
#else |
|
/* We use the errno variable used by the system dependent layer. */ |
#undef errno |
extern int errno; |
|
/* |
FUNCTION |
<<_fstat_r>>---Reentrant version of fstat |
|
INDEX |
_fstat_r |
|
ANSI_SYNOPSIS |
#include <reent.h> |
int _fstat_r(struct _reent *<[ptr]>, |
int <[fd]>, struct stat *<[pstat]>); |
|
TRAD_SYNOPSIS |
#include <reent.h> |
int _fstat_r(<[ptr]>, <[fd]>, <[pstat]>) |
struct _reent *<[ptr]>; |
int <[fd]>; |
struct stat *<[pstat]>; |
|
DESCRIPTION |
This is a reentrant version of <<fstat>>. It |
takes a pointer to the global data block, which holds |
<<errno>>. |
*/ |
|
int |
_fstat_r (ptr, fd, pstat) |
struct _reent *ptr; |
int fd; |
struct stat *pstat; |
{ |
int ret; |
|
errno = 0; |
if ((ret = _fstat (fd, pstat)) == -1 && errno != 0) |
ptr->_errno = errno; |
return ret; |
} |
|
#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */ |
/execr.c
0,0 → 1,145
/* Reentrant versions of execution system calls. These |
implementations just call the usual system calls. */ |
|
#include <reent.h> |
#include <unistd.h> |
#include <sys/wait.h> |
#include <_syslist.h> |
|
/* Some targets provides their own versions of these functions. Those |
targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS. */ |
|
#ifdef _REENT_ONLY |
#ifndef REENTRANT_SYSCALLS_PROVIDED |
#define REENTRANT_SYSCALLS_PROVIDED |
#endif |
#endif |
|
/* If NO_EXEC is defined, we don't need these functions. */ |
|
#if defined (REENTRANT_SYSCALLS_PROVIDED) || defined (NO_EXEC) |
|
int _dummy_exec_syscalls = 1; |
|
#else |
|
/* We use the errno variable used by the system dependent layer. */ |
#undef errno |
extern int errno; |
|
/* |
FUNCTION |
<<_execve_r>>---Reentrant version of execve |
INDEX |
_execve_r |
|
ANSI_SYNOPSIS |
#include <reent.h> |
int _execve_r(struct _reent *<[ptr]>, char *<[name]>, |
char **<[argv]>, char **<[env]>); |
|
TRAD_SYNOPSIS |
#include <reent.h> |
int _execve_r(<[ptr]>, <[name]>, <[argv]>, <[env]>) |
struct _reent *<[ptr]>; |
char *<[name]>; |
char **<[argv]>; |
char **<[env]>; |
|
DESCRIPTION |
This is a reentrant version of <<execve>>. It |
takes a pointer to the global data block, which holds |
<<errno>>. |
*/ |
|
int |
_execve_r (ptr, name, argv, env) |
struct _reent *ptr; |
char *name; |
char **argv; |
char **env; |
{ |
int ret; |
|
errno = 0; |
if ((ret = _execve (name, argv, env)) == -1 && errno != 0) |
ptr->_errno = errno; |
return ret; |
} |
|
|
/* |
FUNCTION |
<<_fork_r>>---Reentrant version of fork |
|
INDEX |
_fork_r |
|
ANSI_SYNOPSIS |
#include <reent.h> |
int _fork_r(struct _reent *<[ptr]>); |
|
TRAD_SYNOPSIS |
#include <reent.h> |
int _fork_r(<[ptr]>) |
struct _reent *<[ptr]>; |
|
DESCRIPTION |
This is a reentrant version of <<fork>>. It |
takes a pointer to the global data block, which holds |
<<errno>>. |
*/ |
|
#ifndef NO_FORK |
|
int |
_fork_r (ptr) |
struct _reent *ptr; |
{ |
int ret; |
|
errno = 0; |
if ((ret = _fork ()) == -1 && errno != 0) |
ptr->_errno = errno; |
return ret; |
} |
|
#endif |
|
/* |
FUNCTION |
<<_wait_r>>---Reentrant version of wait |
|
INDEX |
_wait_r |
|
ANSI_SYNOPSIS |
#include <reent.h> |
int _wait_r(struct _reent *<[ptr]>, int *<[status]>); |
|
TRAD_SYNOPSIS |
#include <reent.h> |
int _wait_r(<[ptr]>, <[status]>) |
struct _reent *<[ptr]>; |
int *<[status]>; |
|
DESCRIPTION |
This is a reentrant version of <<wait>>. It |
takes a pointer to the global data block, which holds |
<<errno>>. |
*/ |
|
int |
_wait_r (ptr, status) |
struct _reent *ptr; |
int *status; |
{ |
int ret; |
|
errno = 0; |
if ((ret = _wait (status)) == -1 && errno != 0) |
ptr->_errno = errno; |
return ret; |
} |
|
#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */ |
/writer.c
0,0 → 1,63
/* Reentrant versions of write system call. */ |
|
#include <reent.h> |
#include <unistd.h> |
#include <_syslist.h> |
|
/* Some targets provides their own versions of this functions. Those |
targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS. */ |
|
#ifdef _REENT_ONLY |
#ifndef REENTRANT_SYSCALLS_PROVIDED |
#define REENTRANT_SYSCALLS_PROVIDED |
#endif |
#endif |
|
#ifndef REENTRANT_SYSCALLS_PROVIDED |
|
/* We use the errno variable used by the system dependent layer. */ |
#undef errno |
extern int errno; |
|
/* |
FUNCTION |
<<_write_r>>---Reentrant version of write |
|
INDEX |
_write_r |
|
ANSI_SYNOPSIS |
#include <reent.h> |
_ssize_t _write_r(struct _reent *<[ptr]>, |
int <[fd]>, const void *<[buf]>, size_t <[cnt]>); |
|
TRAD_SYNOPSIS |
#include <reent.h> |
_ssize_t _write_r(<[ptr]>, <[fd]>, <[buf]>, <[cnt]>) |
struct _reent *<[ptr]>; |
int <[fd]>; |
char *<[buf]>; |
size_t <[cnt]>; |
|
DESCRIPTION |
This is a reentrant version of <<write>>. It |
takes a pointer to the global data block, which holds |
<<errno>>. |
*/ |
|
_ssize_t |
_write_r (ptr, fd, buf, cnt) |
struct _reent *ptr; |
int fd; |
_CONST _PTR buf; |
size_t cnt; |
{ |
_ssize_t ret; |
|
errno = 0; |
if ((ret = (_ssize_t)_write (fd, buf, cnt)) == -1 && errno != 0) |
ptr->_errno = errno; |
return ret; |
} |
|
#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */ |
/reent.c
0,0 → 1,122
/* |
FUNCTION |
<<reent>>---definition of impure data. |
|
INDEX |
reent |
|
DESCRIPTION |
This module defines the impure data area used by the |
non-reentrant functions, such as strtok. |
*/ |
|
#include <stdlib.h> |
#include <reent.h> |
|
#ifdef _REENT_ONLY |
#ifndef REENTRANT_SYSCALLS_PROVIDED |
#define REENTRANT_SYSCALLS_PROVIDED |
#endif |
#endif |
|
#ifndef REENTRANT_SYSCALLS_PROVIDED |
|
/* We use the errno variable used by the system dependent layer. */ |
#undef errno |
int errno; |
|
#endif |
|
/* Interim cleanup code */ |
|
void |
cleanup_glue (ptr, glue) |
struct _reent *ptr; |
struct _glue *glue; |
{ |
/* Have to reclaim these in reverse order: */ |
if (glue->_next) |
cleanup_glue (ptr, glue->_next); |
|
_free_r (ptr, glue); |
} |
|
void |
_reclaim_reent (ptr) |
struct _reent *ptr; |
{ |
if (ptr != _impure_ptr) |
{ |
/* used by mprec routines. */ |
if (ptr->_freelist) |
{ |
int i; |
for (i = 0; i < 15 /* _Kmax */; i++) |
{ |
struct _Bigint *thisone, *nextone; |
|
nextone = ptr->_freelist[i]; |
while (nextone) |
{ |
thisone = nextone; |
nextone = nextone->_next; |
_free_r (ptr, thisone); |
} |
} |
|
_free_r (ptr, ptr->_freelist); |
} |
|
/* atexit stuff */ |
if ((ptr->_atexit) && (ptr->_atexit != &ptr->_atexit0)) |
{ |
struct _atexit *p, *q; |
for (p = ptr->_atexit; p != &ptr->_atexit0;) |
{ |
q = p; |
p = p->_next; |
_free_r (ptr, q); |
} |
} |
|
if (ptr->_cvtbuf) |
_free_r (ptr, ptr->_cvtbuf); |
|
if (ptr->__sdidinit) |
{ |
/* cleanup won't reclaim memory 'coz usually it's run |
before the program exits, and who wants to wait for that? */ |
ptr->__cleanup (ptr); |
|
if (ptr->__sglue._next) |
cleanup_glue (ptr, ptr->__sglue._next); |
} |
|
/* Malloc memory not reclaimed; no good way to return memory anyway. */ |
|
} |
} |
|
/* |
* Do atexit() processing and cleanup |
* |
* NOTE: This is to be executed at task exit. It does not tear anything |
* down which is used on a global basis. |
*/ |
|
void |
_wrapup_reent(struct _reent *ptr) |
{ |
register struct _atexit *p; |
register int n; |
|
if (ptr == 0) |
ptr = _REENT; |
|
for (p = ptr->_atexit; p; p = p->_next) |
for (n = p->_ind; --n >= 0;) |
(*p->_fns[n]) (); |
if (ptr->__cleanup) |
(*ptr->__cleanup) (ptr); |
} |
|
/linkr.c
0,0 → 1,66
/* Reentrant versions of file system calls. These implementations |
just call the usual system calls. */ |
|
#include <reent.h> |
#include <unistd.h> |
#include <_syslist.h> |
|
/* Some targets provides their own versions of these functions. Those |
targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS. */ |
|
#ifdef _REENT_ONLY |
#ifndef REENTRANT_SYSCALLS_PROVIDED |
#define REENTRANT_SYSCALLS_PROVIDED |
#endif |
#endif |
|
#ifdef REENTRANT_SYSCALLS_PROVIDED |
|
int _dummy_link_syscalls = 1; |
|
#else |
|
/* We use the errno variable used by the system dependent layer. */ |
#undef errno |
extern int errno; |
|
/* |
FUNCTION |
<<_link_r>>---Reentrant version of link |
|
INDEX |
_link_r |
|
ANSI_SYNOPSIS |
#include <reent.h> |
int _link_r(struct _reent *<[ptr]>, |
const char *<[old]>, const char *<[new]>); |
|
TRAD_SYNOPSIS |
#include <reent.h> |
int _link_r(<[ptr]>, <[old]>, <[new]>) |
struct _reent *<[ptr]>; |
char *<[old]>; |
char *<[new]>; |
|
DESCRIPTION |
This is a reentrant version of <<link>>. It |
takes a pointer to the global data block, which holds |
<<errno>>. |
*/ |
|
int |
_link_r (ptr, old, new) |
struct _reent *ptr; |
_CONST char *old; |
_CONST char *new; |
{ |
int ret; |
|
errno = 0; |
if ((ret = _link (old, new)) == -1 && errno != 0) |
ptr->_errno = errno; |
return ret; |
} |
|
#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */ |
/timer.c
0,0 → 1,113
/* Reentrant versions of times and gettimeofday system calls for the |
clock and time ANSI C routines. |
This implementation just calls the times/gettimeofday system calls. |
Gettimeofday may not be available on all targets. It's presence |
here is dubious. Consider it for internal use only. */ |
|
#include <reent.h> |
#include <time.h> |
#include <sys/time.h> |
#include <sys/times.h> |
#include <_syslist.h> |
|
/* Some targets provides their own versions of these functions. Those |
targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS. */ |
|
#ifdef _REENT_ONLY |
#ifndef REENTRANT_SYSCALLS_PROVIDED |
#define REENTRANT_SYSCALLS_PROVIDED |
#endif |
#endif |
|
#ifdef REENTRANT_SYSCALLS_PROVIDED |
|
int _dummy_time_syscalls = 1; |
|
#else |
|
/* We use the errno variable used by the system dependent layer. */ |
#undef errno |
extern int errno; |
|
/* |
FUNCTION |
<<_times_r>>---Reentrant version of times |
|
INDEX |
_times_r |
|
ANSI_SYNOPSIS |
#include <reent.h> |
#include <sys/times.h> |
clock_t _times_r(struct _reent *<[ptr]>, struct tms *<[ptms]>); |
|
TRAD_SYNOPSIS |
#include <reent.h> |
#include <sys/times.h> |
clock_t _times_r(<[ptr]>, <[ptms]>) |
struct _reent *<[ptr]>; |
struct tms *<[ptms]>; |
|
DESCRIPTION |
This is a reentrant version of <<times>>. It |
takes a pointer to the global data block, which holds |
<<errno>>. |
*/ |
|
clock_t |
_times_r (ptr, ptms) |
struct _reent *ptr; |
struct tms *ptms; |
{ |
clock_t ret; |
|
ret = _times (ptms); |
return ret; |
} |
|
/* |
FUNCTION |
<<_gettimeofday_r>>---Reentrant version of gettimeofday |
|
INDEX |
_gettimeofday_r |
|
ANSI_SYNOPSIS |
#include <reent.h> |
#include <time.h> |
int _gettimeofday_r(struct _reent *<[ptr]>, |
struct timeval *<[ptimeval]>, |
struct timezone *<[ptimezone]>); |
|
TRAD_SYNOPSIS |
#include <reent.h> |
#include <time.h> |
int _gettimeofday_r(<[ptr]>, <[ptimeval]>, <[ptimezone]>) |
struct _reent *<[ptr]>; |
struct timeval *<[ptimeval]>; |
struct timezone *<[ptimezone]>; |
|
DESCRIPTION |
This is a reentrant version of <<gettimeofday>>. It |
takes a pointer to the global data block, which holds |
<<errno>>. |
|
This function is only available for a few targets. |
Check libc.a to see if its available on yours. |
*/ |
|
int |
_gettimeofday_r (ptr, ptimeval, ptimezone) |
struct _reent *ptr; |
struct timeval *ptimeval; |
struct timezone *ptimezone; |
{ |
int ret; |
|
errno = 0; |
if ((ret = _gettimeofday (ptimeval, ptimezone)) == -1 && errno != 0) |
ptr->_errno = errno; |
return ret; |
} |
|
#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */ |
/unlinkr.c
0,0 → 1,59
/* Reentrant versions of file system calls. These implementations |
just call the usual system calls. */ |
|
#include <reent.h> |
#include <unistd.h> |
#include <_syslist.h> |
|
/* Some targets provides their own versions of these functions. Those |
targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS. */ |
|
#ifdef _REENT_ONLY |
#ifndef REENTRANT_SYSCALLS_PROVIDED |
#define REENTRANT_SYSCALLS_PROVIDED |
#endif |
#endif |
|
#ifndef REENTRANT_SYSCALLS_PROVIDED |
|
/* We use the errno variable used by the system dependent layer. */ |
#undef errno |
extern int errno; |
|
/* |
FUNCTION |
<<_unlink_r>>---Reentrant version of unlink |
|
INDEX |
_unlink_r |
|
ANSI_SYNOPSIS |
#include <reent.h> |
int _unlink_r(struct _reent *<[ptr]>, const char *<[file]>); |
|
TRAD_SYNOPSIS |
#include <reent.h> |
int _unlink_r(<[ptr]>, <[file]>) |
struct _reent *<[ptr]>; |
char *<[file]>; |
|
DESCRIPTION |
This is a reentrant version of <<unlink>>. It |
takes a pointer to the global data block, which holds |
<<errno>>. |
*/ |
|
int |
_unlink_r (ptr, file) |
struct _reent *ptr; |
_CONST char *file; |
{ |
int ret; |
|
errno = 0; |
if ((ret = _unlink (file)) == -1 && errno != 0) |
ptr->_errno = errno; |
return ret; |
} |
|
#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */ |
/sbrkr.c
0,0 → 1,65
/* Reentrant version of sbrk system call. */ |
|
#include <reent.h> |
#include <unistd.h> |
#include <_syslist.h> |
|
/* Some targets provides their own versions of these functions. Those |
targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS. */ |
|
#ifdef _REENT_ONLY |
#ifndef REENTRANT_SYSCALLS_PROVIDED |
#define REENTRANT_SYSCALLS_PROVIDED |
#endif |
#endif |
|
/* If MALLOC_PROVIDED is defined, we don't need this function. */ |
|
#if defined (REENTRANT_SYSCALLS_PROVIDED) || defined (MALLOC_PROVIDED) |
|
int _dummy_sbrk_syscalls = 1; |
|
#else |
|
/* We use the errno variable used by the system dependent layer. */ |
#undef errno |
extern int errno; |
|
/* |
FUNCTION |
<<_sbrk_r>>---Reentrant version of sbrk |
|
INDEX |
_sbrk_r |
|
ANSI_SYNOPSIS |
#include <reent.h> |
void *_sbrk_r(struct _reent *<[ptr]>, size_t <[incr]>); |
|
TRAD_SYNOPSIS |
#include <reent.h> |
void *_sbrk_r(<[ptr]>, <[incr]>) |
struct _reent *<[ptr]>; |
size_t <[incr]>; |
|
DESCRIPTION |
This is a reentrant version of <<sbrk>>. It |
takes a pointer to the global data block, which holds |
<<errno>>. |
*/ |
|
void * |
_sbrk_r (ptr, incr) |
struct _reent *ptr; |
size_t incr; |
{ |
char *ret; |
void *_sbrk(size_t); |
|
errno = 0; |
if ((ret = (char *)(_sbrk (incr))) == (void *) -1 && errno != 0) |
ptr->_errno = errno; |
return ret; |
} |
|
#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */ |
/openr.c
0,0 → 1,65
/* Reentrant versions of open system call. */ |
|
#include <reent.h> |
#include <unistd.h> |
#include <fcntl.h> |
#include <_syslist.h> |
|
/* Some targets provides their own versions of this functions. Those |
targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS. */ |
|
#ifdef _REENT_ONLY |
#ifndef REENTRANT_SYSCALLS_PROVIDED |
#define REENTRANT_SYSCALLS_PROVIDED |
#endif |
#endif |
|
#ifndef REENTRANT_SYSCALLS_PROVIDED |
|
/* We use the errno variable used by the system dependent layer. */ |
#undef errno |
extern int errno; |
|
/* |
FUNCTION |
<<_open_r>>---Reentrant version of open |
|
INDEX |
_open_r |
|
ANSI_SYNOPSIS |
#include <reent.h> |
int _open_r(struct _reent *<[ptr]>, |
const char *<[file]>, int <[flags]>, int <[mode]>); |
|
TRAD_SYNOPSIS |
#include <reent.h> |
int _open_r(<[ptr]>, <[file]>, <[flags]>, <[mode]>) |
struct _reent *<[ptr]>; |
char *<[file]>; |
int <[flags]>; |
int <[mode]>; |
|
DESCRIPTION |
This is a reentrant version of <<open>>. It |
takes a pointer to the global data block, which holds |
<<errno>>. |
*/ |
|
int |
_open_r (ptr, file, flags, mode) |
struct _reent *ptr; |
_CONST char *file; |
int flags; |
int mode; |
{ |
int ret; |
|
errno = 0; |
if ((ret = _open (file, flags, mode)) == -1 && errno != 0) |
ptr->_errno = errno; |
return ret; |
} |
|
|
#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */ |
/signgam.c
0,0 → 1,16
/* The signgam variable is stored in the reentrancy structure. This |
function returns its address for use by the macro signgam defined in |
math.h. */ |
|
#include <math.h> |
#include <reent.h> |
|
#ifndef _REENT_ONLY |
|
int * |
__signgam () |
{ |
return &_REENT->_new._reent._gamma_signgam; |
} |
|
#endif |
/lseekr.c
0,0 → 1,63
/* Reentrant versions of lseek system call. */ |
|
#include <reent.h> |
#include <unistd.h> |
#include <_syslist.h> |
|
/* Some targets provides their own versions of this functions. Those |
targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS. */ |
|
#ifdef _REENT_ONLY |
#ifndef REENTRANT_SYSCALLS_PROVIDED |
#define REENTRANT_SYSCALLS_PROVIDED |
#endif |
#endif |
|
#ifndef REENTRANT_SYSCALLS_PROVIDED |
|
/* We use the errno variable used by the system dependent layer. */ |
#undef errno |
extern int errno; |
|
/* |
FUNCTION |
<<_lseek_r>>---Reentrant version of lseek |
|
INDEX |
_lseek_r |
|
ANSI_SYNOPSIS |
#include <reent.h> |
off_t _lseek_r(struct _reent *<[ptr]>, |
int <[fd]>, off_t <[pos]>, int <[whence]>); |
|
TRAD_SYNOPSIS |
#include <reent.h> |
off_t _lseek_r(<[ptr]>, <[fd]>, <[pos]>, <[whence]>) |
struct _reent *<[ptr]>; |
int <[fd]>; |
off_t <[pos]>; |
int <[whence]>; |
|
DESCRIPTION |
This is a reentrant version of <<lseek>>. It |
takes a pointer to the global data block, which holds |
<<errno>>. |
*/ |
|
off_t |
_lseek_r (ptr, fd, pos, whence) |
struct _reent *ptr; |
int fd; |
off_t pos; |
int whence; |
{ |
off_t ret; |
|
errno = 0; |
if ((ret = _lseek (fd, pos, whence)) == (off_t) -1 && errno != 0) |
ptr->_errno = errno; |
return ret; |
} |
|
#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */ |
/closer.c
0,0 → 1,58
/* Reentrant version of close system call. */ |
|
#include <reent.h> |
#include <unistd.h> |
#include <_syslist.h> |
|
/* Some targets provides their own versions of this functions. Those |
targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS. */ |
|
#ifdef _REENT_ONLY |
#ifndef REENTRANT_SYSCALLS_PROVIDED |
#define REENTRANT_SYSCALLS_PROVIDED |
#endif |
#endif |
|
#ifndef REENTRANT_SYSCALLS_PROVIDED |
|
/* We use the errno variable used by the system dependent layer. */ |
#undef errno |
extern int errno; |
|
/* |
FUNCTION |
<<_close_r>>---Reentrant version of close |
|
INDEX |
_close_r |
|
ANSI_SYNOPSIS |
#include <reent.h> |
int _close_r(struct _reent *<[ptr]>, int <[fd]>); |
|
TRAD_SYNOPSIS |
#include <reent.h> |
int _close_r(<[ptr]>, <[fd]>) |
struct _reent *<[ptr]>; |
int <[fd]>; |
|
DESCRIPTION |
This is a reentrant version of <<close>>. It |
takes a pointer to the global data block, which holds |
<<errno>>. |
*/ |
|
int |
_close_r (ptr, fd) |
struct _reent *ptr; |
int fd; |
{ |
int ret; |
|
errno = 0; |
if ((ret = _close (fd)) == -1 && errno != 0) |
ptr->_errno = errno; |
return ret; |
} |
|
#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */ |
/Makefile.am
0,0 → 1,70
## Process this file with automake to generate Makefile.in |
|
AUTOMAKE_OPTIONS = cygnus |
|
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) |
|
LIB_SOURCES = \ |
closer.c \ |
reent.c \ |
impure.c \ |
execr.c \ |
fstatr.c \ |
linkr.c \ |
lseekr.c \ |
openr.c \ |
readr.c \ |
signalr.c \ |
signgam.c \ |
sbrkr.c \ |
statr.c \ |
timer.c \ |
unlinkr.c \ |
writer.c |
|
libreent_la_LDFLAGS = -Xcompiler -nostdlib |
|
if USE_LIBTOOL |
noinst_LTLIBRARIES = libreent.la |
libreent_la_SOURCES = $(LIB_SOURCES) |
noinst_DATA = objectlist.awk.in |
else |
noinst_LIBRARIES = lib.a |
lib_a_SOURCES = $(LIB_SOURCES) |
noinst_DATA = |
endif # USE_LIBTOOL |
|
include $(srcdir)/../../Makefile.shared |
|
CHEWOUT_FILES = \ |
closer.def \ |
reent.def \ |
execr.def \ |
fstatr.def \ |
linkr.def \ |
lseekr.def \ |
openr.def \ |
readr.def \ |
signalr.def \ |
sbrkr.def \ |
statr.def \ |
timer.def \ |
unlinkr.def \ |
writer.def |
|
SUFFIXES = .def .h |
|
CHEW = ../../doc/makedoc -f $(srcdir)/../../doc/doc.str |
|
.c.def: |
$(CHEW) < $< > $*.def 2> $*.ref |
touch stmp-def |
|
TARGETDOC = ../tmp.texi |
|
doc: $(CHEWOUT_FILES) |
cat $(srcdir)/reent.tex >> $(TARGETDOC) |
|
impure.$(oext): $(srcdir)/impure.c $(srcdir)/../include/sys/reent.h |
|
CLEANFILES = $(CHEWOUT_FILES) *.ref |
/reent.tex
0,0 → 1,108
@node Reentrancy |
@chapter Reentrancy |
|
@cindex reentrancy |
Reentrancy is a characteristic of library functions which allows multiple |
processes to use the same address space with assurance that the values stored |
in those spaces will remain constant between calls. Cygnus's implementation |
of the library functions ensures that |
whenever possible, these library functions are reentrant. However, |
there are some functions that can not be trivially made reentrant. |
Hooks have been provided to allow you to use these functions in a fully |
reentrant fashion. |
|
@findex _reent |
@findex reent.h |
@cindex reentrancy structure |
These hooks use the structure @code{_reent} defined in @file{reent.h}. |
A variable defined as @samp{struct _reent} is called a @dfn{reentrancy |
structure}. All functions which must manipulate global information are |
available in two versions. The first version has the usual name, and |
uses a single global instance of the reentrancy structure. The second |
has a different name, normally formed by prepending @samp{_} and |
appending @samp{_r}, and takes a pointer to the particular reentrancy |
structure to use. |
|
For example, the function @code{fopen} takes two arguments, @var{file} |
and @var{mode}, and uses the global reentrancy structure. The function |
@code{_fopen_r} takes the arguments, @var{struct_reent}, which is a |
pointer to an instance of the reentrancy structure, @var{file} |
and @var{mode}. |
|
@cindex global reentrancy structure |
@findex _impure_ptr |
Each function which uses the global reentrancy structure uses the global |
variable @code{_impure_ptr}, which points to a reentrancy structure. |
|
This means that you have two ways to achieve reentrancy. Both require |
that each thread of execution control initialize a unique global |
variable of type @samp{struct _reent}: |
|
@enumerate |
@item |
@cindex extra argument, reentrant fns |
Use the reentrant versions of the library functions, after initializing |
a global reentrancy structure for each process. Use the pointer to this |
structure as the extra argument for all library functions. |
|
@item |
Ensure that each thread of execution control has a pointer to its own |
unique reentrancy structure in the global variable @code{_impure_ptr}, |
and call the standard library subroutines. |
@end enumerate |
|
@cindex list of reentrant functions |
@cindex reentrant function list |
The following functions are provided in both reentrant |
and non-reentrant versions. |
|
@example |
@exdent @emph{Equivalent for errno variable:} |
_errno_r |
|
@exdent @emph{Locale functions:} |
_localeconv_r _setlocale_r |
|
@exdent @emph{Equivalents for stdio variables:} |
_stdin_r _stdout_r _stderr_r |
|
@page |
@exdent @emph{Stdio functions:} |
_fdopen_r _perror_r _tempnam_r |
_fopen_r _putchar_r _tmpnam_r |
_getchar_r _puts_r _tmpfile_r |
_gets_r _remove_r _vfprintf_r |
_iprintf_r _rename_r _vsnprintf_r |
_mkstemp_r _snprintf_r _vsprintf_r |
_mktemp_t _sprintf_r |
|
@exdent @emph{Signal functions:} |
_init_signal_r _signal_r |
_kill_r __sigtramp_r |
_raise_r |
|
@exdent @emph{Stdlib functions:} |
_calloc_r _mblen_r _setenv_r |
_dtoa_r _mbstowcs_r _srand_r |
_free_r _mbtowc_r _strtod_r |
_getenv_r _memalign_r _strtol_r |
_mallinfo_r _mstats_r _strtoul_r |
_malloc_r _putenv_r _system_r |
_malloc_r _rand_r _wcstombs_r |
_malloc_stats_r _realloc_r _wctomb_r |
|
@exdent @emph{String functions:} |
_strdup_r _strtok_r |
|
@exdent @emph{System functions:} |
_close_r _link_r _unlink_r |
_execve_r _lseek_r _wait_r |
_fcntl_r _open_r _write_r |
_fork_r _read_r |
_fstat_r _sbrk_r |
_gettimeofday_r _stat_r |
_getpid_r _times_r |
|
@exdent @emph{Time function:} |
_asctime_r |
@end example |
/statr.c
0,0 → 1,68
/* Reentrant versions of stat system call. This implementation just |
calls the stat system call. */ |
|
#include <reent.h> |
#include <unistd.h> |
#include <sys/stat.h> |
#include <_syslist.h> |
|
/* Some targets provides their own versions of these functions. Those |
targets should define REENTRANT_SYSCALLS_PROVIDED in |
TARGET_CFLAGS. */ |
|
#ifdef _REENT_ONLY |
#ifndef REENTRANT_SYSCALLS_PROVIDED |
#define REENTRANT_SYSCALLS_PROVIDED |
#endif |
#endif |
|
#ifdef REENTRANT_SYSCALLS_PROVIDED |
|
int _dummy_stat_syscalls = 1; |
|
#else |
|
/* We use the errno variable used by the system dependent layer. */ |
#undef errno |
extern int errno; |
|
/* |
FUNCTION |
<<_stat_r>>---Reentrant version of stat |
|
INDEX |
_stat_r |
|
ANSI_SYNOPSIS |
#include <reent.h> |
int _stat_r(struct _reent *<[ptr]>, |
const char *<[file]>, struct stat *<[pstat]>); |
|
TRAD_SYNOPSIS |
#include <reent.h> |
int _stat_r(<[ptr]>, <[file]>, <[pstat]>) |
struct _reent *<[ptr]>; |
char *<[file]>; |
struct stat *<[pstat]>; |
|
DESCRIPTION |
This is a reentrant version of <<stat>>. It |
takes a pointer to the global data block, which holds |
<<errno>>. |
*/ |
|
int |
_stat_r (ptr, file, pstat) |
struct _reent *ptr; |
_CONST char *file; |
struct stat *pstat; |
{ |
int ret; |
|
errno = 0; |
if ((ret = _stat (file, pstat)) == -1 && errno != 0) |
ptr->_errno = errno; |
return ret; |
} |
|
#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */ |
/readr.c
0,0 → 1,63
/* Reentrant versions of read system call. */ |
|
#include <reent.h> |
#include <unistd.h> |
#include <_syslist.h> |
|
/* Some targets provides their own versions of this functions. Those |
targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS. */ |
|
#ifdef _REENT_ONLY |
#ifndef REENTRANT_SYSCALLS_PROVIDED |
#define REENTRANT_SYSCALLS_PROVIDED |
#endif |
#endif |
|
#ifndef REENTRANT_SYSCALLS_PROVIDED |
|
/* We use the errno variable used by the system dependent layer. */ |
#undef errno |
extern int errno; |
|
/* |
FUNCTION |
<<_read_r>>---Reentrant version of read |
|
INDEX |
_read_r |
|
ANSI_SYNOPSIS |
#include <reent.h> |
long _read_r(struct _reent *<[ptr]>, |
int <[fd]>, void *<[buf]>, size_t <[cnt]>); |
|
TRAD_SYNOPSIS |
#include <reent.h> |
long _read_r(<[ptr]>, <[fd]>, <[buf]>, <[cnt]>) |
struct _reent *<[ptr]>; |
int <[fd]>; |
char *<[buf]>; |
size_t <[cnt]>; |
|
DESCRIPTION |
This is a reentrant version of <<read>>. It |
takes a pointer to the global data block, which holds |
<<errno>>. |
*/ |
|
long |
_read_r (ptr, fd, buf, cnt) |
struct _reent *ptr; |
int fd; |
_PTR buf; |
size_t cnt; |
{ |
long ret; |
|
errno = 0; |
if ((ret = _read (fd, buf, cnt)) == -1 && errno != 0) |
ptr->_errno = errno; |
return ret; |
} |
|
#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */ |