From fed8f7f7aeb06dfae0dfbfb085c6857cc457c254 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 15 Jun 1998 18:12:05 +0000 Subject: Update. 1998-06-15 18:07 Ulrich Drepper * iconvdata/ksc5601.h: Clean up a bit. 1998-06-15 14:35 Ulrich Drepper * sunrpc/svc_tcp.c (readtcp): Also listen to all the other connections and process incoming data. * sunrpc/xdr_rec.c (set_input_fragment): Only recognize zero length fragments as invalid. Patches by Thorsten Kukuk . 1998-06-13 Andreas Jaeger Removal of duplicates like "the the". * manual/time.texi (TZ Variable): Likewise. * manual/users.texi (Manipulating the Database): Likewise. * manual/sysinfo.texi (Filesystem handling): Likewise. * manual/signal.texi (Signaling Yourself): Likewise. * manual/message.texi (Message Translation): Likewise. (Common Usage): Likewise. * manual/llio.texi: Likewise. * manual/arith.texi (Old-style number conversion): Likewise. * manual/argp.texi (Argp): Likewise. (Argp Parsers): Likewise. (Argp Help Filtering): Likewise. * hesiod/README.hesiod: Correct typo. * manual/llio.texi: Correct typos. * manual/sysinfo.texi: Likewise. 1998-06-13 Andreas Jaeger * rt/aio.h: Rename __op to __operation for g++. 1998-06-13 20:17 -0400 Zack Weinberg * iconvdata/gen-8bit-gap.sh: Use awk not perl. Clean up sed script. * iconvdata/gen-8bit-gap-1.sh: Likewise. * iconvdata/gen-8bit.sh: Clean up sed script. * iconvdata/Makefile: Remove all PERL conditionals; build all the modules all the time. Export AWK. (gen-8bit-gap): Delete setting of PERL. (gen-8bit-gap-1): Likewise. (perl-generated-headers): Renamed awk-generated-headers. * iconvdata/gap.pl: Removed. * iconvdata/gaptab.pl: Removed. * iconvdata/gap.awk: New file. * iconvdata/gaptab.awk: New file. 1998-06-15 Ulrich Drepper * sysdeps/generic/Dist: Add errno-loc.c. * sysdeps/unix/sysv/linux/alpha/glob.c: Add prototypes for the __new_* functions. 1998-06-14 14:21 -0400 Zack Weinberg * stdio-common/bug12.c: New test for fread()/fseek(). * stdio-common/Makefile (tests): Add bug12. --- ChangeLog | 66 ++++++++++++++++++++++++++++++++++ hesiod/README.hesiod | 6 ++-- iconvdata/Makefile | 37 ++++++++----------- iconvdata/gap.awk | 39 ++++++++++++++++++++ iconvdata/gap.pl | 16 --------- iconvdata/gaptab.awk | 48 +++++++++++++++++++++++++ iconvdata/gaptab.pl | 25 ------------- iconvdata/gen-8bit-gap-1.sh | 15 ++++---- iconvdata/gen-8bit-gap.sh | 15 ++++---- iconvdata/gen-8bit.sh | 10 +++--- iconvdata/ksc5601.h | 11 +++--- manual/argp.texi | 6 ++-- manual/arith.texi | 2 +- manual/llio.texi | 88 ++++++++++++++++++++++----------------------- manual/message.texi | 6 ++-- manual/signal.texi | 2 +- manual/sysinfo.texi | 10 +++--- manual/time.texi | 2 +- manual/users.texi | 11 +++--- sunrpc/svc_tcp.c | 44 +++++++++++++---------- sunrpc/xdr_rec.c | 12 ++++--- sysdeps/i386/i686/ffs.c | 45 +++++++++++++++++++++++ 22 files changed, 333 insertions(+), 183 deletions(-) create mode 100644 iconvdata/gap.awk delete mode 100644 iconvdata/gap.pl create mode 100644 iconvdata/gaptab.awk delete mode 100644 iconvdata/gaptab.pl create mode 100644 sysdeps/i386/i686/ffs.c diff --git a/ChangeLog b/ChangeLog index 67d1945..5fd5ad8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,69 @@ +1998-06-15 18:07 Ulrich Drepper + + * iconvdata/ksc5601.h: Clean up a bit. + +1998-06-15 14:35 Ulrich Drepper + + * sunrpc/svc_tcp.c (readtcp): Also listen to all the other connections + and process incoming data. + * sunrpc/xdr_rec.c (set_input_fragment): Only recognize zero length + fragments as invalid. + Patches by Thorsten Kukuk . + +1998-06-13 Andreas Jaeger + + Removal of duplicates like "the the". + * manual/time.texi (TZ Variable): Likewise. + * manual/users.texi (Manipulating the Database): Likewise. + * manual/sysinfo.texi (Filesystem handling): Likewise. + * manual/signal.texi (Signaling Yourself): Likewise. + * manual/message.texi (Message Translation): Likewise. + (Common Usage): Likewise. + * manual/llio.texi: Likewise. + * manual/arith.texi (Old-style number conversion): Likewise. + * manual/argp.texi (Argp): Likewise. + (Argp Parsers): Likewise. + (Argp Help Filtering): Likewise. + + * hesiod/README.hesiod: Correct typo. + + * manual/llio.texi: Correct typos. + * manual/sysinfo.texi: Likewise. + +1998-06-13 Andreas Jaeger + + * rt/aio.h: Rename __op to __operation for g++. + +1998-06-13 20:17 -0400 Zack Weinberg + + * iconvdata/gen-8bit-gap.sh: Use awk not perl. Clean up sed + script. + * iconvdata/gen-8bit-gap-1.sh: Likewise. + * iconvdata/gen-8bit.sh: Clean up sed script. + + * iconvdata/Makefile: Remove all PERL conditionals; build all + the modules all the time. Export AWK. + (gen-8bit-gap): Delete setting of PERL. + (gen-8bit-gap-1): Likewise. + (perl-generated-headers): Renamed awk-generated-headers. + + * iconvdata/gap.pl: Removed. + * iconvdata/gaptab.pl: Removed. + * iconvdata/gap.awk: New file. + * iconvdata/gaptab.awk: New file. + +1998-06-15 Ulrich Drepper + + * sysdeps/generic/Dist: Add errno-loc.c. + + * sysdeps/unix/sysv/linux/alpha/glob.c: Add prototypes for the + __new_* functions. + +1998-06-14 14:21 -0400 Zack Weinberg + + * stdio-common/bug12.c: New test for fread()/fseek(). + * stdio-common/Makefile (tests): Add bug12. + 1998-06-14 Andreas Schwab * sysdeps/generic/elf/backtracesyms.c: Make array elements diff --git a/hesiod/README.hesiod b/hesiod/README.hesiod index 914e0d1..335a73e 100644 --- a/hesiod/README.hesiod +++ b/hesiod/README.hesiod @@ -26,9 +26,9 @@ and their reentrant counterparts. Configuring your systems ======================== -Configuring your systems to make use use the Hesiod name service -requires one or more of the following steps, depending on whether you -are already running Hesiod in your network. +Configuring your systems to make use the Hesiod name service requires +one or more of the following steps, depending on whether you are +already running Hesiod in your network. Configuring NSS --------------- diff --git a/iconvdata/Makefile b/iconvdata/Makefile index 5de9bbf..a1634cf 100644 --- a/iconvdata/Makefile +++ b/iconvdata/Makefile @@ -31,17 +31,15 @@ modules := ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4 ISO8859-5 \ EBCDIC-FI-SE-A EBCDIC-FR EBCDIC-IS-FRISS EBCDIC-IT EBCDIC-PT \ EBCDIC-UK EBCDIC-US IBM037 IBM038 IBM274 IBM275 IBM423 \ IBM500 IBM870 IBM871 IBM891 IBM903 IBM904 IBM905 IBM1047 \ - CP874 CP737 CP775 ISO-2022-KR -ifneq ($(PERL),no) -modules += KOI8-R LATIN-GREEK LATIN-GREEK-1 IBM256 IBM273 IBM277 IBM278 \ + CP874 CP737 CP775 ISO-2022-KR \ + KOI8-R LATIN-GREEK LATIN-GREEK-1 IBM256 IBM273 IBM277 IBM278 \ IBM280 IBM281 IBM284 IBM285 IBM290 IBM297 IBM420 IBM424 \ IBM437 IBM850 IBM851 IBM852 IBM855 IBM857 IBM860 IBM861 \ IBM862 IBM863 IBM864 IBM865 IBM868 IBM869 IBM875 IBM880 \ IBM918 IBM1004 IBM1026 CP1250 CP1251 CP1252 CP1253 CP1254 \ CP1255 CP1256 CP1257 ISO-2022-JP -endif -modules.so := $(addsuffix .so, $(modules)) +modules.so := $(addsuffix .so, $(modules)) include ../Makeconfig @@ -173,7 +171,7 @@ LDFLAGS-libKSC.so = -Wl,-soname,$(@F) LDFLAGS-libGB.so = -Wl,-soname,$(@F) LDFLAGS-libCNS.so = -Wl,-soname,$(@F) -distribute := 8bit-generic.c 8bit-gap.c gap.pl gaptab.pl gconv-modules \ +distribute := 8bit-generic.c 8bit-gap.c gap.awk gaptab.awk gconv-modules \ iso8859-1.c iso8859-2.c iso8859-3.c iso8859-4.c iso8859-5.c \ iso8859-6.c iso8859-7.c iso8859-8.c iso8859-9.c iso8859-10.c \ t61.c iso6937.c sjis.c jis0201.h jis0208.h jis0212.h \ @@ -245,12 +243,14 @@ sed-generated-headers := iso8859-2.h iso8859-3.h iso8859-4.h iso8859-6.h \ define generate-8bit-gap-table $(make-target-directory) -PERL="$(PERL)" $(SHELL) ./gen-8bit-gap.sh $< > $(@:stmp=T) +$(SHELL) ./gen-8bit-gap.sh $< > $(@:stmp=T) $(move-if-change) $(@:stmp=T) $(@:stmp=h) touch $@ endef -perl-generated-headers := koi8-r.h latin-greek.h latin-greek-1.h \ +export AWK + +awk-generated-headers := koi8-r.h latin-greek.h latin-greek-1.h \ ibm256.h ibm273.h ibm277.h ibm278.h ibm280.h \ ibm281.h ibm284.h ibm285.h ibm290.h ibm297.h \ ibm420.h ibm424.h ibm437.h ibm850.h ibm851.h \ @@ -263,17 +263,15 @@ perl-generated-headers := koi8-r.h latin-greek.h latin-greek-1.h \ iso8859-10.h iso8859-7jp.h generated = $(sed-generated-headers) $(sed-generated-headers:%.h=%.stmp) \ - $(perl-generated-headers) $(perl-generated-headers:%.h=%.stmp) \ + $(awk-generated-headers) $(awk-generated-headers:%.h=%.stmp) \ iconv-test.out ifdef objpfx generated += $(objpfx)gconv-modules endif # The headers must be generated before the compilation. -before-compile = $(addprefix $(objpfx),$(sed-generated-headers)) -ifneq ($(PERL),no) -before-compile += $(addprefix $(objpfx),$(perl-generated-headers)) -endif +before-compile = $(addprefix $(objpfx),\ + $(sed-generated-headers) $(awk-generated-headers)) # Rules to generate the headers. $(sed-generated-headers:%=$(objpfx)%): $(objpfx)%.h: $(objpfx)%.stmp @@ -355,8 +353,7 @@ $(objpfx)ibm905.stmp: ../localedata/charmaps/IBM905 gen-8bit.sh $(objpfx)ibm1047.stmp: ../localedata/charmaps/IBM1047 gen-8bit.sh $(generate-8bit-table) -ifneq ($(PERL),no) -$(perl-generated-headers:%=$(objpfx)%): $(objpfx)%.h: $(objpfx)%.stmp +$(awk-generated-headers:%=$(objpfx)%): $(objpfx)%.h: $(objpfx)%.stmp @: $(objpfx)iso8859-5.stmp: ../localedata/charmaps/ISO-8859-5 gen-8bit-gap.sh @@ -365,7 +362,7 @@ $(objpfx)iso8859-7.stmp: ../localedata/charmaps/ISO-8859-7 gen-8bit-gap.sh $(generate-8bit-gap-table) $(objpfx)iso8859-7jp.stmp: ../localedata/charmaps/ISO-8859-7 gen-8bit-gap-1.sh $(make-target-directory) - PERL="$(PERL)" $(SHELL) ./gen-8bit-gap-1.sh $< >$(@:stmp=T) + $(SHELL) ./gen-8bit-gap-1.sh $< >$(@:stmp=T) $(move-if-change) $(@:stmp=T) $(@:stmp=h) touch $@ @@ -460,13 +457,9 @@ $(objpfx)cp1256.stmp: ../localedata/charmaps/CP1256 gen-8bit-gap.sh $(generate-8bit-gap-table) $(objpfx)cp1257.stmp: ../localedata/charmaps/CP1257 gen-8bit-gap.sh $(generate-8bit-gap-table) -endif - -headers: $(addprefix $(objpfx),$(sed-generated-headers)) -ifneq ($(PERL),no) -headers: $(addprefix $(objpfx),$(perl-generated-headers)) -endif +headers: $(addprefix $(objpfx),\ + $(sed-generated-headers) $(awk-generated-headers)) $(addprefix $(inst_gconvdir)/, $(modules.so)): \ $(inst_gconvdir)/%: $(objpfx)% $(+force) diff --git a/iconvdata/gap.awk b/iconvdata/gap.awk new file mode 100644 index 0000000..583d22b --- /dev/null +++ b/iconvdata/gap.awk @@ -0,0 +1,39 @@ +BEGIN { hv["0"] = 0; hv["1"] = 1; hv["2"] = 2; hv["3"] = 3; + hv["4"] = 4; hv["5"] = 5; hv["6"] = 6; hv["7"] = 7; + hv["8"] = 8; hv["9"] = 9; hv["A"] = 10; hv["B"] = 11; + hv["C"] = 12; hv["D"] = 13; hv["E"] = 14; hv["F"] = 15; + hv["a"] = 10; hv["b"] = 11; hv["c"] = 12; hv["d"] = 13; + hv["e"] = 14; hv["f"] = 15; + + first = 0; last = 0; idx = 0; +} + +function tonum(str) +{ + num=0; + cnt=1; + while (cnt <= length(str)) { + num *= 16; + num += hv[substr(str,cnt,1)]; + ++cnt; + } + return num; +} + +{ + u = tonum($1); + if (u - last > 6) + { + if (last) + { + printf (" { start: 0x%04x, end: 0x%04x, idx: %5d },\n", + first, last, idx); + idx -= u - last - 1; + } + first = u; + } + last = u; +} + +END { printf (" { start: 0x%04x, end: 0x%04x, idx: %5d },\n", + first, last, idx); } diff --git a/iconvdata/gap.pl b/iconvdata/gap.pl deleted file mode 100644 index 2a06adc..0000000 --- a/iconvdata/gap.pl +++ /dev/null @@ -1,16 +0,0 @@ -$first=$last=$idx=0; -while (<>) { - local($ucs,$rest) = split; - local($u)=hex($ucs); - if ($u - $last > 6) { - if ($last != 0) { - printf (" { start: 0x%04x, end: 0x%04x, idx: %5d },\n", - $first, $last, $idx); - $idx -= $u - $last - 1; - } - $first=$u; - } - $last=$u; -} -printf (" { start: 0x%04x, end: 0x%04x, idx: %5d },\n", - $first, $last, $idx); diff --git a/iconvdata/gaptab.awk b/iconvdata/gaptab.awk new file mode 100644 index 0000000..f9d1526 --- /dev/null +++ b/iconvdata/gaptab.awk @@ -0,0 +1,48 @@ +BEGIN { hv["0"] = 0; hv["1"] = 1; hv["2"] = 2; hv["3"] = 3; + hv["4"] = 4; hv["5"] = 5; hv["6"] = 6; hv["7"] = 7; + hv["8"] = 8; hv["9"] = 9; hv["A"] = 10; hv["B"] = 11; + hv["C"] = 12; hv["D"] = 13; hv["E"] = 14; hv["F"] = 15; + hv["a"] = 10; hv["b"] = 11; hv["c"] = 12; hv["d"] = 13; + hv["e"] = 14; hv["f"] = 15; + + first = 0; last = 0; idx = 0; f = 0; +} + +function tonum(str) +{ + num=0; + cnt=1; + while (cnt <= length(str)) { + num *= 16; + num += hv[substr(str,cnt,1)]; + ++cnt; + } + return num; +} + +function fmt(val) +{ + if (f++ % 8 == 0) + { printf ("\n '\\x%02x',", val); } + else + { printf (" '\\x%02x',", val); } +} + +{ + u = tonum($1); c = tonum($2); + + if (u - last > 6) + { + if (last) { idx += last - first + 1; } + first = u; + } + else + { + for (m = last+1; m < u; m++) { fmt(0); } + } + + fmt(c); + last = u; +} + +END { print "" } diff --git a/iconvdata/gaptab.pl b/iconvdata/gaptab.pl deleted file mode 100644 index 77df1c3..0000000 --- a/iconvdata/gaptab.pl +++ /dev/null @@ -1,25 +0,0 @@ -$first=$last=$idx=0; -sub fmt { - printf ("\n ") if (($n % 8) == 0); - ++$n; - my($val) = pop(@_); - printf (" '\\x%02x',", $val); -} -while (<>) { - local($ucs,$char,$rest) = split; - local($u)=hex($ucs); - local($c)=hex($char); - if ($u - $last > 6) { - if ($last != 0) { - $idx += $last - $first + 1; - } - $first=$u; - } else { - for ($m = $last + 1; $m < $u; ++$m) { - fmt (0); - } - } - fmt ($c); - $last=$u; -} -printf ("\n"); diff --git a/iconvdata/gen-8bit-gap-1.sh b/iconvdata/gen-8bit-gap-1.sh index febf2ea..5e949e7 100644 --- a/iconvdata/gen-8bit-gap-1.sh +++ b/iconvdata/gen-8bit-gap-1.sh @@ -1,18 +1,15 @@ #! /bin/sh echo "static const uint32_t iso88597_to_ucs4[96] = {" -sed -e '/^[^[:space:]]*[[:space:]]*.x00/d' \ +sed -ne '/^[^[:space:]]*[[:space:]]*.x00/d' \ -e 's/^[^[:space:]]*[[:space:]]*.x\([A-F].\)[[:space:]]*.*/ [0x\1 - 0xA0] = 0x\2,/p' \ - -e d "$@" | \ -sort -u + "$@" | sort -u echo "};" echo "static const struct gap from_idx[] = {" -sed -e 's/^[^[:space:]]*[[:space:]]*.x\([A-F].\)[[:space:]]*.*/0x\2 0x\1/p' \ - -e d "$@" | \ -sort -u | $PERL gap.pl +sed -ne 's/^[^[:space:]]*[[:space:]]*.x\([A-F].\)[[:space:]]*.*/\2/p' \ + "$@" | sort -u | $AWK -f gap.awk echo " { start: 0xffff, end: 0xffff, idx: 0 }" echo "};" echo "static const char iso88597_from_ucs4[] = {" -sed -e 's/^[^[:space:]]*[[:space:]]*.x\([A-F].\)[[:space:]]*.*/0x\2 0x\1/p' \ - -e d "$@" | \ -sort -u | $PERL gaptab.pl +sed -ne 's/^[^[:space:]]*[[:space:]]*.x\([A-F].\)[[:space:]]*.*/0x\2 0x\1/p' \ + "$@" | sort -u | $AWK -f gaptab.awk echo "};" diff --git a/iconvdata/gen-8bit-gap.sh b/iconvdata/gen-8bit-gap.sh index fd05a6b..7c11832 100644 --- a/iconvdata/gen-8bit-gap.sh +++ b/iconvdata/gen-8bit-gap.sh @@ -1,18 +1,15 @@ #! /bin/sh echo "static const uint32_t to_ucs4[256] = {" -sed -e '/^[^[:space:]]*[[:space:]]*.x00/d' \ +sed -ne '/^[^[:space:]]*[[:space:]]*.x00/d' \ -e 's/^[^[:space:]]*[[:space:]]*.x\(..\)[[:space:]]*.*/ [0x\1] = 0x\2,/p' \ - -e d "$@" | \ -sort -u + "$@" | sort -u echo "};" echo "static const struct gap from_idx[] = {" -sed -e 's/^[^[:space:]]*[[:space:]]*.x\(..\)[[:space:]]*.*/0x\2 0x\1/p' \ - -e d "$@" | \ -sort -u | $PERL gap.pl +sed -ne 's/^[^[:space:]]*[[:space:]]*.x\(..\)[[:space:]]*.*/\2/p' \ + "$@" | sort -u | $AWK -f gap.awk echo " { start: 0xffff, end: 0xffff, idx: 0 }" echo "};" echo "static const char from_ucs4[] = {" -sed -e 's/^[^[:space:]]*[[:space:]]*.x\(..\)[[:space:]]*.*/0x\2 0x\1/p' \ - -e d "$@" | \ -sort -u | $PERL gaptab.pl +sed -ne 's/^[^[:space:]]*[[:space:]]*.x\(..\)[[:space:]]*.*/\2 \1/p' \ + "$@" | sort -u | $AWK -f gaptab.awk echo "};" diff --git a/iconvdata/gen-8bit.sh b/iconvdata/gen-8bit.sh index efa44ea..de6605f 100644 --- a/iconvdata/gen-8bit.sh +++ b/iconvdata/gen-8bit.sh @@ -1,13 +1,11 @@ #! /bin/sh echo "static const uint32_t to_ucs4[256] = {" -sed -e '/^[^[:space:]]*[[:space:]]*.x00/d' \ +sed -ne '/^[^[:space:]]*[[:space:]]*.x00/d' \ -e 's/^[^[:space:]]*[[:space:]]*.x\(..\)[[:space:]]*.*/ [0x\1] = 0x\2,/p' \ - -e d "$@" | \ -sort -u + "$@" | sort -u echo "};" echo "static const char from_ucs4[] = {" -sed -e '/^[^[:space:]]*[[:space:]]*.x00/d' \ +sed -ne '/^[^[:space:]]*[[:space:]]*.x00/d' \ -e 's/^[^[:space:]]*[[:space:]]*.x\(..\)[[:space:]]*.*/ [0x\2] = 0x\1,/p' \ - -e d "$@" | \ -sort -u + "$@" | sort -u echo "};" diff --git a/iconvdata/ksc5601.h b/iconvdata/ksc5601.h index 0b10dcd..e67d911 100644 --- a/iconvdata/ksc5601.h +++ b/iconvdata/ksc5601.h @@ -85,13 +85,12 @@ static inline size_t ucs4_to_ksc5601_hangul (uint32_t wch, unsigned char *s, size_t avail) { int l = 0; - int m; int u = KSC5601_HANGUL - 1; uint32_t try; while (l <= u) { - m = (l + u) / 2; + int m = (l + u) / 2; try = (uint32_t) __ksc5601_hangul_to_ucs[m]; if (try > wch) u = m - 1; @@ -109,7 +108,7 @@ ucs4_to_ksc5601_hangul (uint32_t wch, unsigned char *s, size_t avail) } } - return UNKNOWN_10646_CHAR; + return UNKNOWN_10646_CHAR; } @@ -117,13 +116,12 @@ static inline size_t ucs4_to_ksc5601_hanja (uint32_t wch, unsigned char *s, size_t avail) { int l = 0; - int m; int u = KSC5601_HANJA - 1; uint32_t try; while (l <= u) { - m = (l + u) / 2; + int m = (l + u) / 2; try = (uint32_t) __ksc5601_hanja_from_ucs[m].ucs; if (try > wch) u=m-1; @@ -148,13 +146,12 @@ static inline size_t ucs4_to_ksc5601_sym (uint32_t wch, unsigned char *s, size_t avail) { int l = 0; - int m; int u = KSC5601_SYMBOL - 1; uint32_t try; while (l <= u) { - m = (l + u) / 2; + int m = (l + u) / 2; try = __ksc5601_sym_from_ucs[m].ucs; if (try > wch) u = m - 1; diff --git a/manual/argp.texi b/manual/argp.texi index ab16fe3..4847468 100644 --- a/manual/argp.texi +++ b/manual/argp.texi @@ -60,7 +60,7 @@ call to @code{argp_parse} is the only argument-parsing code needed in @comment argp.h @comment GNU @deftypefun {error_t} argp_parse (const struct argp *@var{argp}, int @var{argc}, char **@var{argv}, unsigned @var{flags}, int *@var{arg_index}, void *@var{input}) -The @code{argp_parse} function parses the arguments in in @var{argv}, of +The @code{argp_parse} function parses the arguments in @var{argv}, of length @var{argc}, using the argp parser @var{argp} (@pxref{Argp Parsers}); a value of zero is the same as a @code{struct argp} containing all zeros. @var{flags} is a set of flag bits that modify the @@ -203,7 +203,7 @@ messages. @xref{Argp Help Filtering}. The @code{options}, @code{parser}, @code{args_doc}, and @code{doc} fields are usually all that are needed. If an argp parser is defined as -an initialized C variable, only the used fields need be specified in in +an initialized C variable, only the used fields need be specified in the initializer---the rest will default to zero due to the way C structure initialization works (this fact is exploited for most argp structures, grouping the most-used fields near the beginning, so that @@ -845,7 +845,7 @@ Turns off any message-printing/exiting options, specifically @need 2000 @subsection Customizing Argp Help Output -The @code{help_filter} field in a a @code{struct argp} is a pointer to a +The @code{help_filter} field in a @code{struct argp} is a pointer to a function to filter the text of help messages before displaying them. They have a function signature like: diff --git a/manual/arith.texi b/manual/arith.texi index 57b3ac9..8822a8c 100644 --- a/manual/arith.texi +++ b/manual/arith.texi @@ -1339,7 +1339,7 @@ library also provides these functions together with some useful extensions in the same sense. Generally, you should avoid using these functions unless the really fit -into the problem you have to to solve. Otherwise it is almost always +into the problem you have to solve. Otherwise it is almost always better to use @code{sprintf} since its greater availability (it is an @w{ISO C} function). diff --git a/manual/llio.texi b/manual/llio.texi index e0b1671..6387eec 100644 --- a/manual/llio.texi +++ b/manual/llio.texi @@ -142,7 +142,7 @@ or @code{O_CREAT} is set and the file does not already exist. If on a 32 bits machine the sources are translated with @code{_FILE_OFFSET_BITS == 64} the function @code{open} returns a file descriptor opened in the large file mode which enables the file handling -functions to use files up to @math{2^63} in size and offset from +functions to use files up to @math{2^63} bytes in size and offset from @math{-2^63} to @math{2^63}. This happens transparently for the user since all of the lowlevel file handling functions are equally replaced. @@ -266,7 +266,7 @@ on their meaning. Please note that there is @emph{no} separate @code{close64} function. This is not necessary since this function does not determine nor depend -on the more of the file. The kernel which performs the @code{close} +on the mode of the file. The kernel which performs the @code{close} operation knows for which mode the descriptor is used and can handle this situation. @end deftypefun @@ -1402,7 +1402,7 @@ These functions are part of the library with realtime functions named The implementation of these functions can be done using support in the kernel (if available) or using an implementation based on threads at userlevel. In the latter case it might be necessary to link applications -with the thread library @file{libthread} in addition to @file{librt}. +with the thread library @file{libpthread} in addition to @file{librt}. All AIO operations operate on files which were opened previously. There might be arbitrary many operations for one file running. The @@ -1429,8 +1429,8 @@ I.e., it is not possible to use any of the AIO operations on devices like terminals where an @code{lseek} call would lead to an error. @item off_t aio_offset -This element specified at which offset in the file the operation (input -or output) is performed. Since the operation are carried in arbitrary +This element specifies at which offset in the file the operation (input +or output) is performed. Since the operations are carried out in arbitrary order and more than one operation for one file descriptor can be started, one cannot expect a current read/write position of the file descriptor. @@ -1451,10 +1451,10 @@ AIO operation. @item struct sigevent aio_sigevent This element specifies how the calling process is notified once the -operation terminated. If the @code{sigev_notify} element is +operation terminates. If the @code{sigev_notify} element is @code{SIGEV_NONE} no notification is send. If it is @code{SIGEV_SIGNAL} the signal determined by @code{sigev_signo} is send. Otherwise -@code{sigev_notify} must be @code{SIGEV_THREAD} in which case a thread +@code{sigev_notify} must be @code{SIGEV_THREAD}. In this case a thread is created which starts executing the function pointed to by @code{sigev_notify_function}. @@ -1478,12 +1478,12 @@ Start a write operation. Write @code{aio_nbytes} bytes starting at @item LIO_NOP Do nothing for this control block. This value is useful sometimes when an array of @code{struct aiocb} values contains holes, i.e., some of the -values must not be handled allthough the whole array is presented to the +values must not be handled although the whole array is presented to the @code{lio_listio} function. @end vtable @end table -When the sourcs are compiled using @code{_FILE_OFFSET_BITS == 64} on a +When the sources are compiled using @code{_FILE_OFFSET_BITS == 64} on a 32 bits machine this type is in fact @code{struct aiocb64} since the LFS interface transparently replaces the @code{struct aiocb} definition. @end deftp @@ -1529,7 +1529,7 @@ AIO operation. @item struct sigevent aio_sigevent This element specifies how the calling process is notified once the -operation terminated. If the @code{sigev_notify} element is +operation terminates. If the @code{sigev_notify} element is @code{SIGEV_NONE} no notification is send. If it is @code{SIGEV_SIGNAL} the signal determined by @code{sigev_signo} is send. Otherwise @code{sigev_notify} must be @code{SIGEV_THREAD} in which case a thread @@ -1539,7 +1539,7 @@ which starts executing the function pointeed to by @item int aio_lio_opcode This element is only used by the @code{lio_listio} and @code{[lio_listio64} functions. Since these functions allow to start an -arbitrary number of operations at once and since each operationcan be +arbitrary number of operations at once and since each operation can be input or output (or nothing) the information must be stored in the control block. See the description of @code{struct aiocb} for a description of the possible values. @@ -1566,7 +1566,7 @@ aiocb64} since the LFS replaces transparently the old interface. @deftypefun int aio_read (struct aiocb *@var{aiocbp}) This function initiates an asynchronous read operation. The function call immediately returns after the operation was enqueued or when an -error was encoutered. +error was encountered. The first @code{aiocbp->aio_nbytes} bytes of the file for which @code{aiocbp->aio_fildes} is a descriptor are written to the buffer @@ -1593,8 +1593,8 @@ limitations. The @code{aio_read} function is not implemented. @item EBADF The @code{aiocbp->aio_fildes} descriptor is not valid. This condition -need not be recognized before enqueueing the request and so this error -might also be signaled asynchrously. +needs not be recognized before enqueueing the request and so this error +might also be signaled asynchronously. @item EINVAL The @code{aiocbp->aio_offset} or @code{aiocbp->aio_reqpiro} value is invalid. This condition need not be recognized before enqueueing the @@ -1609,7 +1609,7 @@ functions. As long as the value returned by @code{aio_error} is otherwise the value is to be interpreted as an error code. If the function terminated the result of the operation can be get using a call to @code{aio_return}. The returned value is the same as an equivalent -call to @code{read} would have returned. Possible error code returned +call to @code{read} would have returned. Possible error codes returned by @code{aio_error} are: @table @code @@ -1635,7 +1635,7 @@ difference is that on @w{32 bits} machines the file descriptor should be opened in the large file mode. Internally @code{aio_read64} uses functionality equivalent to @code{lseek64} (@pxref{File Position Primitive}) to position the file descriptor correctly for the reading, -as opposed to @code{lseek} funcationality used in @code{aio_read}. +as opposed to @code{lseek} functionality used in @code{aio_read}. When the sources are compiled with @code{_FILE_OFFSET_BITS == 64} this function is available under the name @code{aio_read} and so transparently @@ -1650,7 +1650,7 @@ of functions with a very similar interface. @deftypefun int aio_write (struct aiocb *@var{aiocbp}) This function initiates an asynchronous write operation. The function call immediately returns after the operation was enqueued or if before -this happens an error was encoutered. +this happens an error was encountered. The first @code{aiocbp->aio_nbytes} bytes from the buffer starting at @code{aiocbp->aio_buf} are written to the file for which @@ -1677,12 +1677,12 @@ limitations. The @code{aio_write} function is not implemented. @item EBADF The @code{aiocbp->aio_fildes} descriptor is not valid. This condition -need not be recognized before enqueueing the request and so this error -might also be signaled asynchrously. +needs not be recognized before enqueueing the request and so this error +might also be signaled asynchronously. @item EINVAL The @code{aiocbp->aio_offset} or @code{aiocbp->aio_reqpiro} value is -invalid. This condition need not be recognized before enqueueing the -request and so this error might also be signaled asynchrously. +invalid. This condition needs not be recognized before enqueueing the +request and so this error might also be signaled asynchronously. @end table In the case @code{aio_write} returns zero the current status of the @@ -1715,11 +1715,11 @@ replaces the normal implementation. @comment Unix98 @deftypefun int aio_write64 (struct aiocb *@var{aiocbp}) This function is similar to the @code{aio_write} function. The only -difference is that only @w{32 bits} machines the file descriptor should +difference is that on @w{32 bits} machines the file descriptor should be opened in the large file mode. Internally @code{aio_write64} uses functionality equivalent to @code{lseek64} (@pxref{File Position Primitive}) to position the file descriptor correctly for the writing, -as opposed to @code{lseek} funcationality used in @code{aio_write}. +as opposed to @code{lseek} functionality used in @code{aio_write}. When the sources are compiled with @code{_FILE_OFFSET_BITS == 64} this function is available under the name @code{aio_write} and so transparently @@ -1755,14 +1755,14 @@ a time. Another situation is where the @code{lio_listio} call was cancelled before all requests are processed (@pxref{Cancel AIO Operations}) and the remaining requests have to be reissued. -The the other members of each element of the array pointed to by +The other members of each element of the array pointed to by @code{list} must have values suitable for the operation as described in the documentation for @code{aio_read} and @code{aio_write} above. The @var{mode} argument determines how @code{lio_listio} behaves after having enqueued all the requests. If @var{mode} is @code{LIO_WAIT} it waits until all requests terminated. Otherwise @var{mode} must be -@code{LIO_NOWAIT} and in this case the function returns immeditely after +@code{LIO_NOWAIT} and in this case the function returns immediately after having enqueued all the requests. In this case the caller gets a notification of the termination of all requests according to the @var{sig} parameter. If @var{sig} is @code{NULL} no notification is @@ -1793,7 +1793,7 @@ The resources necessary to queue all the requests are not available in the moment. The error status for each element of @var{list} must be checked which request failed. -Another reason could be that the systemwide limit of AIO requests is +Another reason could be that the system wide limit of AIO requests is exceeded. This cannot be the case for the implementation on GNU systems since no arbitrary limits exist. @item EINVAL @@ -1801,7 +1801,7 @@ The @var{mode} parameter is invalid or @var{nent} is larger than @code{AIO_LISTIO_MAX}. @item EIO One or more of the request's I/O operations failed. The error status of -each request should be checked which one failed. +each request should be checked for which one failed. @item ENOSYS The @code{lio_listio} function is not supported. @end table @@ -1823,7 +1823,7 @@ difference is that only @w{32 bits} machines the file descriptor should be opened in the large file mode. Internally @code{lio_listio64} uses functionality equivalent to @code{lseek64} (@pxref{File Position Primitive}) to position the file descriptor correctly for the reading or -writing, as opposed to @code{lseek} funcationality used in +writing, as opposed to @code{lseek} functionality used in @code{lio_listio}. When the sources are compiled with @code{_FILE_OFFSET_BITS == 64} this @@ -1835,7 +1835,7 @@ machines. @node Status of AIO Operations @subsection Getting the Status of AIO Operations -As already decsribes in the documentation of the functions in the last +As already described in the documentation of the functions in the last section it must be possible to get information about the status of a I/O request. When the operation is performed really asynchronous (as with @code{aio_read} and @code{aio_write} and with @code{aio_listio} when the @@ -1847,11 +1847,11 @@ The following two function allow to get this kind of information. @comment POSIX.1b @deftypefun int aio_error (const struct aiocb *@var{aiocbp}) This function determines the error state of the request described by the -@code{struct aiocb} variable pointed to by @var{aiocbp}. If the the +@code{struct aiocb} variable pointed to by @var{aiocbp}. If the request has not yet terminated the value returned is always @code{EINPROGRESS}. Once the request has terminated the value @code{aio_error} returns is either @math{0} if the request completed -successfully or it returns the the value which would be stored in the +successfully or it returns the value which would be stored in the @code{errno} variable if the request would have been done using @code{read}, @code{write}, or @code{fsync}. @@ -1886,8 +1886,8 @@ carried out by the request described in the variable pointed to by by @code{aio_error} is @code{EINPROGRESS} the return of this function is undefined. -Once the request is finished this function can used used exactly once to -retriece the return value. Following calls might lead to undefined +Once the request is finished this function can be used exactly once to +retrieve the return value. Following calls might lead to undefined behaviour. The return value itself is the value which would have been returned by the @code{read}, @code{write}, or @code{fsync} call. @@ -1917,10 +1917,10 @@ machines. @subsection Getting into a Consistent State When dealing with asynchronous operations it is sometimes necessary to -get into a consistent state. This would mean for AIO that ones wants to +get into a consistent state. This would mean for AIO that one wants to know whether a certain request or a group of request were processed. This could be done by waiting for the notification sent by the system -after the operation terminated but this sometimes would been a wasting +after the operation terminated but this sometimes would mean wasting resources (mainly computation time). Instead POSIX.1b defines two functions which will help with most kinds of consistency. @@ -1933,7 +1933,7 @@ defined. @comment POSIX.1b @deftypefun int aio_fsync (int @var{op}, struct aiocb *@var{aiocbp}) Calling this function forces all I/O operations operating queued at the -time of the function call operating on the file desriptor +time of the function call operating on the file descriptor @code{aiocbp->aio_fildes} into the synchronized I/O completion state (@pxref{Synchronizing I/O}). The @code{aio_fsync} function return immediately but the notification through the method described in @@ -1944,12 +1944,12 @@ after the synchronization request are not effected. If @var{op} is @code{O_DSYNC} the synchronization happens as with a call to @code{fdatasync}. Otherwise @var{op} should be @code{O_SYNC} and -thee synchronization happens as with @code{fsync}. +the synchronization happens as with @code{fsync}. -As long as the synchronization hasn't happened a call to +As long as the synchronization has not happened a call to @code{aio_error} with the reference to the object pointed to by -@var{aiocbp} returns @code{EINPROGRESS}. Once the synchronizatio is -done @code{aio_error} return @math{0} if the synchronization wasn +@var{aiocbp} returns @code{EINPROGRESS}. Once the synchronization is +done @code{aio_error} return @math{0} if the synchronization was not successful. Otherwise the value returned is the value to which the @code{fsync} or @code{fdatasync} function would have set the @code{errno} variable. In this case nothing can be assumed about the @@ -1961,7 +1961,7 @@ successfully filed. Otherwise the return value is @math{-1} and @table @code @item EAGAIN -The request coulnd't be enqueued due to temporary lack of resources. +The request could not be enqueued due to temporary lack of resources. @item EBADF The file descriptor @code{aiocbp->aio_fildes} is not valid or not open for writing. @@ -1990,7 +1990,7 @@ transparently replaces the interface for small files on 32 bits machines. @end deftypefun -Another method of synchronization is to until one or more requests of a +Another method of synchronization is to wait until one or more requests of a specific set terminated. This could be achieved by the @code{aio_*} functions to notify the initiating process about the termination but in some situations this is not the ideal solution. In a program which @@ -2020,7 +2020,7 @@ finished. If @var{timeout} is not @code{NULL} the process remains suspended at as long as specified in @var{timeout}. In this case @code{aio_suspend} returns with an error. -The return value of the function is @math{0} is one or more requests +The return value of the function is @math{0} if one or more requests from the @var{list} have terminated. Otherwise the function returns @math{-1} and @code{errno} is set to one of the following values: @@ -2135,7 +2135,7 @@ The POSIX standard does not specify how the AIO functions are implemented. They could be system calls but it is also possible to emulate them at userlevel. -At least the available implementatio at the point of this writing is a +At least the available implementation at the point of this writing is a userlevel implementation which uses threads for handling the enqueued requests. This implementation requires to make some decisions about limitations but hard limitations are something which better should be diff --git a/manual/message.texi b/manual/message.texi index cc57439..fb61262 100644 --- a/manual/message.texi +++ b/manual/message.texi @@ -27,7 +27,7 @@ As mentioned above the message catalog handling provides easy extendibility by using external data files which contain the message translations. I.e., these files contain for each of the messages used in the program a translation for the appropriate language. So the tasks -of the message handling functions functions are +of the message handling functions are @itemize @bullet @item @@ -537,7 +537,7 @@ following slavishly the X/Open specs and not relying on the extension and by using the GNU extensions. We will take a look at the former method first to understand the benefits of extensions. -@subsubsection Not using symbolic symbolic names +@subsubsection Not using symbolic names Since the X/Open format of the message catalog files does not allow symbol names we have to work with numbers all the time. When we start @@ -673,7 +673,7 @@ int main (void) @{ nl_catd catdesc = catopen ("hello.cat", NL_CAT_LOCALE); - printf (catgets (catdesc, SetMainSet, SetMainHello, + printf (catgets (catdesc, SetMainSet, SetMainHello, "Hello, world!\n")); catclose (catdesc); return 0; diff --git a/manual/signal.texi b/manual/signal.texi index 263b1f0..fc05d22 100644 --- a/manual/signal.texi +++ b/manual/signal.texi @@ -2176,7 +2176,7 @@ provided only for compatibility with SVID. One convenient use for @code{raise} is to reproduce the default behavior of a signal that you have trapped. For instance, suppose a user of your program types the SUSP character (usually @kbd{C-z}; @pxref{Special -Characters}) to send it an interactive stop stop signal +Characters}) to send it an interactive stop signal (@code{SIGTSTP}), and you want to clean up some internal data buffers before stopping. You might set this up like this: diff --git a/manual/sysinfo.texi b/manual/sysinfo.texi index 9b55133..f35aa8b 100644 --- a/manual/sysinfo.texi +++ b/manual/sysinfo.texi @@ -225,7 +225,7 @@ This structure is used with the @code{getfsent}, @code{getfsspec}, and @table @code @item char *fs_spec -This element desribes the device from which the filesystem is mounted. +This element describes the device from which the filesystem is mounted. Normally this is the name of a special device, such as a hard disk partition, but it could also be a more or less generic string. For @dfn{NFS} it would be a hostname and directory name combination. @@ -236,8 +236,8 @@ function predates @w{ISO C}. The same is true for the other string elements of this structure. @item char *fs_file -This desribes the mount point on the local system. I.e., accessing any -file in this filesystem has this string implicitly or explicitly as a +This describes the mount point on the local system. I.e., accessing any +file in this filesystem has implicitly or explicitly this string as a prefix. @item char *fs_vfstype @@ -422,10 +422,10 @@ Expands to @code{"defaults"}. This option should be used alone since it indicates all values for the custumizable values are chosen to be the default. @item MNTOPT_RO -Expands to @code{"ro"}. See the the @code{FSTAB_RO} value, it means the +Expands to @code{"ro"}. See the @code{FSTAB_RO} value, it means the filesystem is mounted read-only. @item MNTOPT_RW -Expand to @code{"rw"}. See the the @code{FSTAB_RW} value, it means the +Expand to @code{"rw"}. See the @code{FSTAB_RW} value, it means the filesystem is mounted with read and write permissions. @item MNTOPT_SUID Expands to @code{"suid"}. This means that the SUID bit (@pxref{How diff --git a/manual/time.texi b/manual/time.texi index a4d1f77..540bca1 100644 --- a/manual/time.texi +++ b/manual/time.texi @@ -1064,7 +1064,7 @@ The second format is used when there is Daylight Saving Time: The initial @var{std} and @var{offset} specify the standard time zone, as described above. The @var{dst} string and @var{offset} specify the name -and offset for the corresponding daylight saving time time zone; if the +and offset for the corresponding daylight saving time zone; if the @var{offset} is omitted, it defaults to one hour ahead of standard time. The remainder of the specification describes when daylight saving time is diff --git a/manual/users.texi b/manual/users.texi index 824b8ea..5ffd5fd 100644 --- a/manual/users.texi +++ b/manual/users.texi @@ -86,7 +86,7 @@ about a group ID or group name. @c When Hurd is more widely used, explain multiple effective user IDs @c here. -zw At any time, each process has an @dfn{effective user ID}, a @dfn{effective -group ID}, and a set of @dfn{supplementary group IDs}. These IDs +group ID}, and a set of @dfn{supplementary group IDs}. These IDs determine the privileges of the process. They are collectively called the @dfn{persona} of the process, because they determine ``who it is'' for purposes of access control. @@ -325,7 +325,7 @@ old effective user ID.) If the process is not privileged, and the system supports the @code{_POSIX_SAVED_IDS} feature, then this function behaves like -@code{seteuid}. +@code{seteuid}. The return values and error conditions are the same as for @code{seteuid}. @end deftypefun @@ -392,7 +392,7 @@ to @var{newgid}, provided that the process is privileged. It also deletes the file group ID, if any. If the process is not privileged, then @code{setgid} behaves like -@code{setegid}. +@code{setegid}. The return values and error conditions for @code{setgid} are the same as those for @code{seteuid}. @@ -463,7 +463,7 @@ This function works by scanning the group database for all the groups has constructed. The return values and error conditions are the same as for -@code{setgroups}. +@code{setgroups}. @end deftypefun @node Enable/Disable Setuid @@ -1170,7 +1170,7 @@ database specified by @var{wtmp_file}. For possible values for the subset of these functions, they are not standardized. There are often subtle differences in the return types, and there are considerable differences between the various definitions of @code{struct utmp}. When -programming for the GNU system, it is probably probably best to stick +programming for the GNU system, it is probably best to stick with the functions described in this section. If however, you want your program to be portable, consider using the XPG functions described in @ref{XPG Functions}, or take a look at the BSD compatible functions in @@ -1974,4 +1974,3 @@ found in the netgroup. The return value is @code{0} if the netgroup itself is not found, the netgroup does not contain the triple or internal errors occurred. @end deftypefun - diff --git a/sunrpc/svc_tcp.c b/sunrpc/svc_tcp.c index 41f9533..e162c02 100644 --- a/sunrpc/svc_tcp.c +++ b/sunrpc/svc_tcp.c @@ -284,13 +284,19 @@ svctcp_destroy (SVCXPRT *xprt) * All read operations timeout after 35 seconds. * A timeout is fatal for the connection. */ -static struct timeval wait_per_try = -{35, 0}; +static struct timeval wait_per_try = {35, 0}; /* * reads data from the tcp connection. * any error is fatal and the connection is closed. * (And a read of zero bytes is a half closed stream => error.) + * + * Note: we have to be careful here not to allow ourselves to become + * blocked too long in this routine. While we're waiting for data from one + * client, another client may be trying to connect. To avoid this situation, + * some code from svc_run() is transplanted here: the select() loop checks + * all RPC descriptors including the one we want and calls svc_getreqset2() + * to handle new requests if any are detected. */ static int readtcp (char *xprtptr, char *buf, int len) @@ -298,39 +304,41 @@ readtcp (char *xprtptr, char *buf, int len) SVCXPRT *xprt = (SVCXPRT *)xprtptr; int sock = xprt->xp_sock; #ifdef FD_SETSIZE - fd_set mask; fd_set readfds; - - FD_ZERO (&mask); - FD_SET (sock, &mask); #else int mask = 1 << sock; int readfds; #endif /* def FD_SETSIZE */ - do + while (1) { struct timeval timeout = wait_per_try; - readfds = mask; + readfds = svc_fdset; +#ifdef FD_SETSIZE + FD_SET (sock, &readfds); +#else + readfds |= (1 << sock); +#endif /* def FD_SETSIZE */ if (select (_rpc_dtablesize (), &readfds, (fd_set *) NULL, (fd_set *) NULL, &timeout) <= 0) { if (errno == EINTR) - { - continue; - } + continue; goto fatal_err; } + #ifdef FD_SETSIZE - } - while (!FD_ISSET (sock, &readfds)); + if (FD_ISSET (sock, &readfds)) #else - } - while (readfds != mask); + if (readfds == mask) #endif /* def FD_SETSIZE */ - if ((len = read (sock, buf, len)) > 0) - { - return len; + break; + + svc_getreqset (&readfds); } + + if ((len = read (sock, buf, len)) > 0) + return len; + fatal_err: ((struct tcp_conn *) (xprt->xp_p1))->strm_stat = XPRT_DIED; return -1; diff --git a/sunrpc/xdr_rec.c b/sunrpc/xdr_rec.c index a4e28b0..b2ab2fa 100644 --- a/sunrpc/xdr_rec.c +++ b/sunrpc/xdr_rec.c @@ -565,16 +565,20 @@ set_input_fragment (RECSTREAM *rstrm) { u_long header; - if (!get_input_bytes (rstrm, (caddr_t) & header, BYTES_PER_XDR_UNIT)) + if (! get_input_bytes (rstrm, (caddr_t)&header, BYTES_PER_XDR_UNIT)) return FALSE; header = ntohl (header); rstrm->last_frag = ((header & LAST_FRAG) == 0) ? FALSE : TRUE; /* * Sanity check. Try not to accept wildly incorrect - * record sizes. + * record sizes. Unfortunately, the only record size + * we can positively identify as being 'wildly incorrect' + * is zero. Ridiculously large record sizes may look wrong, + * but we don't have any way to be certain that they aren't + * what the client actually intended to send us. */ - if ((header & (~LAST_FRAG)) > rstrm->recvsize) - return(FALSE); + if ((header & (~LAST_FRAG)) == 0) + return FALSE; rstrm->fbtbc = header & ~LAST_FRAG; return TRUE; } diff --git a/sysdeps/i386/i686/ffs.c b/sysdeps/i386/i686/ffs.c new file mode 100644 index 0000000..c858b31 --- /dev/null +++ b/sysdeps/i386/i686/ffs.c @@ -0,0 +1,45 @@ +/* ffs -- find first set bit in a word, counted from least significant end. + For Intel 80x86, x>=6. + This file is part of the GNU C Library. + Copyright (C) 1991, 92, 93, 94, 97, 98 Free Software Foundation, Inc. + Contributed by Ulrich Drepper . + + 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 + +#undef ffs + +#ifdef __GNUC__ + +int +__ffs (x) + int x; +{ + int cnt; + int tmp; + + asm ("bsfl %2,%0\n" /* Count low bits in X and store in %1. */ + "cmovel %1,%0\n" /* If number was zero, use -1 as result. */ + : "=&r" (cnt), "=r" (tmp) : "rm" (x), "1" (-1)); + + return cnt + 1; +} +weak_alias (__ffs, ffs) + +#else +#include +#endif -- cgit v1.1