From 39e16978c3b4ac8eaf2201fac56316623910d9da Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 29 Aug 1997 01:19:12 +0000 Subject: [PATCH] Update. 1997-08-29 02:36 Ulrich Drepper * Makefile (version-info.h): Use ISO form for the date. * catgets/catgetsinfo.h: Include . (struct catalog_obj): Add lock field. (__open_catalog): Remove second parameter from prototype. * catgets/catgets.c (catopen): Initialize lock field. (catgets): Don't pass second parameter to __open_catalog. * catgets/gencat.c: Initialize lock field and don't pass second parameter to __open_catalog. * catgets/open_catalog.c (__open_catalog): Decide about use of path by examining path in struct, not based on extra argument. Acquire a the lock before trying to load the catalog and release it before returning. * csu/Makefile (abi-tag.h): Make sure target directory exists. * io/Makefile (headers): Add bits/poll.h. * io/sys/poll.h: Remove definitions of POLL* constants. Include . * sysdeps/generic/bits/poll.h: New file. * sysdeps/unix/sysv/linux/bits/poll.h: New file. * sysdeps/unix/sysv/linux/m68k/bits/poll.h: New file. * sysdeps/unix/sysv/linux/mips/bits/poll.h: New file. * sysdeps/unix/sysv/linux/sparc/bits/poll.h: New file. * libio/fileops.c (_IO_file_read, _IO_file_write): Remove dead code. * malloc/obstack.c: Add casts to keep very verbose compilers on 64bit machine quiet. * nss/Makefile (libnss_db.so): Find libdb.so in db2 directory. 1997-08-28 17:30 Ulrich Drepper * catgets/catgets.c (catopen): Correctly determine length of string in NLSPATH evironment variable. Patch by HJ Lu . 1997-08-27 23:19 Richard Henderson * sysdeps/generic/dl-sysdep.c (DL_FIND_ARG_COMPONENTS): Provide default macro to track down arguments from stack start. (_dl_sysdep_start): Use it. * sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c: Truncate to simply providing a special DL_FIND_ARG_COMPONENTS and including the next file up the line. * sysdeps/powerpc/e_sqrt.c: Move contents to w_sqrt.c and provide stub. * sysdeps/powerpc/e_sqrtf.c: Likewise. * sysdeps/powerpc/s_copysignf.S: Provide empty file; symbol is with the double precision version. * sysdeps/powerpc/s_fabsf.S: Likewise. * sysdeps/powerpc/s_isnanf.S: Likewise. --- ChangeLog | 55 ++++ Makefile | 4 +- bits/poll.h | 38 +++ catgets/catgets.c | 6 +- catgets/catgetsinfo.h | 7 +- catgets/gencat.c | 4 +- catgets/open_catalog.c | 28 ++- csu/Makefile | 1 + io/Makefile | 2 +- io/sys/poll.h | 25 +- libio/fileops.c | 29 +-- localedata/CHECKSUMS | 8 +- localedata/Makefile | 7 +- localedata/README | 12 +- localedata/fmon-de_DE.exp | 30 +++ localedata/fmon-en_US.exp | 30 +++ localedata/locales/cs_CZ | 262 +++++++++----------- localedata/sort-test.sh | 2 +- localedata/tst-fmon.c | 65 +++++ localedata/tst-fmon.sh | 32 +++ malloc/obstack.c | 10 +- nss/Makefile | 2 +- sysdeps/generic/bits/poll.h | 38 +++ sysdeps/generic/dl-sysdep.c | 27 +- sysdeps/powerpc/e_sqrt.c | 142 +---------- sysdeps/powerpc/e_sqrtf.c | 137 +--------- sysdeps/powerpc/s_copysignf.S | 1 + sysdeps/powerpc/s_fabsf.S | 1 + sysdeps/powerpc/s_isnanf.S | 1 + sysdeps/powerpc/w_sqrt.c | 141 +++++++++++ sysdeps/powerpc/w_sqrtf.c | 136 ++++++++++ sysdeps/unix/sysv/linux/bits/poll.h | 48 ++++ sysdeps/unix/sysv/linux/m68k/bits/poll.h | 43 ++++ sysdeps/unix/sysv/linux/mips/bits/poll.h | 48 ++++ sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c | 152 ++---------- sysdeps/unix/sysv/linux/sparc/bits/poll.h | 43 ++++ 36 files changed, 980 insertions(+), 637 deletions(-) create mode 100644 bits/poll.h create mode 100644 localedata/fmon-de_DE.exp create mode 100644 localedata/fmon-en_US.exp create mode 100644 localedata/tst-fmon.c create mode 100755 localedata/tst-fmon.sh create mode 100644 sysdeps/generic/bits/poll.h create mode 100644 sysdeps/powerpc/s_copysignf.S create mode 100644 sysdeps/powerpc/s_fabsf.S create mode 100644 sysdeps/powerpc/s_isnanf.S create mode 100644 sysdeps/powerpc/w_sqrt.c create mode 100644 sysdeps/powerpc/w_sqrtf.c create mode 100644 sysdeps/unix/sysv/linux/bits/poll.h create mode 100644 sysdeps/unix/sysv/linux/m68k/bits/poll.h create mode 100644 sysdeps/unix/sysv/linux/mips/bits/poll.h create mode 100644 sysdeps/unix/sysv/linux/sparc/bits/poll.h diff --git a/ChangeLog b/ChangeLog index 95dde68ad9..86a662f7ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,58 @@ +1997-08-29 02:36 Ulrich Drepper + + * Makefile (version-info.h): Use ISO form for the date. + + * catgets/catgetsinfo.h: Include . + (struct catalog_obj): Add lock field. + (__open_catalog): Remove second parameter from prototype. + * catgets/catgets.c (catopen): Initialize lock field. + (catgets): Don't pass second parameter to __open_catalog. + * catgets/gencat.c: Initialize lock field and don't pass second + parameter to __open_catalog. + * catgets/open_catalog.c (__open_catalog): Decide about use of + path by examining path in struct, not based on extra argument. + Acquire a the lock before trying to load the catalog and release + it before returning. + + * csu/Makefile (abi-tag.h): Make sure target directory exists. + + * io/Makefile (headers): Add bits/poll.h. + * io/sys/poll.h: Remove definitions of POLL* constants. + Include . + * sysdeps/generic/bits/poll.h: New file. + * sysdeps/unix/sysv/linux/bits/poll.h: New file. + * sysdeps/unix/sysv/linux/m68k/bits/poll.h: New file. + * sysdeps/unix/sysv/linux/mips/bits/poll.h: New file. + * sysdeps/unix/sysv/linux/sparc/bits/poll.h: New file. + + * libio/fileops.c (_IO_file_read, _IO_file_write): Remove dead code. + + * malloc/obstack.c: Add casts to keep very verbose compilers on + 64bit machine quiet. + + * nss/Makefile (libnss_db.so): Find libdb.so in db2 directory. + +1997-08-28 17:30 Ulrich Drepper + + * catgets/catgets.c (catopen): Correctly determine length of string + in NLSPATH evironment variable. Patch by HJ Lu . + +1997-08-27 23:19 Richard Henderson + + * sysdeps/generic/dl-sysdep.c (DL_FIND_ARG_COMPONENTS): Provide + default macro to track down arguments from stack start. + (_dl_sysdep_start): Use it. + * sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c: Truncate to simply + providing a special DL_FIND_ARG_COMPONENTS and including the next + file up the line. + + * sysdeps/powerpc/e_sqrt.c: Move contents to w_sqrt.c and provide stub. + * sysdeps/powerpc/e_sqrtf.c: Likewise. + * sysdeps/powerpc/s_copysignf.S: Provide empty file; symbol is with + the double precision version. + * sysdeps/powerpc/s_fabsf.S: Likewise. + * sysdeps/powerpc/s_isnanf.S: Likewise. + 1997-08-10 19:17 Philip Blundell * nss/nss_db/db-XXX.c: Include not . Somebody diff --git a/Makefile b/Makefile index 9034b6fd40..5c233c860f 100644 --- a/Makefile +++ b/Makefile @@ -146,7 +146,7 @@ all-Banner-files = $(wildcard $(addsuffix /Banner, $(subdirs))) $(objpfx)version-info.h: $(+sysdir_pfx)config.make $(all-Banner-files) (case $(config-os) in \ linux*) version=`(echo -e "#include \nUTS_RELEASE"\ - | $(CC) -E -P - | \ + | $(CC) -E -P - | \ sed -e 's/"\([^"]*\)".*/\1/p' -e d) 2>/dev/null`;\ if [ -z "$$version" ]; then \ if [ -r /proc/version ]; then \ @@ -157,7 +157,7 @@ $(objpfx)version-info.h: $(+sysdir_pfx)config.make $(all-Banner-files) fi; \ fi; \ echo -n "\"Compiled on a Linux $$version system "; \ - echo "on `date +%Y/%m/%d`.\\n\"" ;; \ + echo "on `date +%Y-%m-%d`.\\n\"" ;; \ *) ;; \ esac; \ files="$(all-Banner-files)"; \ diff --git a/bits/poll.h b/bits/poll.h new file mode 100644 index 0000000000..55ec70e363 --- /dev/null +++ b/bits/poll.h @@ -0,0 +1,38 @@ +/* Copyright (C) 1997 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. */ + + +/* Event types that can be polled for. These bits may be set in `events' + to indicate the interesting event types; they will appear in `revents' + to indicate the status of the file descriptor. */ +#define POLLIN 01 /* There is data to read. */ +#define POLLPRI 02 /* There is urgent data to read. */ +#define POLLOUT 04 /* Writing now will not block. */ + +/* Some aliases. */ +#define POLLWRNORM POLLOUT + +/* Event types always implicitly polled for. These bits need not be set in + `events', but they will appear in `revents' to indicate the status of + the file descriptor. */ +#define POLLERR 010 /* Error condition. */ +#define POLLHUP 020 /* Hung up. */ +#define POLLNVAL 040 /* Invalid polling request. */ + +/* Canonical number of polling requests to read in at a time in poll. */ +#define NPOLLFILE 30 diff --git a/catgets/catgets.c b/catgets/catgets.c index 4c6997e567..d5eefc9e08 100644 --- a/catgets/catgets.c +++ b/catgets/catgets.c @@ -87,7 +87,7 @@ catopen (const char *cat_name, int flag) if (nlspath != NULL && *nlspath != '\0') { /* Append the system dependent directory. */ - size_t len = strlen (nlspath + 1 + sizeof NLSPATH); + size_t len = strlen (nlspath) + 1 + sizeof NLSPATH; char *tmp = alloca (len); __stpcpy (__stpcpy (__stpcpy (tmp, nlspath), ":"), NLSPATH); @@ -111,6 +111,8 @@ catopen (const char *cat_name, int flag) result->nlspath = NULL; } + __libc_lock_init (result->lock); + return (nl_catd) result; } @@ -130,7 +132,7 @@ catgets (nl_catd catalog_desc, int set, int message, const char *string) catalog = (__nl_catd) catalog_desc; if (catalog->status == closed) - __open_catalog (catalog, 1); + __open_catalog (catalog); if (catalog->status == nonexisting) { diff --git a/catgets/catgetsinfo.h b/catgets/catgetsinfo.h index 292572decf..edb1099d8c 100644 --- a/catgets/catgetsinfo.h +++ b/catgets/catgetsinfo.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, . @@ -18,6 +18,7 @@ Boston, MA 02111-1307, USA. */ #include +#include struct catalog_obj @@ -47,6 +48,8 @@ typedef struct catalog_info struct catalog_obj *file_ptr; size_t file_size; + + __libc_lock_define (,lock); } *__nl_catd; @@ -56,4 +59,4 @@ typedef struct catalog_info /* Prototypes for helper functions. */ -void __open_catalog (__nl_catd __catalog, int __with_path); +void __open_catalog (__nl_catd __catalog); diff --git a/catgets/gencat.c b/catgets/gencat.c index 9ce962c3c9..8d310d81f4 100644 --- a/catgets/gencat.c +++ b/catgets/gencat.c @@ -988,9 +988,11 @@ read_old (struct catalog *catalog, const char *file_name) old_cat_obj.status = closed; old_cat_obj.cat_name = file_name; + old_cat_obj.nlspath = NULL; + __libc_lock_init (old_cat_obj.lock); /* Try to open catalog, but don't look through the NLSPATH. */ - __open_catalog (&old_cat_obj, 0); + __open_catalog (&old_cat_obj); if (old_cat_obj.status != mmapped && old_cat_obj.status != malloced) if (errno == ENOENT) diff --git a/catgets/open_catalog.c b/catgets/open_catalog.c index 2c1cbb4a4c..62fb111e43 100644 --- a/catgets/open_catalog.c +++ b/catgets/open_catalog.c @@ -33,14 +33,22 @@ void -__open_catalog (__nl_catd catalog, int with_path) +__open_catalog (__nl_catd catalog) { int fd; struct stat st; int swapping; - if (strchr (catalog->cat_name, '/') != NULL || !with_path) - fd = open (catalog->cat_name, O_RDONLY); + /* Make sure we are alone. */ + __libc_lock_lock (catalog->lock); + + /* Check whether there was no other thread faster. */ + if (catalog->status != closed) + /* While we waited some other thread tried to open the catalog. */ + goto unlock_return; + + if (strchr (catalog->cat_name, '/') != NULL || catalog->nlspath == NULL) + fd = __open (catalog->cat_name, O_RDONLY); else { const char *run_nlspath = catalog->nlspath; @@ -164,7 +172,7 @@ __open_catalog (__nl_catd catalog, int with_path) if (fd < 0 || __fstat (fd, &st) < 0) { catalog->status = nonexisting; - return; + goto unlock_return; } #ifndef MAP_COPY @@ -195,7 +203,7 @@ __open_catalog (__nl_catd catalog, int with_path) if (catalog->file_ptr == NULL) { catalog->status = nonexisting; - return; + goto unlock_return; } todo = st.st_size; /* Save read, handle partial reads. */ @@ -207,7 +215,7 @@ __open_catalog (__nl_catd catalog, int with_path) { free ((void *) catalog->file_ptr); catalog->status = nonexisting; - return; + goto unlock_return; } todo -= now; } @@ -227,14 +235,14 @@ __open_catalog (__nl_catd catalog, int with_path) swapping = 1; else { - /* Illegal file. Free he resources and mark catalog as not + /* Illegal file. Free the resources and mark catalog as not usable. */ if (catalog->status == mmapped) __munmap ((void *) catalog->file_ptr, catalog->file_size); else free (catalog->file_ptr); catalog->status = nonexisting; - return; + goto unlock_return; } #define SWAP(x) (swapping ? SWAPU32 (x) : (x)) @@ -260,4 +268,8 @@ __open_catalog (__nl_catd catalog, int with_path) catalog->strings = (const char *) &catalog->file_ptr->name_ptr[catalog->plane_size * catalog->plane_depth * 3 * 2]; + + /* Release the lock again. */ + unlock_return: + __libc_lock_unlock (catalog->lock); } diff --git a/csu/Makefile b/csu/Makefile index baafac5718..cfc5340d36 100644 --- a/csu/Makefile +++ b/csu/Makefile @@ -126,6 +126,7 @@ $(addprefix $(objpfx),$(filter-out $(start-installed-name),$(csu-dummies))): / := $$/# bite me. $(objpfx)abi-tag.h: $(..)abi-tags + $(make-target-directory) rm -f $@.new sed 's/#.*$//;/^[ ]*$$/d' $< | while read conf tag; do \ test `expr '$(config-machine)-$(config-vendor)-$(config-os)' \ diff --git a/io/Makefile b/io/Makefile index 055dabeba6..3f37e37c8a 100644 --- a/io/Makefile +++ b/io/Makefile @@ -23,7 +23,7 @@ subdir := io headers := sys/stat.h bits/stat.h sys/statfs.h bits/statfs.h sys/vfs.h \ fcntl.h sys/fcntl.h bits/fcntl.h \ - poll.h sys/poll.h \ + poll.h sys/poll.h bits/poll.h \ utime.h ftw.h fts.h routines := \ diff --git a/io/sys/poll.h b/io/sys/poll.h index e694fe37d5..b9af2cfc0e 100644 --- a/io/sys/poll.h +++ b/io/sys/poll.h @@ -1,5 +1,5 @@ /* Compatibility definitions for System V `poll' interface. - Copyright (C) 1994, 1996 Free Software Foundation, Inc. + Copyright (C) 1994, 1996, 1997 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 @@ -22,6 +22,9 @@ #include +/* Get the platform dependent bits of `poll'. */ +#include + __BEGIN_DECLS /* Data structure describing a polling request. */ @@ -32,26 +35,6 @@ struct pollfd short int revents; /* Types of events that actually occurred. */ }; -/* Event types that can be polled for. These bits may be set in `events' - to indicate the interesting event types; they will appear in `revents' - to indicate the status of the file descriptor. */ -#define POLLIN 01 /* There is data to read. */ -#define POLLPRI 02 /* There is urgent data to read. */ -#define POLLOUT 04 /* Writing now will not block. */ - -/* Some aliases. */ -#define POLLWRNORM POLLOUT - -/* Event types always implicitly polled for. These bits need not be set in - `events', but they will appear in `revents' to indicate the status of - the file descriptor. */ -#define POLLERR 010 /* Error condition. */ -#define POLLHUP 020 /* Hung up. */ -#define POLLNVAL 040 /* Invalid polling request. */ - -/* Canonical number of polling requests to read in at a time in poll. */ -#define NPOLLFILE 30 - /* Poll the file descriptors described by the NFDS structures starting at FDS. If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for diff --git a/libio/fileops.c b/libio/fileops.c index b3a3a24651..10f7567b0a 100644 --- a/libio/fileops.c +++ b/libio/fileops.c @@ -575,19 +575,7 @@ _IO_file_read (fp, buf, size) void *buf; _IO_ssize_t size; { - for (;;) - { - _IO_ssize_t count = _IO_read (fp->_fileno, buf, size); -#if 0 && defined EINTR - /* We must not do this optimization since POSIX.1 explicitly - requests that the stream operations must return with the - error EINTR if this happens. There must be the possibility - that stream operations time out. --drepper */ - if (count == -1 && errno == EINTR) - continue; -#endif - return count; - } + return _IO_read (fp->_fileno, buf, size); } _IO_pos_t @@ -626,19 +614,8 @@ _IO_file_write (f, data, n) _IO_ssize_t count = _IO_write (f->_fileno, data, to_do); if (count == EOF) { -#if 0 && defined EINTR - /* We must not do this optimization since POSIX.1 explicitly - requests that the stream operations must return with the - error EINTR if this happens. There must be the - possibility that stream operations time out. --drepper */ - if (errno == EINTR) - continue; - else -#endif - { - f->_flags |= _IO_ERR_SEEN; - break; - } + f->_flags |= _IO_ERR_SEEN; + break; } to_do -= count; data = (void *) ((char *) data + count); diff --git a/localedata/CHECKSUMS b/localedata/CHECKSUMS index 7c71e4ea7f..0c01ab21b3 100644 --- a/localedata/CHECKSUMS +++ b/localedata/CHECKSUMS @@ -156,6 +156,7 @@ db3c60025eb80244d70bf7889f058055 charmaps/T.101-G2 572baa84bd05d4b236b7e2fb211d0dfd charmaps/T.61-7BIT 1e39e36aa7544014059b0aa8381ab051 charmaps/T.61-8BIT 81c8e12a75dff4371ce82773d670cd6d charmaps/VIDEOTEX-SUPPL +910e8174540ecba1ac61b5f27f6dc359 locales/cs_CZ 45ade09ead9fd385d58504bfc005ecab locales/da_DK 249894e0554d46d1fbdae4a5fb8cc20e locales/de_AT b3628f73e00bb655a5e96bcc2331893c locales/de_BE @@ -175,14 +176,13 @@ bda978c8b0e379d57a8599edfdb2e858 locales/fi_FI a25300033ea6c619a4e15051f14aa65e locales/fo_FO 02ca55b19338f94530f0b60999638ed4 locales/fr_BE 655c7b8713b9aad20014df2c27928cb7 locales/fr_CA -8e60885c3fda81bc7773f139657974f3 locales/fr_CA,2.13 -8a76a0e3ea2923367fdbab78a6bc67cb locales/fr_CA,2.13.orig +d5bec15a74c4107a77a46fe185883574 locales/fr_CA,2.13 19403a5cd69a9ad658b173859eb022ef locales/fr_CH 48d8981b117e72c5eb2e9c181cbd7d2b locales/fr_FR cc1b77cf4cdc4488a99637e730e0f57f locales/fr_LU 1987b72e766038b0f475165c994d1469 locales/ga_IE be2ef06fd9a4b4def515216972fe9250 locales/gr_GR -9e2de7fe4b41f9bad952cdc5bfd77cd4 locales/hr_HR +e7ad1d62ccf958b04f018cbd96ede3b2 locales/hr_HR 7f35d03bbe29b53831674704f8b307af locales/hu_HU 1a8b95f6663b7a99703a32c6135d8896 locales/is_IS 47620dbc36bf3ffe04b32dd16b7aae3c locales/it_IT @@ -194,7 +194,7 @@ d5394568c45886788becf67b54bc916e locales/lt_LT e71081f29649cfd4ac8563ae1f7932fa locales/nl_NL 3a0720088defd80baa0623990c6d196a locales/no_NO 6d1bb18d4271cd712e5dc24eec4706b9 locales/pl_PL -b07ce7e57dda4687f2a83cd5ec79a3e0 locales/POSIX +bbbcbd6f0a484ec25d8a592217a76ebb locales/POSIX 509fc74fdd394f6876358d357f955645 locales/pt_BR 7c2463bcee68bccde3145642a34a8ef1 locales/pt_PT 32c766f85eb82823856485e5802dce19 locales/ro_RO diff --git a/localedata/Makefile b/localedata/Makefile index 17dd43c8d2..87f8cbaceb 100644 --- a/localedata/Makefile +++ b/localedata/Makefile @@ -30,9 +30,9 @@ charmaps := $(filter-out $(addprefix charmaps/, CVS RCS %~), \ locales := $(filter-out $(addprefix locales/, CVS RCS %~), \ $(wildcard locales/*)) -test-srcs := collate-test xfrm-test +test-srcs := collate-test xfrm-test tst-fmon test-input := de_DE.ISO-8859-1 da_DK.ISO-8859-1 fr_CA,2.13.ISO-8859-1 - +fmon-input := de_DE.ISO-8859-1 en_US.ISO-8859-1 # Get $(inst_i18ndir) defined. include ../Makeconfig @@ -48,6 +48,7 @@ $(inst_i18ndir)/locales/%: locales/%; $(do-install) ifeq (no,$(cross-compiling)) -tests: $(objpfx)collate-test $(objpfx)xfrm-test +tests: $(objpfx)collate-test $(objpfx)xfrm-test $(objpfx)tst-fmon $(SHELL) -e sort-test.sh $(common-objpfx) $(test-input) + $(SHELL) -e tst-fmon.sh $(common-objpfx) $(fmon-input) endif diff --git a/localedata/README b/localedata/README index efd375d3e2..3ef75539c1 100644 --- a/localedata/README +++ b/localedata/README @@ -2,7 +2,7 @@ and POSIX character set descriptions -Ulrich Drepper Time-stamp: <1997/02/12 22:13:01 drepper> +Ulrich Drepper Time-stamp: <1997/06/04 01:36:26 drepper> drepper@cygnus.com @@ -34,10 +34,10 @@ desired data should happen like this: localedef -i fr_CA -f ISO-8859-1 fr_CA This will place the 6 output files in the appropriate directory where -the GNU libc functions can find them. Please note that you need the -rights to write to this directory ($(prefix)/share/locale, where +the GNU libc functions can find them. Please note that you need +permission to write to this directory ($(prefix)/share/locale, where $(prefix) is the value you specified while configuring GNU libc). If -you do not have the necessary rights, you can write the files into an +you do not have the necessary permissions, you can write the files into an arbitrary directory by giving a path including a '/' character instead of `fr_CA'. E.g., to put the new files in a subdirectory of the current directory simply use @@ -48,7 +48,7 @@ How to use these data files is described in the GNU libc manual, especially in the section describing the `setlocale' function. -The here contained files can originally be found at +The files contained here were originally from ftp://dkuug.dk/i18n/WG15-collection @@ -60,7 +60,7 @@ data or want to add something please contact and Ulrich Drepper -Please make sure your corrections are relativ to the originally +Please make sure your corrections are relative to the originally distributed files. Consult the CHECKSUMS file which contains the MD5 sums for all data files. diff --git a/localedata/fmon-de_DE.exp b/localedata/fmon-de_DE.exp new file mode 100644 index 0000000000..77cb9dd0df --- /dev/null +++ b/localedata/fmon-de_DE.exp @@ -0,0 +1,30 @@ +" DM123,45" +"-DM123,45" +" DM3.456,78" +" DM123,45" +" -DM123,45" +" DM3.456,78" +" DM 123,45" +"-DM 123,45" +" DM 3.456,78" +" DM***123,45" +"-DM***123,45" +" DM*3.456,78" +" DM000123,45" +"-DM000123,45" +" DM03.456,78" +" DM 123,45" +"-DM 123,45" +" DM 3456,78" +" DM 123" +"-DM 123" +" DM 3457" +" DM 123,4500" +"-DM 123,4500" +" DM 3456,7810" +" DM 123,45 " +"(DM 123,45)" +" DM 3.456,78 " +" 123,45 " +"( 123,45)" +" 3.456,78 " diff --git a/localedata/fmon-en_US.exp b/localedata/fmon-en_US.exp new file mode 100644 index 0000000000..a740c7257f --- /dev/null +++ b/localedata/fmon-en_US.exp @@ -0,0 +1,30 @@ +" $123.45" +"-$123.45" +" $3,456.78" +" $123.45" +" -$123.45" +" $3,456.78" +" $ 123.45" +"-$ 123.45" +" $ 3,456.78" +" $***123.45" +"-$***123.45" +" $*3,456.78" +" $000123.45" +"-$000123.45" +" $03,456.78" +" $ 123.45" +"-$ 123.45" +" $ 3456.78" +" $ 123" +"-$ 123" +" $ 3457" +" $ 123.4500" +"-$ 123.4500" +" $ 3456.7810" +" $ 123.45 " +"($ 123.45)" +" $ 3,456.78 " +" 123.45 " +"( 123.45)" +" 3,456.78 " diff --git a/localedata/locales/cs_CZ b/localedata/locales/cs_CZ index ba159570d8..6713adc6d2 100644 --- a/localedata/locales/cs_CZ +++ b/localedata/locales/cs_CZ @@ -2,9 +2,9 @@ escape_char / comment_char % % % Czech Language Locale for Czech -% Source: -% Address: U školy 292 Without diactitical chars: U skoly 292 -% 783 72 Velký Týnec 782 72 Velky Tynec +% Source: +% Address: U školy 292 Without diactitical chars: U skoly 292 +% 783 72 Velký Týnec 782 72 Velky Tynec % Contact: Vladimir Michl % Email: Vladimir.Michl@upol.cz % Tel: @@ -19,13 +19,15 @@ comment_char % % Charset: ISO_8859-2:1987 % Distribution and use is free, also % for commercial purposes. +% 1997-08-20: Michael Mráka +% Změny zejména v sekci LC_TIME. (Changes especially in LC_TIME section.) + % zpracování: %% localedef -c -i -f "ISO_8859-2:1987" 'cs_CZ.ISO-8859-2' %% pokud se podaří odstranit chyby, lze -c vynechat. -%% pro úspěšné přeložení je třeba mít kolekci lokalizací WG15collection. -%% Tuto rozbalit do adresáře +%% pro úspěšné přeložení je třeba mít kolekci lokalizací WG15collection. Tuto rozbalit do adresáře %% /usr/share/i18n %% Lokalizace se pak budou tvořit v adresáři /usr/share/locale @@ -42,9 +44,9 @@ comment_char % LC_COLLATE % Definice písmene ch -collating-element from "" -collating-element from "" -collating-element from "" +collating-element from "" +collating-element from "" +collating-element from "" collating-symbol collating-symbol @@ -65,11 +67,10 @@ collating-symbol collating-symbol collating-symbol -order_start forward;backward/ - ;forward;position +order_start forward;forward;forward;forward - + @@ -87,7 +88,7 @@ order_start forward;backward/ -% +% ;;;IGNORE IGNORE;IGNORE;IGNORE; IGNORE;IGNORE;IGNORE; @@ -202,8 +203,8 @@ order_start forward;backward/ IGNORE;IGNORE;IGNORE; IGNORE;IGNORE;IGNORE; IGNORE;IGNORE;IGNORE; -UNDEFINED IGNORE;IGNORE;IGNORE - +UNDEFINED IGNORE;IGNORE;IGNORE;IGNORE + <0> <0>;<0>;IGNORE;IGNORE <1> <1>;<1>;IGNORE;IGNORE <2> <2>;<2>;IGNORE;IGNORE @@ -267,9 +268,9 @@ UNDEFINED IGNORE;IGNORE;IGNORE ;;;IGNORE ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE ;;;IGNORE ;;;IGNORE @@ -385,13 +386,10 @@ END LC_COLLATE LC_CTYPE -digit <0>;<1>;<2>;<3>;<4>;/ - <5>;<6>;<7>;<8>;<9> +digit <0>;<1>;<2>;<3>;<4>;<5>;<6>;<7>;<8>;<9> -xdigit <0>;<1>;<2>;<3>;<4>;/ - <5>;<6>;<7>;<8>;<9>;/ - ;...;;/ - ;...; +xdigit <0>;<1>;<2>;<3>;<4>;<5>;<6>;<7>;<8>;<9>;/ + ;...;;;...; punct ;...;;/ <:>;...;;/ @@ -406,7 +404,7 @@ blank ;; space ;;;;/ ;; - + cntrl ;;;;;;/ ;;;;;;/ ;;;;
;;/ @@ -419,89 +417,6 @@ cntrl ;;;;;;/ ;;;;;;/ ;;;; -alpha ;...;;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - >;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - >;/ - ;/ - ;/ - ;/ - ;/ - ;/ - >;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;...;;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - >;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - >;/ - ;/ - ;/ - ;/ - ;/ - ;/ - >;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - upper ;...;;/ ;/ @@ -588,6 +503,89 @@ lower ;...;;/ ;/ +alpha ;...;;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + >;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + >;/ + ;/ + ;/ + ;/ + ;/ + ;/ + >;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;...;;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + >;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + >;/ + ;/ + ;/ + ;/ + ;/ + ;/ + >;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + toupper (,);(,);(,);(,);(,);(,);/ (,);(,);(,);(,);(,);(,);/ @@ -687,7 +685,7 @@ END LC_CTYPE %% ekvivalenty yes/no %% ------------------------- -LC_MESSAGES +LC_MESSAGES yesexpr "<<(><)/>><.><*>" noexpr "<<(><)/>><.><*>" @@ -734,6 +732,7 @@ END LC_NUMERIC LC_TIME + abday "";/ "

