mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-21 12:30:06 +00:00
Tue May 7 19:00:01 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* string/argz-extract.c: Remove const from decl. * string/argz.h: Here too. * Makeconfig (version.mk): Fix regexp in sed cmd. Depend on $(..)Makeconfig. * GMP code updated from gmp-2.0 release. * stdlib/Makefile (mpn-routines): Removed add_1, added inlines. * sysdeps/generic/add_1.c: File removed. * stdlib/strtod.c: mp_limb is now mp_limb_t. * stdlib/fpioconst.c, stdlib/fpioconst.h: Likewise. * stdio-common/_itoa.c: Likewise. * stdio-common/printf_fp.c: Likewise. Don't include ansidecl.h. * sysdeps/mach/hurd/getcwd.c: Use io_identity instead of io_stat. * shlib-versions: New file. * Makerules (soversions.mk): New target, include file generated from shlib-versions. Moved shared library rules before installation rules. Rewrote shared library installation rules for versioned libraries. * math/Makefile (libm.so-version): Variable removed. * sysdeps/mach/hurd/i386/exc2signal.c: Use struct hurd_signal_detail. * hurd/report-wait.c (_S_msg_describe_ports): New function. * configure.in: Add AC_PROG_LN_S check. * config.make.in (LN_S): New variable. Sun May 5 03:10:44 1996 Ulrich Drepper <drepper@cygnus.com> * misc/efgcvt_r.c (ecvt_r): Work aroung gcc bug. gcc does not know about weak aliases now and optimizes necessary `if' statement away. * posix/unistd.h: Add swapoff prototype. * sysdeps/generic/confname.h: Add even more POSIX.4 symbols. * sysdeps/posix/fpathconf.c (__fpathconf): Get information for _PC_PATH_MAX from fstatfs function if available. * sysdeps/posix/sysconf.c: Add code to handle _SC_AIO_LISTIO_MAX, _SC_AIO_MAX, _SC_AIO_PRIO_DELTA_MAX, _SC_DELAYTIMER_MAX, _SC_MQ_OPEN_MAX, _SC_MQ_PRIO_MAX, _SC_RTSIG_MAX, _SC_SEM_NSEMS_MAX, _SC_SEM_VALUE_MAX, _SC_SIGQUEUE_MAX, and _SC_TIMER_MAX. * sysdeps/unix/sysv/sysv4/sysconf.c: Ditto. * sysdeps/stub/swapoff.c: New file. Stub version for swapoff function. * sysdeps/unix/syscalls.list: Add swapoff. * sysdeps/unix/sysv/linux/Dist: Add sys/acct.h. * sysdeps/unix/sysv/linux/Makefile [$(subdir) == misc] (sysdep_routines): Add mount, umount, llseek, setfsgid, setfsuid, sysinfo, and uselib. (headers): Add sys/sysinfo.h. * sysdeps/unix/sysv/linux/gethostid.c: Prevent warning. * sysdeps/unix/sysv/linux/i386/Makefile [$(subdir) == misc] (sysdep_routines): Add ioperm, iopl, and vm86. (headers): Add sys/perm.h and sys/vm86.h. * sysdeps/unix/sysv/linux/i386/sys/perm.h: New file. Contains prototypes for iopl and ioperm. * sysdeps/unix/sysv/linux/i386/sys/vm86.h: New file. Contains prototype for vm86. * sysdeps/unix/sysv/linux/i386/syscalls.list: New file. Add vm86 system call. * sysdeps/unix/sysv/linux/sys/acct.h: New file. Contains prototypes for acct function. * sysdeps/unix/sysv/linux/sys/socket.h: Provide real header file with prototypes. * sysdeps/unix/sysv/linux/sys/sysinfo.h: New file. Contains prototype for sysinfo function. * sysdeps/unix/sysv/linux/syscalls.list: Add flock, ioperm, iopl, llseek, setfsgid, setfsuid, sysinfo, and uselib. * sysdeps/unix/sysv/linux/sysconf.c: Instead of duplicating posix/sysconf.c now only handle cases different to that implementation. Tue May 7 15:08:19 1996 Miles Bader <miles@gnu.ai.mit.edu> * stdio/linewrap.c (__line_wrap_output): Renamed from lwoutput (all references changed). Now exported. * stdio/linewrap.c (struct data): Type deleted (moved to linewrap.h). (wrap_stream, unwrap_stream, lwclose, lwfileno, lwoutput, line_wrap_stream, line_unwrap_stream): Use struct line_wrap_data instead of struct data. (lwoutput, line_wrap_stream, line_unwrap_stream): Rename various occurences of `wrap' and `wrapmargin' to `wmargin'. (line_wrapped, line_wrap_lmargin, line_wrap_set_lmargin, line_wrap_rmargin, line_wrap_set_rmargin, line_wrap_wmargin, line_wrap_set_wmargin, line_wrap_point): New functions. * stdio/linewrap.h: New file. * stdio/Makefile (headers): Add linewrap.h. Tue May 7 14:19:12 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * sysdeps/unix/sysv/linux/i386/Makefile: File removed. * stdio/stdio.h: Remove line_wrap_stream, line_unwap_stream decls. * sysdeps/unix/sysv/linux/schedbits.h: New file. Tue May 7 13:47:02 1996 Miles Bader <miles@gnu.ai.mit.edu> * stdio/linewrap.c (struct data): Make margin fields not-pointers. (lwoutput): Adjust uses acordingly. * sysdeps/mach/hurd/fdatasync.c: New file. * sysdeps/mach/hurd/fsync.c: Pass new flag to file_sync. * sysdeps/mach/hurd/xmknod.c: Pass new flag to dir_link. * sysdeps/mach/hurd/symlink.c: Likewise. * sysdeps/mach/hurd/link.c: Likewise. * sysdeps/mach/hurd/bind.c: Likewise. * hurd/hurdsig.c (write_corefile): Likewise. * hurd/hurdsig.c (write_corefile): Pass cttyid port to crash server. * sysdeps/mach/hurd/fpathconf.c: RPC takes int pointer, not long int. * sysdeps/mach/hurd/_exit.c (_hurd_exit): Pass sigcode arg to proc_mark_exit. * sysdeps/mach/hurd/dl-sysdep.c (_exit): Likewise. * sysdeps/mach/hurd/wait4.c: Pass sigcode arg to proc_wait. * sysdeps/mach/hurd/rename.c: Pass new flag to dir_rename. * hurd/hurdfault.c (_hurdsig_fault_catch_exception_raise): Use struct hurd_signal_detail. * hurd/catch-exc.c (_S_catch_exception_raise): Likewise. * hurd/hurd-raise.c (_hurd_raise_signal): Likewise. * sysdeps/mach/hurd/i386/trampoline.c (_hurd_setup_sighandler): Likewise. * sysdeps/mach/hurd/setitimer.c (restart_itimer): Likewise. * hurd/hurd/signal.h: Fix _hurd_exception2signal prototype. * hurd/hurdsig.c (write_corefile): Take const struct hurd_signal_detail * arg. Pass all details to crash_dump_task. (_hurd_internal_post_signal): Pass DETAIL to write_corefile. (_hurd_internal_post_signal: suspend): Pass code and error to proc_mark_stop. * hurd/hurdprio.c (_hurd_priority_which_map): Pass flags arg to proc_getprocinfo by reference.
This commit is contained in:
parent
b928942eaa
commit
0e3426bbcf
165
ChangeLog
165
ChangeLog
@ -1,5 +1,170 @@
|
||||
Tue May 7 19:00:01 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
|
||||
|
||||
* string/argz-extract.c: Remove const from decl.
|
||||
* string/argz.h: Here too.
|
||||
|
||||
* Makeconfig (version.mk): Fix regexp in sed cmd.
|
||||
Depend on $(..)Makeconfig.
|
||||
|
||||
* GMP code updated from gmp-2.0 release.
|
||||
* stdlib/Makefile (mpn-routines): Removed add_1, added inlines.
|
||||
* sysdeps/generic/add_1.c: File removed.
|
||||
* stdlib/strtod.c: mp_limb is now mp_limb_t.
|
||||
* stdlib/fpioconst.c, stdlib/fpioconst.h: Likewise.
|
||||
* stdio-common/_itoa.c: Likewise.
|
||||
* stdio-common/printf_fp.c: Likewise.
|
||||
Don't include ansidecl.h.
|
||||
|
||||
* sysdeps/mach/hurd/getcwd.c: Use io_identity instead of io_stat.
|
||||
|
||||
* shlib-versions: New file.
|
||||
* Makerules (soversions.mk): New target, include file generated from
|
||||
shlib-versions. Moved shared library rules before installation rules.
|
||||
Rewrote shared library installation rules for versioned libraries.
|
||||
* math/Makefile (libm.so-version): Variable removed.
|
||||
|
||||
* sysdeps/mach/hurd/i386/exc2signal.c: Use struct hurd_signal_detail.
|
||||
|
||||
* hurd/report-wait.c (_S_msg_describe_ports): New function.
|
||||
|
||||
* configure.in: Add AC_PROG_LN_S check.
|
||||
* config.make.in (LN_S): New variable.
|
||||
|
||||
Sun May 5 03:10:44 1996 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* misc/efgcvt_r.c (ecvt_r): Work aroung gcc bug. gcc does
|
||||
not know about weak aliases now and optimizes necessary `if'
|
||||
statement away.
|
||||
|
||||
* posix/unistd.h: Add swapoff prototype.
|
||||
|
||||
* sysdeps/generic/confname.h: Add even more POSIX.4 symbols.
|
||||
|
||||
* sysdeps/posix/fpathconf.c (__fpathconf): Get information
|
||||
for _PC_PATH_MAX from fstatfs function if available.
|
||||
|
||||
* sysdeps/posix/sysconf.c: Add code to handle _SC_AIO_LISTIO_MAX,
|
||||
_SC_AIO_MAX, _SC_AIO_PRIO_DELTA_MAX, _SC_DELAYTIMER_MAX,
|
||||
_SC_MQ_OPEN_MAX, _SC_MQ_PRIO_MAX, _SC_RTSIG_MAX,
|
||||
_SC_SEM_NSEMS_MAX, _SC_SEM_VALUE_MAX, _SC_SIGQUEUE_MAX, and
|
||||
_SC_TIMER_MAX.
|
||||
* sysdeps/unix/sysv/sysv4/sysconf.c: Ditto.
|
||||
|
||||
* sysdeps/stub/swapoff.c: New file. Stub version for swapoff
|
||||
function.
|
||||
|
||||
* sysdeps/unix/syscalls.list: Add swapoff.
|
||||
|
||||
* sysdeps/unix/sysv/linux/Dist: Add sys/acct.h.
|
||||
|
||||
* sysdeps/unix/sysv/linux/Makefile [$(subdir) == misc]
|
||||
(sysdep_routines): Add mount, umount, llseek, setfsgid, setfsuid,
|
||||
sysinfo, and uselib.
|
||||
(headers): Add sys/sysinfo.h.
|
||||
|
||||
* sysdeps/unix/sysv/linux/gethostid.c: Prevent warning.
|
||||
|
||||
* sysdeps/unix/sysv/linux/i386/Makefile [$(subdir) == misc]
|
||||
(sysdep_routines): Add ioperm, iopl, and vm86.
|
||||
(headers): Add sys/perm.h and sys/vm86.h.
|
||||
|
||||
* sysdeps/unix/sysv/linux/i386/sys/perm.h: New file. Contains
|
||||
prototypes for iopl and ioperm.
|
||||
|
||||
* sysdeps/unix/sysv/linux/i386/sys/vm86.h: New file. Contains
|
||||
prototype for vm86.
|
||||
|
||||
* sysdeps/unix/sysv/linux/i386/syscalls.list: New file. Add
|
||||
vm86 system call.
|
||||
|
||||
* sysdeps/unix/sysv/linux/sys/acct.h: New file. Contains
|
||||
prototypes for acct function.
|
||||
|
||||
* sysdeps/unix/sysv/linux/sys/socket.h: Provide real header
|
||||
file with prototypes.
|
||||
|
||||
* sysdeps/unix/sysv/linux/sys/sysinfo.h: New file. Contains
|
||||
prototype for sysinfo function.
|
||||
|
||||
* sysdeps/unix/sysv/linux/syscalls.list: Add flock, ioperm, iopl,
|
||||
llseek, setfsgid, setfsuid, sysinfo, and uselib.
|
||||
|
||||
* sysdeps/unix/sysv/linux/sysconf.c: Instead of duplicating
|
||||
posix/sysconf.c now only handle cases different to that
|
||||
implementation.
|
||||
|
||||
Tue May 7 15:08:19 1996 Miles Bader <miles@gnu.ai.mit.edu>
|
||||
|
||||
* stdio/linewrap.c (__line_wrap_output): Renamed from lwoutput
|
||||
(all references changed). Now exported.
|
||||
|
||||
* stdio/linewrap.c (struct data): Type deleted (moved to linewrap.h).
|
||||
(wrap_stream, unwrap_stream, lwclose, lwfileno, lwoutput,
|
||||
line_wrap_stream, line_unwrap_stream): Use struct line_wrap_data
|
||||
instead of struct data.
|
||||
(lwoutput, line_wrap_stream, line_unwrap_stream): Rename various
|
||||
occurences of `wrap' and `wrapmargin' to `wmargin'.
|
||||
(line_wrapped, line_wrap_lmargin, line_wrap_set_lmargin,
|
||||
line_wrap_rmargin, line_wrap_set_rmargin, line_wrap_wmargin,
|
||||
line_wrap_set_wmargin, line_wrap_point): New functions.
|
||||
* stdio/linewrap.h: New file.
|
||||
* stdio/Makefile (headers): Add linewrap.h.
|
||||
|
||||
Tue May 7 14:19:12 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
|
||||
|
||||
* sysdeps/unix/sysv/linux/i386/Makefile: File removed.
|
||||
|
||||
* stdio/stdio.h: Remove line_wrap_stream, line_unwap_stream decls.
|
||||
|
||||
* sysdeps/unix/sysv/linux/schedbits.h: New file.
|
||||
|
||||
Tue May 7 13:47:02 1996 Miles Bader <miles@gnu.ai.mit.edu>
|
||||
|
||||
* stdio/linewrap.c (struct data): Make margin fields not-pointers.
|
||||
(lwoutput): Adjust uses acordingly.
|
||||
|
||||
Tue May 7 10:51:52 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
|
||||
|
||||
* sysdeps/mach/hurd/fdatasync.c: New file.
|
||||
* sysdeps/mach/hurd/fsync.c: Pass new flag to file_sync.
|
||||
|
||||
* sysdeps/mach/hurd/xmknod.c: Pass new flag to dir_link.
|
||||
* sysdeps/mach/hurd/symlink.c: Likewise.
|
||||
* sysdeps/mach/hurd/link.c: Likewise.
|
||||
* sysdeps/mach/hurd/bind.c: Likewise.
|
||||
* hurd/hurdsig.c (write_corefile): Likewise.
|
||||
|
||||
* hurd/hurdsig.c (write_corefile): Pass cttyid port to crash server.
|
||||
|
||||
* sysdeps/mach/hurd/fpathconf.c: RPC takes int pointer, not long int.
|
||||
|
||||
* sysdeps/mach/hurd/_exit.c (_hurd_exit): Pass sigcode arg to
|
||||
proc_mark_exit.
|
||||
* sysdeps/mach/hurd/dl-sysdep.c (_exit): Likewise.
|
||||
|
||||
* sysdeps/mach/hurd/wait4.c: Pass sigcode arg to proc_wait.
|
||||
|
||||
* sysdeps/mach/hurd/rename.c: Pass new flag to dir_rename.
|
||||
|
||||
* hurd/hurdfault.c (_hurdsig_fault_catch_exception_raise): Use struct
|
||||
hurd_signal_detail.
|
||||
* hurd/catch-exc.c (_S_catch_exception_raise): Likewise.
|
||||
* hurd/hurd-raise.c (_hurd_raise_signal): Likewise.
|
||||
* sysdeps/mach/hurd/i386/trampoline.c (_hurd_setup_sighandler):
|
||||
Likewise.
|
||||
* sysdeps/mach/hurd/setitimer.c (restart_itimer): Likewise.
|
||||
|
||||
* hurd/hurd/signal.h: Fix _hurd_exception2signal prototype.
|
||||
|
||||
* hurd/hurdsig.c (write_corefile): Take const struct
|
||||
hurd_signal_detail * arg. Pass all details to crash_dump_task.
|
||||
(_hurd_internal_post_signal): Pass DETAIL to write_corefile.
|
||||
(_hurd_internal_post_signal: suspend): Pass code and error to
|
||||
proc_mark_stop.
|
||||
|
||||
* hurd/hurdprio.c (_hurd_priority_which_map): Pass flags arg to
|
||||
proc_getprocinfo by reference.
|
||||
|
||||
* wcsmbs/wcwidth.c, wcsmbs/wcswidth.c: Fixed typos.
|
||||
|
||||
* sysdeps/unix/sysv/linux/sys/mman.h: Fixed typo.
|
||||
|
@ -471,9 +471,9 @@ endif
|
||||
|
||||
# Figure out the version numbers from version.h.
|
||||
|
||||
$(common-objpfx)version.mk: $(..)version.h
|
||||
sed -n -e 's/^.*RELEASE.*\"\([^"]*\)";$$/release=\1/p' \
|
||||
-e 's/^.*VERSION.*\"\([^"]*\)";$$/version=\1/p' \
|
||||
$(common-objpfx)version.mk: $(..)version.h $(..)Makeconfig
|
||||
sed -n -e 's/^.*RELEASE.*"\([^"]*\)".*$$/release=\1/p' \
|
||||
-e 's/^.*VERSION.*"\([^"]*\)".*$$/version=\1/p' \
|
||||
< $< > $@-new
|
||||
mv -f $@-new $@
|
||||
|
||||
|
164
Makerules
164
Makerules
@ -428,6 +428,71 @@ $(AR) cru$(verbose) $(@:$(objpfx)%=%) \
|
||||
$(RANLIB) $@
|
||||
endef
|
||||
|
||||
# Shared library building.
|
||||
|
||||
ifeq (yes,$(build-shared))
|
||||
|
||||
# Process the shlib-versions file, which tells us what shared library
|
||||
# version numbers to use when we install shared objects on this system.
|
||||
-include $(common-objpfx)soversions.mk
|
||||
$(common-objpfx)soversions.mk: $(..)shlib-versions $(..)Makerules \
|
||||
$(common-objpfx)config.make
|
||||
sed 's/#.*$$//' $< | while read conf versions; do \
|
||||
test -n "$$versions" || continue; \
|
||||
case '$(config-machine)-$(config-vendor)-$(config-os)' in $$conf)\
|
||||
for v in $$versions; do \
|
||||
lib="$${v%%=*}"; if eval "test -z \"\$$vers_lib$$lib\""; then \
|
||||
eval vers_lib$${lib}=yes; \
|
||||
echo $$lib.so-version=.$${v##$$lib=}; fi; \
|
||||
done ;; esac; done > $@T
|
||||
mv -f $@T $@
|
||||
|
||||
# Get $(version) defined with the release version number.
|
||||
-include $(common-objpfx)version.mk
|
||||
|
||||
|
||||
# Pattern rule to build a shared object from an archive of PIC objects.
|
||||
# This must come after the installation rules so Make doesn't try to
|
||||
# build shared libraries in place from the installed *_pic.a files.
|
||||
# $(LDLIBS-%.so) may contain -l switches to generate run-time dependencies
|
||||
# on other shared objects.
|
||||
lib%.so: lib%_pic.a; $(build-shlib)
|
||||
|
||||
ifeq ($(have-no-whole-archive),yes)
|
||||
no-whole-archive = -Wl,--no-whole-archive
|
||||
else
|
||||
no-whole-archive =
|
||||
endif
|
||||
|
||||
define build-shlib
|
||||
$(LINK.o) -shared -o $@ $(sysdep-LDFLAGS) $(config-LDFLAGS) \
|
||||
-Wl,-soname=lib$(libprefix)$(@F:lib%.so=%).so$($(@F)-version) \
|
||||
$(LDFLAGS.so) $(LDFLAGS-$(@F:lib%.so=%).so) \
|
||||
-Wl,-rpath-link=$(common-objdir) \
|
||||
-Wl,--whole-archive $^ $(no-whole-archive) \
|
||||
$(LDLIBS-$(@F:lib%.so=%).so)
|
||||
endef
|
||||
|
||||
# Don't try to use -lc when making libc.so itself.
|
||||
# Also omits crti.o and crtn.o, which we do not want
|
||||
# since we define our own `.init' section specially.
|
||||
LDFLAGS-c.so = -nostdlib -nostartfiles
|
||||
# Give libc.so an entry point and make it directly runnable itself.
|
||||
LDFLAGS-c.so += -e __libc_print_version
|
||||
# Use our own special initializer and finalizer files for libc.so.
|
||||
elfobjdir := $(firstword $(objdir) $(..)elf)
|
||||
$(common-objpfx)libc.so: $(elfobjdir)/soinit.so \
|
||||
$(common-objpfx)libc_pic.a \
|
||||
$(elfobjdir)/sofini.so
|
||||
$(build-shlib)
|
||||
|
||||
ifdef libc.so-version
|
||||
$(common-objpfx)libc.so$(libc.so-version): $(common-objpfx)libc.so
|
||||
rm -f $@
|
||||
ln -s $(<F) $@ || ln $< $@
|
||||
endif
|
||||
endif
|
||||
|
||||
# Installation.
|
||||
|
||||
# $(install-lib) are installed from the object directory into $(libdir);
|
||||
@ -483,13 +548,56 @@ endef
|
||||
install-lib.so := $(filter %.so,$(install-lib:%_pic.a=%.so))
|
||||
install-lib := $(filter-out %.so %_pic.a,$(install-lib))
|
||||
ifeq (yes,$(build-shared))
|
||||
install-lib-nosubdir: $(foreach so,$(install-lib.so),\
|
||||
$(libdir)/$(patsubst $(libprefix)lib%,lib$(libprefix)%,\
|
||||
$(libprefix)$(so))$($(so)-version))
|
||||
|
||||
install: $(slibdir)/libc.so$(libc.so-version)
|
||||
$(slibdir)/lib$(libprefix)c.so$(libc.so-version): $(common-objpfx)libc.so
|
||||
$(do-install-so)
|
||||
install-lib-nosubdir: $(install-lib.so:%=$(libdir)/%)
|
||||
install: $(slibdir)/libc.so
|
||||
|
||||
# Find which .so's have versions.
|
||||
versioned := $(foreach so,$(install-lib.so),\
|
||||
$(patsubst %,$(so),$($(so)-version)))
|
||||
|
||||
# Install all the unversioned shared libraries.
|
||||
$(addprefix $(libdir)/,$(filter-out $(versioned),$(install-lib.so))): \
|
||||
$(libdir)/%: $(objpfx)lib%.so; $(do-install-program)
|
||||
|
||||
make-link = cd $(@D); rm -f $(@F); $(LN_S) $(<F) $(@F)
|
||||
|
||||
ifdef libc.so-version
|
||||
# For a library specified to be version N, install three files:
|
||||
# libc.so -> libc.so.N (e.g. libc.so.6)
|
||||
# libc.so.6 -> libc-VERSION.so (e.g. libc-1.10.so)
|
||||
|
||||
$(slibdir)/libc.so: $(slibdir)/libc.so$(libc.so-version)
|
||||
$(make-link)
|
||||
$(slibdir)/libc.so$(libc.so-version): $(slibdir)/libc-$(version).so
|
||||
$(make-link)
|
||||
$(slibdir)/libc-$(version).so: $(common-objpfx)libc.so; $(do-install-program)
|
||||
else
|
||||
$(slibdir)/libc.so: $(common-objpfx)libc.so; $(do-install-program)
|
||||
endif
|
||||
|
||||
|
||||
ifneq (,$(versioned))
|
||||
# Produce three sets of rules as above for all the smaller versioned libraries.
|
||||
|
||||
define o-iterator-doit
|
||||
$$(libdir)/$o: $$(libdir)/$o$$($o-version); $$(make-link)
|
||||
endef
|
||||
object-suffixes-left := $(versioned)
|
||||
include $(..)o-iterator.mk
|
||||
|
||||
define o-iterator-doit
|
||||
$$(libdir)/$o$$($o-version): $$(libdir)/$(o:.so=)-$$(version).so; $$(make-link)
|
||||
endef
|
||||
object-suffixes-left := $(versioned)
|
||||
include $(..)o-iterator.mk
|
||||
|
||||
define o-iterator-doit
|
||||
$$(libdir)/$(o:.so=)-$$(version).so: $$(objpfx)$o; $$(do-install-program)
|
||||
endef
|
||||
object-suffixes-left := $(versioned)
|
||||
include $(..)o-iterator.mk
|
||||
endif
|
||||
|
||||
define do-install-so
|
||||
$(do-install-program)
|
||||
@ -561,50 +669,6 @@ install-no-libc.a-nosubdir: install-headers-nosubdir install-data-nosubdir\
|
||||
install-others-nosubdir install-sbin-nosubdir
|
||||
install: install-no-libc.a-nosubdir
|
||||
|
||||
ifeq (yes,$(build-shared))
|
||||
# Pattern rule to build a shared object from an archive of PIC objects.
|
||||
# This must come after the installation rules so Make doesn't try to
|
||||
# build shared libraries in place from the installed *_pic.a files.
|
||||
# $(LDLIBS-%.so) may contain -l switches to generate run-time dependencies
|
||||
# on other shared objects.
|
||||
lib%.so: lib%_pic.a; $(build-shlib)
|
||||
|
||||
ifeq ($(have-no-whole-archive),yes)
|
||||
no-whole-archive = -Wl,--no-whole-archive
|
||||
else
|
||||
no-whole-archive =
|
||||
endif
|
||||
|
||||
define build-shlib
|
||||
$(LINK.o) -shared -o $@ $(sysdep-LDFLAGS) $(config-LDFLAGS) \
|
||||
-Wl,-soname=lib$(libprefix)$(@F:lib%.so=%).so$($(@F)-version) \
|
||||
$(LDFLAGS.so) $(LDFLAGS-$(@F:lib%.so=%).so) \
|
||||
-Wl,-rpath-link=$(common-objdir) \
|
||||
-Wl,--whole-archive $^ $(no-whole-archive) \
|
||||
$(LDLIBS-$(@F:lib%.so=%).so)
|
||||
endef
|
||||
|
||||
# Don't try to use -lc when making libc.so itself.
|
||||
# Also omits crti.o and crtn.o, which we do not want
|
||||
# since we define our own `.init' section specially.
|
||||
LDFLAGS-c.so = -nostdlib -nostartfiles
|
||||
# Give libc.so an entry point and make it directly runnable itself.
|
||||
LDFLAGS-c.so += -e __libc_print_version
|
||||
# Use our own special initializer and finalizer files for libc.so.
|
||||
elfobjdir := $(firstword $(objdir) $(..)elf)
|
||||
$(common-objpfx)libc.so: $(elfobjdir)/soinit.so \
|
||||
$(common-objpfx)libc_pic.a \
|
||||
$(elfobjdir)/sofini.so
|
||||
$(build-shlib)
|
||||
|
||||
ifdef libc.so-version
|
||||
$(common-objpfx)libc.so$(libc.so-version): $(common-objpfx)libc.so
|
||||
rm -f $@
|
||||
ln -s $(<F) $@ || ln $< $@
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
# Command to compile $< in $(objdir) using the native libraries.
|
||||
define native-compile
|
||||
cwd=`pwd`; cd $(@D); $(BUILD_CC) $(BUILD_CFLAGS) \
|
||||
|
@ -37,5 +37,6 @@ AS = $(CC) -c
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
LN_S = @LN_S@
|
||||
|
||||
# More variables may be inserted below by configure.
|
||||
|
@ -1,6 +1,6 @@
|
||||
Dnl Process this file with autoconf to produce a configure script.
|
||||
AC_REVISION([$CVSid$])
|
||||
AC_PREREQ(2.9)dnl dnl Minimum Autoconf version required.
|
||||
AC_PREREQ(2.10)dnl dnl Minimum Autoconf version required.
|
||||
AC_INIT(features.h)
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
|
||||
@ -293,6 +293,7 @@ if test "$INSTALL" = "${srcdir}/install-sh"; then
|
||||
# The makefiles need to use a different form to find it in $srcdir.
|
||||
INSTALL='$(..)./install-sh'
|
||||
fi
|
||||
AC_PROG_LN_S
|
||||
|
||||
AC_CHECK_TOOL(CC, gcc)
|
||||
AC_CHECK_TOOL(AR, ar)
|
||||
|
@ -29,18 +29,21 @@ _S_catch_exception_raise (mach_port_t port,
|
||||
int code,
|
||||
int subcode)
|
||||
{
|
||||
int signo, error;
|
||||
long int sigcode;
|
||||
struct hurd_sigstate *ss;
|
||||
int signo;
|
||||
struct hurd_signal_detail d;
|
||||
|
||||
if (task != __mach_task_self ())
|
||||
/* The sender wasn't the kernel. */
|
||||
return EPERM;
|
||||
|
||||
d.exc = exception;
|
||||
d.exc_code = code;
|
||||
d.exc_subcode = subcode;
|
||||
|
||||
/* Call the machine-dependent function to translate the Mach exception
|
||||
codes into a signal number and subcode. */
|
||||
_hurd_exception2signal (exception, code, subcode,
|
||||
&signo, &sigcode, &error);
|
||||
_hurd_exception2signal (&d, &signo);
|
||||
|
||||
/* Find the sigstate structure for the faulting thread. */
|
||||
__mutex_lock (&_hurd_siglock);
|
||||
@ -70,7 +73,7 @@ _S_catch_exception_raise (mach_port_t port,
|
||||
}
|
||||
|
||||
/* Post the signal. */
|
||||
_hurd_internal_post_signal (ss, signo, sigcode, error,
|
||||
_hurd_internal_post_signal (ss, signo, &d,
|
||||
MACH_PORT_NULL, MACH_MSG_TYPE_PORT_SEND,
|
||||
0);
|
||||
|
||||
|
@ -27,7 +27,7 @@ Cambridge, MA 02139, USA. */
|
||||
|
||||
void
|
||||
_hurd_raise_signal (struct hurd_sigstate *ss,
|
||||
int signo, long int sigcode, int sigerror)
|
||||
int signo, const struct hurd_signal_detail *detail)
|
||||
{
|
||||
if (ss == NULL)
|
||||
{
|
||||
@ -37,12 +37,11 @@ _hurd_raise_signal (struct hurd_sigstate *ss,
|
||||
|
||||
/* Mark SIGNO as pending to be delivered. */
|
||||
__sigaddset (&ss->pending, signo);
|
||||
ss->pending_data[signo].code = sigcode;
|
||||
ss->pending_data[signo].error = sigerror;
|
||||
ss->pending_data[signo] = *detail;
|
||||
|
||||
__spin_unlock (&ss->lock);
|
||||
|
||||
/* Send a message to the signal thread so it
|
||||
will wake up and check for pending signals. */
|
||||
__msg_sig_post (_hurd_msgport, signo, sigcode, __mach_task_self ());
|
||||
__msg_sig_post (_hurd_msgport, signo, detail->code, __mach_task_self ());
|
||||
}
|
||||
|
@ -233,7 +233,8 @@ extern void _hurd_raise_signal (struct hurd_sigstate *ss, int signo,
|
||||
|
||||
/* Translate a Mach exception into a signal (machine-dependent). */
|
||||
|
||||
extern void _hurd_exception2signal (struct hurd_signal_detail *);
|
||||
extern void _hurd_exception2signal (struct hurd_signal_detail *detail,
|
||||
int *signo);
|
||||
|
||||
|
||||
/* Make the thread described by SS take the signal described by SIGNO and
|
||||
@ -259,7 +260,7 @@ extern void _hurd_internal_post_signal (struct hurd_sigstate *ss,
|
||||
struct machine_thread_all_state;
|
||||
extern struct sigcontext *
|
||||
_hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
|
||||
int signo, const struct hurd_signal_detail *detail,
|
||||
int signo, struct hurd_signal_detail *detail,
|
||||
int rpc_wait, struct machine_thread_all_state *state);
|
||||
|
||||
/* Function run by the signal thread to receive from the signal port. */
|
||||
|
@ -42,19 +42,21 @@ _hurdsig_fault_catch_exception_raise (mach_port_t port,
|
||||
int subcode)
|
||||
{
|
||||
int signo;
|
||||
long int sigcode;
|
||||
int sigerror;
|
||||
struct hurd_signal_detail d;
|
||||
|
||||
if (port != forward_sigexc ||
|
||||
thread != _hurd_msgport_thread || task != __mach_task_self ())
|
||||
return EPERM; /* Strange bogosity. */
|
||||
|
||||
d.exc = exception;
|
||||
d.exc_code = code;
|
||||
d.exc_subcode = subcode;
|
||||
|
||||
/* Call the machine-dependent function to translate the Mach exception
|
||||
codes into a signal number and subcode. */
|
||||
_hurd_exception2signal (exception, code, subcode,
|
||||
&signo, &sigcode, &sigerror);
|
||||
_hurd_exception2signal (&d, &signo);
|
||||
|
||||
return HURD_PREEMPT_SIGNAL_P (&_hurdsig_fault_preempter, signo, sigcode)
|
||||
return HURD_PREEMPT_SIGNAL_P (&_hurdsig_fault_preempter, signo, d.code)
|
||||
? 0 : EGREGIOUS;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Support code for dealing with priorities in the Hurd.
|
||||
Copyright (C) 1994, 1995 Free Software Foundation, Inc.
|
||||
Copyright (C) 1994, 1995, 1996 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
|
||||
@ -62,7 +62,7 @@ _hurd_priority_which_map (enum __priority_which which, int who,
|
||||
char *tw = 0;
|
||||
size_t twsz = 0;
|
||||
if (err = __USEPORT (PROC, __proc_getprocinfo (port, pids[i],
|
||||
pi_flags,
|
||||
&pi_flags,
|
||||
&pi, &pisize,
|
||||
&tw, &twsz)))
|
||||
continue;
|
||||
|
@ -130,7 +130,7 @@ int _hurd_core_limit; /* XXX */
|
||||
/* Call the crash dump server to mummify us before we die.
|
||||
Returns nonzero if a core file was written. */
|
||||
static int
|
||||
write_corefile (int signo, long int sigcode, int sigerror)
|
||||
write_corefile (int signo, const struct hurd_signal_detail *detail)
|
||||
{
|
||||
error_t err;
|
||||
mach_port_t coreserver;
|
||||
@ -168,13 +168,16 @@ write_corefile (int signo, long int sigcode, int sigerror)
|
||||
/* Call the core dumping server to write the core file. */
|
||||
err = __crash_dump_task (coreserver,
|
||||
__mach_task_self (),
|
||||
file, _hurdsig_getenv ("GNUTARGET"),
|
||||
signo, sigcode, sigerror);
|
||||
file,
|
||||
signo, detail->code, detail->error,
|
||||
detail->exc, detail->exc_code, detail->exc_subcode,
|
||||
_hurd_ports[INIT_PORT_CTTYID].port,
|
||||
MACH_MSG_TYPE_COPY_SEND);
|
||||
__mach_port_deallocate (__mach_task_self (), coreserver);
|
||||
if (! err)
|
||||
/* The core dump into FILE succeeded, so now link it into the
|
||||
directory. */
|
||||
err = __dir_link (file, coredir, name);
|
||||
err = __dir_link (file, coredir, name, 1);
|
||||
__mach_port_deallocate (__mach_task_self (), file);
|
||||
__mach_port_deallocate (__mach_task_self (), coredir);
|
||||
return !err;
|
||||
@ -477,7 +480,7 @@ _hurd_internal_post_signal (struct hurd_sigstate *ss,
|
||||
__mutex_unlock (&_hurd_siglock);
|
||||
abort_all_rpcs (signo, &thread_state, 1);
|
||||
reply ();
|
||||
__proc_mark_stop (port, signo);
|
||||
__proc_mark_stop (port, signo, detail->code);
|
||||
}));
|
||||
_hurd_stopped = 1;
|
||||
}
|
||||
@ -546,8 +549,8 @@ _hurd_internal_post_signal (struct hurd_sigstate *ss,
|
||||
{
|
||||
__mutex_lock (&_hurd_siglock);
|
||||
for (pe = _hurdsig_preempters; pe && handler == SIG_ERR; pe = pe->next)
|
||||
if (HURD_PREEMPT_SIGNAL_P (pe, signo, sigcode))
|
||||
handler = (*pe->preempter) (pe, ss, &signo, &sigcode, &sigerror);
|
||||
if (HURD_PREEMPT_SIGNAL_P (pe, signo, detail->code))
|
||||
handler = (*pe->preempter) (pe, ss, &signo, detail);
|
||||
__mutex_unlock (&_hurd_siglock);
|
||||
}
|
||||
|
||||
@ -664,7 +667,7 @@ _hurd_internal_post_signal (struct hurd_sigstate *ss,
|
||||
/* If we would ordinarily stop for a job control signal, but we are
|
||||
orphaned so noone would ever notice and continue us again, we just
|
||||
quietly die, alone and in the dark. */
|
||||
sigcode = signo;
|
||||
detail->code = signo;
|
||||
signo = SIGKILL;
|
||||
act = term;
|
||||
}
|
||||
@ -686,7 +689,8 @@ _hurd_internal_post_signal (struct hurd_sigstate *ss,
|
||||
/* We are already stopped, but receiving an untraced stop
|
||||
signal. Instead of resuming and suspending again, just
|
||||
notify the proc server of the new stop signal. */
|
||||
error_t err = __USEPORT (PROC, __proc_mark_stop (port, signo));
|
||||
error_t err = __USEPORT (PROC, __proc_mark_stop
|
||||
(port, signo, detail->code));
|
||||
assert_perror (err);
|
||||
}
|
||||
else
|
||||
@ -701,7 +705,7 @@ _hurd_internal_post_signal (struct hurd_sigstate *ss,
|
||||
sigbomb:
|
||||
/* We got a fault setting up the stack frame for the handler.
|
||||
Nothing to do but die; BSD gets SIGILL in this case. */
|
||||
sigcode = signo; /* XXX ? */
|
||||
detail->code = signo; /* XXX ? */
|
||||
signo = SIGILL;
|
||||
act = core;
|
||||
/* FALLTHROUGH */
|
||||
@ -721,7 +725,7 @@ _hurd_internal_post_signal (struct hurd_sigstate *ss,
|
||||
int status = W_EXITCODE (0, signo);
|
||||
/* Do a core dump if desired. Only set the wait status bit saying we
|
||||
in fact dumped core if the operation was actually successful. */
|
||||
if (act == core && write_corefile (signo, sigcode, sigerror))
|
||||
if (act == core && write_corefile (signo, detail))
|
||||
status |= WCOREFLAG;
|
||||
/* Tell proc how we died and then stick the saber in the gut. */
|
||||
_hurd_exit (status);
|
||||
@ -808,8 +812,7 @@ _hurd_internal_post_signal (struct hurd_sigstate *ss,
|
||||
|
||||
/* Call the machine-dependent function to set the thread up
|
||||
to run the signal handler, and preserve its old context. */
|
||||
scp = _hurd_setup_sighandler (ss, handler,
|
||||
signo, sigcode,
|
||||
scp = _hurd_setup_sighandler (ss, handler, signo, detail,
|
||||
wait_for_reply, &thread_state);
|
||||
if (scp == NULL)
|
||||
goto sigbomb;
|
||||
@ -848,7 +851,7 @@ _hurd_internal_post_signal (struct hurd_sigstate *ss,
|
||||
}
|
||||
|
||||
/* Backdoor extra argument to signal handler. */
|
||||
scp->sc_error = sigerror;
|
||||
scp->sc_error = detail->error;
|
||||
|
||||
/* Block SIGNO and requested signals while running the handler. */
|
||||
scp->sc_mask = ss->blocked;
|
||||
@ -897,8 +900,7 @@ _hurd_internal_post_signal (struct hurd_sigstate *ss,
|
||||
if (__sigismember (&pending, signo))
|
||||
{
|
||||
__sigdelset (&ss->pending, signo);
|
||||
sigcode = ss->pending_data[signo].code;
|
||||
sigerror = ss->pending_data[signo].error;
|
||||
*detail = ss->pending_data[signo];
|
||||
__spin_unlock (&ss->lock);
|
||||
goto post_signal;
|
||||
}
|
||||
|
@ -149,3 +149,28 @@ _S_msg_report_wait (mach_port_t msgport, thread_t thread,
|
||||
__mach_port_deallocate (__mach_task_self (), thread);
|
||||
return 0;
|
||||
}
|
||||
|
||||
kern_return_t
|
||||
_S_msg_describe_ports (mach_port_t msgport, mach_port_t refport,
|
||||
mach_port_t *ports, mach_msg_type_number_t nports,
|
||||
char **desc, mach_msg_type_number_t *desclen)
|
||||
{
|
||||
char *p, *end;
|
||||
|
||||
if (__USEPORT (AUTH, msgport != port))
|
||||
return EPERM;
|
||||
|
||||
end = *desc + *desclen;
|
||||
p = *desc;
|
||||
while (nports-- > 0)
|
||||
{
|
||||
char this[200];
|
||||
describe_port (this, *ports++);
|
||||
p = __stpncpy (p, this, end - p);
|
||||
if (p == end && p[-1] != '\0')
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
*desclen = p - *desc;
|
||||
return 0;
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ distribute := math_private.h machine/asm.h machine/endian.h
|
||||
# Build the -lm library.
|
||||
|
||||
extra-libs := libm
|
||||
libm.so-version := .0
|
||||
libm-routines := e_acos e_acosf e_acosh e_acoshf e_asin e_asinf \
|
||||
e_atan2 e_atan2f e_atanh e_atanhf e_cosh e_coshf \
|
||||
e_exp e_expf e_fmod e_fmodf e_hypot e_hypotf e_j0 \
|
||||
|
@ -69,7 +69,9 @@ ecvt_r (value, ndigit, decpt, sign, buf, len)
|
||||
char *buf;
|
||||
size_t len;
|
||||
{
|
||||
if (&log10)
|
||||
double (*log10_function) (double) = &log10;
|
||||
|
||||
if (log10_function)
|
||||
{
|
||||
/* Use the reasonable code if -lm is included. */
|
||||
ndigit -= (int) floor (log10 (fabs (value)));
|
||||
|
@ -650,6 +650,9 @@ extern int chroot __P ((__const char *__path));
|
||||
This call is restricted to the super-user. */
|
||||
extern int swapon __P ((__const char *__path));
|
||||
|
||||
/* Stop using block special device PATH for swapping. */
|
||||
extern int swapoff __P ((__const char *__path));
|
||||
|
||||
/* Reboot or halt the system. */
|
||||
extern int reboot __P ((int __howto));
|
||||
|
||||
|
21
shlib-versions
Normal file
21
shlib-versions
Normal file
@ -0,0 +1,21 @@
|
||||
# This file defines the shared library version numbers we will install.
|
||||
|
||||
# The following lines list filename patterns matching canonical configurations,
|
||||
# and the associated versions to use for various libraries. The entire
|
||||
# list processed, with earlier entries taking precedence over later entries.
|
||||
# So loose patterns at the end of the list can give defaults.
|
||||
|
||||
# Configuration Library versions
|
||||
# ------------- ------- --------
|
||||
|
||||
# The interface to -lm depends only on cpu, not on operating system.
|
||||
i?86-*-* libm=6
|
||||
|
||||
# We provide libc.so.6 for Linux kernel versions 1.3.95 and later.
|
||||
i?86-*-linux* libc=6
|
||||
|
||||
# libmachuser.so.1 corresponds to mach/*.defs as of Utah's UK22 release.
|
||||
*-*-gnu* libmachuser=1
|
||||
|
||||
# libhurduser.so.0.0 corresponds to hurd/*.defs as of 7 May 1996.
|
||||
*-*-gnu* libhurduser=0.0
|
@ -49,7 +49,7 @@ Cambridge, MA 02139, USA. */
|
||||
struct base_table_t
|
||||
{
|
||||
#if (UDIV_TIME > 2 * UMUL_TIME)
|
||||
mp_limb base_multiplier;
|
||||
mp_limb_t base_multiplier;
|
||||
#endif
|
||||
char flag;
|
||||
char post_shift;
|
||||
@ -58,9 +58,9 @@ struct base_table_t
|
||||
{
|
||||
char normalization_steps;
|
||||
char ndigits;
|
||||
mp_limb base PACK;
|
||||
mp_limb_t base PACK;
|
||||
#if UDIV_TIME > 2 * UMUL_TIME
|
||||
mp_limb base_ninv PACK;
|
||||
mp_limb_t base_ninv PACK;
|
||||
#endif
|
||||
} big;
|
||||
#endif
|
||||
@ -183,12 +183,12 @@ _itoa (value, buflim, base, upper_case)
|
||||
do \
|
||||
{ \
|
||||
/* `unsigned long long int' always has 64 bits. */ \
|
||||
mp_limb work_hi = value >> (64 - BITS_PER_MP_LIMB); \
|
||||
mp_limb_t work_hi = value >> (64 - BITS_PER_MP_LIMB); \
|
||||
\
|
||||
if (BITS_PER_MP_LIMB == 32) \
|
||||
if (work_hi != 0) \
|
||||
{ \
|
||||
mp_limb work_lo; \
|
||||
mp_limb_t work_lo; \
|
||||
int cnt; \
|
||||
\
|
||||
work_lo = value & 0xfffffffful; \
|
||||
@ -228,11 +228,11 @@ _itoa (value, buflim, base, upper_case)
|
||||
default:
|
||||
{
|
||||
#if BITS_PER_MP_LIMB == 64
|
||||
mp_limb base_multiplier = brec->base_multiplier;
|
||||
mp_limb_t base_multiplier = brec->base_multiplier;
|
||||
if (brec->flag)
|
||||
while (value != 0)
|
||||
{
|
||||
mp_limb quo, rem, x, dummy;
|
||||
mp_limb_t quo, rem, x, dummy;
|
||||
|
||||
umul_ppmm (x, dummy, value, base_multiplier);
|
||||
quo = (x + ((value - x) >> 1)) >> (brec->post_shift - 1);
|
||||
@ -243,7 +243,7 @@ _itoa (value, buflim, base, upper_case)
|
||||
else
|
||||
while (value != 0)
|
||||
{
|
||||
mp_limb quo, rem, x, dummy;
|
||||
mp_limb_t quo, rem, x, dummy;
|
||||
|
||||
umul_ppmm (x, dummy, value, base_multiplier);
|
||||
quo = x >> brec->post_shift;
|
||||
@ -253,36 +253,36 @@ _itoa (value, buflim, base, upper_case)
|
||||
}
|
||||
#endif
|
||||
#if BITS_PER_MP_LIMB == 32
|
||||
mp_limb t[3];
|
||||
mp_limb_t t[3];
|
||||
int n;
|
||||
|
||||
/* First convert x0 to 1-3 words in base s->big.base.
|
||||
Optimize for frequent cases of 32 bit numbers. */
|
||||
if ((mp_limb) (value >> 32) >= 1)
|
||||
if ((mp_limb_t) (value >> 32) >= 1)
|
||||
{
|
||||
int big_normalization_steps = brec->big.normalization_steps;
|
||||
mp_limb big_base_norm = brec->big.base << big_normalization_steps;
|
||||
mp_limb_t big_base_norm = brec->big.base << big_normalization_steps;
|
||||
|
||||
if ((mp_limb) (value >> 32) >= brec->big.base)
|
||||
if ((mp_limb_t) (value >> 32) >= brec->big.base)
|
||||
{
|
||||
mp_limb x1hi, x1lo, r;
|
||||
mp_limb_t x1hi, x1lo, r;
|
||||
/* If you want to optimize this, take advantage of
|
||||
that the quotient in the first udiv_qrnnd will
|
||||
always be very small. It might be faster just to
|
||||
subtract in a tight loop. */
|
||||
|
||||
#if UDIV_TIME > 2 * UMUL_TIME
|
||||
mp_limb x, xh, xl;
|
||||
mp_limb_t x, xh, xl;
|
||||
|
||||
if (big_normalization_steps == 0)
|
||||
xh = 0;
|
||||
else
|
||||
xh = (mp_limb) (value >> 64 - big_normalization_steps);
|
||||
xl = (mp_limb) (value >> 32 - big_normalization_steps);
|
||||
xh = (mp_limb_t) (value >> 64 - big_normalization_steps);
|
||||
xl = (mp_limb_t) (value >> 32 - big_normalization_steps);
|
||||
udiv_qrnnd_preinv (x1hi, r, xh, xl, big_base_norm,
|
||||
brec->big.base_ninv);
|
||||
|
||||
xl = ((mp_limb) value) << big_normalization_steps;
|
||||
xl = ((mp_limb_t) value) << big_normalization_steps;
|
||||
udiv_qrnnd_preinv (x1lo, x, r, xl, big_base_norm,
|
||||
big_normalization_steps);
|
||||
t[2] = x >> big_normalization_steps;
|
||||
@ -297,16 +297,16 @@ _itoa (value, buflim, base, upper_case)
|
||||
big_normalization_steps);
|
||||
t[1] = x >> big_normalization_steps;
|
||||
#elif UDIV_NEEDS_NORMALIZATION
|
||||
mp_limb x, xh, xl;
|
||||
mp_limb_t x, xh, xl;
|
||||
|
||||
if (big_normalization_steps == 0)
|
||||
xh = 0;
|
||||
else
|
||||
xh = (mp_limb) (value >> 64 - big_normalization_steps);
|
||||
xl = (mp_limb) (value >> 32 - big_normalization_steps);
|
||||
xh = (mp_limb_t) (value >> 64 - big_normalization_steps);
|
||||
xl = (mp_limb_t) (value >> 32 - big_normalization_steps);
|
||||
udiv_qrnnd (x1hi, r, xh, xl, big_base_norm);
|
||||
|
||||
xl = ((mp_limb) value) << big_normalization_steps;
|
||||
xl = ((mp_limb_t) value) << big_normalization_steps;
|
||||
udiv_qrnnd (x1lo, x, r, xl, big_base_norm);
|
||||
t[2] = x >> big_normalization_steps;
|
||||
|
||||
@ -319,9 +319,9 @@ _itoa (value, buflim, base, upper_case)
|
||||
udiv_qrnnd (t[0], x, xh, xl, big_base_norm);
|
||||
t[1] = x >> big_normalization_steps;
|
||||
#else
|
||||
udiv_qrnnd (x1hi, r, 0, (mp_limb) (value >> 32),
|
||||
udiv_qrnnd (x1hi, r, 0, (mp_limb_t) (value >> 32),
|
||||
brec->big.base);
|
||||
udiv_qrnnd (x1lo, t[2], r, (mp_limb) value, brec->big.base);
|
||||
udiv_qrnnd (x1lo, t[2], r, (mp_limb_t) value, brec->big.base);
|
||||
udiv_qrnnd (t[0], t[1], x1hi, x1lo, brec->big.base);
|
||||
#endif
|
||||
n = 3;
|
||||
@ -329,23 +329,23 @@ _itoa (value, buflim, base, upper_case)
|
||||
else
|
||||
{
|
||||
#if (UDIV_TIME > 2 * UMUL_TIME)
|
||||
mp_limb x;
|
||||
mp_limb_t x;
|
||||
|
||||
value <<= brec->big.normalization_steps;
|
||||
udiv_qrnnd_preinv (t[0], x, (mp_limb) (value >> 32),
|
||||
(mp_limb) value, big_base_norm,
|
||||
udiv_qrnnd_preinv (t[0], x, (mp_limb_t) (value >> 32),
|
||||
(mp_limb_t) value, big_base_norm,
|
||||
brec->big.base_ninv);
|
||||
t[1] = x >> brec->big.normalization_steps;
|
||||
#elif UDIV_NEEDS_NORMALIZATION
|
||||
mp_limb x;
|
||||
mp_limb_t x;
|
||||
|
||||
value <<= big_normalization_steps;
|
||||
udiv_qrnnd (t[0], x, (mp_limb) (value >> 32),
|
||||
(mp_limb) value, big_base_norm);
|
||||
udiv_qrnnd (t[0], x, (mp_limb_t) (value >> 32),
|
||||
(mp_limb_t) value, big_base_norm);
|
||||
t[1] = x >> big_normalization_steps;
|
||||
#else
|
||||
udiv_qrnnd (t[0], t[1], (mp_limb) (value >> 32),
|
||||
(mp_limb) value, brec->big.base);
|
||||
udiv_qrnnd (t[0], t[1], (mp_limb_t) (value >> 32),
|
||||
(mp_limb_t) value, brec->big.base);
|
||||
#endif
|
||||
n = 2;
|
||||
}
|
||||
@ -359,15 +359,15 @@ _itoa (value, buflim, base, upper_case)
|
||||
/* Convert the 1-3 words in t[], word by word, to ASCII. */
|
||||
do
|
||||
{
|
||||
mp_limb ti = t[--n];
|
||||
mp_limb_t ti = t[--n];
|
||||
int ndig_for_this_limb = 0;
|
||||
|
||||
#if UDIV_TIME > 2 * UMUL_TIME
|
||||
mp_limb base_multiplier = brec->base_multiplier;
|
||||
mp_limb_t base_multiplier = brec->base_multiplier;
|
||||
if (brec->flag)
|
||||
while (ti != 0)
|
||||
{
|
||||
mp_limb quo, rem, x, dummy;
|
||||
mp_limb_t quo, rem, x, dummy;
|
||||
|
||||
umul_ppmm (x, dummy, ti, base_multiplier);
|
||||
quo = (x + ((ti - x) >> 1)) >> (brec->post_shift - 1);
|
||||
@ -379,7 +379,7 @@ _itoa (value, buflim, base, upper_case)
|
||||
else
|
||||
while (ti != 0)
|
||||
{
|
||||
mp_limb quo, rem, x, dummy;
|
||||
mp_limb_t quo, rem, x, dummy;
|
||||
|
||||
umul_ppmm (x, dummy, ti, base_multiplier);
|
||||
quo = x >> brec->post_shift;
|
||||
@ -391,7 +391,7 @@ _itoa (value, buflim, base, upper_case)
|
||||
#else
|
||||
while (ti != 0)
|
||||
{
|
||||
mp_limb quo, rem;
|
||||
mp_limb_t quo, rem;
|
||||
|
||||
quo = ti / base;
|
||||
rem = ti % base;
|
||||
|
@ -28,7 +28,6 @@ Cambridge, MA 02139, USA. */
|
||||
# include <stdio.h>
|
||||
#endif
|
||||
#include <alloca.h>
|
||||
#include <ansidecl.h>
|
||||
#include <ctype.h>
|
||||
#include <float.h>
|
||||
#include <gmp-mparam.h>
|
||||
@ -69,7 +68,7 @@ ssize_t __printf_pad __P ((FILE *, char pad, int n)); /* In vfprintf.c. */
|
||||
#define outchar(ch) \
|
||||
do \
|
||||
{ \
|
||||
register CONST int outc = (ch); \
|
||||
register const int outc = (ch); \
|
||||
if (putc (outc, fp) == EOF) \
|
||||
return -1; \
|
||||
++done; \
|
||||
@ -107,10 +106,10 @@ ssize_t __printf_pad __P ((FILE *, char pad, int n)); /* In vfprintf.c. */
|
||||
An MP variable occupies a varying number of entries in its array. We keep
|
||||
track of this number for efficiency reasons. Otherwise we would always
|
||||
have to process the whole array. */
|
||||
#define MPN_VAR(name) mp_limb *name; mp_size_t name##size
|
||||
#define MPN_VAR(name) mp_limb_t *name; mp_size_t name##size
|
||||
|
||||
#define MPN_ASSIGN(dst,src) \
|
||||
memcpy (dst, src, (dst##size = src##size) * sizeof (mp_limb))
|
||||
memcpy (dst, src, (dst##size = src##size) * sizeof (mp_limb_t))
|
||||
#define MPN_GE(u,v) \
|
||||
(u##size > v##size || (u##size == v##size && __mpn_cmp (u, v, u##size) >= 0))
|
||||
|
||||
@ -139,7 +138,7 @@ __printf_fp (FILE *fp,
|
||||
union
|
||||
{
|
||||
double dbl;
|
||||
LONG_DOUBLE ldbl;
|
||||
__long_double_t ldbl;
|
||||
}
|
||||
fpnum;
|
||||
|
||||
@ -151,11 +150,11 @@ __printf_fp (FILE *fp,
|
||||
const char *grouping;
|
||||
|
||||
/* "NaN" or "Inf" for the special cases. */
|
||||
CONST char *special = NULL;
|
||||
const char *special = NULL;
|
||||
|
||||
/* We need just a few limbs for the input before shifting to the right
|
||||
position. */
|
||||
mp_limb fp_input[(LDBL_MANT_DIG + BITS_PER_MP_LIMB - 1) / BITS_PER_MP_LIMB];
|
||||
mp_limb_t fp_input[(LDBL_MANT_DIG + BITS_PER_MP_LIMB - 1) / BITS_PER_MP_LIMB];
|
||||
/* We need to shift the contents of fp_input by this amount of bits. */
|
||||
int to_shift;
|
||||
|
||||
@ -184,11 +183,11 @@ __printf_fp (FILE *fp,
|
||||
int done = 0;
|
||||
|
||||
/* General helper (carry limb). */
|
||||
mp_limb cy;
|
||||
mp_limb_t cy;
|
||||
|
||||
char hack_digit (void)
|
||||
{
|
||||
mp_limb hi;
|
||||
mp_limb_t hi;
|
||||
|
||||
if (expsign != 0 && type == 'f' && exponent-- > 0)
|
||||
hi = 0;
|
||||
@ -337,10 +336,10 @@ __printf_fp (FILE *fp,
|
||||
would be really big it could lead to memory problems. */
|
||||
{
|
||||
mp_size_t bignum_size = ((ABS (exponent) + BITS_PER_MP_LIMB - 1)
|
||||
/ BITS_PER_MP_LIMB + 4) * sizeof (mp_limb);
|
||||
frac = (mp_limb *) alloca (bignum_size);
|
||||
tmp = (mp_limb *) alloca (bignum_size);
|
||||
scale = (mp_limb *) alloca (bignum_size);
|
||||
/ BITS_PER_MP_LIMB + 4) * sizeof (mp_limb_t);
|
||||
frac = (mp_limb_t *) alloca (bignum_size);
|
||||
tmp = (mp_limb_t *) alloca (bignum_size);
|
||||
scale = (mp_limb_t *) alloca (bignum_size);
|
||||
}
|
||||
|
||||
/* We now have to distinguish between numbers with positive and negative
|
||||
@ -515,7 +514,7 @@ __printf_fp (FILE *fp,
|
||||
if (exponent >= tens->m_expo)
|
||||
{
|
||||
int i, incr, cnt_h, cnt_l;
|
||||
mp_limb topval[2];
|
||||
mp_limb_t topval[2];
|
||||
|
||||
/* The __mpn_mul function expects the first argument to be
|
||||
bigger than the second. */
|
||||
@ -545,11 +544,11 @@ __printf_fp (FILE *fp,
|
||||
{
|
||||
topval[0] = 0;
|
||||
topval[1]
|
||||
= ((mp_limb) 10) << (BITS_PER_MP_LIMB - 4 - cnt_h);
|
||||
= ((mp_limb_t) 10) << (BITS_PER_MP_LIMB - 4 - cnt_h);
|
||||
}
|
||||
else
|
||||
{
|
||||
topval[0] = ((mp_limb) 10) << (BITS_PER_MP_LIMB - 4);
|
||||
topval[0] = ((mp_limb_t) 10) << (BITS_PER_MP_LIMB - 4);
|
||||
topval[1] = 0;
|
||||
(void) __mpn_lshift (topval, topval, 2,
|
||||
BITS_PER_MP_LIMB - cnt_h);
|
||||
|
183
stdio/linewrap.c
183
stdio/linewrap.c
@ -22,42 +22,27 @@ Cambridge, MA 02139, USA. */
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* We keep this data for each line-wrapping stream. */
|
||||
|
||||
struct data
|
||||
{
|
||||
const size_t *lmargin, *rmargin; /* Left and right margins. */
|
||||
const size_t *wrapmargin; /* Margin to wrap to, or null to truncate. */
|
||||
size_t point; /* Current column of last chars flushed. */
|
||||
|
||||
/* Original cookie and hooks from the stream. */
|
||||
void *cookie;
|
||||
void (*output) (FILE *, int);
|
||||
__io_close_fn *close;
|
||||
__io_fileno_fn *fileno;
|
||||
__io_seek_fn *seek;
|
||||
};
|
||||
#include <linewrap.h>
|
||||
|
||||
void __line_wrap_output (FILE *, int);
|
||||
|
||||
/* Install our hooks into a stream. */
|
||||
|
||||
static inline void
|
||||
wrap_stream (FILE *stream, struct data *d)
|
||||
wrap_stream (FILE *stream, struct line_wrap_data *d)
|
||||
{
|
||||
static void lwoutput (FILE *, int);
|
||||
static __io_close_fn lwclose;
|
||||
static __io_fileno_fn lwfileno;
|
||||
|
||||
stream->__cookie = d;
|
||||
stream->__room_funcs.__output = &lwoutput;
|
||||
stream->__room_funcs.__output = &__line_wrap_output;
|
||||
stream->__io_funcs.__close = &lwclose;
|
||||
stream->__io_funcs.__fileno = &lwfileno;
|
||||
stream->__io_funcs.__seek = NULL; /* Cannot seek. */
|
||||
}
|
||||
|
||||
/* Restore a stream to its original state. */
|
||||
|
||||
static inline void
|
||||
unwrap_stream (FILE *stream, struct data *d)
|
||||
unwrap_stream (FILE *stream, struct line_wrap_data *d)
|
||||
{
|
||||
stream->__cookie = d->cookie;
|
||||
stream->__room_funcs.__output = d->output;
|
||||
@ -72,41 +57,40 @@ unwrap_stream (FILE *stream, struct data *d)
|
||||
static int
|
||||
lwclose (void *cookie)
|
||||
{
|
||||
struct data *d = cookie;
|
||||
struct line_wrap_data *d = cookie;
|
||||
return (*d->close) (d->cookie);
|
||||
}
|
||||
|
||||
static int
|
||||
lwfileno (void *cookie)
|
||||
{
|
||||
struct data *d = cookie;
|
||||
struct line_wrap_data *d = cookie;
|
||||
return (*d->fileno) (d->cookie);
|
||||
}
|
||||
|
||||
/* This function is called when STREAM must be flushed.
|
||||
C is EOF or a character to be appended to the buffer contents. */
|
||||
|
||||
static void
|
||||
lwoutput (FILE *stream, int c)
|
||||
void
|
||||
__line_wrap_output (FILE *stream, int c)
|
||||
{
|
||||
char *buf, *nl;
|
||||
size_t len;
|
||||
|
||||
/* Extract our data and restore the stream's original cookie
|
||||
and output function so writes we do really go out. */
|
||||
struct data *d = stream->__cookie;
|
||||
struct line_wrap_data *d = stream->__cookie;
|
||||
unwrap_stream (stream, d);
|
||||
|
||||
/* Scan the buffer for newlines. */
|
||||
for (buf = stream->__buffer;
|
||||
(buf < stream->__bufp || (c != EOF && c != '\n')) && !stream->__error)
|
||||
buf = stream->__buffer;
|
||||
while ((buf < stream->__bufp || (c != EOF && c != '\n')) && !stream->__error)
|
||||
{
|
||||
size_t r;
|
||||
|
||||
if (d->point == 0 && d->lmargin && *d->lmargin != 0)
|
||||
if (d->point == 0 && d->lmargin != 0)
|
||||
{
|
||||
/* We are starting a new line. Print spaces to the left margin. */
|
||||
const size_t pad = *d->lmargin;
|
||||
const size_t pad = d->lmargin;
|
||||
if (stream->__bufp + pad < stream->__put_limit)
|
||||
{
|
||||
/* We can fit in them in the buffer by moving the
|
||||
@ -141,8 +125,7 @@ lwoutput (FILE *stream, int c)
|
||||
{
|
||||
/* The buffer ends in a partial line. */
|
||||
|
||||
if (!d->rmargin ||
|
||||
d->point + len + (c != EOF && c != '\n') <= d->rmargin)
|
||||
if (d->point + len + (c != EOF && c != '\n') <= d->rmargin)
|
||||
{
|
||||
/* The remaining buffer text is a partial line and fits
|
||||
within the maximum line width. Advance point for the
|
||||
@ -155,7 +138,7 @@ lwoutput (FILE *stream, int c)
|
||||
the end of the buffer. */
|
||||
nl = stream->__bufp;
|
||||
}
|
||||
else if (!d->rmargin || d->point + (nl - buf) <= d->rmargin)
|
||||
else if (d->point + (nl - buf) <= d->rmargin)
|
||||
{
|
||||
/* The buffer contains a full line that fits within the maximum
|
||||
line width. Reset point and scan the next line. */
|
||||
@ -165,9 +148,9 @@ lwoutput (FILE *stream, int c)
|
||||
}
|
||||
|
||||
/* This line is too long. */
|
||||
r = *d->rmargin;
|
||||
r = d->rmargin;
|
||||
|
||||
if (! d->wrapmargin)
|
||||
if (d->wmargin < 0)
|
||||
{
|
||||
/* Truncate the line by overwriting the excess with the
|
||||
newline and anything after it in the buffer. */
|
||||
@ -242,7 +225,7 @@ lwoutput (FILE *stream, int c)
|
||||
|
||||
/* Temporarily reset bufp to include just the first line. */
|
||||
stream->__bufp = nl;
|
||||
if (nextline - (nl + 1) < d->wrap)
|
||||
if (nextline - (nl + 1) < d->wmargin)
|
||||
/* The margin needs more blanks than we removed.
|
||||
Output the first line so we can use the space. */
|
||||
(*d->output) (stream, '\n');
|
||||
@ -255,7 +238,7 @@ lwoutput (FILE *stream, int c)
|
||||
d->point = 0;
|
||||
|
||||
/* Add blanks up to the wrap margin column. */
|
||||
for (i = 0; i < d->wrap; ++i)
|
||||
for (i = 0; i < d->wmargin; ++i)
|
||||
*stream->__bufp++ = ' ';
|
||||
|
||||
/* Copy the tail of the original buffer into the current buffer
|
||||
@ -284,19 +267,16 @@ lwoutput (FILE *stream, int c)
|
||||
wrap_stream (stream, d);
|
||||
}
|
||||
|
||||
/* Modify STREAM so that it prefixes lines written on it with *LMARGIN
|
||||
spaces and limits them to *RMARGIN columns total. If WRAP is not null,
|
||||
words that extend past *RMARGIN are wrapped by replacing the whitespace
|
||||
before them with a newline and *WRAP spaces. Otherwise, chars beyond
|
||||
*RMARGIN are simply dropped until a newline. Returns STREAM after
|
||||
modifying it, or NULL if there was an error. The pointers passed are
|
||||
stored in the stream and so must remain valid until `line_unwrap_stream'
|
||||
is called; the values pointed to can be changed between stdio calls. */
|
||||
|
||||
/* Modify STREAM so that it prefixes lines written on it with LMARGIN spaces
|
||||
and limits them to RMARGIN columns total. If WMARGIN >= 0, words that
|
||||
extend past RMARGIN are wrapped by replacing the whitespace before them
|
||||
with a newline and WMARGIN spaces. Otherwise, chars beyond RMARGIN are
|
||||
simply dropped until a newline. Returns STREAM after modifying it, or
|
||||
NULL if there was an error. */
|
||||
FILE *
|
||||
line_wrap_stream (FILE *stream, size_t *lmargin, size_t *rmargin, size_t *wrap)
|
||||
line_wrap_stream (FILE *stream, size_t lmargin, size_t rmargin, size_t wmargin)
|
||||
{
|
||||
struct data *d = malloc (sizeof *d);
|
||||
struct line_wrap_data *d = malloc (sizeof *d);
|
||||
|
||||
if (!d)
|
||||
return NULL;
|
||||
@ -321,25 +301,116 @@ line_wrap_stream (FILE *stream, size_t *lmargin, size_t *rmargin, size_t *wrap)
|
||||
to work if the stream is switched to full or no buffering. */
|
||||
stream->__linebuf = 1;
|
||||
|
||||
#define ref(arg) d->arg = arg
|
||||
ref (lmargin);
|
||||
ref (rmargin);
|
||||
ref (wrap);
|
||||
#undef ref
|
||||
d->lmargin = lmargin;
|
||||
d->rmargin = rmargin;
|
||||
d->wmargin = wmargin;
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
/* Remove the hooks placed in STREAM by `line_wrap_stream'. */
|
||||
|
||||
void
|
||||
line_unwrap_stream (FILE *stream)
|
||||
{
|
||||
struct data *d = stream->__cookie;
|
||||
struct line_wrap_data *d = stream->__cookie;
|
||||
unwrap_stream (stream, d);
|
||||
free (d);
|
||||
}
|
||||
|
||||
/* Functions on wrapped streams. */
|
||||
|
||||
/* Returns true if STREAM is line wrapped. */
|
||||
inline int
|
||||
line_wrapped (FILE *stream)
|
||||
{
|
||||
return (stream->__room_funcs.__output == &__line_wrap_output);
|
||||
}
|
||||
|
||||
/* If STREAM is not line-wrapped return -1, else return its left margin. */
|
||||
size_t
|
||||
line_wrap_lmargin (FILE *stream)
|
||||
{
|
||||
if (! line_wrapped (stream))
|
||||
return -1;
|
||||
return ((struct line_wrap_data *)stream->__cookie)->lmargin;
|
||||
}
|
||||
|
||||
/* If STREAM is not line-wrapped return -1, else set its left margin to
|
||||
LMARGIN and return the old value. */
|
||||
size_t
|
||||
line_wrap_set_lmargin (FILE *stream, size_t lmargin)
|
||||
{
|
||||
if (! line_wrapped (stream))
|
||||
return -1;
|
||||
else
|
||||
{
|
||||
struct line_wrap_data *d = stream->__cookie;
|
||||
size_t old = d->lmargin;
|
||||
d->lmargin = lmargin;
|
||||
return old;
|
||||
}
|
||||
}
|
||||
|
||||
/* If STREAM is not line-wrapped return -1, else return its left margin. */
|
||||
size_t
|
||||
line_wrap_rmargin (FILE *stream)
|
||||
{
|
||||
if (! line_wrapped (stream))
|
||||
return -1;
|
||||
return ((struct line_wrap_data *)stream->__cookie)->rmargin;
|
||||
}
|
||||
|
||||
/* If STREAM is not line-wrapped return -1, else set its right margin to
|
||||
RMARGIN and return the old value. */
|
||||
size_t
|
||||
line_wrap_set_rmargin (FILE *stream, size_t rmargin)
|
||||
{
|
||||
if (! line_wrapped (stream))
|
||||
return -1;
|
||||
else
|
||||
{
|
||||
struct line_wrap_data *d = stream->__cookie;
|
||||
size_t old = d->rmargin;
|
||||
d->rmargin = rmargin;
|
||||
return old;
|
||||
}
|
||||
}
|
||||
|
||||
/* If STREAM is not line-wrapped return -1, else return its wrap margin. */
|
||||
size_t
|
||||
line_wrap_wmargin (FILE *stream)
|
||||
{
|
||||
if (! line_wrapped (stream))
|
||||
return -1;
|
||||
return ((struct line_wrap_data *)stream->__cookie)->wmargin;
|
||||
}
|
||||
|
||||
/* If STREAM is not line-wrapped return -1, else set its left margin to
|
||||
WMARGIN and return the old value. */
|
||||
size_t
|
||||
line_wrap_set_wmargin (FILE *stream, size_t wmargin)
|
||||
{
|
||||
if (! line_wrapped (stream))
|
||||
return -1;
|
||||
else
|
||||
{
|
||||
struct line_wrap_data *d = stream->__cookie;
|
||||
size_t old = d->wmargin;
|
||||
d->wmargin = wmargin;
|
||||
return old;
|
||||
}
|
||||
}
|
||||
|
||||
/* If STREAM is not line-wrapped return -1, else return the column number of
|
||||
the current output point. */
|
||||
size_t
|
||||
line_wrap_point (FILE *stream)
|
||||
{
|
||||
if (! line_wrapped (stream))
|
||||
return -1;
|
||||
return ((struct line_wrap_data *)stream->__cookie)->point;
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
|
189
stdio/linewrap.h
Normal file
189
stdio/linewrap.h
Normal file
@ -0,0 +1,189 @@
|
||||
/* Word-wrapping and line-truncating streams.
|
||||
Copyright (C) 1996 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., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#ifndef __LINEWRAP_H__
|
||||
#define __LINEWRAP_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#include <string.h> /* Need size_t. */
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* We keep this data for each line-wrapping stream. */
|
||||
struct line_wrap_data
|
||||
{
|
||||
size_t lmargin, rmargin; /* Left and right margins. */
|
||||
size_t wmargin; /* Margin to wrap to, or -1 to truncate. */
|
||||
size_t point; /* Current column of last chars flushed. */
|
||||
|
||||
/* Original cookie and hooks from the stream. */
|
||||
void *cookie;
|
||||
void (*output) (FILE *, int);
|
||||
__io_close_fn *close;
|
||||
__io_fileno_fn *fileno;
|
||||
__io_seek_fn *seek;
|
||||
};
|
||||
|
||||
/* Modify STREAM so that it prefixes lines written on it with LMARGIN spaces
|
||||
and limits them to RMARGIN columns total. If WMARGIN >= 0, words that
|
||||
extend past RMARGIN are wrapped by replacing the whitespace before them
|
||||
with a newline and WMARGIN spaces. Otherwise, chars beyond RMARGIN are
|
||||
simply dropped until a newline. Returns STREAM after modifying it, or
|
||||
NULL if there was an error. */
|
||||
FILE *line_wrap_stream (FILE *stream,
|
||||
size_t lmargin, size_t rmargin, size_t wmargin);
|
||||
|
||||
/* Remove the hooks placed in STREAM by `line_wrap_stream'. */
|
||||
void line_unwrap_stream (FILE *stream);
|
||||
|
||||
/* Returns true if STREAM is line wrapped. */
|
||||
extern inline int line_wrapped (FILE *stream);
|
||||
|
||||
/* If STREAM is not line-wrapped return -1, else return its left margin. */
|
||||
extern size_t line_wrap_lmargin (FILE *stream);
|
||||
|
||||
/* If STREAM is not line-wrapped return -1, else set its left margin to
|
||||
LMARGIN and return the old value. */
|
||||
extern size_t line_wrap_set_lmargin (FILE *stream, size_t lmargin);
|
||||
|
||||
/* If STREAM is not line-wrapped return -1, else return its left margin. */
|
||||
extern size_t line_wrap_rmargin (FILE *stream);
|
||||
|
||||
/* If STREAM is not line-wrapped return -1, else set its right margin to
|
||||
RMARGIN and return the old value. */
|
||||
extern size_t line_wrap_set_rmargin (FILE *stream, size_t rmargin);
|
||||
|
||||
/* If STREAM is not line-wrapped return -1, else return its wrap margin. */
|
||||
extern size_t line_wrap_wmargin (FILE *stream);
|
||||
|
||||
/* If STREAM is not line-wrapped return -1, else set its left margin to
|
||||
WMARGIN and return the old value. */
|
||||
extern size_t line_wrap_set_wmargin (FILE *stream, size_t wmargin);
|
||||
|
||||
/* If STREAM is not line-wrapped return -1, else return the column number of
|
||||
the current output point. */
|
||||
extern size_t line_wrap_point (FILE *stream);
|
||||
|
||||
|
||||
#ifdef __OPTIMIZE__
|
||||
|
||||
extern void __line_wrap_output (FILE *, int); /* private */
|
||||
|
||||
/* Returns true if STREAM is line wrapped. */
|
||||
extern inline int
|
||||
line_wrapped (FILE *stream)
|
||||
{
|
||||
return (stream->__room_funcs.__output == &__line_wrap_output);
|
||||
}
|
||||
|
||||
/* If STREAM is not line-wrapped return -1, else return its left margin. */
|
||||
extern inline size_t
|
||||
line_wrap_lmargin (FILE *stream)
|
||||
{
|
||||
if (! line_wrapped (stream))
|
||||
return -1;
|
||||
return ((struct line_wrap_data *)stream->__cookie)->lmargin;
|
||||
}
|
||||
|
||||
/* If STREAM is not line-wrapped return -1, else set its left margin to
|
||||
LMARGIN and return the old value. */
|
||||
extern inline size_t
|
||||
line_wrap_set_lmargin (FILE *stream, size_t lmargin)
|
||||
{
|
||||
if (! line_wrapped (stream))
|
||||
return -1;
|
||||
else
|
||||
{
|
||||
struct line_wrap_data *d = stream->__cookie;
|
||||
size_t old = d->lmargin;
|
||||
d->lmargin = lmargin;
|
||||
return old;
|
||||
}
|
||||
}
|
||||
|
||||
/* If STREAM is not line-wrapped return -1, else return its left margin. */
|
||||
extern inline size_t
|
||||
line_wrap_rmargin (FILE *stream)
|
||||
{
|
||||
if (! line_wrapped (stream))
|
||||
return -1;
|
||||
return ((struct line_wrap_data *)stream->__cookie)->rmargin;
|
||||
}
|
||||
|
||||
/* If STREAM is not line-wrapped return -1, else set its right margin to
|
||||
RMARGIN and return the old value. */
|
||||
extern inline size_t
|
||||
line_wrap_set_rmargin (FILE *stream, size_t rmargin)
|
||||
{
|
||||
if (! line_wrapped (stream))
|
||||
return -1;
|
||||
else
|
||||
{
|
||||
struct line_wrap_data *d = stream->__cookie;
|
||||
size_t old = d->rmargin;
|
||||
d->rmargin = rmargin;
|
||||
return old;
|
||||
}
|
||||
}
|
||||
|
||||
/* If STREAM is not line-wrapped return -1, else return its wrap margin. */
|
||||
extern inline size_t
|
||||
line_wrap_wmargin (FILE *stream)
|
||||
{
|
||||
if (! line_wrapped (stream))
|
||||
return -1;
|
||||
return ((struct line_wrap_data *)stream->__cookie)->wmargin;
|
||||
}
|
||||
|
||||
/* If STREAM is not line-wrapped return -1, else set its left margin to
|
||||
WMARGIN and return the old value. */
|
||||
extern inline size_t
|
||||
line_wrap_set_wmargin (FILE *stream, size_t wmargin)
|
||||
{
|
||||
if (! line_wrapped (stream))
|
||||
return -1;
|
||||
else
|
||||
{
|
||||
struct line_wrap_data *d = stream->__cookie;
|
||||
size_t old = d->wmargin;
|
||||
d->wmargin = wmargin;
|
||||
return old;
|
||||
}
|
||||
}
|
||||
|
||||
/* If STREAM is not line-wrapped return -1, else return the column number of
|
||||
the current output point. */
|
||||
extern inline size_t
|
||||
line_wrap_point (FILE *stream)
|
||||
{
|
||||
if (! line_wrapped (stream))
|
||||
return -1;
|
||||
return ((struct line_wrap_data *)stream->__cookie)->point;
|
||||
}
|
||||
|
||||
#endif /* Optimizing. */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* __LINEWRAP_H__ */
|
@ -353,22 +353,6 @@ extern FILE *fmemopen __P ((__ptr_t __s, size_t __len, __const char *__modes));
|
||||
necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
|
||||
and the number of characters written on fflush or fclose. */
|
||||
extern FILE *open_memstream __P ((char **__bufloc, size_t *__sizeloc));
|
||||
|
||||
|
||||
/* Modify STREAM so that it prefixes lines written on it with *LMARGIN
|
||||
spaces and limits them to *RMARGIN columns total. If WRAP is not null,
|
||||
words that extend past *RMARGIN are wrapped by replacing the whitespace
|
||||
before them with a newline and *WRAP spaces. Otherwise, chars beyond
|
||||
*RMARGIN are simply dropped until a newline. Returns STREAM after
|
||||
modifying it, or NULL if there was an error. The pointers passed are
|
||||
stored in the stream and so must remain valid until `line_unwrap_stream'
|
||||
is called; the values pointed to can be changed between stdio calls. */
|
||||
extern FILE *line_wrap_stream __P ((FILE *__stream,
|
||||
size_t *__lmargin, size_t *__rmargin,
|
||||
size_t *__wrap));
|
||||
|
||||
/* Remove the hooks placed in STREAM by `line_wrap_stream'. */
|
||||
extern void line_unwrap_stream __P ((FILE *__stream));
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -49,7 +49,7 @@ tests := tst-strtol tst-strtod testmb testrand testsort testdiv
|
||||
|
||||
|
||||
# Several mpn functions from GNU MP are used by the strtod function.
|
||||
mpn-routines := add_1 add_n addmul_1 cmp divrem divmod_1 udiv_qrnnd \
|
||||
mpn-routines := inlines add_n addmul_1 cmp divmod_1 divrem udiv_qrnnd \
|
||||
lshift rshift mod_1 mul mul_1 mul_n sub_n submul_1
|
||||
mpn-headers = longlong.h gmp.h gmp-impl.h gmp-mparam.h asm-syntax.h
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Table of MP integer constants 10^(2^i), used for floating point <-> decimal.
|
||||
Copyright (C) 1995 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995, 1996 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
|
||||
@ -29,32 +29,32 @@ Cambridge, MA 02139, USA. */
|
||||
|
||||
/* Table with constants of 10^(2^i), i=0..12 for 32-bit limbs. */
|
||||
|
||||
static const mp_limb _ten_p0[] =
|
||||
static const mp_limb_t _ten_p0[] =
|
||||
{ 0x00000000, 0x00000000, 0x0000000a };
|
||||
static const mp_limb _ten_p1[] =
|
||||
static const mp_limb_t _ten_p1[] =
|
||||
{ 0x00000000, 0x00000000, 0x00000064 };
|
||||
static const mp_limb _ten_p2[] =
|
||||
static const mp_limb_t _ten_p2[] =
|
||||
{ 0x00000000, 0x00000000, 0x00002710 };
|
||||
static const mp_limb _ten_p3[] =
|
||||
static const mp_limb_t _ten_p3[] =
|
||||
{ 0x00000000, 0x00000000, 0x05f5e100 };
|
||||
static const mp_limb _ten_p4[] =
|
||||
static const mp_limb_t _ten_p4[] =
|
||||
{ 0x00000000, 0x00000000, 0x6fc10000, 0x002386f2 };
|
||||
static const mp_limb _ten_p5[] =
|
||||
static const mp_limb_t _ten_p5[] =
|
||||
{ 0x00000000, 0x00000000, 0x00000000, 0x85acef81, 0x2d6d415b, 0x000004ee };
|
||||
static const mp_limb _ten_p6[] =
|
||||
static const mp_limb_t _ten_p6[] =
|
||||
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xbf6a1f01, 0x6e38ed64,
|
||||
0xdaa797ed, 0xe93ff9f4, 0x00184f03 };
|
||||
static const mp_limb _ten_p7[] =
|
||||
static const mp_limb_t _ten_p7[] =
|
||||
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x2e953e01, 0x03df9909, 0x0f1538fd, 0x2374e42f, 0xd3cff5ec, 0xc404dc08,
|
||||
0xbccdb0da, 0xa6337f19, 0xe91f2603, 0x0000024e };
|
||||
static const mp_limb _ten_p8[] =
|
||||
static const mp_limb_t _ten_p8[] =
|
||||
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x982e7c01, 0xbed3875b,
|
||||
0xd8d99f72, 0x12152f87, 0x6bde50c6, 0xcf4a6e70, 0xd595d80f, 0x26b2716e,
|
||||
0xadc666b0, 0x1d153624, 0x3c42d35a, 0x63ff540e, 0xcc5573c0, 0x65f9ef17,
|
||||
0x55bc28f2, 0x80dcc7f7, 0xf46eeddc, 0x5fdcefce, 0x000553f7 };
|
||||
static const mp_limb _ten_p9[] =
|
||||
static const mp_limb_t _ten_p9[] =
|
||||
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
@ -65,7 +65,7 @@ static const mp_limb _ten_p9[] =
|
||||
0x93abade4, 0x1366732a, 0x9449775c, 0x69be5b0e, 0x7343afac, 0xb099bc81,
|
||||
0x45a71d46, 0xa2699748, 0x8cb07303, 0x8a0b1f13, 0x8cab8a97, 0xc1d238d9,
|
||||
0x633415d4, 0x0000001c };
|
||||
static const mp_limb _ten_p10[] =
|
||||
static const mp_limb_t _ten_p10[] =
|
||||
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
@ -85,7 +85,7 @@ static const mp_limb _ten_p10[] =
|
||||
0x36a8de06, 0x73c55349, 0xa7e6bd2a, 0xc1a6970c, 0x47187094, 0xd2db49ef,
|
||||
0x926c3f5b, 0xae6209d4, 0x2d433949, 0x34f4a3c6, 0xd4305d94, 0xd9d61a05,
|
||||
0x00000325 };
|
||||
static const mp_limb _ten_p11[] =
|
||||
static const mp_limb_t _ten_p11[] =
|
||||
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
@ -122,7 +122,7 @@ static const mp_limb _ten_p11[] =
|
||||
0x8c983623, 0xe50f3027, 0x94222771, 0x1d08e2d6, 0xf7e928e6, 0xf2ee5ca6,
|
||||
0x1b61b93c, 0x11eb962b, 0x9648b21c, 0xce2bcba1, 0x34f77154, 0x7bbebe30,
|
||||
0xe526a319, 0x8ce329ac, 0xde4a74d2, 0xb5dc53d5, 0x0009e8b3 };
|
||||
static const mp_limb _ten_p12[] =
|
||||
static const mp_limb_t _ten_p12[] =
|
||||
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
@ -203,32 +203,32 @@ static const mp_limb _ten_p12[] =
|
||||
|
||||
/* Table with constants of 10^(2^i), i=0..12 for 64-bit limbs. */
|
||||
|
||||
static const mp_limb _ten_p0[] =
|
||||
static const mp_limb_t _ten_p0[] =
|
||||
{ 0x0000000000000000, 0x000000000000000a };
|
||||
static const mp_limb _ten_p1[] =
|
||||
static const mp_limb_t _ten_p1[] =
|
||||
{ 0x0000000000000000, 0x0000000000000064 };
|
||||
static const mp_limb _ten_p2[] =
|
||||
static const mp_limb_t _ten_p2[] =
|
||||
{ 0x0000000000000000, 0x0000000000002710 };
|
||||
static const mp_limb _ten_p3[] =
|
||||
static const mp_limb_t _ten_p3[] =
|
||||
{ 0x0000000000000000, 0x0000000005f5e100 };
|
||||
static const mp_limb _ten_p4[] =
|
||||
static const mp_limb_t _ten_p4[] =
|
||||
{ 0x0000000000000000, 0x002386f26fc10000 };
|
||||
static const mp_limb _ten_p5[] =
|
||||
static const mp_limb_t _ten_p5[] =
|
||||
{ 0x0000000000000000, 0x85acef8100000000, 0x000004ee2d6d415b };
|
||||
static const mp_limb _ten_p6[] =
|
||||
static const mp_limb_t _ten_p6[] =
|
||||
{ 0x0000000000000000, 0x0000000000000000, 0x6e38ed64bf6a1f01,
|
||||
0xe93ff9f4daa797ed, 0x0000000000184f03 };
|
||||
static const mp_limb _ten_p7[] =
|
||||
static const mp_limb_t _ten_p7[] =
|
||||
{ 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
|
||||
0x03df99092e953e01, 0x2374e42f0f1538fd, 0xc404dc08d3cff5ec,
|
||||
0xa6337f19bccdb0da, 0x0000024ee91f2603 };
|
||||
static const mp_limb _ten_p8[] =
|
||||
static const mp_limb_t _ten_p8[] =
|
||||
{ 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
|
||||
0x0000000000000000, 0x0000000000000000, 0xbed3875b982e7c01,
|
||||
0x12152f87d8d99f72, 0xcf4a6e706bde50c6, 0x26b2716ed595d80f,
|
||||
0x1d153624adc666b0, 0x63ff540e3c42d35a, 0x65f9ef17cc5573c0,
|
||||
0x80dcc7f755bc28f2, 0x5fdcefcef46eeddc, 0x00000000000553f7 };
|
||||
static const mp_limb _ten_p9[] =
|
||||
static const mp_limb_t _ten_p9[] =
|
||||
{ 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
|
||||
0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
|
||||
0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
|
||||
@ -239,7 +239,7 @@ static const mp_limb _ten_p9[] =
|
||||
0x1366732a93abade4, 0x69be5b0e9449775c, 0xb099bc817343afac,
|
||||
0xa269974845a71d46, 0x8a0b1f138cb07303, 0xc1d238d98cab8a97,
|
||||
0x0000001c633415d4 };
|
||||
static const mp_limb _ten_p10[] =
|
||||
static const mp_limb_t _ten_p10[] =
|
||||
{ 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
|
||||
0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
|
||||
0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
|
||||
@ -259,7 +259,7 @@ static const mp_limb _ten_p10[] =
|
||||
0x73c5534936a8de06, 0xc1a6970ca7e6bd2a, 0xd2db49ef47187094,
|
||||
0xae6209d4926c3f5b, 0x34f4a3c62d433949, 0xd9d61a05d4305d94,
|
||||
0x0000000000000325 };
|
||||
static const mp_limb _ten_p11[] =
|
||||
static const mp_limb_t _ten_p11[] =
|
||||
{ 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
|
||||
0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
|
||||
0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
|
||||
@ -296,7 +296,7 @@ static const mp_limb _ten_p11[] =
|
||||
0xe50f30278c983623, 0x1d08e2d694222771, 0xf2ee5ca6f7e928e6,
|
||||
0x11eb962b1b61b93c, 0xce2bcba19648b21c, 0x7bbebe3034f77154,
|
||||
0x8ce329ace526a319, 0xb5dc53d5de4a74d2, 0x000000000009e8b3 };
|
||||
static const mp_limb _ten_p12[] =
|
||||
static const mp_limb_t _ten_p12[] =
|
||||
{ 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
|
||||
0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
|
||||
0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
|
||||
@ -374,7 +374,7 @@ static const mp_limb _ten_p12[] =
|
||||
#define _LAST_POW10 12
|
||||
|
||||
#else
|
||||
# error "mp_limb size " BITS_PER_MP_LIMB "not accounted for"
|
||||
# error "mp_limb_t size " BITS_PER_MP_LIMB "not accounted for"
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -41,7 +41,7 @@ Cambridge, MA 02139, USA. */
|
||||
strtof/strtod/strtold. */
|
||||
struct mp_power
|
||||
{
|
||||
const mp_limb *array; /* The array with the number representation. */
|
||||
const mp_limb_t *array; /* The array with the number representation. */
|
||||
mp_size_t arraysize; /* Size of the array. */
|
||||
int p_expo; /* Exponent of the number 10^(2^i). */
|
||||
int m_expo; /* Exponent of the number 10^-(2^i-1). */
|
||||
|
@ -95,12 +95,12 @@ extern FLOAT MPN2FLOAT (mp_srcptr mpn, int exponent, int negative);
|
||||
# define MAX_DIG_PER_LIMB 19
|
||||
# define MAX_FAC_PER_LIMB 10000000000000000000UL
|
||||
#else
|
||||
# error "mp_limb size " BITS_PER_MP_LIMB "not accounted for"
|
||||
# error "mp_limb_t size " BITS_PER_MP_LIMB "not accounted for"
|
||||
#endif
|
||||
|
||||
|
||||
/* Local data structure. */
|
||||
static const mp_limb _tens_in_limb[MAX_DIG_PER_LIMB + 1] =
|
||||
static const mp_limb_t _tens_in_limb[MAX_DIG_PER_LIMB + 1] =
|
||||
{ 0, 10, 100,
|
||||
1000, 10000, 100000,
|
||||
1000000, 10000000, 100000000,
|
||||
@ -132,17 +132,17 @@ static const mp_limb _tens_in_limb[MAX_DIG_PER_LIMB + 1] =
|
||||
#define MPNSIZE (howmany (MAX_EXP + 2 * MANT_DIG, BITS_PER_MP_LIMB) \
|
||||
+ 2)
|
||||
/* Declare an mpn integer variable that big. */
|
||||
#define MPN_VAR(name) mp_limb name[MPNSIZE]; mp_size_t name##size
|
||||
#define MPN_VAR(name) mp_limb_t name[MPNSIZE]; mp_size_t name##size
|
||||
/* Copy an mpn integer value. */
|
||||
#define MPN_ASSIGN(dst, src) \
|
||||
memcpy (dst, src, (dst##size = src##size) * sizeof (mp_limb))
|
||||
memcpy (dst, src, (dst##size = src##size) * sizeof (mp_limb_t))
|
||||
|
||||
|
||||
/* Return a floating point number of the needed type according to the given
|
||||
multi-precision number after possible rounding. */
|
||||
static inline FLOAT
|
||||
round_and_return (mp_limb *retval, int exponent, int negative,
|
||||
mp_limb round_limb, mp_size_t round_bit, int more_bits)
|
||||
round_and_return (mp_limb_t *retval, int exponent, int negative,
|
||||
mp_limb_t round_limb, mp_size_t round_bit, int more_bits)
|
||||
{
|
||||
if (exponent < MIN_EXP - 1)
|
||||
{
|
||||
@ -154,7 +154,7 @@ round_and_return (mp_limb *retval, int exponent, int negative,
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
more_bits |= (round_limb & ((((mp_limb) 1) << round_bit) - 1)) != 0;
|
||||
more_bits |= (round_limb & ((((mp_limb_t) 1) << round_bit) - 1)) != 0;
|
||||
if (shift == MANT_DIG)
|
||||
/* This is a special case to handle the very seldom case where
|
||||
the mantissa will be empty after the shift. */
|
||||
@ -175,7 +175,8 @@ round_and_return (mp_limb *retval, int exponent, int negative,
|
||||
round_bit = (shift - 1) % BITS_PER_MP_LIMB;
|
||||
for (i = 0; i < (shift - 1) / BITS_PER_MP_LIMB; ++i)
|
||||
more_bits |= retval[i] != 0;
|
||||
more_bits |= (round_limb & ((((mp_limb) 1) << round_bit) - 1)) != 0;
|
||||
more_bits |= ((round_limb & ((((mp_limb_t) 1) << round_bit) - 1))
|
||||
!= 0);
|
||||
|
||||
(void) __mpn_rshift (retval, &retval[shift / BITS_PER_MP_LIMB],
|
||||
RETURN_LIMB_SIZE - (shift / BITS_PER_MP_LIMB),
|
||||
@ -192,25 +193,25 @@ round_and_return (mp_limb *retval, int exponent, int negative,
|
||||
exponent = MIN_EXP - 2;
|
||||
}
|
||||
|
||||
if ((round_limb & (((mp_limb) 1) << round_bit)) != 0
|
||||
if ((round_limb & (((mp_limb_t) 1) << round_bit)) != 0
|
||||
&& (more_bits || (retval[0] & 1) != 0
|
||||
|| (round_limb & ((((mp_limb) 1) << round_bit) - 1)) != 0))
|
||||
|| (round_limb & ((((mp_limb_t) 1) << round_bit) - 1)) != 0))
|
||||
{
|
||||
mp_limb cy = __mpn_add_1 (retval, retval, RETURN_LIMB_SIZE, 1);
|
||||
mp_limb_t cy = __mpn_add_1 (retval, retval, RETURN_LIMB_SIZE, 1);
|
||||
|
||||
if (((MANT_DIG % BITS_PER_MP_LIMB) == 0 && cy) ||
|
||||
((MANT_DIG % BITS_PER_MP_LIMB) != 0 &&
|
||||
(retval[RETURN_LIMB_SIZE - 1]
|
||||
& (((mp_limb) 1) << (MANT_DIG % BITS_PER_MP_LIMB))) != 0))
|
||||
& (((mp_limb_t) 1) << (MANT_DIG % BITS_PER_MP_LIMB))) != 0))
|
||||
{
|
||||
++exponent;
|
||||
(void) __mpn_rshift (retval, retval, RETURN_LIMB_SIZE, 1);
|
||||
retval[RETURN_LIMB_SIZE - 1]
|
||||
|= ((mp_limb) 1) << ((MANT_DIG - 1) % BITS_PER_MP_LIMB);
|
||||
|= ((mp_limb_t) 1) << ((MANT_DIG - 1) % BITS_PER_MP_LIMB);
|
||||
}
|
||||
else if (exponent == MIN_EXP - 2
|
||||
&& (retval[RETURN_LIMB_SIZE - 1]
|
||||
& (((mp_limb) 1) << ((MANT_DIG - 1) % BITS_PER_MP_LIMB)))
|
||||
& (((mp_limb_t) 1) << ((MANT_DIG - 1) % BITS_PER_MP_LIMB)))
|
||||
!= 0)
|
||||
/* The number was denormalized but now normalized. */
|
||||
exponent = MIN_EXP - 1;
|
||||
@ -229,13 +230,13 @@ round_and_return (mp_limb *retval, int exponent, int negative,
|
||||
value. If the EXPONENT is small enough to be taken as an additional
|
||||
factor for the resulting number (see code) multiply by it. */
|
||||
static inline const STRING_TYPE *
|
||||
str_to_mpn (const STRING_TYPE *str, int digcnt, mp_limb *n, mp_size_t *nsize,
|
||||
str_to_mpn (const STRING_TYPE *str, int digcnt, mp_limb_t *n, mp_size_t *nsize,
|
||||
int *exponent)
|
||||
{
|
||||
/* Number of digits for actual limb. */
|
||||
int cnt = 0;
|
||||
mp_limb low = 0;
|
||||
mp_limb base;
|
||||
mp_limb_t low = 0;
|
||||
mp_limb_t base;
|
||||
|
||||
*nsize = 0;
|
||||
assert (digcnt > 0);
|
||||
@ -247,7 +248,7 @@ str_to_mpn (const STRING_TYPE *str, int digcnt, mp_limb *n, mp_size_t *nsize,
|
||||
n[0] = low;
|
||||
else
|
||||
{
|
||||
mp_limb cy;
|
||||
mp_limb_t cy;
|
||||
cy = __mpn_mul_1 (n, n, *nsize, MAX_FAC_PER_LIMB);
|
||||
cy += __mpn_add_1 (n, n, *nsize, low);
|
||||
if (cy != 0)
|
||||
@ -284,7 +285,7 @@ str_to_mpn (const STRING_TYPE *str, int digcnt, mp_limb *n, mp_size_t *nsize,
|
||||
}
|
||||
else
|
||||
{
|
||||
mp_limb cy;
|
||||
mp_limb_t cy;
|
||||
cy = __mpn_mul_1 (n, n, *nsize, base);
|
||||
cy += __mpn_add_1 (n, n, *nsize, low);
|
||||
if (cy != 0)
|
||||
@ -300,7 +301,8 @@ str_to_mpn (const STRING_TYPE *str, int digcnt, mp_limb *n, mp_size_t *nsize,
|
||||
Tege doesn't like this function so I have to write it here myself. :)
|
||||
--drepper */
|
||||
static inline void
|
||||
__mpn_lshift_1 (mp_limb *ptr, mp_size_t size, unsigned int count, mp_limb limb)
|
||||
__mpn_lshift_1 (mp_limb_t *ptr, mp_size_t size, unsigned int count,
|
||||
mp_limb_t limb)
|
||||
{
|
||||
if (count == BITS_PER_MP_LIMB)
|
||||
{
|
||||
@ -347,7 +349,7 @@ INTERNAL (STRTOF) (nptr, endptr, group)
|
||||
MPN_VAR (den);
|
||||
|
||||
/* Representation for the return value. */
|
||||
mp_limb retval[RETURN_LIMB_SIZE];
|
||||
mp_limb_t retval[RETURN_LIMB_SIZE];
|
||||
/* Number of bits currently in result value. */
|
||||
int bits;
|
||||
|
||||
@ -638,8 +640,8 @@ INTERNAL (STRTOF) (nptr, endptr, group)
|
||||
if (exponent > 0)
|
||||
{
|
||||
/* We now multiply the gained number by the given power of ten. */
|
||||
mp_limb *psrc = num;
|
||||
mp_limb *pdest = den;
|
||||
mp_limb_t *psrc = num;
|
||||
mp_limb_t *pdest = den;
|
||||
int expbit = 1;
|
||||
const struct mp_power *ttab = &_fpioconst_pow10[0];
|
||||
|
||||
@ -647,7 +649,7 @@ INTERNAL (STRTOF) (nptr, endptr, group)
|
||||
{
|
||||
if ((exponent & expbit) != 0)
|
||||
{
|
||||
mp_limb cy;
|
||||
mp_limb_t cy;
|
||||
exponent ^= expbit;
|
||||
|
||||
/* FIXME: not the whole multiplication has to be done.
|
||||
@ -672,7 +674,7 @@ INTERNAL (STRTOF) (nptr, endptr, group)
|
||||
while (exponent != 0);
|
||||
|
||||
if (psrc == den)
|
||||
memcpy (num, den, numsize * sizeof (mp_limb));
|
||||
memcpy (num, den, numsize * sizeof (mp_limb_t));
|
||||
}
|
||||
|
||||
/* Determine how many bits of the result we already have. */
|
||||
@ -702,7 +704,7 @@ INTERNAL (STRTOF) (nptr, endptr, group)
|
||||
|
||||
if (least_bit == 0)
|
||||
memcpy (retval, &num[least_idx],
|
||||
RETURN_LIMB_SIZE * sizeof (mp_limb));
|
||||
RETURN_LIMB_SIZE * sizeof (mp_limb_t));
|
||||
else
|
||||
{
|
||||
for (i = least_idx; i < numsize - 1; ++i)
|
||||
@ -730,7 +732,7 @@ INTERNAL (STRTOF) (nptr, endptr, group)
|
||||
if (target_bit == is_bit)
|
||||
{
|
||||
memcpy (&retval[RETURN_LIMB_SIZE - numsize], num,
|
||||
numsize * sizeof (mp_limb));
|
||||
numsize * sizeof (mp_limb_t));
|
||||
/* FIXME: the following loop can be avoided if we assume a
|
||||
maximal MANT_DIG value. */
|
||||
MPN_ZERO (retval, RETURN_LIMB_SIZE - numsize);
|
||||
@ -745,7 +747,7 @@ INTERNAL (STRTOF) (nptr, endptr, group)
|
||||
}
|
||||
else
|
||||
{
|
||||
mp_limb cy;
|
||||
mp_limb_t cy;
|
||||
assert (numsize < RETURN_LIMB_SIZE);
|
||||
|
||||
cy = __mpn_rshift (&retval[RETURN_LIMB_SIZE - numsize],
|
||||
@ -761,7 +763,7 @@ INTERNAL (STRTOF) (nptr, endptr, group)
|
||||
}
|
||||
|
||||
/* Store the bits we already have. */
|
||||
memcpy (retval, num, numsize * sizeof (mp_limb));
|
||||
memcpy (retval, num, numsize * sizeof (mp_limb_t));
|
||||
#if RETURN_LIMB_SIZE > 1
|
||||
if (numsize < RETURN_LIMB_SIZE)
|
||||
retval[numsize] = 0;
|
||||
@ -779,9 +781,9 @@ INTERNAL (STRTOF) (nptr, endptr, group)
|
||||
int cnt;
|
||||
int neg_exp;
|
||||
int more_bits;
|
||||
mp_limb cy;
|
||||
mp_limb *psrc = den;
|
||||
mp_limb *pdest = num;
|
||||
mp_limb_t cy;
|
||||
mp_limb_t *psrc = den;
|
||||
mp_limb_t *pdest = num;
|
||||
const struct mp_power *ttab = &_fpioconst_pow10[0];
|
||||
|
||||
assert (dig_no > int_no && exponent <= 0);
|
||||
@ -810,14 +812,14 @@ INTERNAL (STRTOF) (nptr, endptr, group)
|
||||
{
|
||||
if ((neg_exp & expbit) != 0)
|
||||
{
|
||||
mp_limb cy;
|
||||
mp_limb_t cy;
|
||||
neg_exp ^= expbit;
|
||||
|
||||
if (densize == 0)
|
||||
{
|
||||
densize = ttab->arraysize - _FPIO_CONST_OFFSET;
|
||||
memcpy (psrc, &ttab->array[_FPIO_CONST_OFFSET],
|
||||
densize * sizeof (mp_limb));
|
||||
densize * sizeof (mp_limb_t));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -836,7 +838,7 @@ INTERNAL (STRTOF) (nptr, endptr, group)
|
||||
while (neg_exp != 0);
|
||||
|
||||
if (psrc == num)
|
||||
memcpy (den, num, densize * sizeof (mp_limb));
|
||||
memcpy (den, num, densize * sizeof (mp_limb_t));
|
||||
|
||||
/* Read the fractional digits from the string. */
|
||||
(void) str_to_mpn (startp, dig_no - int_no, num, &numsize, &exponent);
|
||||
@ -873,7 +875,7 @@ INTERNAL (STRTOF) (nptr, endptr, group)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
mp_limb d, n, quot;
|
||||
mp_limb_t d, n, quot;
|
||||
int used = 0;
|
||||
|
||||
n = num[0];
|
||||
@ -930,8 +932,8 @@ INTERNAL (STRTOF) (nptr, endptr, group)
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
mp_limb d0, d1, n0, n1;
|
||||
mp_limb quot = 0;
|
||||
mp_limb_t d0, d1, n0, n1;
|
||||
mp_limb_t quot = 0;
|
||||
int used = 0;
|
||||
|
||||
d0 = den[0];
|
||||
@ -976,14 +978,14 @@ INTERNAL (STRTOF) (nptr, endptr, group)
|
||||
|
||||
while (bits <= MANT_DIG)
|
||||
{
|
||||
mp_limb r;
|
||||
mp_limb_t r;
|
||||
|
||||
if (n1 == d1)
|
||||
{
|
||||
/* QUOT should be either 111..111 or 111..110. We need
|
||||
special treatment of this rare case as normal division
|
||||
would give overflow. */
|
||||
quot = ~(mp_limb) 0;
|
||||
quot = ~(mp_limb_t) 0;
|
||||
|
||||
r = n0 + d1;
|
||||
if (r < d1) /* Carry in the addition? */
|
||||
@ -1024,8 +1026,8 @@ INTERNAL (STRTOF) (nptr, endptr, group)
|
||||
default:
|
||||
{
|
||||
int i;
|
||||
mp_limb cy, dX, d1, n0, n1;
|
||||
mp_limb quot = 0;
|
||||
mp_limb_t cy, dX, d1, n0, n1;
|
||||
mp_limb_t quot = 0;
|
||||
int used = 0;
|
||||
|
||||
dX = den[densize - 1];
|
||||
@ -1105,10 +1107,10 @@ INTERNAL (STRTOF) (nptr, endptr, group)
|
||||
if (n0 == dX)
|
||||
/* This might over-estimate QUOT, but it's probably not
|
||||
worth the extra code here to find out. */
|
||||
quot = ~(mp_limb) 0;
|
||||
quot = ~(mp_limb_t) 0;
|
||||
else
|
||||
{
|
||||
mp_limb r;
|
||||
mp_limb_t r;
|
||||
|
||||
udiv_qrnnd (quot, r, n0, num[densize - 1], dX);
|
||||
umul_ppmm (n1, n0, d1, quot);
|
||||
|
@ -23,7 +23,7 @@
|
||||
/* Puts pointers to each string in ARGZ into ARGV, which must be large enough
|
||||
to hold them all. */
|
||||
void
|
||||
__argz_extract (const char *argz, size_t len, char **argv)
|
||||
__argz_extract (char *argz, size_t len, char **argv)
|
||||
{
|
||||
while (len > 0)
|
||||
{
|
||||
|
@ -50,8 +50,8 @@ size_t argz_count __P ((__const char *argz, size_t len));
|
||||
|
||||
/* Puts pointers to each string in ARGZ into ARGV, which must be large enough
|
||||
to hold them all. */
|
||||
void __argz_extract __P ((__const char *argz, size_t len, char **argv));
|
||||
void argz_extract __P ((__const char *argz, size_t len, char **argv));
|
||||
void __argz_extract __P ((char *argz, size_t len, char **argv));
|
||||
void argz_extract __P ((char *argz, size_t len, char **argv));
|
||||
|
||||
/* Make '\0' separated arg vector ARGZ printable by converting all the '\0's
|
||||
except the last into the character SEP. */
|
||||
|
@ -1,61 +0,0 @@
|
||||
/* mpn_add_1 --
|
||||
|
||||
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU MP Library.
|
||||
|
||||
The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#define __mpn_add_1 __noname
|
||||
#include "gmp.h"
|
||||
#undef __mpn_add_1
|
||||
|
||||
#include "gmp-impl.h"
|
||||
|
||||
mp_limb
|
||||
__mpn_add_1 (res_ptr, s1_ptr, s1_size, s2_limb)
|
||||
register mp_ptr res_ptr;
|
||||
register mp_srcptr s1_ptr;
|
||||
register mp_size_t s1_size;
|
||||
register mp_limb s2_limb;
|
||||
{
|
||||
register mp_limb x;
|
||||
|
||||
x = *s1_ptr++;
|
||||
s2_limb = x + s2_limb;
|
||||
*res_ptr++ = s2_limb;
|
||||
if (s2_limb < x)
|
||||
{
|
||||
while (--s1_size != 0)
|
||||
{
|
||||
x = *s1_ptr++ + 1;
|
||||
*res_ptr++ = x;
|
||||
if (x != 0)
|
||||
goto fin;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
fin:
|
||||
if (res_ptr != s1_ptr)
|
||||
{
|
||||
mp_size_t i;
|
||||
for (i = 0; i < s1_size - 1; i++)
|
||||
res_ptr[i] = s1_ptr[i];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -94,10 +94,32 @@ enum
|
||||
#define _SC_SEMAPHORES _SC_SEMAPHORES
|
||||
_SC_SHARED_MEMORY_OBJECTS,
|
||||
#define _SC_SHARED_MEMORY_OBJECTS _SC_SHARED_MEMORY_OBJECTS
|
||||
_SC_AIO_LISTIO_MAX,
|
||||
#define _SC_AIO_LIST_MAX _SC_AIO_LIST_MAX
|
||||
_SC_AIO_MAX,
|
||||
#define _SC_AIO_MAX _SC_AIO_MAX
|
||||
_SC_AIO_PRIO_DELTA_MAX,
|
||||
#define _SC_AIO_PRIO_DELTA_MAX _SC_AIO_PRIO_DELTA_MAX
|
||||
_SC_DELAYTIMER_MAX,
|
||||
#define _SC_DELAYTIMER_MAX _SC_DELAYTIMER_MAX
|
||||
_SC_MQ_OPEN_MAX,
|
||||
#define _SC_MQ_OPEN_MAX _SC_MQ_OPEN_MAX
|
||||
_SC_MQ_PRIO_MAX,
|
||||
#define _SC_MQ_PRIO_MAX _SC_MQ_PRIO_MAX
|
||||
_SC_VERSION,
|
||||
#define _SC_VERSION _SC_VERSION
|
||||
_SC_PAGESIZE,
|
||||
#define _SC_PAGESIZE _SC_PAGESIZE
|
||||
_SC_RTSIG_MAX,
|
||||
#define _SC_RTSIG_MAX _SC_RTSIG_MAX
|
||||
_SC_SEM_NSEMS_MAX,
|
||||
#define _SC_SEM_NSEMS_MAX _SC_SEM_NSEMS_MAX
|
||||
_SC_SEM_VALUE_MAX,
|
||||
#define _SC_SEM_VALUE_MAX _SC_SEM_VALUE_MAX
|
||||
_SC_SIGQUEUE_MAX,
|
||||
#define _SC_SIGQUEUE_MAX _SC_SIGQUEUE_MAX
|
||||
_SC_TIMER_MAX,
|
||||
#define _SC_TIMER_MAX _SC_TIMER_MAX
|
||||
|
||||
/* Values for the argument to `sysconf'
|
||||
corresponding to _POSIX2_* symbols. */
|
||||
|
3
sysdeps/generic/inlines.c
Normal file
3
sysdeps/generic/inlines.c
Normal file
@ -0,0 +1,3 @@
|
||||
#define _FORCE_INLINES
|
||||
#define _EXTERN_INLINE /* empty */
|
||||
#include "gmp.h"
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993, 1994, 1995, 1996 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
|
||||
@ -27,14 +27,14 @@ void
|
||||
_hurd_exit (int status)
|
||||
{
|
||||
/* Give the proc server our exit status. */
|
||||
__USEPORT (PROC, __proc_mark_exit (port, status));
|
||||
__USEPORT (PROC, __proc_mark_exit (port, status, 0));
|
||||
|
||||
/* Commit suicide. */
|
||||
__task_terminate (__mach_task_self ());
|
||||
|
||||
/* Perhaps the cached mach_task_self was bogus. */
|
||||
__task_terminate ((__mach_task_self) ());
|
||||
|
||||
|
||||
/* This sucker really doesn't want to die. */
|
||||
while (1)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1992, 94, 95, 96 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
|
||||
@ -67,7 +67,7 @@ DEFUN(bind, (fd, addr, len),
|
||||
if (! err)
|
||||
{
|
||||
/* Link the node, now a socket, into the target directory. */
|
||||
err = __dir_link (dir, node, n);
|
||||
err = __dir_link (dir, node, n, 1);
|
||||
if (err == EEXIST)
|
||||
err = EADDRINUSE;
|
||||
}
|
||||
|
@ -548,7 +548,7 @@ void
|
||||
_exit (int status)
|
||||
{
|
||||
__proc_mark_exit (_dl_hurd_data->portarray[INIT_PORT_PROC],
|
||||
W_EXITCODE (status, 0));
|
||||
W_EXITCODE (status, 0), 0);
|
||||
while (__task_terminate (__mach_task_self ()))
|
||||
__mach_task_self_ = (__mach_task_self) ();
|
||||
}
|
||||
|
32
sysdeps/mach/hurd/fdatasync.c
Normal file
32
sysdeps/mach/hurd/fdatasync.c
Normal file
@ -0,0 +1,32 @@
|
||||
/* Copyright (C) 1991, 92, 93, 94, 96 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., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <hurd.h>
|
||||
#include <hurd/fd.h>
|
||||
|
||||
/* Make all changes done to FD's file data actually appear on disk. */
|
||||
int
|
||||
fdatasync (int fd)
|
||||
{
|
||||
error_t err = HURD_DPORT_USE (fd, __file_sync (port, 1, 1));
|
||||
if (err)
|
||||
return __hurd_dfail (fd, err);
|
||||
return 0;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 1992, 1994, 1995 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 92, 94, 95, 96 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
|
||||
@ -27,7 +27,7 @@ long int
|
||||
__fpathconf (int fd, int name)
|
||||
{
|
||||
error_t err;
|
||||
long int value;
|
||||
int value;
|
||||
|
||||
if (err = HURD_DPORT_USE (fd, __io_pathconf (port, name, &value)))
|
||||
return __hurd_dfail (fd, err), -1L;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 92, 93, 94, 96 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
|
||||
@ -26,7 +26,7 @@ Cambridge, MA 02139, USA. */
|
||||
int
|
||||
DEFUN(fsync, (fd), int fd)
|
||||
{
|
||||
error_t err = HURD_DPORT_USE (fd, __file_sync (port, 1));
|
||||
error_t err = HURD_DPORT_USE (fd, __file_sync (port, 1, 0));
|
||||
if (err)
|
||||
return __hurd_dfail (fd, err);
|
||||
return 0;
|
||||
|
@ -39,11 +39,10 @@ char *
|
||||
__getcwd (char *buf, size_t size)
|
||||
{
|
||||
error_t err;
|
||||
dev_t rootdev, thisdev;
|
||||
mach_port_t rootid, thisid, rootdevid, thisdevid;
|
||||
ino_t rootino, thisino;
|
||||
char *file_name;
|
||||
register char *file_namep;
|
||||
struct stat st;
|
||||
file_t parent;
|
||||
char *dirbuf = NULL;
|
||||
unsigned int dirbufsize = 0;
|
||||
@ -51,6 +50,10 @@ __getcwd (char *buf, size_t size)
|
||||
inline void cleanup (void)
|
||||
{
|
||||
__mach_port_deallocate (__mach_task_self (), parent);
|
||||
__mach_port_deallocate (__mach_task_self (), thisid);
|
||||
__mach_port_deallocate (__mach_task_self (), thisdevid);
|
||||
__mach_port_deallocate (__mach_task_self (), rootid);
|
||||
__mach_port_deallocate (__mach_task_self (), rootdevid);
|
||||
|
||||
if (dirbuf != NULL)
|
||||
__vm_deallocate (__mach_task_self (),
|
||||
@ -81,37 +84,30 @@ __getcwd (char *buf, size_t size)
|
||||
file_namep = file_name + size;
|
||||
*--file_namep = '\0';
|
||||
|
||||
/* Get a port to our root directory and stat it. */
|
||||
/* Get a port to our root directory and get its identity. */
|
||||
|
||||
if (err = __USEPORT (CRDIR, __io_stat (port, &st)))
|
||||
if (err = __USEPORT (CRDIR, __io_identity (port,
|
||||
&rootid, &rootdevid, &rootino)))
|
||||
return __hurd_fail (err), NULL;
|
||||
rootdev = st.st_dev;
|
||||
rootino = st.st_ino;
|
||||
__mach_port_deallocate (__mach_task_self (), rootdevid);
|
||||
|
||||
/* Get a port to our current working directory and stat it. */
|
||||
|
||||
if (err = __USEPORT (CWDIR, __mach_port_mod_refs (__mach_task_self (),
|
||||
(parent = port),
|
||||
MACH_PORT_RIGHT_SEND,
|
||||
1)))
|
||||
return __hurd_fail (err), NULL;
|
||||
if (err = __io_stat (parent, &st))
|
||||
if (err = __USEPORT (CRDIR, __io_identity (port,
|
||||
&thisid, &thisdevid, &thisino)))
|
||||
{
|
||||
cleanup ();
|
||||
__mach_port_deallocate (__mach_task_self (), rootid);
|
||||
return __hurd_fail (err), NULL;
|
||||
}
|
||||
|
||||
thisdev = st.st_dev;
|
||||
thisino = st.st_ino;
|
||||
|
||||
while (!(thisdev == rootdev && thisino == rootino))
|
||||
while (thisid != rootid)
|
||||
{
|
||||
/* PARENT is a port to the directory we are currently on;
|
||||
THISDEV and THISINO are its device and node numbers.
|
||||
Look in its parent (..) for a file with the same numbers. */
|
||||
THISID, THISDEV, and THISINO are its identity.
|
||||
Look in its parent (..) for a file with the same file number. */
|
||||
|
||||
struct dirent *d;
|
||||
dev_t dotdev;
|
||||
mach_port_t dotid, dotdevid;
|
||||
ino_t dotino;
|
||||
int mount_point;
|
||||
file_t newp;
|
||||
@ -127,12 +123,12 @@ __getcwd (char *buf, size_t size)
|
||||
__mach_port_deallocate (__mach_task_self (), parent);
|
||||
parent = newp;
|
||||
|
||||
/* Figure out if this directory is a mount point. */
|
||||
if (err = __io_stat (parent, &st))
|
||||
/* Get this directory's identity and figure out if it's a mount point. */
|
||||
if (err = __io_identity (parent, &dotid, &dotdevid, &dotino))
|
||||
goto errlose;
|
||||
dotdev = st.st_dev;
|
||||
dotino = st.st_ino;
|
||||
mount_point = dotdev != thisdev;
|
||||
__mach_port_deallocate (__mach_task_self (), dotid);
|
||||
__mach_port_deallocate (__mach_task_self (), dotdevid);
|
||||
mount_point = dotdevid != thisdevid;
|
||||
|
||||
/* Search for the last directory. */
|
||||
direntry = 0;
|
||||
@ -178,13 +174,17 @@ __getcwd (char *buf, size_t size)
|
||||
{
|
||||
file_t try = __file_name_lookup_under (parent, d->d_name,
|
||||
O_NOLINK, 0);
|
||||
file_t id, devid;
|
||||
ino_t fileno;
|
||||
if (try == MACH_PORT_NULL)
|
||||
goto lose;
|
||||
err = __io_stat (try, &st);
|
||||
err = __io_identity (try, &id, &devid, &fileno);
|
||||
__mach_port_deallocate (__mach_task_self (), try);
|
||||
if (err)
|
||||
goto errlose;
|
||||
if (st.st_dev == thisdev && st.st_ino == thisino)
|
||||
__mach_port_deallocate (__mach_task_self (), id);
|
||||
__mach_port_deallocate (__mach_task_self (), devid);
|
||||
if (id == thisid)
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
@ -232,7 +232,10 @@ __getcwd (char *buf, size_t size)
|
||||
|
||||
/* The next iteration will find the name of the directory we
|
||||
just searched through. */
|
||||
thisdev = dotdev;
|
||||
__mach_port_deallocate (__mach_task_self (), thisid);
|
||||
__mach_port_deallocate (__mach_task_self (), thisdevid);
|
||||
thisid = dotid;
|
||||
thisdevid = dotdevid;
|
||||
thisino = dotino;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Translate Mach exception codes into signal numbers. i386 version.
|
||||
Copyright (C) 1991, 1992, 1994 Free Software Foundation, Inc.
|
||||
Copyright (C) 1991, 1992, 1994, 1996 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
|
||||
@ -25,48 +25,47 @@ Cambridge, MA 02139, USA. */
|
||||
into a signal number and signal subcode. */
|
||||
|
||||
void
|
||||
_hurd_exception2signal (int exception, int code, int subcode,
|
||||
int *signo, long int *sigcode, int *error)
|
||||
_hurd_exception2signal (struct hurd_signal_detail *detail, int *signo)
|
||||
{
|
||||
*error = 0;
|
||||
detail->error = 0;
|
||||
|
||||
switch (exception)
|
||||
switch (detail->exc)
|
||||
{
|
||||
default:
|
||||
*signo = SIGIOT;
|
||||
*sigcode = exception;
|
||||
detail->code = detail->exc;
|
||||
break;
|
||||
|
||||
|
||||
case EXC_BAD_ACCESS:
|
||||
if (code == KERN_PROTECTION_FAILURE)
|
||||
if (detail->exc_code == KERN_PROTECTION_FAILURE)
|
||||
*signo = SIGSEGV;
|
||||
else
|
||||
*signo = SIGBUS;
|
||||
*sigcode = subcode;
|
||||
*error = code;
|
||||
detail->code = detail->exc_subcode;
|
||||
detail->error = detail->exc_code;
|
||||
break;
|
||||
|
||||
case EXC_BAD_INSTRUCTION:
|
||||
*signo = SIGILL;
|
||||
if (code == EXC_I386_INVOP)
|
||||
*sigcode = ILL_INVOPR_FAULT;
|
||||
else if (code == EXC_I386_STKFLT)
|
||||
*sigcode = ILL_STACK_FAULT;
|
||||
if (detail->exc_code == EXC_I386_INVOP)
|
||||
detail->code = ILL_INVOPR_FAULT;
|
||||
else if (detail->exc_code == EXC_I386_STKFLT)
|
||||
detail->code = ILL_STACK_FAULT;
|
||||
else
|
||||
*sigcode = 0;
|
||||
detail->code = 0;
|
||||
break;
|
||||
|
||||
|
||||
case EXC_ARITHMETIC:
|
||||
switch (code)
|
||||
switch (detail->exc_code)
|
||||
{
|
||||
case EXC_I386_DIV: /* integer divide by zero */
|
||||
*signo = SIGFPE;
|
||||
*sigcode = FPE_INTDIV_FAULT;
|
||||
detail->code = FPE_INTDIV_FAULT;
|
||||
break;
|
||||
|
||||
|
||||
case EXC_I386_INTO: /* integer overflow */
|
||||
*signo = SIGFPE;
|
||||
*sigcode = FPE_INTOVF_TRAP;
|
||||
detail->code = FPE_INTOVF_TRAP;
|
||||
break;
|
||||
|
||||
/* These aren't anywhere documented or used in Mach 3.0. */
|
||||
@ -74,92 +73,92 @@ _hurd_exception2signal (int exception, int code, int subcode,
|
||||
case EXC_I386_EXTOVR:
|
||||
default:
|
||||
*signo = SIGFPE;
|
||||
*sigcode = 0;
|
||||
detail->code = 0;
|
||||
break;
|
||||
|
||||
case EXC_I386_EXTERR:
|
||||
/* Subcode is the fp_status word saved by the hardware.
|
||||
Give an error code corresponding to the first bit set. */
|
||||
if (subcode & FPS_IE)
|
||||
if (detail->exc_subcode & FPS_IE)
|
||||
{
|
||||
*signo = SIGILL;
|
||||
*sigcode = ILL_FPEOPR_FAULT;
|
||||
detail->code = ILL_FPEOPR_FAULT;
|
||||
}
|
||||
else if (subcode & FPS_DE)
|
||||
else if (detail->exc_subcode & FPS_DE)
|
||||
{
|
||||
*signo = SIGFPE;
|
||||
*sigcode = FPE_FLTDNR_FAULT;
|
||||
detail->code = FPE_FLTDNR_FAULT;
|
||||
}
|
||||
else if (subcode & FPS_ZE)
|
||||
else if (detail->exc_subcode & FPS_ZE)
|
||||
{
|
||||
*signo = SIGFPE;
|
||||
*sigcode = FPE_FLTDIV_FAULT;
|
||||
detail->code = FPE_FLTDIV_FAULT;
|
||||
}
|
||||
else if (subcode & FPS_OE)
|
||||
else if (detail->exc_subcode & FPS_OE)
|
||||
{
|
||||
*signo = SIGFPE;
|
||||
*sigcode = FPE_FLTOVF_FAULT;
|
||||
detail->code = FPE_FLTOVF_FAULT;
|
||||
}
|
||||
else if (subcode & FPS_UE)
|
||||
else if (detail->exc_subcode & FPS_UE)
|
||||
{
|
||||
*signo = SIGFPE;
|
||||
*sigcode = FPE_FLTUND_FAULT;
|
||||
detail->code = FPE_FLTUND_FAULT;
|
||||
}
|
||||
else if (subcode & FPS_PE)
|
||||
else if (detail->exc_subcode & FPS_PE)
|
||||
{
|
||||
*signo = SIGFPE;
|
||||
*sigcode = FPE_FLTINX_FAULT;
|
||||
detail->code = FPE_FLTINX_FAULT;
|
||||
}
|
||||
else
|
||||
{
|
||||
*signo = SIGFPE;
|
||||
*sigcode = 0;
|
||||
detail->code = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
/* These two can only be arithmetic exceptions if we
|
||||
/* These two can only be arithmetic exceptions if we
|
||||
are in V86 mode, which sounds like emulation to me.
|
||||
(See Mach 3.0 i386/trap.c.) */
|
||||
case EXC_I386_EMERR:
|
||||
*signo = SIGFPE;
|
||||
*sigcode = FPE_EMERR_FAULT;
|
||||
detail->code = FPE_EMERR_FAULT;
|
||||
break;
|
||||
case EXC_I386_BOUND:
|
||||
*signo = SIGFPE;
|
||||
*sigcode = FPE_EMBND_FAULT;
|
||||
detail->code = FPE_EMBND_FAULT;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case EXC_EMULATION:
|
||||
case EXC_EMULATION:
|
||||
/* 3.0 doesn't give this one, why, I don't know. */
|
||||
*signo = SIGEMT;
|
||||
*sigcode = 0;
|
||||
detail->code = 0;
|
||||
break;
|
||||
|
||||
case EXC_SOFTWARE:
|
||||
/* The only time we get this in Mach 3.0
|
||||
is for an out of bounds trap. */
|
||||
if (code == EXC_I386_BOUND)
|
||||
if (detail->exc_code == EXC_I386_BOUND)
|
||||
{
|
||||
*signo = SIGFPE;
|
||||
*sigcode = FPE_SUBRNG_FAULT;
|
||||
detail->code = FPE_SUBRNG_FAULT;
|
||||
}
|
||||
else
|
||||
{
|
||||
*signo = SIGEMT;
|
||||
*sigcode = 0;
|
||||
detail->code = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case EXC_BREAKPOINT:
|
||||
*signo = SIGTRAP;
|
||||
if (code == EXC_I386_SGL)
|
||||
*sigcode = DBG_SINGLE_TRAP;
|
||||
else if (code == EXC_I386_BPT)
|
||||
*sigcode = DBG_BRKPNT_FAULT;
|
||||
if (detail->exc_code == EXC_I386_SGL)
|
||||
detail->code = DBG_SINGLE_TRAP;
|
||||
else if (detail->exc_code == EXC_I386_BPT)
|
||||
detail->code = DBG_BRKPNT_FAULT;
|
||||
else
|
||||
*sigcode = 0;
|
||||
detail->code = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ Cambridge, MA 02139, USA. */
|
||||
|
||||
struct sigcontext *
|
||||
_hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
|
||||
int signo, long int sigcode,
|
||||
int signo, struct hurd_signal_detail *detail,
|
||||
volatile int rpc_wait,
|
||||
struct machine_thread_all_state *state)
|
||||
{
|
||||
@ -137,7 +137,7 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
|
||||
|
||||
/* Set up the arguments for the signal handler. */
|
||||
stackframe->signo = signo;
|
||||
stackframe->sigcode = sigcode;
|
||||
stackframe->sigcode = detail->code;
|
||||
stackframe->scp = stackframe->return_scp = scp = &stackframe->ctx;
|
||||
stackframe->sigreturn_addr = &__sigreturn;
|
||||
stackframe->sigreturn_returns_here = &&firewall; /* Crash on return. */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 92, 93, 94, 95, 96 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
|
||||
@ -45,7 +45,7 @@ DEFUN(__link, (from, to), CONST char *from AND CONST char *to)
|
||||
todir = __file_name_split (to, &toname);
|
||||
if (todir != MACH_PORT_NULL)
|
||||
{
|
||||
err = __dir_link (todir, linknode, toname);
|
||||
err = __dir_link (todir, linknode, toname, 1);
|
||||
__mach_port_deallocate (__mach_task_self (), todir);
|
||||
}
|
||||
__mach_port_deallocate (__mach_task_self (), linknode);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 92, 93, 94, 96 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
|
||||
@ -38,7 +38,7 @@ DEFUN(rename, (old, new), CONST char *old AND CONST char *new)
|
||||
return -1;
|
||||
}
|
||||
|
||||
err = __dir_rename (olddir, oldname, newdir, newname);
|
||||
err = __dir_rename (olddir, oldname, newdir, newname, 0);
|
||||
__mach_port_deallocate (__mach_task_self (), olddir);
|
||||
__mach_port_deallocate (__mach_task_self (), newdir);
|
||||
if (err)
|
||||
|
@ -114,8 +114,7 @@ timer_thread (void)
|
||||
static sighandler_t
|
||||
restart_itimer (struct hurd_signal_preempter *preempter,
|
||||
struct hurd_sigstate *ss,
|
||||
int *signo, long int *sigcode,
|
||||
int *sigerror)
|
||||
int *signo, struct hurd_signal_detail *detail)
|
||||
{
|
||||
static int setitimer_locked (const struct itimerval *new,
|
||||
struct itimerval *old, void *crit);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 92, 93, 94, 95, 96 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
|
||||
@ -47,15 +47,15 @@ DEFUN(__symlink, (from, to), CONST char *from AND CONST char *to)
|
||||
|
||||
if (! err)
|
||||
/* Set the node's translator to make it a symlink. */
|
||||
err = __file_set_translator (node,
|
||||
FS_TRANS_EXCL|FS_TRANS_SET,
|
||||
err = __file_set_translator (node,
|
||||
FS_TRANS_EXCL|FS_TRANS_SET,
|
||||
FS_TRANS_EXCL|FS_TRANS_SET, 0,
|
||||
buf, sizeof (_HURD_SYMLINK) + len,
|
||||
MACH_PORT_NULL, MACH_MSG_TYPE_COPY_SEND);
|
||||
|
||||
if (! err)
|
||||
/* Link the node, now a valid symlink, into the target directory. */
|
||||
err = __dir_link (dir, node, name);
|
||||
err = __dir_link (dir, node, name, 1);
|
||||
|
||||
__mach_port_deallocate (__mach_task_self (), dir);
|
||||
__mach_port_deallocate (__mach_task_self (), node);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993, 1994, 1995, 1996 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
|
||||
@ -30,8 +30,9 @@ __wait4 (pid_t pid, __WAIT_STATUS_DEFN stat_loc,
|
||||
pid_t dead;
|
||||
error_t err;
|
||||
struct rusage ignored;
|
||||
natural_t sigcode;
|
||||
|
||||
err = __USEPORT (PROC, __proc_wait (port, pid, options, stat_loc,
|
||||
err = __USEPORT (PROC, __proc_wait (port, pid, options, stat_loc, &sigcode,
|
||||
usage ?: &ignored, &dead));
|
||||
|
||||
return err ? (pid_t) __hurd_fail (err) : dead;
|
||||
|
@ -102,7 +102,7 @@ __xmknod (int vers, const char *file_name, mode_t mode, dev_t *dev)
|
||||
|
||||
if (! err)
|
||||
/* Link the node, now a valid device, into the target directory. */
|
||||
err = __dir_link (dir, node, name);
|
||||
err = __dir_link (dir, node, name, 1);
|
||||
|
||||
__mach_port_deallocate (__mach_task_self (), dir);
|
||||
__mach_port_deallocate (__mach_task_self (), node);
|
||||
|
@ -21,6 +21,7 @@ Cambridge, MA 02139, USA. */
|
||||
#include <stddef.h>
|
||||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
#include <sys/statfs.h>
|
||||
|
||||
|
||||
/* Get file-specific information about descriptor FD. */
|
||||
@ -73,7 +74,14 @@ DEFUN(__fpathconf, (fd, name), int fd AND int name)
|
||||
|
||||
case _PC_PATH_MAX:
|
||||
#ifdef PATH_MAX
|
||||
return PATH_MAX;
|
||||
{
|
||||
struct statfs buf;
|
||||
|
||||
if (__fstatfs (fd, &buf) < 0)
|
||||
return errno == ENOSYS ? PATH_MAX : -1;
|
||||
else
|
||||
return buf.f_namelen;
|
||||
}
|
||||
#else
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
|
@ -196,6 +196,83 @@ DEFUN(__sysconf, (name), int name)
|
||||
case _SC_PAGESIZE:
|
||||
return __getpagesize ();
|
||||
|
||||
case _SC_AIO_LISTIO_MAX:
|
||||
#ifdef AIO_LISTIO_MAX
|
||||
return AIO_LISTIO_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_AIO_MAX:
|
||||
#ifdef AIO_MAX
|
||||
return AIO_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_AIO_PRIO_DELTA_MAX:
|
||||
#ifdef AIO_PRIO_DELTA_MAX
|
||||
return AIO_PRIO_DELTA_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_DELAYTIMER_MAX:
|
||||
#ifdef DELAYTIMER_MAX
|
||||
return DELAYTIMER_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_MQ_OPEN_MAX:
|
||||
#ifdef MQ_OPEN_MAX
|
||||
return MQ_OPEN_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_MQ_PRIO_MAX:
|
||||
#ifdef MQ_PRIO_MAX
|
||||
return MQ_PRIO_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_RTSIG_MAX:
|
||||
#ifdef RTSIG_MAX
|
||||
return RTSIG_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_SEM_NSEMS_MAX:
|
||||
#ifdef SEM_NSEMS_MAX
|
||||
return SEM_NSEMS_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_SEM_VALUE_MAX:
|
||||
#ifdef SEM_VALUE_MAX
|
||||
return SEM_VALUE_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_SIGQUEUE_MAX:
|
||||
#ifdef SIGQUEUE_MAX
|
||||
return SIGQUEUE_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_TIMER_MAX:
|
||||
#ifdef TIMER_MAX
|
||||
return TIMER_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_BC_BASE_MAX:
|
||||
#ifdef BC_BASE_MAX
|
||||
return BC_BASE_MAX;
|
||||
|
30
sysdeps/stub/swapoff.c
Normal file
30
sysdeps/stub/swapoff.c
Normal file
@ -0,0 +1,30 @@
|
||||
/* Copyright (C) 1996 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. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* Stop using block special device PATH for swapping. */
|
||||
int
|
||||
swapoff (const char *path)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
stub_warning (swapoff)
|
@ -48,6 +48,7 @@ settimeofday - settimeofday 2 __settimeofday settimeofday
|
||||
setuid - setuid 1 __setuid setuid
|
||||
sigsuspend - sigsuspend 1 sigsuspend
|
||||
sstk - sstk 1 sstk
|
||||
swapoff - swapoff 1 swapoff
|
||||
swapon - swapon 1 swapon
|
||||
symlink - symlink 2 __symlink symlink
|
||||
sync - sync 0 sync
|
||||
|
@ -1,3 +1,4 @@
|
||||
sys/acct.h
|
||||
sys/socketcall.h
|
||||
sys/sysctl.h
|
||||
sys/timex.h
|
||||
|
@ -15,8 +15,9 @@ sysdep_routines += fxstat lxstat xstat
|
||||
endif
|
||||
|
||||
ifeq ($(subdir), misc)
|
||||
sysdep_routines += xmknod s_ptrace s_sysctl sysctl
|
||||
headers += sys/mount.h
|
||||
sysdep_routines += mount umount xmknod s_ptrace s_sysctl sysctl llseek \
|
||||
setfsgid setfsuid sysinfo uselib
|
||||
headers += sys/mount.h sys/sysinfo.h
|
||||
endif
|
||||
|
||||
ifeq ($(subdir), time)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
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
|
||||
@ -80,14 +80,14 @@ gethostid ()
|
||||
/* This also fails. Return and arbitrary value. */
|
||||
return 0;
|
||||
|
||||
/* To get the IP address we need to knoe the host name. */
|
||||
/* To get the IP address we need to know the host name. */
|
||||
hp = gethostbyname (hostname);
|
||||
if (hp == NULL)
|
||||
return 0;
|
||||
|
||||
in.s_addr = 0;
|
||||
memcpy (&in, hp->h_addr,
|
||||
sizeof (in) < hp->h_length ? sizeof (in) : hp->h_length);
|
||||
(int) sizeof (in) < hp->h_length ? sizeof (in) : hp->h_length);
|
||||
|
||||
/* For the return value to be not exactly the IP address we do some
|
||||
bit fiddling. */
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Set the shared library version numbers for Linux/i386.
|
||||
|
||||
libc.so-version = .6
|
||||
libm.so-version = .6
|
||||
ifeq ($(subdir), misc)
|
||||
sysdep_routines += ioperm iopl vm86
|
||||
headers += sys/perm.h sys/vm86.h
|
||||
endif
|
||||
|
36
sysdeps/unix/sysv/linux/i386/sys/perm.h
Normal file
36
sysdeps/unix/sysv/linux/i386/sys/perm.h
Normal file
@ -0,0 +1,36 @@
|
||||
/* Copyright (C) 1996 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 _SYS_PERM_H
|
||||
|
||||
#define _SYS_PERM_H 1
|
||||
#include <features.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Set port input/output permissions. */
|
||||
extern int ioperm __P ((unsigned long __from, unsigned long __num,
|
||||
int __turn_on));
|
||||
|
||||
|
||||
/* Change I/O privilege level. */
|
||||
extern int iopl __P ((int __level));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* sys/perm.h */
|
34
sysdeps/unix/sysv/linux/i386/sys/vm86.h
Normal file
34
sysdeps/unix/sysv/linux/i386/sys/vm86.h
Normal file
@ -0,0 +1,34 @@
|
||||
/* Copyright (C) 1996 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 _SYS_VM86_H
|
||||
|
||||
#define _SYS_VM86_H 1
|
||||
#include <features.h>
|
||||
|
||||
/* Get constants and data types from kernel header file. */
|
||||
#include <linux/vm86.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Enter virtual 8086 mode. */
|
||||
extern int vm86 __P ((struct vm86_struct *__info));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* sys/vm86.h */
|
3
sysdeps/unix/sysv/linux/i386/syscalls.list
Normal file
3
sysdeps/unix/sysv/linux/i386/syscalls.list
Normal file
@ -0,0 +1,3 @@
|
||||
# File name Caller Syscall name # args Strong name Weak names
|
||||
|
||||
vm86 - vm86 1 __vm86 vm86
|
1
sysdeps/unix/sysv/linux/schedbits.h
Normal file
1
sysdeps/unix/sysv/linux/schedbits.h
Normal file
@ -0,0 +1 @@
|
||||
#include <linux/posix_sched.h>
|
34
sysdeps/unix/sysv/linux/sys/acct.h
Normal file
34
sysdeps/unix/sysv/linux/sys/acct.h
Normal file
@ -0,0 +1,34 @@
|
||||
/* Copyright (C) 1996 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 _SYS_ACCT_H
|
||||
|
||||
#define _SYS_ACCT_H 1
|
||||
#include <features.h>
|
||||
|
||||
/* Get needed constants. */
|
||||
#include <linux/acct.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Switch process accounting on and off. */
|
||||
extern int acct __P ((__const char *__filename));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* sys/acct.h */
|
@ -1 +1,169 @@
|
||||
/* Copyright (C) 1991, 92, 94, 95, 96 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., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#ifndef _SYS_SOCKET_H
|
||||
|
||||
#define _SYS_SOCKET_H 1
|
||||
#include <features.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define __need_size_t
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
/* Get Linux specific constants and data types. */
|
||||
#include <linux/socket.h>
|
||||
|
||||
/* This is the type we use for generic socket address arguments.
|
||||
|
||||
With GCC 2.7 and later, the funky union causes redeclarations or uses with
|
||||
any of the listed types to be allowed without complaint. */
|
||||
#if (!defined (__GNUC__) || __GNUC__ < 2 || \
|
||||
(__GNUC__ == 2 && __GNUC_MINOR__ < 7))
|
||||
#define __SOCKADDR_ARG struct sockaddr *
|
||||
#define __CONST_SOCKADDR_ARG __const struct sockaddr *
|
||||
#else
|
||||
/* Add more `struct sockaddr_AF' types here as necessary.
|
||||
These are all the ones I found on NetBSD and Linux. */
|
||||
#define __SOCKADDR_ALLTYPES \
|
||||
__SOCKADDR_ONETYPE (sockaddr) \
|
||||
__SOCKADDR_ONETYPE (sockaddr_at) \
|
||||
__SOCKADDR_ONETYPE (sockaddr_ax25) \
|
||||
__SOCKADDR_ONETYPE (sockaddr_dl) \
|
||||
__SOCKADDR_ONETYPE (sockaddr_eon) \
|
||||
__SOCKADDR_ONETYPE (sockaddr_in) \
|
||||
__SOCKADDR_ONETYPE (sockaddr_in6) \
|
||||
__SOCKADDR_ONETYPE (sockaddr_inarp) \
|
||||
__SOCKADDR_ONETYPE (sockaddr_ipx) \
|
||||
__SOCKADDR_ONETYPE (sockaddr_iso) \
|
||||
__SOCKADDR_ONETYPE (sockaddr_ns) \
|
||||
__SOCKADDR_ONETYPE (sockaddr_un) \
|
||||
__SOCKADDR_ONETYPE (sockaddr_x25)
|
||||
|
||||
#define __SOCKADDR_ONETYPE(type) struct type *__##type##__;
|
||||
typedef union { __SOCKADDR_ALLTYPES
|
||||
} __SOCKADDR_ARG __attribute__ ((__transparent_union__));
|
||||
#undef __SOCKADDR_ONETYPE
|
||||
#define __SOCKADDR_ONETYPE(type) __const struct type *__##type##__;
|
||||
typedef union { __SOCKADDR_ALLTYPES
|
||||
} __CONST_SOCKADDR_ARG __attribute__ ((__transparent_union__));
|
||||
#undef __SOCKADDR_ONETYPE
|
||||
#endif
|
||||
|
||||
|
||||
/* Create a new socket of type TYPE in domain DOMAIN, using
|
||||
protocol PROTOCOL. If PROTOCOL is zero, one is chosen automatically.
|
||||
Returns a file descriptor for the new socket, or -1 for errors. */
|
||||
extern int socket __P ((int __domain, int __type, int __protocol));
|
||||
|
||||
/* Create two new sockets, of type TYPE in domain DOMAIN and using
|
||||
protocol PROTOCOL, which are connected to each other, and put file
|
||||
descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero,
|
||||
one will be chosen automatically. Returns 0 on success, -1 for errors. */
|
||||
extern int socketpair __P ((int __domain, int __type, int __protocol,
|
||||
int __fds[2]));
|
||||
|
||||
/* Give the socket FD the local address ADDR (which is LEN bytes long). */
|
||||
extern int bind __P ((int __fd, __CONST_SOCKADDR_ARG __addr, size_t __len));
|
||||
|
||||
/* Put the local address of FD into *ADDR and its length in *LEN. */
|
||||
extern int getsockname __P ((int __fd, __SOCKADDR_ARG __addr,
|
||||
size_t *__len));
|
||||
|
||||
/* Open a connection on socket FD to peer at ADDR (which LEN bytes long).
|
||||
For connectionless socket types, just set the default address to send to
|
||||
and the only address from which to accept transmissions.
|
||||
Return 0 on success, -1 for errors. */
|
||||
extern int connect __P ((int __fd,
|
||||
__CONST_SOCKADDR_ARG __addr, size_t __len));
|
||||
|
||||
/* Put the address of the peer connected to socket FD into *ADDR
|
||||
(which is *LEN bytes long), and its actual length into *LEN. */
|
||||
extern int getpeername __P ((int __fd, __SOCKADDR_ARG __addr,
|
||||
size_t *__len));
|
||||
|
||||
|
||||
/* Send N bytes of BUF to socket FD. Returns the number sent or -1. */
|
||||
extern int send __P ((int __fd, __ptr_t __buf, size_t __n, int __flags));
|
||||
|
||||
/* Read N bytes into BUF from socket FD.
|
||||
Returns the number read or -1 for errors. */
|
||||
extern int recv __P ((int __fd, __ptr_t __buf, size_t __n, int __flags));
|
||||
|
||||
/* Send N bytes of BUF on socket FD to peer at address ADDR (which is
|
||||
ADDR_LEN bytes long). Returns the number sent, or -1 for errors. */
|
||||
extern int sendto __P ((int __fd, __ptr_t __buf, size_t __n, int __flags,
|
||||
__CONST_SOCKADDR_ARG __addr, size_t __addr_len));
|
||||
|
||||
/* Read N bytes into BUF through socket FD.
|
||||
If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of
|
||||
the sender, and store the actual size of the address in *ADDR_LEN.
|
||||
Returns the number of bytes read or -1 for errors. */
|
||||
extern int recvfrom __P ((int __fd, __ptr_t __buf, size_t __n, int __flags,
|
||||
__SOCKADDR_ARG __addr, size_t *__addr_len));
|
||||
|
||||
|
||||
/* Send a message described MESSAGE on socket FD.
|
||||
Returns the number of bytes sent, or -1 for errors. */
|
||||
extern int sendmsg __P ((int __fd, __const struct msghdr *__message,
|
||||
int __flags));
|
||||
|
||||
/* Receive a message as described by MESSAGE from socket FD.
|
||||
Returns the number of bytes read or -1 for errors. */
|
||||
extern int recvmsg __P ((int __fd, struct msghdr *__message, int __flags));
|
||||
|
||||
|
||||
/* Put the current value for socket FD's option OPTNAME at protocol level LEVEL
|
||||
into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's
|
||||
actual length. Returns 0 on success, -1 for errors. */
|
||||
extern int getsockopt __P ((int __fd, int __level, int __optname,
|
||||
__ptr_t __optval, size_t *__optlen));
|
||||
|
||||
/* Set socket FD's option OPTNAME at protocol level LEVEL
|
||||
to *OPTVAL (which is OPTLEN bytes long).
|
||||
Returns 0 on success, -1 for errors. */
|
||||
extern int setsockopt __P ((int __fd, int __level, int __optname,
|
||||
__ptr_t __optval, size_t __optlen));
|
||||
|
||||
|
||||
/* Prepare to accept connections on socket FD.
|
||||
N connection requests will be queued before further requests are refused.
|
||||
Returns 0 on success, -1 for errors. */
|
||||
extern int listen __P ((int __fd, unsigned int __n));
|
||||
|
||||
/* Await a connection on socket FD.
|
||||
When a connection arrives, open a new socket to communicate with it,
|
||||
set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting
|
||||
peer and *ADDR_LEN to the address's actual length, and return the
|
||||
new socket's descriptor, or -1 for errors. */
|
||||
extern int accept __P ((int __fd, __SOCKADDR_ARG __addr,
|
||||
size_t *__addr_len));
|
||||
|
||||
/* Shut down all or part of the connection open on socket FD.
|
||||
HOW determines what to shut down:
|
||||
0 = No more receptions;
|
||||
1 = No more transmissions;
|
||||
2 = No more receptions or transmissions.
|
||||
Returns 0 on success, -1 for errors. */
|
||||
extern int shutdown __P ((int __fd, int __how));
|
||||
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* sys/socket.h */
|
||||
|
30
sysdeps/unix/sysv/linux/sys/sysinfo.h
Normal file
30
sysdeps/unix/sysv/linux/sys/sysinfo.h
Normal file
@ -0,0 +1,30 @@
|
||||
/* Copyright (C) 1996 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 _SYS_SYSINFO_H
|
||||
|
||||
#define _SYS_SYSINFO_H 1
|
||||
#include <features.h>
|
||||
|
||||
/* Get sysinfo structure from kernel header. */
|
||||
#include <linux/kernel.h>
|
||||
|
||||
/* Returns information on overall system statistics. */
|
||||
extern int sysinfo __P ((struct sysinfo *__info));
|
||||
|
||||
#endif /* sys/sysinfo.h */
|
@ -2,6 +2,7 @@
|
||||
|
||||
adjtimex adjtime adjtimex 1 __adjtimex
|
||||
fdatasync - fdatasync 1 fdatasync
|
||||
flock - flock 2 __flock flock
|
||||
fork - fork 0 __fork fork
|
||||
getegid - getegid 0 __getegid getegid
|
||||
geteuid - geteuid 0 __geteuid geteuid
|
||||
@ -9,7 +10,10 @@ getpgid - getpgid 1 getpgid
|
||||
getpgrp - getpgrp 0 getpgrp
|
||||
getppid - getppid 0 __getppid getppid
|
||||
getsid - getsid 1 getsid
|
||||
ioperm - ioperm 3 ioperm
|
||||
iopl - iopl 1 iopl
|
||||
ipc msgget ipc 5 __ipc
|
||||
llseek - _llseek 5 llseek
|
||||
mlock - mlock 2 __mlock mlock
|
||||
mlockall - mlockall 1 __mlockall mlockall
|
||||
mount - mount 5 __mount mount
|
||||
@ -18,7 +22,7 @@ munlock - munlock 2 __munlock munlock
|
||||
munlockall - munlockall 0 __munlockall munlockall
|
||||
nanosleep - nanosleep 2 nanosleep
|
||||
personality init-first personality 1 __personality personality
|
||||
pipe - pipe 1 __pipe pipe
|
||||
pipe - pipe 1 __pipe pipe
|
||||
reboot - reboot 3 reboot
|
||||
s_getpriority getpriority getpriority 2 __syscall_getpriority
|
||||
s_ptrace ptrace ptrace 4 __syscall_ptrace
|
||||
@ -31,9 +35,13 @@ sched_yield - sched_yield 0 __sched_yield sched_yield
|
||||
sched_primax - sched_get_priority_max 1 __sched_get_priority_max sched_get_priority_max
|
||||
sched_primin - sched_get_priority_min 1 __sched_get_priority_min sched_get_priority_min
|
||||
sched_rr_gi - sched_rr_get_interval 2 __sched_rr_get_interval sched_rr_get_interval
|
||||
setfsgid - setfsgid 1 setfsgid
|
||||
setfsuid - setfsuid 1 setfsuid
|
||||
setpgid - setpgid 2 setpgid
|
||||
sigpending - sigpending 1 sigpending
|
||||
sigprocmask - sigprocmask 3 __sigprocmask sigprocmask
|
||||
s_sysctl sysctl _sysctl 1 __syscall__sysctl
|
||||
sysinfo - sysinfo 1 sysinfo
|
||||
umount - umount 1 __umount umount
|
||||
uselib - uselib 1 uselib
|
||||
wait4 - wait4 4 __wait4 wait4
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* Copyright (C) 1991, 1993, 1995, 1996 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
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
|
||||
@ -13,291 +12,26 @@ 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., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* On Linux we must not ask __getdtablesize for te value for _SC_OPEN_MAX
|
||||
because this would mean an endless loop. */
|
||||
|
||||
#include <ansidecl.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <unistd.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
extern size_t EXFUN(__getpagesize, (NOARGS));
|
||||
extern long int __default_sysconf (int name);
|
||||
|
||||
/* Get the value of the system variable NAME. */
|
||||
long int
|
||||
DEFUN(__sysconf, (name), int name)
|
||||
__sysconf (int name)
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
default:
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
if (name == _SC_OPEN_MAX)
|
||||
return OPEN_MAX;
|
||||
|
||||
case _SC_ARG_MAX:
|
||||
#ifdef ARG_MAX
|
||||
return ARG_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_CHILD_MAX:
|
||||
#ifdef CHILD_MAX
|
||||
return CHILD_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_CLK_TCK:
|
||||
#ifdef CLK_TCK
|
||||
return CLK_TCK;
|
||||
#else
|
||||
return 60;
|
||||
#endif
|
||||
|
||||
case _SC_NGROUPS_MAX:
|
||||
#ifdef NGROUPS_MAX
|
||||
return NGROUPS_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_OPEN_MAX:
|
||||
return OPEN_MAX;
|
||||
|
||||
case _SC_STREAM_MAX:
|
||||
#ifdef STREAM_MAX
|
||||
return STREAM_MAX;
|
||||
#else
|
||||
return FOPEN_MAX;
|
||||
#endif
|
||||
|
||||
case _SC_TZNAME_MAX:
|
||||
return __tzname_max ();
|
||||
|
||||
case _SC_JOB_CONTROL:
|
||||
#ifdef _POSIX_JOB_CONTROL
|
||||
return 1;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_SAVED_IDS:
|
||||
#ifdef _POSIX_SAVED_IDS
|
||||
return 1;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_REALTIME_SIGNALS:
|
||||
#ifdef _POSIX_REALTIME_SIGNALS
|
||||
return 1;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_PRIORITY_SCHEDULING:
|
||||
#ifdef _POSIX_PRIORITY_SCHEDULING
|
||||
return 1;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_TIMERS:
|
||||
#ifdef _POSIX_TIMERS
|
||||
return 1;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_ASYNCHRONOUS_IO:
|
||||
#ifdef _POSIX_ASYNCHRONOUS_IO
|
||||
return 1;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_PRIORITIZED_IO:
|
||||
#ifdef _POSIX_PRIORITIZED_IO
|
||||
return 1;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_SYNCHRONIZED_IO:
|
||||
#ifdef _POSIX_SYNCHRONIZED_IO
|
||||
return 1;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_FSYNC:
|
||||
#ifdef _POSIX_FSYNC
|
||||
return 1;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_MAPPED_FILES:
|
||||
#ifdef _POSIX_MAPPED_FILES
|
||||
return 1;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_MEMLOCK:
|
||||
#ifdef _POSIX_MEMLOCK
|
||||
return 1;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_MEMLOCK_RANGE:
|
||||
#ifdef _POSIX_MEMLOCK_RANGE
|
||||
return 1;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_MEMORY_PROTECTION:
|
||||
#ifdef _POSIX_MEMORY_PROTECTION
|
||||
return 1;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_MESSAGE_PASSING:
|
||||
#ifdef _POSIX_MESSAGE_PASSING
|
||||
return 1;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_SEMAPHORES:
|
||||
#ifdef _POSIX_SEMAPHORES
|
||||
return 1;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_SHARED_MEMORY_OBJECTS:
|
||||
#ifdef _POSIX_SHARED_MEMORY_OBJECTS
|
||||
return 1;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_VERSION:
|
||||
return _POSIX_VERSION;
|
||||
|
||||
case _SC_PAGESIZE:
|
||||
return __getpagesize ();
|
||||
|
||||
case _SC_BC_BASE_MAX:
|
||||
#ifdef BC_BASE_MAX
|
||||
return BC_BASE_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_BC_DIM_MAX:
|
||||
#ifdef BC_DIM_MAX
|
||||
return BC_DIM_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_BC_SCALE_MAX:
|
||||
#ifdef BC_SCALE_MAX
|
||||
return BC_SCALE_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_BC_STRING_MAX:
|
||||
#ifdef BC_STRING_MAX
|
||||
return BC_STRING_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_EQUIV_CLASS_MAX:
|
||||
#ifdef EQUIV_CLASS_MAX
|
||||
return EQUIV_CLASS_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_EXPR_NEST_MAX:
|
||||
#ifdef EXPR_NEST_MAX
|
||||
return EXPR_NEST_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_LINE_MAX:
|
||||
#ifdef LINE_MAX
|
||||
return LINE_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_RE_DUP_MAX:
|
||||
#ifdef RE_DUP_MAX
|
||||
return RE_DUP_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_CHARCLASS_NAME_MAX:
|
||||
#ifdef CHARCLASS_NAME_MAX
|
||||
return CHARCLASS_NAME_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_2_VERSION:
|
||||
/* This is actually supposed to return the version
|
||||
of the 1003.2 utilities on the system {POSIX2_VERSION}. */
|
||||
return _POSIX2_C_VERSION;
|
||||
|
||||
case _SC_2_C_BIND:
|
||||
#ifdef _POSIX2_C_BIND
|
||||
return _POSIX2_C_BIND;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_2_C_DEV:
|
||||
#ifdef _POSIX2_C_DEV
|
||||
return _POSIX2_C_DEV;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_2_FORT_DEV:
|
||||
#ifdef _POSIX2_FORT_DEV
|
||||
return _POSIX2_FORT_DEV;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_2_LOCALEDEF:
|
||||
#ifdef _POSIX2_LOCALEDEF
|
||||
return _POSIX2_LOCALEDEF;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_2_SW_DEV:
|
||||
#ifdef _POSIX2_SW_DEV
|
||||
return _POSIX2_SW_DEV;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
return __default_sysconf (name);
|
||||
}
|
||||
|
||||
weak_alias (__sysconf, sysconf)
|
||||
#define __sysconf __default_sysconf
|
||||
|
||||
#include <sysdeps/posix/sysconf.c>
|
||||
|
@ -186,6 +186,83 @@ DEFUN(__sysconf, (name), int name)
|
||||
case _SC_PAGESIZE:
|
||||
return __sysconfig (_CONFIG_PAGESIZE);
|
||||
|
||||
case _SC_AIO_LISTIO_MAX:
|
||||
#ifdef AIO_LISTIO_MAX
|
||||
return AIO_LISTIO_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_AIO_MAX:
|
||||
#ifdef AIO_MAX
|
||||
return AIO_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_AIO_PRIO_DELTA_MAX:
|
||||
#ifdef AIO_PRIO_DELTA_MAX
|
||||
return AIO_PRIO_DELTA_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_DELAYTIMER_MAX:
|
||||
#ifdef DELAYTIMER_MAX
|
||||
return DELAYTIMER_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_MQ_OPEN_MAX:
|
||||
#ifdef MQ_OPEN_MAX
|
||||
return MQ_OPEN_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_MQ_PRIO_MAX:
|
||||
#ifdef MQ_PRIO_MAX
|
||||
return MQ_PRIO_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_RTSIG_MAX:
|
||||
#ifdef RTSIG_MAX
|
||||
return RTSIG_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_SEM_NSEMS_MAX:
|
||||
#ifdef SEM_NSEMS_MAX
|
||||
return SEM_NSEMS_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_SEM_VALUE_MAX:
|
||||
#ifdef SEM_VALUE_MAX
|
||||
return SEM_VALUE_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_SIGQUEUE_MAX:
|
||||
#ifdef SIGQUEUE_MAX
|
||||
return SIGQUEUE_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_TIMER_MAX:
|
||||
#ifdef TIMER_MAX
|
||||
return TIMER_MAX;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
case _SC_BC_BASE_MAX:
|
||||
#ifdef BC_BASE_MAX
|
||||
return BC_BASE_MAX;
|
||||
|
Loading…
Reference in New Issue
Block a user