";/ "";/ @@ -750,18 +749,22 @@ day "";/ "

";/ "" -abmon "";/ - "";/ - "";/ - "";/ - "";/ - "";/ - "";/ - "

";/ - "";/ - "";/ - "";/ - "

" +%abmon "";"";"";"";"";/ +% "";"";"

";"";"";/ +% "";"

" +% Obávám se, že čeština žádné zkratky pro měsíce nezná :-) +abmon "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "

";/ + "";/ + "";/ + "

";/ + "

" mon "";/ "";/ @@ -777,33 +780,16 @@ mon "";/ "

" -d_t_fmt "<%><%><.><%><%><%><:><%><:><%><%>" -%d_t_fmt "<%><.><%><.><%><%><%>" +d_t_fmt "<%><%><.><%><%><,><%><:><%><:><%><%>" d_fmt "<%><.><%><.><%>" -%d_fmt "<%><.><%><.><%>" t_fmt "<%><:><%><:><%>" -%t_fmt "<%>" t_fmt_ampm "<%><:><%><:><%>" -%t_fmt_ampm "" -%am_pm "am";"pm" am_pm "";"" -% Zde nevím, co následující položky znamenají -% V případě potřeby prosím opravte - -%era "<%>" - -%era_year "<%>" - -%alt_digits "<0>";"<1>";"<2>";"<3>";"<4>";/ -% "<5>";"<6>";"<7>";"<8>" - -%era_d_fmt "<%><%><%>" - END LC_TIME %% END OF LOCALIZATION FILE for cs_CZ.ISO-8859-2 diff --git a/localedata/sort-test.sh b/localedata/sort-test.sh index 8197ac09eb..8f9bb55b72 100644 --- a/localedata/sort-test.sh +++ b/localedata/sort-test.sh @@ -35,5 +35,5 @@ done exit $status # Local Variables: -# mode:ksh +# mode:shell-script # End: diff --git a/localedata/tst-fmon.c b/localedata/tst-fmon.c new file mode 100644 index 0000000000..4b7146996e --- /dev/null +++ b/localedata/tst-fmon.c @@ -0,0 +1,65 @@ +#include +#include +#include + +static int +check (const char *fmt, double n) +{ + int result; + char buf[1000]; + + result = strfmon (buf, sizeof buf, fmt, n) == -1; + + printf ("\"%s\"\n", buf); + return result; +} + +int +main (void) +{ + int result = 0; + + setlocale (LC_ALL, ""); + + result |= check ("%n", 123.45); + result |= check ("%n", -123.45); + result |= check ("%n", 3456.781); + + result |= check ("%11n", 123.45); + result |= check ("%11n", -123.45); + result |= check ("%11n", 3456.781); + + result |= check ("%#5n", 123.45); + result |= check ("%#5n", -123.45); + result |= check ("%#5n", 3456.781); + + result |= check ("%=*#5n", 123.45); + result |= check ("%=*#5n", -123.45); + result |= check ("%=*#5n", 3456.781); + + result |= check ("%=0#5n", 123.45); + result |= check ("%=0#5n", -123.45); + result |= check ("%=0#5n", 3456.781); + + result |= check ("%^#5n", 123.45); + result |= check ("%^#5n", -123.45); + result |= check ("%^#5n", 3456.781); + + result |= check ("%^#5.0n", 123.45); + result |= check ("%^#5.0n", -123.45); + result |= check ("%^#5.0n", 3456.781); + + result |= check ("%^#5.4n", 123.45); + result |= check ("%^#5.4n", -123.45); + result |= check ("%^#5.4n", 3456.781); + + result |= check ("%(#5n", 123.45); + result |= check ("%(#5n", -123.45); + result |= check ("%(#5n", 3456.781); + + result |= check ("%!(#5n", 123.45); + result |= check ("%!(#5n", -123.45); + result |= check ("%!(#5n", 3456.781); + + return result; +} diff --git a/localedata/tst-fmon.sh b/localedata/tst-fmon.sh new file mode 100755 index 0000000000..cac9917ff5 --- /dev/null +++ b/localedata/tst-fmon.sh @@ -0,0 +1,32 @@ +#! /bin/sh + +common_objpfx=$1; shift +lang=$* + +here=`pwd` + +# Generate data files. +for l in $lang; do + cns=`echo $l | sed 's/\(.*\)[.][^.]*/\1/'` + cn=locales/$cns + fn=charmaps/`echo $l | sed 's/.*[.]\([^.]*\)/\1/'` + LD_LIBRARY_PATH=$common_objpfx I18NPATH=./locales ${common_objpfx}elf/ld.so \ + ${common_objpfx}locale/localedef --quiet -i $cn -f $fn \ + ${common_objpfx}localedata/$cns +done + +# Run the tests. +for l in $lang; do + cns=`echo $l | sed 's/\(.*\)[.][^.]*/\1/'` + + LOCPATH=$common_objpfx/localedata LC_ALL=$cns \ + LD_LIBRARY_PATH=$common_objpfx $common_objpfx/elf/ld.so \ + $common_objpfx/localedata/tst-fmon \ + > $common_objpfx/localedata/fmon-$cns.out || status=1 + cmp -s fmon-$cns.exp $common_objpfx/localedata/fmon-$cns.out || status=1 +done + +exit $status +# Local Variables: +# mode:shell-script +# End: diff --git a/malloc/obstack.c b/malloc/obstack.c index 731762f5a9..cc18dc1a9b 100644 --- a/malloc/obstack.c +++ b/malloc/obstack.c @@ -162,7 +162,7 @@ _obstack_begin (h, size, alignment, chunkfun, freefun) register struct _obstack_chunk *chunk; /* points to new chunk */ if (alignment == 0) - alignment = DEFAULT_ALIGNMENT; + alignment = (int) DEFAULT_ALIGNMENT; if (size == 0) /* Default size is what GNU malloc can fit in a 4096-byte block. */ { @@ -221,7 +221,7 @@ _obstack_begin_1 (h, size, alignment, chunkfun, freefun, arg) register struct _obstack_chunk *chunk; /* points to new chunk */ if (alignment == 0) - alignment = DEFAULT_ALIGNMENT; + alignment = (int) DEFAULT_ALIGNMENT; if (size == 0) /* Default size is what GNU malloc can fit in a 4096-byte block. */ { @@ -278,9 +278,9 @@ _obstack_newchunk (h, length) register struct _obstack_chunk *old_chunk = h->chunk; register struct _obstack_chunk *new_chunk; register long new_size; - register int obj_size = h->next_free - h->object_base; - register int i; - int already; + register long obj_size = h->next_free - h->object_base; + register long i; + long already; /* Compute size for new chunk. */ new_size = (obj_size + length) + (obj_size >> 3) + 100; diff --git a/nss/Makefile b/nss/Makefile index fae12eb652..86de2e9d57 100644 --- a/nss/Makefile +++ b/nss/Makefile @@ -70,7 +70,7 @@ endif include ../Rules -$(objpfx)libnss_db.so: $(common-objpfx)db/libdb.so $(objpfx)libnss_files.so +$(objpfx)libnss_db.so: $(common-objpfx)db2/libdb.so $(objpfx)libnss_files.so $(libnss_db-routines:%=$(objpfx)%.c): $(objpfx)db-%.c: nss_files/files-%.c @rm -f $@.new diff --git a/sysdeps/generic/bits/poll.h b/sysdeps/generic/bits/poll.h new file mode 100644 index 0000000000..55ec70e363 --- /dev/null +++ b/sysdeps/generic/bits/poll.h @@ -0,0 +1,38 @@ +/* Copyright (C) 1997 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. */ + + +/* Event types that can be polled for. These bits may be set in `events' + to indicate the interesting event types; they will appear in `revents' + to indicate the status of the file descriptor. */ +#define POLLIN 01 /* There is data to read. */ +#define POLLPRI 02 /* There is urgent data to read. */ +#define POLLOUT 04 /* Writing now will not block. */ + +/* Some aliases. */ +#define POLLWRNORM POLLOUT + +/* Event types always implicitly polled for. These bits need not be set in + `events', but they will appear in `revents' to indicate the status of + the file descriptor. */ +#define POLLERR 010 /* Error condition. */ +#define POLLHUP 020 /* Hung up. */ +#define POLLNVAL 040 /* Invalid polling request. */ + +/* Canonical number of polling requests to read in at a time in poll. */ +#define NPOLLFILE 30 diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c index b942e40f7a..7ee3002314 100644 --- a/sysdeps/generic/dl-sysdep.c +++ b/sysdeps/generic/dl-sysdep.c @@ -45,6 +45,21 @@ int __libc_multiple_libcs; /* Defining this here avoids the inclusion of init-first. */ static ElfW(auxv_t) *_dl_auxv; + +#ifndef DL_FIND_ARG_COMPONENTS +#define DL_FIND_ARG_COMPONENTS(cookie, argc, argv, envp, auxp) \ + do { \ + void **_tmp; \ + (argc) = *(long *) cookie; \ + (argv) = (char **) cookie + 1; \ + (envp) = (argv) + (argc) + 1; \ + for (_tmp = (void **) (envp); *_tmp; ++_tmp) \ + continue; \ + (auxp) = (void *) ++_tmp; \ + } while (0) +#endif + + ElfW(Addr) _dl_sysdep_start (void **start_argptr, void (*dl_main) (const ElfW(Phdr) *phdr, ElfW(Word) phnum, @@ -60,21 +75,15 @@ _dl_sysdep_start (void **start_argptr, gid_t egid = 0; unsigned int seen; + DL_FIND_ARG_COMPONENTS (start_argptr, _dl_argc, _dl_argv, _environ, _dl_auxv); + user_entry = (ElfW(Addr)) &ENTRY_POINT; - _dl_argc = *(long *) start_argptr; - _dl_argv = (char **) start_argptr + 1; - _environ = &_dl_argv[_dl_argc + 1]; _dl_platform = NULL; /* Default to nothing known about the platform. */ - start_argptr = (void **) _environ; - while (*start_argptr) - ++start_argptr; seen = 0; #define M(type) (1 << (type)) - for (av = _dl_auxv = (void *) ++start_argptr; - av->a_type != AT_NULL; - seen |= M ((++av)->a_type)) + for (av = _dl_auxv; av->a_type != AT_NULL; seen |= M ((++av)->a_type)) switch (av->a_type) { case AT_PHDR: diff --git a/sysdeps/powerpc/e_sqrt.c b/sysdeps/powerpc/e_sqrt.c index df80973f58..9416ea60c8 100644 --- a/sysdeps/powerpc/e_sqrt.c +++ b/sysdeps/powerpc/e_sqrt.c @@ -1,141 +1 @@ -/* Single-precision floating point square root. - Copyright (C) 1997 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 -#include -#include -#include - -static const double almost_half = 0.5000000000000001; /* 0.5 + 2^-53 */ -static const uint32_t a_nan = 0x7fc00000; -static const uint32_t a_inf = 0x7f800000; -static const float two108 = 3.245185536584267269e+32; -static const float twom54 = 5.551115123125782702e-17; -extern const float __t_sqrt[1024]; - -/* The method is based on a description in - Computation of elementary functions on the IBM RISC System/6000 processor, - P. W. Markstein, IBM J. Res. Develop, 34(1) 1990. - Basically, it consists of two interleaved Newton-Rhapson approximations, - one to find the actual square root, and one to find its reciprocal - without the expense of a division operation. The tricky bit here - is the use of the POWER/PowerPC multiply-add operation to get the - required accuracy with high speed. - - The argument reduction works by a combination of table lookup to - obtain the initial guesses, and some careful modification of the - generated guesses (which mostly runs on the integer unit, while the - Newton-Rhapson is running on the FPU). */ -double -__sqrt(double x) -{ - const float inf = *(const float *)&a_inf; - /* x = f_wash(x); *//* This ensures only one exception for SNaN. */ - if (x > 0) - { - if (x != inf) - { - /* Variables named starting with 's' exist in the - argument-reduced space, so that 2 > sx >= 0.5, - 1.41... > sg >= 0.70.., 0.70.. >= sy > 0.35... . - Variables named ending with 'i' are integer versions of - floating-point values. */ - double sx; /* The value of which we're trying to find the - square root. */ - double sg,g; /* Guess of the square root of x. */ - double sd,d; /* Difference between the square of the guess and x. */ - double sy; /* Estimate of 1/2g (overestimated by 1ulp). */ - double sy2; /* 2*sy */ - double e; /* Difference between y*g and 1/2 (se = e * fsy). */ - double shx; /* == sx * fsg */ - double fsg; /* sg*fsg == g. */ - fenv_t fe; /* Saved floating-point environment (stores rounding - mode and whether the inexact exception is - enabled). */ - uint32_t xi0, xi1, sxi, fsgi; - const float *t_sqrt; - - fe = fegetenv_register(); - EXTRACT_WORDS (xi0,xi1,x); - relax_fenv_state(); - sxi = xi0 & 0x3fffffff | 0x3fe00000; - INSERT_WORDS (sx, sxi, xi1); - t_sqrt = __t_sqrt + (xi0 >> 52-32-8-1 & 0x3fe); - sg = t_sqrt[0]; - sy = t_sqrt[1]; - - /* Here we have three Newton-Rhapson iterations each of a - division and a square root and the remainder of the - argument reduction, all interleaved. */ - sd = -(sg*sg - sx); - fsgi = xi0 + 0x40000000 >> 1 & 0x7ff00000; - sy2 = sy + sy; - sg = sy*sd + sg; /* 16-bit approximation to sqrt(sx). */ - INSERT_WORDS (fsg, fsgi, 0); - e = -(sy*sg - almost_half); - sd = -(sg*sg - sx); - if ((xi0 & 0x7ff00000) == 0) - goto denorm; - sy = sy + e*sy2; - sg = sg + sy*sd; /* 32-bit approximation to sqrt(sx). */ - sy2 = sy + sy; - e = -(sy*sg - almost_half); - sd = -(sg*sg - sx); - sy = sy + e*sy2; - shx = sx * fsg; - sg = sg + sy*sd; /* 64-bit approximation to sqrt(sx), - but perhaps rounded incorrectly. */ - sy2 = sy + sy; - g = sg * fsg; - e = -(sy*sg - almost_half); - d = -(g*sg - shx); - sy = sy + e*sy2; - fesetenv_register (fe); - return g + sy*d; - denorm: - /* For denormalised numbers, we normalise, calculate the - square root, and return an adjusted result. */ - fesetenv_register (fe); - return __sqrt(x * two108) * twom54; - } - } - else if (x < 0) - { -#ifdef FE_INVALID_SQRT - feraiseexcept (FE_INVALID_SQRT); - /* For some reason, some PowerPC processors don't implement - FE_INVALID_SQRT. I guess no-one ever thought they'd be - used for square roots... :-) */ - if (!fetestexcept (FE_INVALID)) -#endif - feraiseexcept (FE_INVALID); -#ifndef _IEEE_LIBM - if (_LIB_VERSION != _IEEE_) - x = __kernel_standard(x,x,26); - else -#endif - x = *(const float*)&a_nan; - } - return f_wash(x); -} - -weak_alias (__sqrt, sqrt) -/* Strictly, this is wrong, but the only places where _ieee754_sqrt is - used will not pass in a negative result. */ -strong_alias(__sqrt,__ieee754_sqrt) +/* __ieee754_sqrt is in w_sqrt.c */ diff --git a/sysdeps/powerpc/e_sqrtf.c b/sysdeps/powerpc/e_sqrtf.c index 804dff3c44..01c76d6757 100644 --- a/sysdeps/powerpc/e_sqrtf.c +++ b/sysdeps/powerpc/e_sqrtf.c @@ -1,136 +1 @@ -/* Single-precision floating point square root. - Copyright (C) 1997 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 -#include -#include -#include - -static const float almost_half = 0.50000006; /* 0.5 + 2^-24 */ -static const uint32_t a_nan = 0x7fc00000; -static const uint32_t a_inf = 0x7f800000; -static const float two48 = 281474976710656.0; -static const float twom24 = 5.9604644775390625e-8; -extern const float __t_sqrt[1024]; - -/* The method is based on a description in - Computation of elementary functions on the IBM RISC System/6000 processor, - P. W. Markstein, IBM J. Res. Develop, 34(1) 1990. - Basically, it consists of two interleaved Newton-Rhapson approximations, - one to find the actual square root, and one to find its reciprocal - without the expense of a division operation. The tricky bit here - is the use of the POWER/PowerPC multiply-add operation to get the - required accuracy with high speed. - - The argument reduction works by a combination of table lookup to - obtain the initial guesses, and some careful modification of the - generated guesses (which mostly runs on the integer unit, while the - Newton-Rhapson is running on the FPU). */ -float -__sqrtf(float x) -{ - const float inf = *(const float *)&a_inf; - /* x = f_washf(x); *//* This ensures only one exception for SNaN. */ - if (x > 0) - { - if (x != inf) - { - /* Variables named starting with 's' exist in the - argument-reduced space, so that 2 > sx >= 0.5, - 1.41... > sg >= 0.70.., 0.70.. >= sy > 0.35... . - Variables named ending with 'i' are integer versions of - floating-point values. */ - float sx; /* The value of which we're trying to find the square - root. */ - float sg,g; /* Guess of the square root of x. */ - float sd,d; /* Difference between the square of the guess and x. */ - float sy; /* Estimate of 1/2g (overestimated by 1ulp). */ - float sy2; /* 2*sy */ - float e; /* Difference between y*g and 1/2 (note that e==se). */ - float shx; /* == sx * fsg */ - float fsg; /* sg*fsg == g. */ - fenv_t fe; /* Saved floating-point environment (stores rounding - mode and whether the inexact exception is - enabled). */ - uint32_t xi, sxi, fsgi; - const float *t_sqrt; - - GET_FLOAT_WORD (xi, x); - fe = fegetenv_register (); - relax_fenv_state (); - sxi = xi & 0x3fffffff | 0x3f000000; - SET_FLOAT_WORD (sx, sxi); - t_sqrt = __t_sqrt + (xi >> 23-8-1 & 0x3fe); - sg = t_sqrt[0]; - sy = t_sqrt[1]; - - /* Here we have three Newton-Rhapson iterations each of a - division and a square root and the remainder of the - argument reduction, all interleaved. */ - sd = -(sg*sg - sx); - fsgi = xi + 0x40000000 >> 1 & 0x7f800000; - sy2 = sy + sy; - sg = sy*sd + sg; /* 16-bit approximation to sqrt(sx). */ - e = -(sy*sg - almost_half); - SET_FLOAT_WORD (fsg, fsgi); - sd = -(sg*sg - sx); - sy = sy + e*sy2; - if ((xi & 0x7f800000) == 0) - goto denorm; - shx = sx * fsg; - sg = sg + sy*sd; /* 32-bit approximation to sqrt(sx), - but perhaps rounded incorrectly. */ - sy2 = sy + sy; - g = sg * fsg; - e = -(sy*sg - almost_half); - d = -(g*sg - shx); - sy = sy + e*sy2; - fesetenv_register (fe); - return g + sy*d; - denorm: - /* For denormalised numbers, we normalise, calculate the - square root, and return an adjusted result. */ - fesetenv_register (fe); - return __sqrtf(x * two48) * twom24; - } - } - else if (x < 0) - { -#ifdef FE_INVALID_SQRT - feraiseexcept (FE_INVALID_SQRT); - /* For some reason, some PowerPC processors don't implement - FE_INVALID_SQRT. I guess no-one ever thought they'd be - used for square roots... :-) */ - if (!fetestexcept (FE_INVALID)) -#endif - feraiseexcept (FE_INVALID); -#ifndef _IEEE_LIBM - if (_LIB_VERSION != _IEEE_) - x = __kernel_standard(x,x,126); - else -#endif - x = *(const float*)&a_nan; - } - return f_washf(x); -} - -weak_alias (__sqrtf, sqrtf) -/* Strictly, this is wrong, but the only places where _ieee754_sqrt is - used will not pass in a negative result. */ -strong_alias(__sqrtf,__ieee754_sqrtf) +/* __ieee754_sqrtf is in w_sqrtf.c */ diff --git a/sysdeps/powerpc/s_copysignf.S b/sysdeps/powerpc/s_copysignf.S new file mode 100644 index 0000000000..e05438ae7d --- /dev/null +++ b/sysdeps/powerpc/s_copysignf.S @@ -0,0 +1 @@ +/* __copysignf is in s_copysign.S */ diff --git a/sysdeps/powerpc/s_fabsf.S b/sysdeps/powerpc/s_fabsf.S new file mode 100644 index 0000000000..877c710ce8 --- /dev/null +++ b/sysdeps/powerpc/s_fabsf.S @@ -0,0 +1 @@ +/* __fabsf is in s_fabs.S */ diff --git a/sysdeps/powerpc/s_isnanf.S b/sysdeps/powerpc/s_isnanf.S new file mode 100644 index 0000000000..fc22f678a1 --- /dev/null +++ b/sysdeps/powerpc/s_isnanf.S @@ -0,0 +1 @@ +/* __isnanf is in s_isnan.c */ diff --git a/sysdeps/powerpc/w_sqrt.c b/sysdeps/powerpc/w_sqrt.c new file mode 100644 index 0000000000..df80973f58 --- /dev/null +++ b/sysdeps/powerpc/w_sqrt.c @@ -0,0 +1,141 @@ +/* Single-precision floating point square root. + Copyright (C) 1997 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 +#include +#include +#include + +static const double almost_half = 0.5000000000000001; /* 0.5 + 2^-53 */ +static const uint32_t a_nan = 0x7fc00000; +static const uint32_t a_inf = 0x7f800000; +static const float two108 = 3.245185536584267269e+32; +static const float twom54 = 5.551115123125782702e-17; +extern const float __t_sqrt[1024]; + +/* The method is based on a description in + Computation of elementary functions on the IBM RISC System/6000 processor, + P. W. Markstein, IBM J. Res. Develop, 34(1) 1990. + Basically, it consists of two interleaved Newton-Rhapson approximations, + one to find the actual square root, and one to find its reciprocal + without the expense of a division operation. The tricky bit here + is the use of the POWER/PowerPC multiply-add operation to get the + required accuracy with high speed. + + The argument reduction works by a combination of table lookup to + obtain the initial guesses, and some careful modification of the + generated guesses (which mostly runs on the integer unit, while the + Newton-Rhapson is running on the FPU). */ +double +__sqrt(double x) +{ + const float inf = *(const float *)&a_inf; + /* x = f_wash(x); *//* This ensures only one exception for SNaN. */ + if (x > 0) + { + if (x != inf) + { + /* Variables named starting with 's' exist in the + argument-reduced space, so that 2 > sx >= 0.5, + 1.41... > sg >= 0.70.., 0.70.. >= sy > 0.35... . + Variables named ending with 'i' are integer versions of + floating-point values. */ + double sx; /* The value of which we're trying to find the + square root. */ + double sg,g; /* Guess of the square root of x. */ + double sd,d; /* Difference between the square of the guess and x. */ + double sy; /* Estimate of 1/2g (overestimated by 1ulp). */ + double sy2; /* 2*sy */ + double e; /* Difference between y*g and 1/2 (se = e * fsy). */ + double shx; /* == sx * fsg */ + double fsg; /* sg*fsg == g. */ + fenv_t fe; /* Saved floating-point environment (stores rounding + mode and whether the inexact exception is + enabled). */ + uint32_t xi0, xi1, sxi, fsgi; + const float *t_sqrt; + + fe = fegetenv_register(); + EXTRACT_WORDS (xi0,xi1,x); + relax_fenv_state(); + sxi = xi0 & 0x3fffffff | 0x3fe00000; + INSERT_WORDS (sx, sxi, xi1); + t_sqrt = __t_sqrt + (xi0 >> 52-32-8-1 & 0x3fe); + sg = t_sqrt[0]; + sy = t_sqrt[1]; + + /* Here we have three Newton-Rhapson iterations each of a + division and a square root and the remainder of the + argument reduction, all interleaved. */ + sd = -(sg*sg - sx); + fsgi = xi0 + 0x40000000 >> 1 & 0x7ff00000; + sy2 = sy + sy; + sg = sy*sd + sg; /* 16-bit approximation to sqrt(sx). */ + INSERT_WORDS (fsg, fsgi, 0); + e = -(sy*sg - almost_half); + sd = -(sg*sg - sx); + if ((xi0 & 0x7ff00000) == 0) + goto denorm; + sy = sy + e*sy2; + sg = sg + sy*sd; /* 32-bit approximation to sqrt(sx). */ + sy2 = sy + sy; + e = -(sy*sg - almost_half); + sd = -(sg*sg - sx); + sy = sy + e*sy2; + shx = sx * fsg; + sg = sg + sy*sd; /* 64-bit approximation to sqrt(sx), + but perhaps rounded incorrectly. */ + sy2 = sy + sy; + g = sg * fsg; + e = -(sy*sg - almost_half); + d = -(g*sg - shx); + sy = sy + e*sy2; + fesetenv_register (fe); + return g + sy*d; + denorm: + /* For denormalised numbers, we normalise, calculate the + square root, and return an adjusted result. */ + fesetenv_register (fe); + return __sqrt(x * two108) * twom54; + } + } + else if (x < 0) + { +#ifdef FE_INVALID_SQRT + feraiseexcept (FE_INVALID_SQRT); + /* For some reason, some PowerPC processors don't implement + FE_INVALID_SQRT. I guess no-one ever thought they'd be + used for square roots... :-) */ + if (!fetestexcept (FE_INVALID)) +#endif + feraiseexcept (FE_INVALID); +#ifndef _IEEE_LIBM + if (_LIB_VERSION != _IEEE_) + x = __kernel_standard(x,x,26); + else +#endif + x = *(const float*)&a_nan; + } + return f_wash(x); +} + +weak_alias (__sqrt, sqrt) +/* Strictly, this is wrong, but the only places where _ieee754_sqrt is + used will not pass in a negative result. */ +strong_alias(__sqrt,__ieee754_sqrt) diff --git a/sysdeps/powerpc/w_sqrtf.c b/sysdeps/powerpc/w_sqrtf.c new file mode 100644 index 0000000000..804dff3c44 --- /dev/null +++ b/sysdeps/powerpc/w_sqrtf.c @@ -0,0 +1,136 @@ +/* Single-precision floating point square root. + Copyright (C) 1997 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 +#include +#include +#include + +static const float almost_half = 0.50000006; /* 0.5 + 2^-24 */ +static const uint32_t a_nan = 0x7fc00000; +static const uint32_t a_inf = 0x7f800000; +static const float two48 = 281474976710656.0; +static const float twom24 = 5.9604644775390625e-8; +extern const float __t_sqrt[1024]; + +/* The method is based on a description in + Computation of elementary functions on the IBM RISC System/6000 processor, + P. W. Markstein, IBM J. Res. Develop, 34(1) 1990. + Basically, it consists of two interleaved Newton-Rhapson approximations, + one to find the actual square root, and one to find its reciprocal + without the expense of a division operation. The tricky bit here + is the use of the POWER/PowerPC multiply-add operation to get the + required accuracy with high speed. + + The argument reduction works by a combination of table lookup to + obtain the initial guesses, and some careful modification of the + generated guesses (which mostly runs on the integer unit, while the + Newton-Rhapson is running on the FPU). */ +float +__sqrtf(float x) +{ + const float inf = *(const float *)&a_inf; + /* x = f_washf(x); *//* This ensures only one exception for SNaN. */ + if (x > 0) + { + if (x != inf) + { + /* Variables named starting with 's' exist in the + argument-reduced space, so that 2 > sx >= 0.5, + 1.41... > sg >= 0.70.., 0.70.. >= sy > 0.35... . + Variables named ending with 'i' are integer versions of + floating-point values. */ + float sx; /* The value of which we're trying to find the square + root. */ + float sg,g; /* Guess of the square root of x. */ + float sd,d; /* Difference between the square of the guess and x. */ + float sy; /* Estimate of 1/2g (overestimated by 1ulp). */ + float sy2; /* 2*sy */ + float e; /* Difference between y*g and 1/2 (note that e==se). */ + float shx; /* == sx * fsg */ + float fsg; /* sg*fsg == g. */ + fenv_t fe; /* Saved floating-point environment (stores rounding + mode and whether the inexact exception is + enabled). */ + uint32_t xi, sxi, fsgi; + const float *t_sqrt; + + GET_FLOAT_WORD (xi, x); + fe = fegetenv_register (); + relax_fenv_state (); + sxi = xi & 0x3fffffff | 0x3f000000; + SET_FLOAT_WORD (sx, sxi); + t_sqrt = __t_sqrt + (xi >> 23-8-1 & 0x3fe); + sg = t_sqrt[0]; + sy = t_sqrt[1]; + + /* Here we have three Newton-Rhapson iterations each of a + division and a square root and the remainder of the + argument reduction, all interleaved. */ + sd = -(sg*sg - sx); + fsgi = xi + 0x40000000 >> 1 & 0x7f800000; + sy2 = sy + sy; + sg = sy*sd + sg; /* 16-bit approximation to sqrt(sx). */ + e = -(sy*sg - almost_half); + SET_FLOAT_WORD (fsg, fsgi); + sd = -(sg*sg - sx); + sy = sy + e*sy2; + if ((xi & 0x7f800000) == 0) + goto denorm; + shx = sx * fsg; + sg = sg + sy*sd; /* 32-bit approximation to sqrt(sx), + but perhaps rounded incorrectly. */ + sy2 = sy + sy; + g = sg * fsg; + e = -(sy*sg - almost_half); + d = -(g*sg - shx); + sy = sy + e*sy2; + fesetenv_register (fe); + return g + sy*d; + denorm: + /* For denormalised numbers, we normalise, calculate the + square root, and return an adjusted result. */ + fesetenv_register (fe); + return __sqrtf(x * two48) * twom24; + } + } + else if (x < 0) + { +#ifdef FE_INVALID_SQRT + feraiseexcept (FE_INVALID_SQRT); + /* For some reason, some PowerPC processors don't implement + FE_INVALID_SQRT. I guess no-one ever thought they'd be + used for square roots... :-) */ + if (!fetestexcept (FE_INVALID)) +#endif + feraiseexcept (FE_INVALID); +#ifndef _IEEE_LIBM + if (_LIB_VERSION != _IEEE_) + x = __kernel_standard(x,x,126); + else +#endif + x = *(const float*)&a_nan; + } + return f_washf(x); +} + +weak_alias (__sqrtf, sqrtf) +/* Strictly, this is wrong, but the only places where _ieee754_sqrt is + used will not pass in a negative result. */ +strong_alias(__sqrtf,__ieee754_sqrtf) diff --git a/sysdeps/unix/sysv/linux/bits/poll.h b/sysdeps/unix/sysv/linux/bits/poll.h new file mode 100644 index 0000000000..c6b1d2324a --- /dev/null +++ b/sysdeps/unix/sysv/linux/bits/poll.h @@ -0,0 +1,48 @@ +/* Copyright (C) 1997 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. */ + + +/* Event types that can be polled for. These bits may be set in `events' + to indicate the interesting event types; they will appear in `revents' + to indicate the status of the file descriptor. */ +#define POLLIN 0x001 /* There is data to read. */ +#define POLLPRI 0x002 /* There is urgent data to read. */ +#define POLLOUT 0x004 /* Writing now will not block. */ + +#ifdef __USE_XOPEN +/* These values are defined in XPG4.2. */ +# define POLLRDNORM 0x040 /* Normal data may be read. */ +# define POLLRDBAND 0x080 /* Priority data may be read. */ +# define POLLWRNORM 0x100 /* Writing now will not block. */ +# define POLLWRBAND 0x200 /* Priority data may be written. */ +#endif + +#ifdef __USE_GNU +/* This is an extension for Linux. */ +# define POLLMSG 0x400 +#endif + +/* Event types always implicitly polled for. These bits need not be set in + `events', but they will appear in `revents' to indicate the status of + the file descriptor. */ +#define POLLERR 0x008 /* Error condition. */ +#define POLLHUP 0x010 /* Hung up. */ +#define POLLNVAL 0x020 /* Invalid polling request. */ + +/* Canonical number of polling requests to read in at a time in poll. */ +#define NPOLLFILE 30 diff --git a/sysdeps/unix/sysv/linux/m68k/bits/poll.h b/sysdeps/unix/sysv/linux/m68k/bits/poll.h new file mode 100644 index 0000000000..8fea43924a --- /dev/null +++ b/sysdeps/unix/sysv/linux/m68k/bits/poll.h @@ -0,0 +1,43 @@ +/* Copyright (C) 1997 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. */ + + +/* Event types that can be polled for. These bits may be set in `events' + to indicate the interesting event types; they will appear in `revents' + to indicate the status of the file descriptor. */ +#define POLLIN 0x001 /* There is data to read. */ +#define POLLPRI 0x002 /* There is urgent data to read. */ +#define POLLOUT 0x004 /* Writing now will not block. */ + +#ifdef __USE_XOPEN +/* These values are defined in XPG4.2. */ +# define POLLRDNORM 0x040 /* Normal data may be read. */ +# define POLLRDBAND 0x080 /* Priority data may be read. */ +# define POLLWRNORM POLLOUT /* Writing now will not block. */ +# define POLLWRBAND 0x100 /* Priority data may be written. */ +#endif + +/* Event types always implicitly polled for. These bits need not be set in + `events', but they will appear in `revents' to indicate the status of + the file descriptor. */ +#define POLLERR 0x008 /* Error condition. */ +#define POLLHUP 0x010 /* Hung up. */ +#define POLLNVAL 0x020 /* Invalid polling request. */ + +/* Canonical number of polling requests to read in at a time in poll. */ +#define NPOLLFILE 30 diff --git a/sysdeps/unix/sysv/linux/mips/bits/poll.h b/sysdeps/unix/sysv/linux/mips/bits/poll.h new file mode 100644 index 0000000000..c1c9a6b392 --- /dev/null +++ b/sysdeps/unix/sysv/linux/mips/bits/poll.h @@ -0,0 +1,48 @@ +/* Copyright (C) 1997 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. */ + + +/* Event types that can be polled for. These bits may be set in `events' + to indicate the interesting event types; they will appear in `revents' + to indicate the status of the file descriptor. */ +#define POLLIN 0x001 /* There is data to read. */ +#define POLLPRI 0x002 /* There is urgent data to read. */ +#define POLLOUT 0x004 /* Writing now will not block. */ + +#ifdef __USE_XOPEN +/* These values are defined in XPG4.2. */ +# define POLLRDNORM 0x040 /* Normal data may be read. */ +# define POLLRDBAND 0x080 /* Priority data may be read. */ +# define POLLWRNORM POLLOUT /* Writing now will not block. */ +# define POLLWRBAND 0x100 /* Priority data may be written. */ +#endif + +#ifdef __USE_GNU +/* This is an extension for Linux. */ +# define POLLMSG 0x400 +#endif + +/* Event types always implicitly polled for. These bits need not be set in + `events', but they will appear in `revents' to indicate the status of + the file descriptor. */ +#define POLLERR 0x008 /* Error condition. */ +#define POLLHUP 0x010 /* Hung up. */ +#define POLLNVAL 0x020 /* Invalid polling request. */ + +/* Canonical number of polling requests to read in at a time in poll. */ +#define NPOLLFILE 30 diff --git a/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c b/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c index 7280315933..7a2b0c8279 100644 --- a/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c +++ b/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c @@ -17,135 +17,27 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include -#include -#include -#include -#include -#include + +/* The PowerPC's auxiliary argument block gets aligned to a 16-byte + boundary. This is history and impossible to change compatibly. */ + +#define DL_FIND_ARG_COMPONENTS(cookie, argc, argv, envp, auxp) \ + do { \ + void **_tmp; \ + (argc) = *(long *) cookie; \ + (argv) = (char **) cookie + 1; \ + (envp) = (argv) + (argc) + 1; \ + for (_tmp = (void **) (envp); *_tmp; ++_tmp) \ + continue; \ + if (*_tmp == 0 && ((size_t)_tmp & 0xf) != 0) \ + { \ + size_t _test = (size_t)_tmp; \ + _test = _test + 0xf & ~0xf; \ + if (*(long *)_test == AT_PHDR) \ + _tmp = (void **)_test; \ + } \ + (auxp) = (void *) _tmp; \ + } while (0) -extern int _dl_argc; -extern char **_dl_argv; -extern char **_environ; -extern size_t _dl_pagesize; -extern void _end; -extern void _start (void); - -int __libc_enable_secure; -int __libc_multiple_libcs; /* Defining this here avoids the inclusion - of init-first. */ - -ElfW(Addr) -_dl_sysdep_start (void **start_argptr, - void (*dl_main) (const ElfW(Phdr) *phdr, ElfW(Word) phnum, - ElfW(Addr) *user_entry)) -{ - const ElfW(Phdr) *phdr = NULL; - ElfW(Word) phnum = 0; - ElfW(Addr) user_entry; - ElfW(auxv_t) *av; - uid_t uid = 0; - uid_t euid = 0; - gid_t gid = 0; - gid_t egid = 0; - unsigned int seen; - - user_entry = (ElfW(Addr)) &_start; - _dl_argc = *(long *) start_argptr; - _dl_argv = (char **) start_argptr + 1; - _environ = &_dl_argv[_dl_argc + 1]; - start_argptr = (void **) _environ; - while (*start_argptr) - ++start_argptr; - ++start_argptr; - - if (*start_argptr == 0 && - ((unsigned)(char *)start_argptr & 0xF) != 0) - { - unsigned test_sap = (int)(char *)start_argptr; - test_sap = test_sap + 0xF & ~0xF; - if (*(long *)(char *)test_sap == AT_PHDR) - start_argptr = (void **)(char *)test_sap; - } - - seen = 0; -#define M(type) (1 << (type)) - - for (av = (void *) start_argptr; - av->a_type != AT_NULL; - seen |= M ((++av)->a_type)) - switch (av->a_type) - { - case AT_PHDR: - phdr = av->a_un.a_ptr; - break; - case AT_PHNUM: - phnum = av->a_un.a_val; - break; - case AT_PAGESZ: - _dl_pagesize = av->a_un.a_val; - break; - case AT_ENTRY: - user_entry = av->a_un.a_val; - break; - case AT_UID: - uid = av->a_un.a_val; - break; - case AT_GID: - gid = av->a_un.a_val; - break; - case AT_EUID: - euid = av->a_un.a_val; - break; - case AT_EGID: - egid = av->a_un.a_val; - break; - } - - /* Linux doesn't provide us with any of these values on the stack - when the dynamic linker is run directly as a program. */ - -#define SEE(UID, uid) if ((seen & M (AT_##UID)) == 0) uid = __get##uid () - SEE (UID, uid); - SEE (GID, gid); - SEE (EUID, euid); - SEE (EGID, egid); - - - __libc_enable_secure = uid != euid || gid != egid; - - __brk (0); /* Initialize the break. */ - - if (__sbrk (0) == &_end) - { - /* The dynamic linker was run as a program, and so the initial break - starts just after our bss, at &_end. The malloc in dl-minimal.c - will consume the rest of this page, so tell the kernel to move the - break up that far. When the user program examines its break, it - will see this new value and not clobber our data. */ - size_t pg = __getpagesize (); - - __sbrk (pg - ((&_end - (void *) 0) & pg)); - __sbrk (pg - ((&_end - (void *) 0) & (pg - 1))); - } - - (*dl_main) (phdr, phnum, &user_entry); - return user_entry; -} - -void -_dl_sysdep_start_cleanup (void) -{ -} - -#ifndef MAP_ANON -/* This is only needed if the system doesn't support MAP_ANON. */ - -int -_dl_sysdep_open_zero_fill (void) -{ - return __open ("/dev/zero", O_RDONLY); -} -#endif +#include diff --git a/sysdeps/unix/sysv/linux/sparc/bits/poll.h b/sysdeps/unix/sysv/linux/sparc/bits/poll.h new file mode 100644 index 0000000000..8fea43924a --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/bits/poll.h @@ -0,0 +1,43 @@ +/* Copyright (C) 1997 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. */ + + +/* Event types that can be polled for. These bits may be set in `events' + to indicate the interesting event types; they will appear in `revents' + to indicate the status of the file descriptor. */ +#define POLLIN 0x001 /* There is data to read. */ +#define POLLPRI 0x002 /* There is urgent data to read. */ +#define POLLOUT 0x004 /* Writing now will not block. */ + +#ifdef __USE_XOPEN +/* These values are defined in XPG4.2. */ +# define POLLRDNORM 0x040 /* Normal data may be read. */ +# define POLLRDBAND 0x080 /* Priority data may be read. */ +# define POLLWRNORM POLLOUT /* Writing now will not block. */ +# define POLLWRBAND 0x100 /* Priority data may be written. */ +#endif + +/* Event types always implicitly polled for. These bits need not be set in + `events', but they will appear in `revents' to indicate the status of + the file descriptor. */ +#define POLLERR 0x008 /* Error condition. */ +#define POLLHUP 0x010 /* Hung up. */ +#define POLLNVAL 0x020 /* Invalid polling request. */ + +/* Canonical number of polling requests to read in at a time in poll. */ +#define NPOLLFILE 30