1
0
mirror of https://https.git.savannah.gnu.org/git/gnulib.git synced 2026-09-01 02:34:55 +00:00

manual merge

This commit is contained in:
Bruce Korb
2011-05-06 08:15:59 -07:00
582 changed files with 8579 additions and 2395 deletions
+1678 -32
View File
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -90,7 +90,9 @@ at any time.
http://ftp.gnu.org/gnu/grep/
ftp://ftp.gnu.org/gnu/grep/
* GNU gettext 0.16.1.
* GNU gettext.
+ Always use the newest available gettext release, see
<http://www.gnu.org/software/gnulib/manual/html_node/gettextize-and-autopoint.html>.
+ Recommended.
Needed if you use modules that use internationalization (many do).
+ Homepage:
+3
View File
@@ -2353,6 +2353,7 @@ func_all_modules ()
func_module futimens
func_module getaddrinfo
func_module getcwd
func_module getcwd-lgpl
func_module getgroups
func_module gethostname
func_module getlogin
@@ -2464,6 +2465,7 @@ func_all_modules ()
func_module sys_stat
func_module sys_time
func_module sys_times
func_module sys_uio
func_module sys_utsname
func_module sys_wait
func_module tsearch
@@ -3474,6 +3476,7 @@ func_all_modules ()
func_module gnupload
func_module maintainer-makefile
func_module mktempd
func_module readme-release
func_module update-copyright
func_module useless-if-before-free
func_module vc-list-files
+14
View File
@@ -12,6 +12,20 @@ User visible incompatible changes
Date Modules Changes
2011-05-02 exit The module is removed. It was deprecated
on 2010-03-05. Use 'stdlib' directly instead.
2011-04-27 mgetgroups The 'xgetgroups' function has been split into
a new 'xgetgroups' module.
2011-04-27 save-cwd This module pulls in fewer dependencies by
default; to retain robust handling of directories
with an absolute name longer than PATH_MAX, you
must now explicitly include the 'getcwd' module.
2011-04-19 close-hook This module has been renamed to 'fd-hook' and
generalized.
2011-03-08 regex-quote The last argument is no longer an 'int cflags'
but instead a pointer to a previously constructed
'struct regex_quote_spec'.
+75 -72
View File
@@ -3,7 +3,7 @@ eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}'
if 0;
# Generate a release announcement message.
my $VERSION = '2010-05-03 20:17'; # UTC
my $VERSION = '2011-04-29 21:01'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
@@ -106,7 +106,7 @@ sub sizes (@)
my $t = `$cmd`;
# FIXME-someday: give a better diagnostic, a la $PROCESS_STATUS
$@
and (warn "$ME: command failed: `$cmd'\n"), $fail = 1;
and (warn "$ME: command failed: `$cmd'\n"), $fail = 1;
chomp $t;
$t =~ s/^([\d.]+[MkK]).*/${1}B/;
$res{$f} = $t;
@@ -128,12 +128,12 @@ sub print_locations ($\@\%@)
foreach my $url (@{$url})
{
for my $file (@file)
{
print " $url/$file";
print " (", $$size{$file}, ")"
if exists $$size{$file};
print "\n";
}
{
print " $url/$file";
print " (", $$size{$file}, ")"
if exists $$size{$file};
print "\n";
}
}
print "\n";
}
@@ -154,17 +154,17 @@ sub print_checksums (@)
foreach my $meth (qw (md5 sha1))
{
foreach my $f (@file)
{
open IN, '<', $f
or die "$ME: $f: cannot open for reading: $!\n";
binmode IN;
my $dig =
($meth eq 'md5'
? Digest::MD5->new->addfile(*IN)->hexdigest
: Digest::SHA1->new->addfile(*IN)->hexdigest);
close IN;
print "$dig $f\n";
}
{
open IN, '<', $f
or die "$ME: $f: cannot open for reading: $!\n";
binmode IN;
my $dig =
($meth eq 'md5'
? Digest::MD5->new->addfile(*IN)->hexdigest
: Digest::SHA1->new->addfile(*IN)->hexdigest);
close IN;
print "$dig $f\n";
}
}
print "\n";
}
@@ -180,7 +180,10 @@ sub print_news_deltas ($$$)
{
my ($news_file, $prev_version, $curr_version) = @_;
print "\n$news_file\n\n";
my $news_name = $news_file;
$news_name =~ s|^\./||;
print "\n$news_name\n\n";
# Print all lines from $news_file, starting with the first one
# that mentions $curr_version up to but not including
@@ -194,24 +197,24 @@ sub print_news_deltas ($$$)
while (defined (my $line = <NEWS>))
{
if ( ! $in_items)
{
# Match lines like these:
# * Major changes in release 5.0.1:
# * Noteworthy changes in release 6.6 (2006-11-22) [stable]
$line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$curr_version\E(?:[^\d.]|$)/o
or next;
$in_items = 1;
print $line;
}
{
# Match lines like these:
# * Major changes in release 5.0.1:
# * Noteworthy changes in release 6.6 (2006-11-22) [stable]
$line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$curr_version\E(?:[^\d.]|$)/o
or next;
$in_items = 1;
print $line;
}
else
{
# This regexp must not match version numbers in NEWS items.
# For example, they might well say `introduced in 4.5.5',
# and we don't want that to match.
$line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$prev_version\E(?:[^\d.]|$)/o
and last;
print $line;
}
{
# This regexp must not match version numbers in NEWS items.
# For example, they might well say `introduced in 4.5.5',
# and we don't want that to match.
$line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$prev_version\E(?:[^\d.]|$)/o
and last;
print $line;
}
}
close NEWS;
@@ -229,8 +232,8 @@ sub print_changelog_deltas ($$)
use File::Find;
my @changelog;
find ({wanted => sub {$_ eq 'ChangeLog' && -d 'CVS'
and push @changelog, $File::Find::name}},
'.');
and push @changelog, $File::Find::name}},
'.');
# If there are no ChangeLog files, we're done.
@changelog
@@ -255,7 +258,7 @@ sub print_changelog_deltas ($$)
my $dot_slash = $d eq '.' ? $d : "./$d";
my $target = "$dot_slash/ChangeLog";
delete $changelog{$target}
and push @reordered, $target;
and push @reordered, $target;
}
# Append any remaining ChangeLog files.
@@ -282,20 +285,20 @@ sub print_changelog_deltas ($$)
while (defined (my $line = <DIFF>))
{
if ($line =~ /^\+\+\+ /)
{
my $separator = "*"x70 ."\n";
$line =~ s///;
$line =~ s/\s.*//;
$prev_printed_line_empty
or print "\n";
print $separator, $line, $separator;
}
{
my $separator = "*"x70 ."\n";
$line =~ s///;
$line =~ s/\s.*//;
$prev_printed_line_empty
or print "\n";
print $separator, $line, $separator;
}
elsif ($line =~ /^\+/)
{
$line =~ s///;
print $line;
$prev_printed_line_empty = ($line =~ /^$/);
}
{
$line =~ s///;
print $line;
$prev_printed_line_empty = ($line =~ /^$/);
}
}
close DIFF;
@@ -316,25 +319,25 @@ sub get_tool_versions ($$)
foreach my $t (@$tool_list)
{
if ($t eq 'gnulib')
{
push @tool_version_pair, ucfirst $t . ' ' . $gnulib_version;
next;
}
{
push @tool_version_pair, ucfirst $t . ' ' . $gnulib_version;
next;
}
# Assume that the last "word" on the first line of
# `tool --version` output is the version string.
my ($first_line, undef) = split ("\n", `$t --version`);
if ($first_line =~ /.* (\d[\w.-]+)$/)
{
$t = ucfirst $t;
push @tool_version_pair, "$t $1";
}
{
$t = ucfirst $t;
push @tool_version_pair, "$t $1";
}
else
{
defined $first_line
and $first_line = '';
warn "$ME: $t: unexpected --version output\n:$first_line";
$fail = 1;
}
{
defined $first_line
and $first_line = '';
warn "$ME: $t: unexpected --version output\n:$first_line";
$fail = 1;
}
}
$fail
@@ -398,8 +401,8 @@ sub get_tool_versions ($$)
grep (/^gnulib$/, @tool_list) ^ defined $gnulib_version
and (warn "$ME: when specifying gnulib as a tool, you must also specify\n"
. "--gnulib-version=V, where V is the result of running git describe\n"
. "in the gnulib source directory.\n"), $fail = 1;
. "--gnulib-version=V, where V is the result of running git describe\n"
. "in the gnulib source directory.\n"), $fail = 1;
exists $valid_release_types{$release_type}
or (warn "$ME: `$release_type': invalid release type\n"), $fail = 1;
@@ -448,11 +451,11 @@ EOF
print_locations ("compressed sources", @url_dir_list, %size, @tarballs);
-f $xd
and print_locations ("xdelta diffs (useful? if so, "
. "please tell bug-gnulib\@gnu.org)",
@url_dir_list, %size, $xd);
. "please tell bug-gnulib\@gnu.org)",
@url_dir_list, %size, $xd);
my @sig_files = map { "$_.sig" } @tarballs;
print_locations ("GPG detached signatures[*]", @url_dir_list, %size,
@sig_files);
@sig_files);
if ($url_dir_list[0] =~ "gnu\.org")
{
print "To reduce load on the main server, use a mirror listed at:\n";
+35 -16
View File
@@ -1,6 +1,6 @@
#! /bin/sh
# Print a version string.
scriptversion=2011-03-03.12; # UTC
scriptversion=2011-05-03.08; # UTC
# Bootstrap this package from checked-out sources.
@@ -130,18 +130,7 @@ source_base=lib
m4_base=m4
doc_base=doc
tests_base=tests
# Extra files from gnulib, which override files from other sources.
gnulib_extra_files="
$build_aux/install-sh
$build_aux/missing
$build_aux/mdate-sh
$build_aux/texinfo.tex
$build_aux/depcomp
$build_aux/config.guess
$build_aux/config.sub
doc/INSTALL
"
gnulib_extra_files=''
# Additional gnulib-tool options to use. Use "\newline" to break lines.
gnulib_tool_option_extras=
@@ -229,6 +218,18 @@ case "$0" in
*) test -r "$0.conf" && . ./"$0.conf" ;;
esac
# Extra files from gnulib, which override files from other sources.
test -z "${gnulib_extra_files}" && \
gnulib_extra_files="
$build_aux/install-sh
$build_aux/missing
$build_aux/mdate-sh
$build_aux/texinfo.tex
$build_aux/depcomp
$build_aux/config.guess
$build_aux/config.sub
doc/INSTALL
"
if test "$vc_ignore" = auto; then
vc_ignore=
@@ -278,14 +279,29 @@ if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
exit 1
fi
# Ensure that lines starting with ! sort last, per gitignore conventions
# for whitelisting exceptions after a more generic blacklist pattern.
sort_patterns() {
sort -u "$@" | sed '/^!/ {
H
d
}
$ {
P
x
s/^\n//
}'
}
# If $STR is not already on a line by itself in $FILE, insert it,
# sorting the new contents of the file and replacing $FILE with the result.
insert_sorted_if_absent() {
file=$1
str=$2
test -f $file || touch $file
echo "$str" | sort -u - $file | cmp - $file > /dev/null \
|| echo "$str" | sort -u - $file -o $file \
echo "$str" | sort_patterns - $file | cmp - $file > /dev/null \
|| { echo "$str" | sort_patterns - $file > $file.bak \
&& mv $file.bak $file; } \
|| exit 1
}
@@ -405,7 +421,10 @@ check_versions() {
# Honor $APP variables ($TAR, $AUTOCONF, etc.)
appvar=`echo $app | tr '[a-z]-' '[A-Z]_'`
test "$appvar" = TAR && appvar=AMTAR
eval "app=\${$appvar-$app}"
case $appvar in
GZIP) ;; # Do not use $GZIP: it contains gzip options.
*) eval "app=\${$appvar-$app}" ;;
esac
inst_ver=$(get_version $app)
if [ ! "$inst_ver" ]; then
echo "$me: Error: '$app' not found" >&2
+2
View File
@@ -286,6 +286,7 @@ case $basic_machine in
| nds32 | nds32le | nds32be \
| nios | nios2 \
| ns16k | ns32k \
| open8 \
| or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \
@@ -394,6 +395,7 @@ case $basic_machine in
| nds32-* | nds32le-* | nds32be-* \
| nios-* | nios2-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+10 -6
View File
@@ -1,10 +1,10 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2010-10-07.20; # UTC
scriptversion=2011-04-16.09; # UTC
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010
# Free Software Foundation, Inc.
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
# 2011 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -166,10 +166,12 @@ gcc)
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## well. hp depmode also adds that space, but also prefixes the VPATH
## to the object. Take care to not repeat it in the output.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
@@ -557,7 +559,9 @@ makedepend)
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
# makedepend may prepend the VPATH from the source file name to the object.
# No need to regex-escape $object, excess matching of '.' is harmless.
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
+13 -7
View File
@@ -3,7 +3,7 @@
# controlled .prev-version file, automate the procedure by which we record
# the date, release-type and version string in the NEWS file. That commit
# will serve to identify the release, so apply a signed tag to it as well.
VERSION=2010-06-07.07 # UTC
VERSION=2011-05-04.11 # UTC
# Note: this is a bash script (could be zsh or dash)
@@ -32,7 +32,7 @@ help_version()
{
case $1 in
--help) cat <<EOF
Usage: $ME VERSION RELEASE_TYPE
Usage: $ME [OPTION...] VERSION RELEASE_TYPE
Run this script to perform the final pre-release NEWS update
in which the date, release-type and version string are recorded.
@@ -46,8 +46,9 @@ Requirements:
- a version-controlled .prev-version file
Options:
--help print this help, then exit
--version print version number, then exit
--branch BRANCH set release branch (default: master)
--help print this help, then exit
--version print version number, then exit
EXAMPLE:
To update NEWS and tag the beta 8.1 release of coreutils, I would run this:
@@ -73,10 +74,15 @@ EOF
esac
}
branch=master
case $1 in
--branch) shift; branch=$1; shift ;;
esac
case $# in
1) help_version $1; exit 0;;
2) ;;
*) warn "Usage: $ME VERSION TYPE"; exit 1;;
*) warn "Usage: $ME [OPTION...] VERSION TYPE"; exit 1;;
esac
ver=$1
@@ -121,9 +127,9 @@ perl -MPOSIX -ni -e 'my $today = strftime "%F", localtime time;' \
-e 'print $.==3 ? "$pfx $ver ($today) [$type]\n" : $_' \
NEWS || die 'failed to update NEWS'
# Ensure the current branch name is "master":
# Ensure the current branch name is correct:
curr_br=$(git rev-parse --symbolic-full-name HEAD)
test "$curr_br" = refs/heads/master || die not on master
test "$curr_br" = refs/heads/$branch || die not on branch $branch
printf "version $ver\n\n* NEWS: Record release date.\n" \
| git commit -F - -a || die 'git commit failed'
+2 -2
View File
@@ -2,7 +2,7 @@
# gendocs.sh -- generate a GNU manual in many formats. This script is
# mentioned in maintain.texi. See the help message below for usage details.
scriptversion=2010-11-29.11
scriptversion=2011-04-08.14
# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
# Foundation, Inc.
@@ -305,10 +305,10 @@ if test -n "$docbook"; then
docbook_xml_gz_size=`calcsize "$outdir/$PACKAGE-db.xml.gz"`
mv $PACKAGE-db.xml "$outdir/"
split_html_db_dir=html_node_db
cmd="${DOCBOOK2HTML} -o $split_html_db_dir \"${outdir}/$PACKAGE-db.xml\""
echo "Generating docbook HTML... ($cmd)"
eval "$cmd"
split_html_db_dir=html_node_db
(
cd ${split_html_db_dir} || exit 1
tar -czf "$abs_outdir/${PACKAGE}.html_node_db.tar.gz" -- *.html
+4
View File
@@ -156,6 +156,8 @@ func_verbose $compile_command \
"$srcdir"/progname.c \
"$srcdir"/progreloc.c \
"$srcdir"/areadlink.c \
"$srcdir"/careadlinkat.c \
"$srcdir"/allocator.c \
"$srcdir"/readlink.c \
"$srcdir"/canonicalize-lgpl.c \
"$srcdir"/malloca.c \
@@ -172,6 +174,8 @@ rm -f relocwrapper.o \
progreloc.o \
xreadlink.o \
areadlink.o \
careadlinkat.o \
allocator.o \
canonicalize-lgpl.o \
malloca.o \
relocatable.o \
+8 -6
View File
@@ -3,7 +3,7 @@
% Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
%
\def\texinfoversion{2011-02-24.09}
\def\texinfoversion{2011-03-25.11}
%
% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@@ -7053,12 +7053,14 @@ end
% ... and for \example:
\spaceisspace
%
% The \empty here causes a following catcode 5 newline to be eaten
% as part of reading whitespace after a control sequence. It does
% not eat a catcode 13 newline. There's no good way to handle the
% two cases. See the Macro Details node in the manual for the
% workaround we currently have to recommend for macros and
% The \empty here causes a following catcode 5 newline to be eaten as
% part of reading whitespace after a control sequence. It does not
% eat a catcode 13 newline. There's no good way to handle the two
% cases (untried: maybe e-TeX's \everyeof could help, though plain TeX
% would then have different behavior). See the Macro Details node in
% the manual for the workaround we recommend for macros and
% line-oriented commands.
%
\scantokens{#1\empty}%
\endgroup}
+3 -3
View File
@@ -4,7 +4,7 @@ eval '(exit $?0)' && eval 'exec perl -wST "$0" ${1+"$@"}'
# Detect instances of "if (p) free (p);".
# Likewise "if (p != 0)", "if (0 != p)", or with NULL; and with braces.
my $VERSION = '2011-01-09 01:39'; # UTC
my $VERSION = '2011-04-20 13:43'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
@@ -132,7 +132,7 @@ sub is_NULL ($)
while ($line =~
/\b(if\s*\(\s*([^)]+?)(?:\s*!=\s*([^)]+?))?\s*\)
# 1 2 3
(?: \s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)|
(?: \s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)\s*;|
\s*\{\s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)\s*;\s*\}))/sxg)
{
my $all = $1;
@@ -179,7 +179,7 @@ free=xfree
git grep -l -z "$free *(" \
| xargs -0 useless-if-before-free -l --name="$free" \
| xargs -0 perl -0x3b -pi -e \
's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL))?\s*\)\s+('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\))/$2/s'
's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL))?\s*\)\s+('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\)\s*;)/$2/s'
# Use the following to remove redundant uses of kfree inside braces.
# Note that -0777 puts perl in slurp-whole-file mode;
+7 -7
View File
@@ -2,7 +2,7 @@
# List version-controlled file names.
# Print a version string.
scriptversion=2010-04-23.22; # UTC
scriptversion=2011-04-29.20; # UTC
# Copyright (C) 2006-2011 Free Software Foundation, Inc.
@@ -94,12 +94,12 @@ elif test -d CVS; then
eval cvsu --find --types=AFGM '"$dir"' $postprocess
else
eval awk -F/ \''{ \
if (!$1 && $3 !~ /^-/) { \
f=FILENAME; \
if (f ~ /CVS\/Entries$/) \
f = substr(f, 1, length(f)-11); \
print f $2; \
}}'\'' \
if (!$1 && $3 !~ /^-/) { \
f=FILENAME; \
if (f ~ /CVS\/Entries$/) \
f = substr(f, 1, length(f)-11); \
print f $2; \
}}'\'' \
`find "$dir" -name Entries -print` /dev/null' $postprocess
fi
elif test -d .svn; then
+3
View File
@@ -15,3 +15,6 @@ IRIX 6.5, OSF/1 5.1, Solaris 11 2010-11, Cygwin 1.7.5, mingw, Interix 3.5, BeOS.
Portability problems not fixed by Gnulib:
@itemize
@end itemize
The gnulib module @code{clean-temp} can create temporary files that will not
be left behind after signals such as SIGINT.
+3
View File
@@ -15,3 +15,6 @@ glibc 2.10, MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX
Portability problems not fixed by Gnulib:
@itemize
@end itemize
The gnulib module @code{clean-temp} can create temporary files that will not
be left behind after signals such as SIGINT.
+7
View File
@@ -10,8 +10,15 @@ Portability problems fixed by Gnulib:
This function is missing on many non-glibc platforms:
glibc 2.10, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin
1.5.x, mingw, Interix 3.5, BeOS.
@item
This function is declared in @code{<unistd.h>} instead of @code{<stdlib.h>}
on some platforms:
MacOS X 10.5.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@end itemize
The gnulib module @code{clean-temp} can create temporary files that will not
be left behind after signals such as SIGINT.
+7 -2
View File
@@ -7,8 +7,13 @@ Gnulib module: strchrnul
Portability problems fixed by Gnulib:
@itemize
@item
This function is missing on all non-glibc platforms:
MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin, mingw, Interix 3.5, BeOS.
This function is missing on many non-glibc platforms:
MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX 5.1, HP-UX 11,
IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.7.8, mingw, Interix 3.5,
BeOS.
@item
This function crashes when no occurrence is found on some platforms:
Cygwin 1.7.9.
@end itemize
Portability problems not fixed by Gnulib:
+1 -1
View File
@@ -287,7 +287,7 @@ Also, on some platforms macros like @samp{_FILE_OFFSET_BITS} and
@samp{_GNU_SOURCE} may be ineffective, or may have only a limited
effect, if defined after the first system header file is included.
Finally, note that you can not use @code{AC_LIBOBJ} or
Finally, note that you cannot use @code{AC_LIBOBJ} or
@code{AC_REPLACE_FUNCS} in your @file{configure.ac} and expect the
resulting object files to be automatically added to @file{lib/libgnu.a}.
This is because your @code{AC_LIBOBJ} and @code{AC_REPLACE_FUNCS} invocations
+9
View File
@@ -396,6 +396,15 @@ Tests modules can depend on non-tests modules. Non-tests modules should not
depend on tests modules. (Recall that tests modules are built in a separate
directory.)
Each listed required module may be declared a conditional dependency. This
is indicated by placing the condition for the dependency on the same line,
enclosed in brackets, after the name of the required module. The condition
is a shell expression that is run after the module's @code{configure.ac}
statements. For example:
@smallexample
strtoull [test $ac_cv_func_strtoumax = no]
@end smallexample
@item configure.ac-early
This field contains @file{configure.ac} stuff (Autoconf macro invocations and
shell statements) that are logically placed early in the @file{configure.ac}
+2 -2
View File
@@ -10,7 +10,7 @@ Portability problems fixed by Gnulib:
@itemize
@item
On Windows platforms (excluding Cygwin), the descriptors returned by
the @code{accept} function can not be used in calls to @code{read},
the @code{accept} function cannot be used in calls to @code{read},
@code{write}, and @code{close}; you have to use @code{recv}, @code{send},
@code{closesocket} in these cases instead.
@item
@@ -22,7 +22,7 @@ used instead.
Portability problems not fixed by Gnulib:
@itemize
@item
On BeOS, the descriptors returned by the @code{accept} function can not be used
On BeOS, the descriptors returned by the @code{accept} function cannot be used
in calls to @code{read}, @code{write}, and @code{close}; you have to use
@code{recv}, @code{send}, @code{closesocket} in these cases instead.
@item
+5 -2
View File
@@ -4,9 +4,9 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/dup2.html}
Gnulib module: dup2
Gnulib module: dup2 or dup2-obsolete
Portability problems fixed by Gnulib:
Portability problems fixed by either Gnulib module @code{dup2} or @code{dup2-obsolete}:
@itemize
@item
This function always returns 0 for success on some platforms:
@@ -34,7 +34,10 @@ This function returns @code{EMFILE} instead of @code{EBADF} for
extremely large targets, which interferes with using
@code{dup2(fd,fd)==fd)} as the minimal @code{EBADF} filter:
FreeBSD 6.1, Cygwin 1.5.
@end itemize
Portability problems fixed by Gnulib module @code{dup2-obsolete}:
@itemize
@item
This function is missing on some older platforms.
@end itemize
+10 -2
View File
@@ -4,9 +4,17 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fclose.html}
Gnulib module: fclose
Gnulib module: fclose, fflush
Portability problems fixed by Gnulib:
Portability problems fixed by Gnulib module @code{fclose} together with module @code{fflush}:
@itemize
@item
On some platforms, this function fails to set the file position of a
seekable input stream to the byte after the last one actually read:
glibc 2.13, FreeBSD.
@end itemize
Portability problems fixed by Gnulib module @code{fclose}:
@itemize
@item
On Windows platforms (excluding Cygwin), @code{socket} and @code{accept}
+7 -2
View File
@@ -4,10 +4,15 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fgetc.html}
Gnulib module: ---
Gnulib module: stdio, nonblocking
Portability problems fixed by Gnulib:
Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
@itemize
@item
When reading from a non-blocking pipe whose buffer is empty, this function
fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on
some platforms:
mingw.
@end itemize
Portability problems not fixed by Gnulib:
+7 -2
View File
@@ -4,10 +4,15 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fgets.html}
Gnulib module: ---
Gnulib module: stdio, nonblocking
Portability problems fixed by Gnulib:
Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
@itemize
@item
When reading from a non-blocking pipe whose buffer is empty, this function
fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on
some platforms:
mingw.
@end itemize
Portability problems not fixed by Gnulib:
+10 -1
View File
@@ -4,7 +4,7 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fprintf.html}
Gnulib module: fprintf-posix or stdio, sigpipe
Gnulib module: fprintf-posix or stdio, nonblocking, sigpipe
Portability problems fixed by Gnulib module @code{fprintf-posix}:
@itemize
@@ -64,6 +64,15 @@ This function can crash in out-of-memory conditions on some platforms:
MacOS X 10.3, FreeBSD 6.0, NetBSD 5.0.
@end itemize
Portability problems fixed by Gnulib module @code{stdio} or @code{fprintf-posix}, together with module @code{nonblocking}:
@itemize
@item
When writing to a non-blocking pipe whose buffer is full, this function fails
with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some
platforms:
mingw.
@end itemize
Portability problems fixed by Gnulib module @code{stdio} or @code{fprintf-posix}, together with module @code{sigpipe}:
@itemize
@item
+11 -2
View File
@@ -4,9 +4,18 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fputc.html}
Gnulib module: stdio, sigpipe
Gnulib module: stdio, nonblocking, sigpipe
Portability problems fixed by Gnulib:
Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
@itemize
@item
When writing to a non-blocking pipe whose buffer is full, this function fails
with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some
platforms:
mingw.
@end itemize
Portability problems fixed by Gnulib module @code{stdio}, together with module @code{sigpipe}:
@itemize
@item
When writing to a pipe with no readers, this function fails, instead of
+11 -2
View File
@@ -4,9 +4,18 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fputs.html}
Gnulib module: stdio, sigpipe
Gnulib module: stdio, nonblocking, sigpipe
Portability problems fixed by Gnulib:
Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
@itemize
@item
When writing to a non-blocking pipe whose buffer is full, this function fails
with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some
platforms:
mingw.
@end itemize
Portability problems fixed by Gnulib module @code{stdio}, together with module @code{sigpipe}:
@itemize
@item
When writing to a pipe with no readers, this function fails, instead of
+7 -2
View File
@@ -4,10 +4,15 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fread.html}
Gnulib module: ---
Gnulib module: stdio, nonblocking
Portability problems fixed by Gnulib:
Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
@itemize
@item
When reading from a non-blocking pipe whose buffer is empty, this function
fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on
some platforms:
mingw.
@end itemize
Portability problems not fixed by Gnulib:
+7 -2
View File
@@ -4,10 +4,15 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fscanf.html}
Gnulib module: ---
Gnulib module: stdio, nonblocking
Portability problems fixed by Gnulib:
Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
@itemize
@item
When reading from a non-blocking pipe whose buffer is empty, this function
fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on
some platforms:
mingw.
@end itemize
Portability problems not fixed by Gnulib:
+11 -2
View File
@@ -4,9 +4,18 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fwrite.html}
Gnulib module: stdio, sigpipe
Gnulib module: stdio, nonblocking, sigpipe
Portability problems fixed by Gnulib:
Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
@itemize
@item
When writing to a non-blocking pipe whose buffer is full, this function fails
with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some
platforms:
mingw.
@end itemize
Portability problems fixed by Gnulib module @code{stdio}, together with module @code{sigpipe}:
@itemize
@item
When writing to a pipe with no readers, this function fails, instead of
+10 -5
View File
@@ -10,13 +10,18 @@ Portability problems fixed by Gnulib:
@itemize
@item
This function is missing on some platforms:
HP-UX 11.11, IRIX 6.5, OSF/1 4.0, Solaris 7, Cygwin 1.5.x, mingw, Interix 3.5, BeOS.
HP-UX 11.11, IRIX 6.5, OSF/1 4.0, Solaris 7, Cygwin 1.5.x, Interix
3.5, BeOS.
@item
This function is only available in @code{<ws2tcpip.h>} on some
platforms:
mingw.
@item
This function's return type is @code{char *} instead of @code{const char *}
on some platforms:
AIX 7.1, HP-UX 11, OSF/1 5.1, Solaris 9, mingw.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item
This function's return type is @code{char *} instead of @code{const char *}
on some platforms:
AIX 7.1, HP-UX 11, OSF/1 5.1, Solaris 9.
@end itemize
+7 -2
View File
@@ -4,10 +4,15 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/getc.html}
Gnulib module: ---
Gnulib module: stdio, nonblocking
Portability problems fixed by Gnulib:
Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
@itemize
@item
When reading from a non-blocking pipe whose buffer is empty, this function
fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on
some platforms:
mingw.
@end itemize
Portability problems not fixed by Gnulib:
+7 -2
View File
@@ -4,10 +4,15 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/getchar.html}
Gnulib module: ---
Gnulib module: stdio, nonblocking
Portability problems fixed by Gnulib:
Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
@itemize
@item
When reading from a non-blocking pipe whose buffer is empty, this function
fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on
some platforms:
mingw.
@end itemize
Portability problems not fixed by Gnulib:
+15 -5
View File
@@ -4,16 +4,26 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/getcwd.html}
Gnulib module: getcwd
Gnulib module: getcwd or getcwd-lgpl
Portability problems fixed by Gnulib:
Portability problems fixed by either Gnulib module @code{getcwd} or
@code{getcwd-lgpl}:
@itemize
@item
On glibc platforms, @code{getcwd (NULL, n)} allocates memory for the result.
On some other platforms, this call is not allowed. Conversely, mingw fails
to honor non-zero @code{n}.
@item
On some platforms, the prototype for @code{getcwd} uses @code{int}
instead of @code{size_t} for the size argument:
mingw.
@end itemize
Portability problems fixed by Gnulib module @code{getcwd}:
@itemize
@item
This function is missing on some older platforms.
@item
On glibc platforms, @code{getcwd (NULL, n)} allocates memory for the result.
On other platforms, this call is not allowed.
@item
This function does not handle long file names (greater than @code{PATH_MAX})
correctly on some platforms.
@end itemize
+7 -2
View File
@@ -4,10 +4,15 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/gets.html}
Gnulib module: ---
Gnulib module: stdio, nonblocking
Portability problems fixed by Gnulib:
Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
@itemize
@item
When reading from a non-blocking pipe whose buffer is empty, this function
fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on
some platforms:
mingw.
@end itemize
Portability problems not fixed by Gnulib:
+2 -2
View File
@@ -27,8 +27,8 @@ when GNU libiconv is not installed.
@item
This function was not correctly implemented in glibc versions before 2.2.
@item
When @code{iconv} encounters an input character that is valid but that can
not be converted to the output character set, glibc's and GNU libiconv's
When @code{iconv} encounters an input character that is valid but that
cannot be converted to the output character set, glibc's and GNU libiconv's
@code{iconv} stop the conversion. Some other implementations put an
implementation-defined character into the output buffer. ---
Gnulib provides higher-level facilities @code{striconv} and @code{striconveh}
+8 -5
View File
@@ -4,18 +4,21 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/memchr.html}
Gnulib module: memchr
Gnulib module: memchr or memchr-obsolete
Portability problems fixed by Gnulib:
Portability problems fixed by either Gnulib module @code{memchr} or @code{memchr-obsolete}:
@itemize
@item
This function is missing on some older platforms.
@item
This function dereferences too much memory on some platforms:
glibc 2.10 on x86_64, IA-64; glibc 2.11 on Alpha.
@end itemize
Portability problems fixed by Gnulib module @code{memchr-obsolete}:
@itemize
@item
This function is missing on some older platforms.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@end itemize
+11 -4
View File
@@ -12,15 +12,22 @@ Portability problems fixed by Gnulib:
This function is missing on some platforms:
mingw.
@item
This function is declared in @code{<unistd.h>} instead of @code{<stdlib.h>}
on some platforms:
MacOS X 10.3.
@item
On some platforms (HP-UX 10.20, SunOS 4.1.4, Solaris 2.5.1), mkstemp has a silly
limit that it can create no more than 26 files from a given template. On
OSF/1 4.0f, it can create only 32 files per process.
@item
On some older platforms, @code{mkstemp} can create a world or group
writable or readable file, if you haven't set the process umask to
077. This is a security risk.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item
On platforms other than glibc 2.0.7 or newer, @code{mkstemp} can create a
world or group writable or readable file, if you haven't set the process
umask to 077. This is a security risk.
@end itemize
The gnulib module @code{clean-temp} can create temporary files that will not
be left behind after signals such as SIGINT.
+4
View File
@@ -14,6 +14,10 @@ and (without the slash) names a nonexistent file or a file that is not a
directory, on some platforms:
FreeBSD 7.2, AIX 7.1, HP-UX 11.00, Solaris 9, Irix 5.3.
@item
This function does not support the @code{O_NONBLOCK} flag when it is defined
by the gnulib module @code{nonblock} on some platforms:
mingw.
@item
On Windows platforms (excluding Cygwin), this function does usually not
recognize the @file{/dev/null} filename.
@end itemize
+10 -1
View File
@@ -4,7 +4,7 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/printf.html}
Gnulib module: printf-posix or stdio, sigpipe
Gnulib module: printf-posix or stdio, nonblocking, sigpipe
Portability problems fixed by Gnulib module @code{printf-posix}:
@itemize
@@ -64,6 +64,15 @@ This function can crash in out-of-memory conditions on some platforms:
MacOS X 10.3, FreeBSD 6.0, NetBSD 5.0.
@end itemize
Portability problems fixed by Gnulib module @code{stdio} or @code{printf-posix}, together with module @code{nonblocking}:
@itemize
@item
When writing to a non-blocking pipe whose buffer is full, this function fails
with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some
platforms:
mingw.
@end itemize
Portability problems fixed by Gnulib module @code{stdio} or @code{printf-posix}, together with module @code{sigpipe}:
@itemize
@item
+11 -2
View File
@@ -4,9 +4,18 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/putc.html}
Gnulib module: stdio, sigpipe
Gnulib module: stdio, nonblocking, sigpipe
Portability problems fixed by Gnulib:
Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
@itemize
@item
When writing to a non-blocking pipe whose buffer is full, this function fails
with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some
platforms:
mingw.
@end itemize
Portability problems fixed by Gnulib module @code{stdio}, together with module @code{sigpipe}:
@itemize
@item
When writing to a pipe with no readers, this function fails, instead of
+11 -2
View File
@@ -4,9 +4,18 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/putchar.html}
Gnulib module: stdio, sigpipe
Gnulib module: stdio, nonblocking, sigpipe
Portability problems fixed by Gnulib:
Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
@itemize
@item
When writing to a non-blocking pipe whose buffer is full, this function fails
with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some
platforms:
mingw.
@end itemize
Portability problems fixed by Gnulib module @code{stdio}, together with module @code{sigpipe}:
@itemize
@item
When writing to a pipe with no readers, this function fails, instead of
+11 -2
View File
@@ -4,9 +4,18 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/puts.html}
Gnulib module: stdio, sigpipe
Gnulib module: stdio, nonblocking, sigpipe
Portability problems fixed by Gnulib:
Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
@itemize
@item
When writing to a non-blocking pipe whose buffer is full, this function fails
with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some
platforms:
mingw.
@end itemize
Portability problems fixed by Gnulib module @code{stdio}, together with module @code{sigpipe}:
@itemize
@item
When writing to a pipe with no readers, this function fails, instead of
+7 -2
View File
@@ -4,10 +4,15 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/read.html}
Gnulib module: ---
Gnulib module: stdio, nonblocking
Portability problems fixed by Gnulib:
Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
@itemize
@item
When reading from a non-blocking pipe whose buffer is empty, this function
fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on
some platforms:
mingw.
@end itemize
Portability problems not fixed by Gnulib:
+7 -2
View File
@@ -4,10 +4,15 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/scanf.html}
Gnulib module: ---
Gnulib module: stdio, nonblocking
Portability problems fixed by Gnulib:
Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
@itemize
@item
When reading from a non-blocking pipe whose buffer is empty, this function
fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on
some platforms:
mingw.
@end itemize
Portability problems not fixed by Gnulib:
+2 -2
View File
@@ -10,7 +10,7 @@ Portability problems fixed by Gnulib:
@itemize
@item
On Windows platforms (excluding Cygwin), the descriptors returned by
the @code{socket} function can not be used in calls to @code{read},
the @code{socket} function cannot be used in calls to @code{read},
@code{write}, and @code{close}; you have to use @code{recv}, @code{send},
@code{closesocket} in these cases instead.
@item
@@ -22,7 +22,7 @@ used instead.
Portability problems not fixed by Gnulib:
@itemize
@item
On BeOS, the descriptors returned by the @code{socket} function can not be used
On BeOS, the descriptors returned by the @code{socket} function cannot be used
in calls to @code{read}, @code{write}, and @code{close}; you have to use
@code{recv}, @code{send}, @code{closesocket} in these cases instead.
@end itemize
+8 -5
View File
@@ -4,13 +4,10 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/strtod.html}
Gnulib module: strtod
Gnulib module: strtod or strtod-obsolete
Portability problems fixed by Gnulib:
Portability problems fixed by either Gnulib module @code{strtod} or @code{strtod-obsolete}:
@itemize
@item
This function is missing on some old platforms.
@item
This function mis-parses strings with leading @samp{+} on some old platforms:
Old versions of Linux.
@@ -67,6 +64,12 @@ platforms:
AIX 7.1.
@end itemize
Portability problems fixed by Gnulib module @code{strtod-obsolete}:
@itemize
@item
This function is missing on some old platforms.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item
+10 -1
View File
@@ -4,7 +4,7 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/vfprintf.html}
Gnulib module: vfprintf-posix or stdio, sigpipe
Gnulib module: vfprintf-posix or stdio, nonblocking, sigpipe
Portability problems fixed by Gnulib module @code{vfprintf-posix}:
@itemize
@@ -64,6 +64,15 @@ This function can crash in out-of-memory conditions on some platforms:
MacOS X 10.3, FreeBSD 6.0, NetBSD 5.0.
@end itemize
Portability problems fixed by Gnulib module @code{stdio} or @code{vfprintf-posix}, together with module @code{nonblocking}:
@itemize
@item
When writing to a non-blocking pipe whose buffer is full, this function fails
with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some
platforms:
mingw.
@end itemize
Portability problems fixed by Gnulib module @code{stdio} or @code{vfprintf-posix}, together with module @code{sigpipe}:
@itemize
@item
+7 -2
View File
@@ -4,10 +4,15 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/vfscanf.html}
Gnulib module: ---
Gnulib module: vfscanf, nonblocking
Portability problems fixed by Gnulib:
Portability problems fixed by Gnulib module @code{vfscanf}, together with module @code{nonblocking}:
@itemize
@item
When reading from a non-blocking pipe whose buffer is empty, this function
fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on
some platforms:
mingw.
@end itemize
Portability problems not fixed by Gnulib:
+10 -1
View File
@@ -4,7 +4,7 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/vprintf.html}
Gnulib module: vprintf-posix or stdio, sigpipe
Gnulib module: vprintf-posix or stdio, nonblocking, sigpipe
Portability problems fixed by Gnulib module @code{vprintf-posix}:
@itemize
@@ -64,6 +64,15 @@ This function can crash in out-of-memory conditions on some platforms:
MacOS X 10.3, FreeBSD 6.0, NetBSD 5.0.
@end itemize
Portability problems fixed by Gnulib module @code{stdio} or @code{vprintf-posix}, together with module @code{nonblocking}:
@itemize
@item
When writing to a non-blocking pipe whose buffer is full, this function fails
with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some
platforms:
mingw.
@end itemize
Portability problems fixed by Gnulib module @code{stdio} or @code{vprintf-posix}, together with module @code{sigpipe}:
@itemize
@item
+7 -2
View File
@@ -4,10 +4,15 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/vscanf.html}
Gnulib module: ---
Gnulib module: vscanf, nonblocking
Portability problems fixed by Gnulib:
Portability problems fixed by Gnulib module @code{vscanf}, together with module @code{nonblocking}:
@itemize
@item
When reading from a non-blocking pipe whose buffer is empty, this function
fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on
some platforms:
mingw.
@end itemize
Portability problems not fixed by Gnulib:
+17 -2
View File
@@ -4,9 +4,24 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/write.html}
Gnulib module: write, sigpipe
Gnulib module: write, nonblocking, sigpipe
Portability problems fixed by Gnulib:
Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
@itemize
@item
When writing to a non-blocking pipe whose buffer is full, this function fails
with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some
platforms:
mingw.
@item
When writing to a non-blocking pipe on which no reader is currently waiting
an amount of bytes that exceeds the pipe buffer's size, then -- even if the
pipe's buffer is empty -- this function fails, instead of performing a partial
write into the pipe buffer, on some platforms:
mingw.
@end itemize
Portability problems fixed by Gnulib module @code{stdio}, together with module @code{sigpipe}:
@itemize
@item
When writing to a pipe with no readers, this function fails with error
+20 -1
View File
@@ -3,12 +3,31 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/assert.h.html}
Gnulib module: ---
Gnulib module: assert-h
See also the Gnulib module @code{assert}.
Portability problems fixed by Gnulib:
@itemize
@item
The draft C1X and C++0X @code{static_assert}, and the draft C1X
@code{_Static_assert}, are not supported by many platforms.
For example, GCC versions before 4.6.0 do not support @code{_Static_assert},
and G++ versions through at least 4.6.0 do not support @code{static_assert}.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item
Draft C1X @code{_Static_assert} and draft C++0X @code{static_assert}
are keywords that can be used without including @code{<assert.h>}.
The Gnulib substitutes are macros that require including @code{<assert.h>}.
@item
The draft C1X @code{static_assert} and @code{_Static_assert} can also
be used within a @code{struct} or @code{union} specifier, in place of
an ordinary declaration of a member of the struct or union. The
Gnulib substitute can be used only as an ordinary declaration.
@item
In C99, @code{assert} can be applied to any scalar expression.
In C89, the argument to @code{assert} is of type @code{int}.
@end itemize
+12 -2
View File
@@ -9,14 +9,24 @@ Portability problems fixed by Gnulib:
@itemize
@item
@samp{O_CLOEXEC}, @samp{O_DIRECTORY}, @samp{O_DSYNC}, @samp{O_NOCTTY},
@samp{O_NOFOLLOW}, @samp{O_NONBLOCK}, @samp{O_RSYNC}, @samp{O_SYNC},
@samp{O_NOFOLLOW}, @samp{O_RSYNC}, @samp{O_SYNC},
and @samp{O_TTY_INIT} are not defined on some platforms. Gnulib defines
these macros to 0.
these macros to 0, which is generally safe.
@item
@samp{O_NONBLOCK} is not defined on some platforms. If the
@samp{nonblocking} module is in use, gnulib guarantees a working
non-zero value; otherwise, the gnulib replacement is 0.
@item
@samp{O_EXEC} and @samp{O_SEARCH} are not defined on some platforms.
Gnulib defines these macros to @samp{O_RDONLY}, which is typically 0.
@item
The @samp{O_ACCMODE} mask mistakenly omits @samp{O_SEARCH} and
@samp{O_EXEC} on some platforms:
Cygwin.
@item
@samp{O_BINARY}, @samp{O_TEXT} (not specified by POSIX, but essential for
portability to Woe32 platforms) are defined on some platforms but not on
+5
View File
@@ -28,6 +28,11 @@ mingw.
@item
The macro @code{SA_NODEFER} is not defined on some platforms:
Interix 3.5.
@item
The type @code{sighandler_t} (a GNU extension) is not defined on most non-glibc
platforms:
MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX 5.1, HP-UX 11,
IRIX 6.5, OSF/1 5.1, Solaris 11 2010-11, Cygwin, mingw, Interix 3.5, BeOS.
@end itemize
Portability problems not fixed by Gnulib:
+9
View File
@@ -17,6 +17,9 @@ This header file is not self-contained on some platforms: it requires
This header file does not define the type @code{socklen_t} on some platforms:
HP-UX 10.20, IRIX 6.5, OSF/1 4.0, Interix 3.5, BeOS.
@item
This header file does not define the type @code{struct iovec} on some platforms:
OpenBSD 4.4.
@item
This header file is lacking the @code{SHUT_RD}, @code{SHUT_WR},
@code{SHUT_RDWR} macros on some platforms, despite having the @code{shutdown}
functions:
@@ -29,4 +32,10 @@ AIX 7.1.
Portability problems not fixed by Gnulib:
@itemize
@item
This header file does not declare the @code{msg_control} and
@code{msg_controllen} members of @code{struct msghdr} on some
platforms. This can be detected by the absence of the
@code{CMSG_FIRSTHDR} macro:
gnulib replacement header, old BSD
@end itemize
+9 -5
View File
@@ -3,15 +3,19 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_uio.h.html}
Gnulib module: ---
Gnulib module: sys_uio
Portability problems fixed by Gnulib:
@itemize
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item
This header file is missing on some platforms:
mingw.
@item
This header file is not self-contained (it requires @code{<sys/types.h>} to be
included first) on some platforms:
OpenBSD 4.4.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@end itemize
+443 -78
View File
@@ -223,6 +223,10 @@ Options for --import, --add/remove-import,
--avoid=MODULE Avoid including the given MODULE. Useful if you
have code that provides equivalent functionality.
This option can be repeated.
--conditional-dependencies
Support conditional dependencies (experimental,
may save configure time and object code, not
compatible with --with-tests).
--libtool Use libtool rules.
--no-libtool Don't use libtool rules.
@@ -912,6 +916,8 @@ fi
# - excl_unportable_tests true if --without-unportable-tests was given, blank
# otherwise
# - avoidlist list of modules to avoid, from --avoid
# - cond_dependencies true if --conditional-dependencies was given, blank
# otherwise
# - lgpl yes or a number if --lgpl was given, blank otherwise
# - makefile_name from --makefile-name
# - libtool true if --libtool was given, false if --no-libtool was
@@ -953,6 +959,7 @@ fi
excl_privileged_tests=
excl_unportable_tests=
avoidlist=
cond_dependencies=
lgpl=
makefile_name=
libtool=
@@ -1002,7 +1009,7 @@ fi
--extract-* )
mode=`echo "X$1" | sed -e 's/^X--//'`
shift ;;
--copy-file | --copy-fil | --copy-fi | --copy-f | --copy- | --copy | --cop | --co )
--copy-file | --copy-fil | --copy-fi | --copy-f | --copy- | --copy | --cop )
mode=copy-file
shift ;;
--dir )
@@ -1153,6 +1160,9 @@ fi
arg=`echo "X$1" | sed -e 's/^X--avoid=//'`
func_append avoidlist " $arg"
shift ;;
--conditional-dependencies | --conditional-dependencie | --conditional-dependenci | --conditional-dependenc | --conditional-dependen | --conditional-depende | --conditional-depend | --conditional-depen | --conditional-depe | --conditional-dep | --conditional-de | --conditional-d | --conditional- | --conditional | --conditiona | --condition | --conditio | --conditi | --condit | --condi | --cond | --con)
cond_dependencies=true
shift ;;
--lgpl )
lgpl=yes
shift ;;
@@ -1298,6 +1308,10 @@ fi
if test -z "$pobase" && test -n "$po_domain"; then
func_warning "--po-domain has no effect without a --po-base option"
fi
if test -n "$cond_dependencies" && test -n "$inctests"; then
echo "gnulib-tool: option --conditional-dependencies is not supported with --with-tests" 1>&2
func_exit 1
fi
# Determine the minimum supported autoconf version from the project's
# configure.ac.
@@ -2128,11 +2142,13 @@ func_get_autoconf_snippet ()
fi
}
# func_get_automake_snippet module
# func_get_automake_snippet_conditional module
# returns the part of the Makefile.am snippet that can be put inside Automake
# conditionals.
# Input:
# - local_gnulib_dir from --local-dir
# - modcache true or false, from --cache-modules/--no-cache-modules
func_get_automake_snippet ()
func_get_automake_snippet_conditional ()
{
if ! $modcache; then
func_lookup_file "modules/$1"
@@ -2152,6 +2168,16 @@ func_get_automake_snippet ()
fi
fi
fi
}
# func_get_automake_snippet_unconditional module
# returns the part of the Makefile.am snippet that must stay outside of
# Automake conditionals.
# Input:
# - local_gnulib_dir from --local-dir
# - modcache true or false, from --cache-modules/--no-cache-modules
func_get_automake_snippet_unconditional ()
{
case "$1" in
*-tests)
# *-tests module live in tests/, not lib/.
@@ -2176,8 +2202,10 @@ func_get_automake_snippet ()
sed_extract_mentioned_files='s/^lib_SOURCES[ ]*+=[ ]*//p'
already_mentioned_files=` \
{ if ! $modcache; then
func_lookup_file "modules/$1"
sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
else
func_cache_lookup_module "$1"
if $have_associative; then
if eval 'test -n "${modcache_makefile[$1]+set}"'; then
eval 'echo "${modcache_makefile[$1]}"'
@@ -2243,6 +2271,16 @@ func_get_automake_snippet ()
esac
}
# func_get_automake_snippet module
# Input:
# - local_gnulib_dir from --local-dir
# - modcache true or false, from --cache-modules/--no-cache-modules
func_get_automake_snippet ()
{
func_get_automake_snippet_conditional "$1"
func_get_automake_snippet_unconditional "$1"
}
# func_get_include_directive module
# Input:
# - local_gnulib_dir from --local-dir
@@ -2380,6 +2418,143 @@ func_acceptable ()
return 0
}
# sed expression to keep the first 32 characters of each line.
sed_first_32_chars='s/^\(................................\).*/\1/'
# func_module_shellfunc_name module
# computes the shell function name that will contain the m4 macros for the module.
# Input:
# - macro_prefix prefix to use
# Output:
# - shellfunc shell function name
func_module_shellfunc_name ()
{
case $1 in
*[!a-zA-Z0-9_]*)
shellfunc=func_${macro_prefix}_gnulib_m4code_`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
*)
shellfunc=func_${macro_prefix}_gnulib_m4code_$1 ;;
esac
}
# func_module_shellvar_name module
# computes the shell variable name the will be set to true once the m4 macros
# for the module have been executed.
# Output:
# - shellvar shell variable name
func_module_shellvar_name ()
{
case $1 in
*[!a-zA-Z0-9_]*)
shellvar=${macro_prefix}_gnulib_enabled_`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
*)
shellvar=${macro_prefix}_gnulib_enabled_$1 ;;
esac
}
# func_module_conditional_name module
# computes the automake conditional name for the module.
# Output:
# - conditional name of automake conditional
func_module_conditional_name ()
{
case $1 in
*[!a-zA-Z0-9_]*)
conditional=${macro_prefix}_GNULIB_ENABLED_`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
*)
conditional=${macro_prefix}_GNULIB_ENABLED_$1 ;;
esac
}
# func_uncond_add_module B
# notes the presence of B as an unconditional module.
#
# func_conddep_add_module A B cond
# notes the presence of a conditional dependency from module A to module B,
# subject to the condition that A is enabled and cond is true.
#
# func_cond_module_p B
# tests whether module B is conditional.
#
# func_cond_module_condition A B
# returns the condition when B should be enabled as a dependency of A, once the
# m4 code for A has been executed.
# Output: - condition
#
if $have_associative; then
declare -A conddep_isuncond
declare -A conddep_dependers
declare -A conddep_condition
func_uncond_add_module ()
{
eval 'conddep_isuncond[$1]=true'
eval 'unset conddep_dependers[$1]'
}
func_conddep_add_module ()
{
eval 'isuncond="${conddep_isuncond[$2]}"'
if test -z "$isuncond"; then
# No unconditional dependency to B known at this point.
eval 'conddep_dependers[$2]="${conddep_dependers[$2]} $1"'
eval 'conddep_condition[$1---$2]="$3"'
fi
}
func_cond_module_p ()
{
eval 'previous_dependers="${conddep_dependers[$1]}"'
test -n "$previous_dependers"
}
func_cond_module_condition ()
{
eval 'condition="${conddep_condition[$1---$2]}"'
}
else
func_uncond_add_module ()
{
case $1 in
*[!a-zA-Z0-9_]*)
suffix=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
*)
suffix=$1 ;;
esac
eval 'conddep_isuncond_'"$suffix"'=true'
eval 'unset conddep_dependers_'"$suffix"
}
func_conddep_add_module ()
{
case $2 in
*[!a-zA-Z0-9_]*)
suffix=`echo "$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
*)
suffix=$2 ;;
esac
eval 'isuncond="${conddep_isuncond_'"$suffix"'}"'
if test -z "$isuncond"; then
eval 'conddep_dependers_'"$suffix"'="${conddep_dependers_'"$suffix"'} $1"'
suffix=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"`
eval 'conddep_condition_'"$suffix"'="$3"'
fi
}
func_cond_module_p ()
{
case $1 in
*[!a-zA-Z0-9_]*)
suffix=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
*)
suffix=$1 ;;
esac
eval 'previous_dependers="${conddep_dependers_'"$suffix"'}"'
test -n "$previous_dependers"
}
func_cond_module_condition ()
{
suffix=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"`
eval 'condition="${conddep_condition_'"$suffix"'}"'
}
fi
sed_dependencies_without_conditions='s/ *\[.*//'
# func_modules_transitive_closure
# Input:
# - local_gnulib_dir from --local-dir
@@ -2411,11 +2586,16 @@ func_acceptable ()
# - excl_unportable_tests true if tests that fail on some platforms should be
# excluded, blank otherwise
# - avoidlist list of modules to avoid
# - cond_dependencies true if conditional dependencies shall be supported,
# blank otherwise
# - tmp pathname of a temporary directory
# Output:
# - modules list of modules, including dependencies
# - conddep_dependers, conddep_condition information about conditionally
# enabled modules
func_modules_transitive_closure ()
{
sed_escape_dependency='s|\([/.]\)|\\\1|g'
# In order to process every module only once (for speed), process an "input
# list" of modules, producing an "output list" of modules. During each round,
# more modules can be queued in the input list. Once a module on the input
@@ -2425,6 +2605,16 @@ func_modules_transitive_closure ()
inmodules="$modules"
outmodules=
fmtc_inc_all_tests="$inc_all_direct_tests"
if test -n "$cond_dependencies"; then
for module in $inmodules; do
func_verify_module
if test -n "$module"; then
if func_acceptable $module; then
func_uncond_add_module $module
fi
fi
done
fi
while test -n "$inmodules"; do
inmodules_this_round="$inmodules"
inmodules= # Accumulator, queue for next round
@@ -2433,7 +2623,23 @@ func_modules_transitive_closure ()
if test -n "$module"; then
if func_acceptable $module; then
func_append outmodules " $module"
deps=`func_get_dependencies $module`
if test -n "$cond_dependencies"; then
if func_get_automake_snippet_conditional $module | grep '^if ' > /dev/null; then
# A module whose Makefile.am snippet contains a reference to an
# automake conditional. If we were to use it conditionally, we
# would get an error
# configure: error: conditional "..." was never defined.
# because automake 1.11.1 does not handle nested conditionals
# correctly. As a workaround, make the module unconditional.
func_uncond_add_module $module
fi
if func_cond_module_p $module; then
conditional=true
else
conditional=false
fi
fi
deps=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
# Duplicate dependencies are harmless, but Jim wants a warning.
duplicated_deps=`echo "$deps" | LC_ALL=C sort | LC_ALL=C uniq -d`
if test -n "$duplicated_deps"; then
@@ -2486,6 +2692,24 @@ func_modules_transitive_closure ()
done
if $inc; then
func_append inmodules " $dep"
if test -n "$cond_dependencies"; then
escaped_dep=`echo "$dep" | sed -e "$sed_escape_dependency"`
sed_extract_condition1='/^ *'"$escaped_dep"' *$/{s/^.*$/true/p}'
sed_extract_condition2='/^ *'"$escaped_dep"' *\[.*\] *$/{s/^ *'"$escaped_dep"' *\[\(.*\)\] *$/\1/p}'
condition=`func_get_dependencies $module | sed -n -e "$sed_extract_condition1" -e "$sed_extract_condition2"`
if test "$condition" = true; then
condition=
fi
if test -n "$condition"; then
func_conddep_add_module "$module" "$dep" "$condition"
else
if $conditional; then
func_conddep_add_module "$module" "$dep" true
else
func_uncond_add_module "$dep"
fi
fi
fi
fi
done
fi
@@ -2522,7 +2746,7 @@ func_show_module_list ()
echo "Module list with included dependencies (indented):"
echo "$specified_modules" | sed -e '/^$/d' -e 's/$/| /' > "$tmp"/specified-modules
echo "$modules" | sed -e '/^$/d' \
| LC_ALL=C join -t '|' -a 2 "$tmp"/specified-modules - \
| LC_ALL=C join -t '|' -a2 "$tmp"/specified-modules - \
| sed -e 's/^\(.*\)|.*/|\1/' -e 's/^/ /' -e 's/^ |\(.*\)$/ '"${bold_on}"'\1'"${bold_off}"'/'
}
@@ -2812,7 +3036,7 @@ func_emit_lib_Makefile_am ()
func_verify_nontests_module
if test -n "$module"; then
{
func_get_automake_snippet "$module" |
func_get_automake_snippet_conditional "$module" |
LC_ALL=C \
sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
-e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
@@ -2826,16 +3050,32 @@ func_emit_lib_Makefile_am ()
echo "${libname}_${libext}_LIBADD += @${perhapsLT}ALLOCA@"
echo "${libname}_${libext}_DEPENDENCIES += @${perhapsLT}ALLOCA@"
fi
} > "$tmp"/amsnippet
} > "$tmp"/amsnippet1
{
func_get_automake_snippet_unconditional "$module" |
LC_ALL=C sed -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g'
} > "$tmp"/amsnippet2
# Skip the contents if it's entirely empty.
if grep '[^ ]' "$tmp"/amsnippet > /dev/null ; then
if grep '[^ ]' "$tmp"/amsnippet1 "$tmp"/amsnippet2 > /dev/null ; then
echo "## begin gnulib module $module"
echo
cat "$tmp"/amsnippet
if test -n "$cond_dependencies"; then
if func_cond_module_p "$module"; then
func_module_conditional_name "$module"
echo "if $conditional"
fi
fi
cat "$tmp"/amsnippet1
if test -n "$cond_dependencies"; then
if func_cond_module_p "$module"; then
echo "endif"
fi
fi
cat "$tmp"/amsnippet2
echo "## end gnulib module $module"
echo
fi
rm -f "$tmp"/amsnippet
rm -f "$tmp"/amsnippet1 "$tmp"/amsnippet2
# Test whether there are some source files in subdirectories.
for f in `func_get_filelist "$module"`; do
case $f in
@@ -3380,6 +3620,190 @@ func_emit_initmacro_done ()
echo "])"
}
# func_emit_autoconf_snippet indentation
# emits the autoconf snippet of a module.
# Input:
# - local_gnulib_dir from --local-dir
# - modcache true or false, from --cache-modules/--no-cache-modules
# - sed_replace_build_aux sed expression that replaces reference to build-aux
# - module the module name
# - toplevel true or false. 'false' means a subordinate use of
# gnulib-tool.
# - disable_libtool true or false. It tells whether to disable libtool
# handling even if it has been specified through the
# command line options.
# - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT
# invocations.
# - indentation spaces to prepend on each line
func_emit_autoconf_snippet ()
{
if { case $module in
gnumakefile | maintainer-makefile)
# These modules are meant to be used only in the top-level directory.
$toplevel ;;
*)
true ;;
esac
}; then
func_get_autoconf_snippet "$module" \
| sed -e '/^$/d;' -e "s/^/$indentation/" \
-e "$sed_replace_build_aux" \
| { if $disable_libtool; then
sed -e 's/\$gl_cond_libtool/false/g' \
-e 's/gl_libdeps/gltests_libdeps/g' \
-e 's/gl_ltlibdeps/gltests_ltlibdeps/g'
else
cat
fi
} \
| { if $disable_gettext; then
sed -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./'
else
cat
fi
}
if test "$module" = 'alloca' && test "$libtool" = true && ! $disable_libtool; then
echo 'changequote(,)dnl'
echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
echo 'changequote([, ])dnl'
echo 'AC_SUBST([LTALLOCA])'
fi
fi
}
# func_emit_autoconf_snippets modules verifier toplevel disable_libtool disable_gettext
# collects and emit the autoconf snippets of a set of modules.
# Input:
# - local_gnulib_dir from --local-dir
# - modcache true or false, from --cache-modules/--no-cache-modules
# - sed_replace_build_aux sed expression that replaces reference to build-aux
# - modules the list of modules.
# - verifier one of func_verify_module, func_verify_nontests_module,
# func_verify_tests_module. It selects the subset of
# $modules to consider.
# - toplevel true or false. 'false' means a subordinate use of
# gnulib-tool.
# - disable_libtool true or false. It tells whether to disable libtool
# handling even if it has been specified through the
# command line options.
# - disable_gettext true or false. It tells whether to disable AM_GNU_GETTEXT
# invocations.
func_emit_autoconf_snippets ()
{
verifier="$2"
toplevel="$3"
disable_libtool="$4"
disable_gettext="$5"
if test -n "$cond_dependencies"; then
# Emit the autoconf code for the unconditional modules.
for module in $1; do
eval $verifier
if test -n "$module"; then
if func_cond_module_p "$module"; then
:
else
func_emit_autoconf_snippet " "
fi
fi
done
# Initialize the shell variables indicating that the modules are enabled.
for module in $1; do
eval $verifier
if test -n "$module"; then
if func_cond_module_p "$module"; then
func_module_shellvar_name "$module"
echo " $shellvar=false"
fi
fi
done
# Emit the autoconf code for the conditional modules, each in a separate
# function. This makes it possible to support cycles among conditional
# modules.
for module in $1; do
eval $verifier
if test -n "$module"; then
if func_cond_module_p "$module"; then
func_module_shellfunc_name "$module"
func_module_shellvar_name "$module"
echo " $shellfunc ()"
echo ' {'
echo " if ! \$$shellvar; then"
func_emit_autoconf_snippet " "
echo " $shellvar=true"
deps=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
for dep in $deps; do
if func_cond_module_p "$dep"; then
func_module_shellfunc_name "$dep"
func_cond_module_condition "$module" "$dep"
if test "$condition" != true; then
echo ' if $condition; then'
echo " $shellfunc"
echo ' fi'
else
echo " $shellfunc"
fi
else
# The autoconf code for $dep has already been emitted above and
# therefore is already executed when this function is run.
:
fi
done
echo ' fi'
echo ' }'
fi
fi
done
# Emit the dependencies from the unconditional to the conditional modules.
for module in $1; do
eval $verifier
if test -n "$module"; then
if func_cond_module_p "$module"; then
:
else
deps=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
for dep in $deps; do
if func_cond_module_p "$dep"; then
func_module_shellfunc_name "$dep"
func_cond_module_condition "$module" "$dep"
if test "$condition" != true; then
echo " if $condition; then"
echo " $shellfunc"
echo ' fi'
else
echo " $shellfunc"
fi
else
# The autoconf code for $dep has already been emitted above and
# therefore is already executed when this code is run.
:
fi
done
fi
fi
done
# Define the Automake conditionals.
echo " m4_pattern_allow([^${macro_prefix}_GNULIB_ENABLED_])"
for module in $1; do
eval $verifier
if test -n "$module"; then
if func_cond_module_p "$module"; then
func_module_conditional_name "$module"
func_module_shellvar_name "$module"
echo " AM_CONDITIONAL([$conditional], [\$$shellvar])"
fi
fi
done
else
# Ignore the conditions, and enable all modules unconditionally.
for module in $1; do
eval $verifier
if test -n "$module"; then
func_emit_autoconf_snippet " "
fi
done
fi
}
# func_import modules
# Uses also the variables
# - mode import or add-import or remove-import or update
@@ -3406,6 +3830,8 @@ func_emit_initmacro_done ()
# otherwise
# - inc_all_tests true if --with-all-tests was given, blank otherwise
# - avoidlist list of modules to avoid, from --avoid
# - cond_dependencies true if conditional dependencies shall be supported,
# blank otherwise
# - lgpl yes or a number if library's license shall be LGPL,
# blank otherwise
# - makefile_name from --makefile-name
@@ -4568,22 +4994,7 @@ s,//*$,/,'
echo " gl_m4_base='$m4base'"
func_emit_initmacro_start $macro_prefix
echo " gl_source_base='$sourcebase'"
for module in $main_modules; do
func_verify_module
if test -n "$module"; then
echo " # Code from module $module:"
func_get_autoconf_snippet "$module" \
| sed -e '/^$/d;' -e 's/^/ /' \
-e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./' \
-e "$sed_replace_build_aux"
if test "$module" = 'alloca' && test "$libtool" = true; then
echo 'changequote(,)dnl'
echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
echo 'changequote([, ])dnl'
echo 'AC_SUBST([LTALLOCA])'
fi
fi
done
func_emit_autoconf_snippets "$main_modules" func_verify_module true false true
echo " # End of code from modules"
func_emit_initmacro_end $macro_prefix
echo " gltests_libdeps="
@@ -4599,18 +5010,7 @@ s,//*$,/,'
echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
for module in $testsrelated_modules; do
func_verify_module
if test -n "$module"; then
func_get_autoconf_snippet "$module" \
| sed -e '/^$/d;' -e 's/^/ /' \
-e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./' \
-e "$sed_replace_build_aux" \
-e 's/\$gl_cond_libtool/false/g' \
-e 's/gl_libdeps/gltests_libdeps/g' \
-e 's/gl_ltlibdeps/gltests_ltlibdeps/g'
fi
done
func_emit_autoconf_snippets "$testsrelated_modules" func_verify_module true true true
echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
func_emit_initmacro_end ${macro_prefix}tests
# _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
@@ -4891,6 +5291,8 @@ s,//*$,/,'
# - excl_unportable_tests true if tests that fail on some platforms should be
# excluded, blank otherwise
# - avoidlist list of modules to avoid
# - cond_dependencies true if conditional dependencies shall be supported,
# blank otherwise
# - libtool true if --libtool was given, false if --no-libtool was
# given, blank otherwise
# - symbolic true if files should be symlinked, copied otherwise
@@ -5163,34 +5565,9 @@ func_create_testdir ()
# autoconf snippets. It's cleanest to put those of the library before
# those of the tests.
echo "gl_source_base='../$sourcebase'"
for module in $modules; do
func_verify_nontests_module
if test -n "$module"; then
case $module in
gnumakefile | maintainer-makefile)
# These modules are meant to be used only in the top-level directory.
;;
*)
func_get_autoconf_snippet "$module" \
| sed -e "$sed_replace_build_aux"
if test "$module" = 'alloca' && test "$libtool" = true; then
echo 'changequote(,)dnl'
echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
echo 'changequote([, ])dnl'
echo 'AC_SUBST([LTALLOCA])'
fi
;;
esac
fi
done
func_emit_autoconf_snippets "$modules" func_verify_nontests_module false false false
echo "gl_source_base='.'"
for module in $modules; do
func_verify_tests_module
if test -n "$module"; then
func_get_autoconf_snippet "$module" \
| sed -e "$sed_replace_build_aux"
fi
done
func_emit_autoconf_snippets "$modules" func_verify_tests_module false false false
func_emit_initmacro_end $macro_prefix
# _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
# created using libtool, because libtool already handles the dependencies.
@@ -5296,19 +5673,7 @@ func_create_testdir ()
echo "gl_m4_base='$m4base'"
func_emit_initmacro_start $macro_prefix
echo "gl_source_base='$sourcebase'"
for module in $modules; do
func_verify_nontests_module
if test -n "$module"; then
func_get_autoconf_snippet "$module" \
| sed -e "$sed_replace_build_aux"
if test "$module" = 'alloca' && test "$libtool" = true; then
echo 'changequote(,)dnl'
echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
echo 'changequote([, ])dnl'
echo 'AC_SUBST([LTALLOCA])'
fi
fi
done
func_emit_autoconf_snippets "$modules" func_verify_nontests_module true false false
func_emit_initmacro_end $macro_prefix
# _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
# created using libtool, because libtool already handles the dependencies.
+5
View File
@@ -0,0 +1,5 @@
#define _GL_USE_STDLIB_ALLOC 1
#include <config.h>
#include "allocator.h"
#include <stdlib.h>
struct allocator const stdlib_allocator = { malloc, realloc, free, NULL };
+57
View File
@@ -0,0 +1,57 @@
/* Memory allocators such as malloc+free.
Copyright (C) 2011 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Paul Eggert. */
#ifndef _GL_ALLOCATOR_H
#define _GL_ALLOCATOR_H
#include <stddef.h>
/* An object describing a memory allocator family. */
struct allocator
{
/* Do not use GCC attributes such as __attribute__ ((malloc)) with
the function types pointed at by these members, because these
attributes do not work with pointers to functions. See
<http://lists.gnu.org/archive/html/bug-gnulib/2011-04/msg00007.html>. */
/* Call ALLOCATE to allocate memory, like 'malloc'. On failure ALLOCATE
should return NULL, though not necessarily set errno. When given
a zero size it may return NULL even if successful. */
void *(*allocate) (size_t);
/* If nonnull, call REALLOCATE to reallocate memory, like 'realloc'.
On failure REALLOCATE should return NULL, though not necessarily set
errno. When given a zero size it may return NULL even if
successful. */
void *(*reallocate) (void *, size_t);
/* Call FREE to free memory, like 'free'. */
void (*free) (void *);
/* If nonnull, call DIE if MALLOC or REALLOC fails. DIE should not
return. DIE can be used by code that detects memory overflow
while calculating sizes to be passed to MALLOC or REALLOC. */
void (*die) (void);
};
/* An allocator using the stdlib functions and a null DIE function. */
extern struct allocator const stdlib_allocator;
#endif /* _GL_ALLOCATOR_H */
+3 -95
View File
@@ -24,108 +24,16 @@
/* Specification. */
#include "areadlink.h"
#include <errno.h>
#include <limits.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#ifndef SSIZE_MAX
# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
#endif
/* Use the system functions, not the gnulib overrides in this file. */
#undef malloc
#undef realloc
/* The initial buffer size for the link value. A power of 2
detects arithmetic overflow earlier, but is not required. */
enum {
INITIAL_BUF_SIZE = 1024
};
#include "careadlinkat.h"
/* Call readlink to get the symbolic link value of FILENAME.
Return a pointer to that NUL-terminated string in malloc'd storage.
If readlink fails, return NULL and set errno.
If realloc fails, or if the link value is longer than SIZE_MAX :-),
If allocation fails, or if the link value is longer than SIZE_MAX :-),
return NULL and set errno to ENOMEM. */
char *
areadlink (char const *filename)
{
/* Allocate the initial buffer on the stack. This way, in the common
case of a symlink of small size, we get away with a single small malloc()
instead of a big malloc() followed by a shrinking realloc(). */
char initial_buf[INITIAL_BUF_SIZE];
char *buffer = initial_buf;
size_t buf_size = sizeof initial_buf;
while (1)
{
/* Attempt to read the link into the current buffer. */
ssize_t link_length = readlink (filename, buffer, buf_size);
/* On AIX 5L v5.3 and HP-UX 11i v2 04/09, readlink returns -1
with errno == ERANGE if the buffer is too small. */
if (link_length < 0 && errno != ERANGE)
{
if (buffer != initial_buf)
{
int saved_errno = errno;
free (buffer);
errno = saved_errno;
}
return NULL;
}
if ((size_t) link_length < buf_size)
{
buffer[link_length++] = '\0';
/* Return it in a chunk of memory as small as possible. */
if (buffer == initial_buf)
{
buffer = (char *) malloc (link_length);
if (buffer == NULL)
{
/* It's easier to set errno to ENOMEM than to rely on the
'malloc-posix' gnulib module. */
errno = ENOMEM;
return NULL;
}
memcpy (buffer, initial_buf, link_length);
}
else
{
/* Shrink buffer before returning it. */
if ((size_t) link_length < buf_size)
{
char *smaller_buffer = (char *) realloc (buffer, link_length);
if (smaller_buffer != NULL)
buffer = smaller_buffer;
}
}
return buffer;
}
if (buffer != initial_buf)
free (buffer);
buf_size *= 2;
if (SSIZE_MAX < buf_size || (SIZE_MAX / 2 < SSIZE_MAX && buf_size == 0))
{
errno = ENOMEM;
return NULL;
}
buffer = (char *) malloc (buf_size);
if (buffer == NULL)
{
/* It's easier to set errno to ENOMEM than to rely on the
'malloc-posix' gnulib module. */
errno = ENOMEM;
return NULL;
}
}
return careadlinkat (AT_FDCWD, filename, NULL, 0, NULL, careadlinkatcwd);
}
+3 -83
View File
@@ -25,101 +25,21 @@
/* Specification. */
#include "areadlink.h"
#include <errno.h>
#include <limits.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#ifndef SSIZE_MAX
# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
#endif
#include "careadlinkat.h"
#if HAVE_READLINKAT
/* The initial buffer size for the link value. A power of 2
detects arithmetic overflow earlier, but is not required. */
enum {
INITIAL_BUF_SIZE = 1024
};
/* Call readlinkat to get the symbolic link value of FILENAME relative to FD.
Return a pointer to that NUL-terminated string in malloc'd storage.
If readlinkat fails, return NULL and set errno (although failure to
change directory will issue a diagnostic and exit).
If realloc fails, or if the link value is longer than SIZE_MAX :-),
If allocation fails, or if the link value is longer than SIZE_MAX :-),
return NULL and set errno to ENOMEM. */
char *
areadlinkat (int fd, char const *filename)
{
/* Allocate the initial buffer on the stack. This way, in the common
case of a symlink of small size, we get away with a single small malloc()
instead of a big malloc() followed by a shrinking realloc(). */
char initial_buf[INITIAL_BUF_SIZE];
char *buffer = initial_buf;
size_t buf_size = sizeof initial_buf;
while (1)
{
/* Attempt to read the link into the current buffer. */
ssize_t link_length = readlinkat (fd, filename, buffer, buf_size);
/* On AIX 5L v5.3 and HP-UX 11i v2 04/09, readlink returns -1
with errno == ERANGE if the buffer is too small. */
if (link_length < 0 && errno != ERANGE)
{
if (buffer != initial_buf)
{
int saved_errno = errno;
free (buffer);
errno = saved_errno;
}
return NULL;
}
if ((size_t) link_length < buf_size)
{
buffer[link_length++] = '\0';
/* Return it in a chunk of memory as small as possible. */
if (buffer == initial_buf)
{
buffer = (char *) malloc (link_length);
if (buffer == NULL)
/* errno is ENOMEM. */
return NULL;
memcpy (buffer, initial_buf, link_length);
}
else
{
/* Shrink buffer before returning it. */
if ((size_t) link_length < buf_size)
{
char *smaller_buffer = (char *) realloc (buffer, link_length);
if (smaller_buffer != NULL)
buffer = smaller_buffer;
}
}
return buffer;
}
if (buffer != initial_buf)
free (buffer);
buf_size *= 2;
if (SSIZE_MAX < buf_size || (SIZE_MAX / 2 < SSIZE_MAX && buf_size == 0))
{
errno = ENOMEM;
return NULL;
}
buffer = (char *) malloc (buf_size);
if (buffer == NULL)
/* errno is ENOMEM. */
return NULL;
}
return careadlinkat (fd, filename, NULL, 0, NULL, readlinkat);
}
#else /* !HAVE_READLINKAT */
+28
View File
@@ -0,0 +1,28 @@
/* Substitute for and wrapper around <assert.h>
Copyright (C) 2011 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* Do not guard the include, since <assert.h> is supposed to define
the assert macro each time it is included. */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
@PRAGMA_COLUMNS@
#@INCLUDE_NEXT@ @NEXT_ASSERT_H@
/* The definition of static_assert is copied here. */
+1 -2
View File
@@ -16,6 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _LIBC
# define _GL_USE_STDLIB_ALLOC 1
# include <config.h>
#endif
@@ -68,8 +69,6 @@
# endif
# define __readlink readlink
# define __set_errno(e) errno = (e)
/* Use the system functions, not the gnulib overrides in this file. */
# undef malloc
# ifndef MAXSYMLINKS
# ifdef SYMLOOP_MAX
# define MAXSYMLINKS SYMLOOP_MAX
+171
View File
@@ -0,0 +1,171 @@
/* Read symbolic links into a buffer without size limitation, relative to fd.
Copyright (C) 2001, 2003-2004, 2007, 2009-2011 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */
#include <config.h>
#include "careadlinkat.h"
#include <errno.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
/* Define this independently so that stdint.h is not a prerequisite. */
#ifndef SIZE_MAX
# define SIZE_MAX ((size_t) -1)
#endif
#ifndef SSIZE_MAX
# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
#endif
#include "allocator.h"
#if ! HAVE_READLINKAT
/* Get the symbolic link value of FILENAME and put it into BUFFER, with
size BUFFER_SIZE. This function acts like readlink but has
readlinkat's signature. */
ssize_t
careadlinkatcwd (int fd, char const *filename, char *buffer,
size_t buffer_size)
{
/* FD must be AT_FDCWD here, otherwise the caller is using this
function in contexts for which it was not meant for. */
if (fd != AT_FDCWD)
abort ();
return readlink (filename, buffer, buffer_size);
}
#endif
/* Assuming the current directory is FD, get the symbolic link value
of FILENAME as a null-terminated string and put it into a buffer.
If FD is AT_FDCWD, FILENAME is interpreted relative to the current
working directory, as in openat.
If the link is small enough to fit into BUFFER put it there.
BUFFER's size is BUFFER_SIZE, and BUFFER can be null
if BUFFER_SIZE is zero.
If the link is not small, put it into a dynamically allocated
buffer managed by ALLOC. It is the caller's responsibility to free
the returned value if it is nonnull and is not BUFFER. A null
ALLOC stands for the standard allocator.
The PREADLINKAT function specifies how to read links. It operates
like POSIX readlinkat()
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>
but can assume that its first argument is the same as FD.
If successful, return the buffer address; otherwise return NULL and
set errno. */
char *
careadlinkat (int fd, char const *filename,
char *buffer, size_t buffer_size,
struct allocator const *alloc,
ssize_t (*preadlinkat) (int, char const *, char *, size_t))
{
char *buf;
size_t buf_size;
size_t buf_size_max =
SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX;
char stack_buf[1024];
if (! alloc)
alloc = &stdlib_allocator;
if (! buffer_size)
{
/* Allocate the initial buffer on the stack. This way, in the
common case of a symlink of small size, we get away with a
single small malloc() instead of a big malloc() followed by a
shrinking realloc(). */
buffer = stack_buf;
buffer_size = sizeof stack_buf;
}
buf = buffer;
buf_size = buffer_size;
do
{
/* Attempt to read the link into the current buffer. */
ssize_t link_length = preadlinkat (fd, filename, buf, buf_size);
size_t link_size;
if (link_length < 0)
{
/* On AIX 5L v5.3 and HP-UX 11i v2 04/09, readlink returns -1
with errno == ERANGE if the buffer is too small. */
int readlinkat_errno = errno;
if (readlinkat_errno != ERANGE)
{
if (buf != buffer)
{
alloc->free (buf);
errno = readlinkat_errno;
}
return NULL;
}
}
link_size = link_length;
if (link_size < buf_size)
{
buf[link_size++] = '\0';
if (buf == stack_buf)
{
char *b = (char *) alloc->allocate (link_size);
if (! b)
break;
memcpy (b, buf, link_size);
buf = b;
}
else if (link_size < buf_size && buf != buffer && alloc->reallocate)
{
/* Shrink BUF before returning it. */
char *b = (char *) alloc->reallocate (buf, link_size);
if (b)
buf = b;
}
return buf;
}
if (buf != buffer)
alloc->free (buf);
if (buf_size <= buf_size_max / 2)
buf_size *= 2;
else if (buf_size < buf_size_max)
buf_size = buf_size_max;
else
break;
buf = (char *) alloc->allocate (buf_size);
}
while (buf);
if (alloc->die)
alloc->die ();
errno = ENOMEM;
return NULL;
}
+73
View File
@@ -0,0 +1,73 @@
/* Read symbolic links into a buffer without size limitation, relative to fd.
Copyright (C) 2011 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */
#ifndef _GL_CAREADLINKAT_H
#define _GL_CAREADLINKAT_H
#include <fcntl.h>
#include <unistd.h>
struct allocator;
/* Assuming the current directory is FD, get the symbolic link value
of FILENAME as a null-terminated string and put it into a buffer.
If FD is AT_FDCWD, FILENAME is interpreted relative to the current
working directory, as in openat.
If the link is small enough to fit into BUFFER put it there.
BUFFER's size is BUFFER_SIZE, and BUFFER can be null
if BUFFER_SIZE is zero.
If the link is not small, put it into a dynamically allocated
buffer managed by ALLOC. It is the caller's responsibility to free
the returned value if it is nonnull and is not BUFFER.
The PREADLINKAT function specifies how to read links. It operates
like POSIX readlinkat()
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>
but can assume that its first argument is the same as FD.
If successful, return the buffer address; otherwise return NULL and
set errno. */
char *careadlinkat (int fd, char const *filename,
char *buffer, size_t buffer_size,
struct allocator const *alloc,
ssize_t (*preadlinkat) (int, char const *,
char *, size_t));
/* Suitable values for careadlinkat's FD and PREADLINKAT arguments,
when doing a plain readlink:
Pass FD = AT_FDCWD and PREADLINKAT = careadlinkatcwd. */
#if HAVE_READLINKAT
/* AT_FDCWD is declared in <fcntl.h>, readlinkat in <unistd.h>. */
# define careadlinkatcwd readlinkat
#else
/* Define AT_FDCWD independently, so that the careadlinkat module does
not depend on the fcntl-h module. The value does not matter, since
careadlinkatcwd ignores it, but we might as well use the same value
as fcntl-h. */
# ifndef AT_FDCWD
# define AT_FDCWD (-3041965)
# endif
ssize_t careadlinkatcwd (int fd, char const *filename,
char *buffer, size_t buffer_size);
#endif
#endif /* _GL_CAREADLINKAT_H */
+6 -2
View File
@@ -1,5 +1,5 @@
/* Temporary directories and temporary files with automatic cleanup.
Copyright (C) 2006, 2009-2011 Free Software Foundation, Inc.
Copyright (C) 2006, 2011 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2006.
This program is free software: you can redistribute it and/or modify
@@ -39,7 +39,11 @@ extern "C" {
This module provides support for temporary directories and temporary files
inside these temporary directories. Temporary files without temporary
directories are not supported here. */
directories are not supported here. The temporary directories and files
are automatically cleaned up (at the latest) when the program exits or
dies from a fatal signal such as SIGINT, SIGTERM, SIGHUP, but not if it
dies from a fatal signal such as SIGQUIT, SIGKILL, or SIGABRT, SIGSEGV,
SIGBUS, SIGILL, SIGFPE. */
struct temp_dir
{
-72
View File
@@ -1,72 +0,0 @@
/* Hook for making the close() function extensible.
Copyright (C) 2009-2011 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef CLOSE_HOOK_H
#define CLOSE_HOOK_H
#ifdef __cplusplus
extern "C" {
#endif
/* Currently, this entire code is only needed for the handling of sockets
on native Windows platforms. */
#if WINDOWS_SOCKETS
/* An element of the list of close hooks.
The fields of this structure are considered private. */
struct close_hook
{
/* Doubly linked list. */
struct close_hook *private_next;
struct close_hook *private_prev;
/* Function that treats the types of FD that it knows about and calls
execute_close_hooks (FD, REMAINING_LIST) as a fallback. */
int (*private_fn) (int fd, const struct close_hook *remaining_list);
};
/* This type of function closes FD, applying special knowledge for the FD
types it knows about, and calls execute_close_hooks (FD, REMAINING_LIST)
for the other FD types. */
typedef int (*close_hook_fn) (int fd, const struct close_hook *remaining_list);
/* Execute the close hooks in REMAINING_LIST.
Return 0 or -1, like close() would do. */
extern int execute_close_hooks (int fd, const struct close_hook *remaining_list);
/* Execute all close hooks.
Return 0 or -1, like close() would do. */
extern int execute_all_close_hooks (int fd);
/* Add a function to the list of close hooks.
The LINK variable points to a piece of memory which is guaranteed to be
accessible until the corresponding call to unregister_close_hook. */
extern void register_close_hook (close_hook_fn hook, struct close_hook *link);
/* Removes a function from the list of close hooks. */
extern void unregister_close_hook (struct close_hook *link);
#endif
#ifdef __cplusplus
}
#endif
#endif /* CLOSE_HOOK_H */
+2 -2
View File
@@ -19,7 +19,7 @@
/* Specification. */
#include <unistd.h>
#include "close-hook.h"
#include "fd-hook.h"
/* Override close() to call into other gnulib modules. */
@@ -28,7 +28,7 @@ rpl_close (int fd)
#undef close
{
#if WINDOWS_SOCKETS
int retval = execute_all_close_hooks (fd);
int retval = execute_all_close_hooks (close, fd);
#else
int retval = close (fd);
#endif
+1 -1
View File
@@ -38,7 +38,7 @@
count += count_one_bits_32 (x >> 31 >> 1); \
return count;
/* Compute and return the the number of 1-bits set in the least
/* Compute and return the number of 1-bits set in the least
significant 32 bits of X. */
static inline int
count_one_bits_32 (unsigned int x)
-14
View File
@@ -26,20 +26,6 @@
#include "binary-io.h"
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
/* Native Woe32 API. */
# include <string.h>
/* Get declarations of the Win32 API functions. */
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
/* Upper bound on getdtablesize(). See lib/getdtablesize.c. */
# define OPEN_MAX_MAX 0x10000
#endif
int
dup3 (int oldfd, int newfd, int flags)
{
+19 -35
View File
@@ -29,19 +29,13 @@
#include <sys/types.h>
#include <sys/stat.h>
#include "dosname.h"
#include "filenamecat.h"
#ifndef REPLACE_OPEN_DIRECTORY
# define REPLACE_OPEN_DIRECTORY 0
#endif
#ifndef HAVE_CANONICALIZE_FILE_NAME
# if GNULIB_CANONICALIZE || GNULIB_CANONICALIZE_LGPL
# define HAVE_CANONICALIZE_FILE_NAME 1
# else
# define HAVE_CANONICALIZE_FILE_NAME 0
# define canonicalize_file_name(name) NULL
# endif
#endif
/* This replacement assumes that a directory is not renamed while opened
through a file descriptor.
@@ -90,36 +84,26 @@ ensure_dirs_slot (size_t fd)
return true;
}
/* Return the canonical name of DIR in malloc'd storage. */
/* Return an absolute name of DIR in malloc'd storage. */
static char *
get_name (char const *dir)
{
char *cwd;
char *result;
if (REPLACE_OPEN_DIRECTORY || !HAVE_CANONICALIZE_FILE_NAME)
{
/* The function canonicalize_file_name has not yet been ported
to mingw, with all its drive letter and backslash quirks.
Fortunately, getcwd is reliable in this case, but we ensure
we can get back to where we started before using it. Treat
"." as a special case, as it is frequently encountered. */
char *cwd = getcwd (NULL, 0);
int saved_errno;
if (dir[0] == '.' && dir[1] == '\0')
return cwd;
if (chdir (cwd))
return NULL;
result = chdir (dir) ? NULL : getcwd (NULL, 0);
saved_errno = errno;
if (chdir (cwd))
abort ();
free (cwd);
errno = saved_errno;
}
else
{
/* Avoid changing the directory. */
result = canonicalize_file_name (dir);
}
int saved_errno;
if (IS_ABSOLUTE_FILE_NAME (dir))
return strdup (dir);
/* We often encounter "."; treat it as a special case. */
cwd = getcwd (NULL, 0);
if (!cwd || (dir[0] == '.' && dir[1] == '\0'))
return cwd;
result = mfile_name_concat (cwd, dir, NULL);
saved_errno = errno;
free (cwd);
errno = saved_errno;
return result;
}
+15 -3
View File
@@ -22,18 +22,30 @@
#include <errno.h>
#include <unistd.h>
/* Override fclose() to call the overridden close(). */
#include "freading.h"
/* Override fclose() to call the overridden fflush() or close(). */
int
rpl_fclose (FILE *fp)
#undef fclose
{
int saved_errno = 0;
int fd;
if (fflush (fp))
/* Don't change behavior on memstreams. */
fd = fileno (fp);
if (fd < 0)
return fclose (fp);
/* We only need to flush the file if it is not reading or if it is
seekable. This only guarantees the file position of input files
if the fflush module is also in use. */
if ((!freading (fp) || lseek (fileno (fp), 0, SEEK_CUR) != -1)
&& fflush (fp))
saved_errno = errno;
if (close (fileno (fp)) < 0 && saved_errno == 0)
if (close (fd) < 0 && saved_errno == 0)
saved_errno = errno;
fclose (fp); /* will fail with errno = EBADF */
+19 -2
View File
@@ -182,8 +182,7 @@ _GL_WARN_ON_USE (openat, "openat is not portable - "
#endif
#if !defined O_CLOEXEC && defined O_NOINHERIT
/* Mingw spells it `O_NOINHERIT'. Intentionally leave it
undefined if not available. */
/* Mingw spells it `O_NOINHERIT'. */
# define O_CLOEXEC O_NOINHERIT
#endif
@@ -219,6 +218,19 @@ _GL_WARN_ON_USE (openat, "openat is not portable - "
# define O_NONBLOCK O_NDELAY
#endif
/* If the gnulib module 'nonblocking' is in use, guarantee a working non-zero
value of O_NONBLOCK. Otherwise, O_NONBLOCK is defined (above) to O_NDELAY
or to 0 as fallback. */
#if @GNULIB_NONBLOCKING@
# if O_NONBLOCK
# define GNULIB_defined_O_NONBLOCK 0
# else
# define GNULIB_defined_O_NONBLOCK 1
# undef O_NONBLOCK
# define O_NONBLOCK 0x40000000
# endif
#endif
#ifndef O_NOCTTY
# define O_NOCTTY 0
#endif
@@ -247,6 +259,11 @@ _GL_WARN_ON_USE (openat, "openat is not portable - "
# define O_TTY_INIT 0
#endif
#if O_ACCMODE != (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH)
# undef O_ACCMODE
# define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH)
#endif
/* For systems that distinguish between text and binary I/O.
O_BINARY is usually declared in fcntl.h */
#if !defined O_BINARY && defined _O_BINARY
+44 -19
View File
@@ -1,4 +1,4 @@
/* Hook for making the close() function extensible.
/* Hook for making making file descriptor functions close(), ioctl() extensible.
Copyright (C) 2009-2011 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2009.
@@ -18,13 +18,9 @@
#include <config.h>
/* Specification. */
#include "close-hook.h"
#include "fd-hook.h"
#include <stdlib.h>
#include <unistd.h>
#undef close
/* Currently, this entire code is only needed for the handling of sockets
on native Windows platforms. */
@@ -32,49 +28,77 @@
/* The first and last link in the doubly linked list.
Initially the list is empty. */
static struct close_hook anchor = { &anchor, &anchor, NULL };
static struct fd_hook anchor = { &anchor, &anchor, NULL, NULL };
int
execute_close_hooks (int fd, const struct close_hook *remaining_list)
execute_close_hooks (const struct fd_hook *remaining_list, gl_close_fn primary,
int fd)
{
if (remaining_list == &anchor)
/* End of list reached. */
return close (fd);
return primary (fd);
else
return remaining_list->private_fn (fd, remaining_list->private_next);
return remaining_list->private_close_fn (remaining_list->private_next,
primary, fd);
}
int
execute_all_close_hooks (int fd)
execute_all_close_hooks (gl_close_fn primary, int fd)
{
return execute_close_hooks (fd, anchor.private_next);
return execute_close_hooks (anchor.private_next, primary, fd);
}
int
execute_ioctl_hooks (const struct fd_hook *remaining_list, gl_ioctl_fn primary,
int fd, int request, void *arg)
{
if (remaining_list == &anchor)
/* End of list reached. */
return primary (fd, request, arg);
else
return remaining_list->private_ioctl_fn (remaining_list->private_next,
primary, fd, request, arg);
}
int
execute_all_ioctl_hooks (gl_ioctl_fn primary,
int fd, int request, void *arg)
{
return execute_ioctl_hooks (anchor.private_next, primary, fd, request, arg);
}
void
register_close_hook (close_hook_fn hook, struct close_hook *link)
register_fd_hook (close_hook_fn close_hook, ioctl_hook_fn ioctl_hook, struct fd_hook *link)
{
if (close_hook == NULL)
close_hook = execute_close_hooks;
if (ioctl_hook == NULL)
ioctl_hook = execute_ioctl_hooks;
if (link->private_next == NULL && link->private_prev == NULL)
{
/* Add the link to the doubly linked list. */
link->private_next = anchor.private_next;
link->private_prev = &anchor;
link->private_fn = hook;
link->private_close_fn = close_hook;
link->private_ioctl_fn = ioctl_hook;
anchor.private_next->private_prev = link;
anchor.private_next = link;
}
else
{
/* The link is already in use. */
if (link->private_fn != hook)
if (link->private_close_fn != close_hook
|| link->private_ioctl_fn != ioctl_hook)
abort ();
}
}
void
unregister_close_hook (struct close_hook *link)
unregister_fd_hook (struct fd_hook *link)
{
struct close_hook *next = link->private_next;
struct close_hook *prev = link->private_prev;
struct fd_hook *next = link->private_next;
struct fd_hook *prev = link->private_prev;
if (next != NULL && prev != NULL)
{
@@ -84,7 +108,8 @@ unregister_close_hook (struct close_hook *link)
/* Clear the link, to mark it unused. */
link->private_next = NULL;
link->private_prev = NULL;
link->private_fn = NULL;
link->private_close_fn = NULL;
link->private_ioctl_fn = NULL;
}
}
+119
View File
@@ -0,0 +1,119 @@
/* Hook for making making file descriptor functions close(), ioctl() extensible.
Copyright (C) 2009-2011 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef FD_HOOK_H
#define FD_HOOK_H
#ifdef __cplusplus
extern "C" {
#endif
/* Currently, this entire code is only needed for the handling of sockets
on native Windows platforms. */
#if WINDOWS_SOCKETS
/* Type of function that closes FD. */
typedef int (*gl_close_fn) (int fd);
/* Type of function that applies a control request to FD. */
typedef int (*gl_ioctl_fn) (int fd, int request, void *arg);
/* An element of the list of file descriptor hooks.
In CLOS (Common Lisp Object System) speak, it consists of an "around"
method for the close() function and an "around" method for the ioctl()
function.
The fields of this structure are considered private. */
struct fd_hook
{
/* Doubly linked list. */
struct fd_hook *private_next;
struct fd_hook *private_prev;
/* Function that treats the types of FD that it knows about and calls
execute_close_hooks (REMAINING_LIST, PRIMARY, FD) as a fallback. */
int (*private_close_fn) (const struct fd_hook *remaining_list,
gl_close_fn primary,
int fd);
/* Function that treats the types of FD that it knows about and calls
execute_ioctl_hooks (REMAINING_LIST, PRIMARY, FD, REQUEST, ARG) as a
fallback. */
int (*private_ioctl_fn) (const struct fd_hook *remaining_list,
gl_ioctl_fn primary,
int fd, int request, void *arg);
};
/* This type of function closes FD, applying special knowledge for the FD
types it knows about, and calls
execute_close_hooks (REMAINING_LIST, PRIMARY, FD)
for the other FD types.
In CLOS speak, REMAINING_LIST is the remaining list of "around" methods,
and PRIMARY is the "primary" method for close(). */
typedef int (*close_hook_fn) (const struct fd_hook *remaining_list,
gl_close_fn primary,
int fd);
/* Execute the close hooks in REMAINING_LIST, with PRIMARY as "primary" method.
Return 0 or -1, like close() would do. */
extern int execute_close_hooks (const struct fd_hook *remaining_list,
gl_close_fn primary,
int fd);
/* Execute all close hooks, with PRIMARY as "primary" method.
Return 0 or -1, like close() would do. */
extern int execute_all_close_hooks (gl_close_fn primary, int fd);
/* This type of function applies a control request to FD, applying special
knowledge for the FD types it knows about, and calls
execute_ioctl_hooks (REMAINING_LIST, PRIMARY, FD, REQUEST, ARG)
for the other FD types.
In CLOS speak, REMAINING_LIST is the remaining list of "around" methods,
and PRIMARY is the "primary" method for ioctl(). */
typedef int (*ioctl_hook_fn) (const struct fd_hook *remaining_list,
gl_ioctl_fn primary,
int fd, int request, void *arg);
/* Execute the ioctl hooks in REMAINING_LIST, with PRIMARY as "primary" method.
Return 0 or -1, like ioctl() would do. */
extern int execute_ioctl_hooks (const struct fd_hook *remaining_list,
gl_ioctl_fn primary,
int fd, int request, void *arg);
/* Execute all ioctl hooks, with PRIMARY as "primary" method.
Return 0 or -1, like ioctl() would do. */
extern int execute_all_ioctl_hooks (gl_ioctl_fn primary,
int fd, int request, void *arg);
/* Add a function pair to the list of file descriptor hooks.
CLOSE_HOOK and IOCTL_HOOK may be NULL, indicating no change.
The LINK variable points to a piece of memory which is guaranteed to be
accessible until the corresponding call to unregister_fd_hook. */
extern void register_fd_hook (close_hook_fn close_hook, ioctl_hook_fn ioctl_hook,
struct fd_hook *link);
/* Removes a hook from the list of file descriptor hooks. */
extern void unregister_fd_hook (struct fd_hook *link);
#endif
#ifdef __cplusplus
}
#endif
#endif /* FD_HOOK_H */
+19 -2
View File
@@ -32,6 +32,22 @@
# define N_(String) String
#endif
#if HAVE_DECL_GAI_STRERROR
# include <sys/socket.h>
# undef gai_strerror
# if HAVE_DECL_GAI_STRERRORA
# define gai_strerror gai_strerrorA
# endif
const char *
rpl_gai_strerror (int code)
{
return gai_strerror (code);
}
#else /* !HAVE_DECL_GAI_STRERROR */
static struct
{
int code;
@@ -71,6 +87,7 @@ gai_strerror (int code)
return _("Unknown error");
}
#ifdef _LIBC
# ifdef _LIBC
libc_hidden_def (gai_strerror)
#endif
# endif
#endif /* !HAVE_DECL_GAI_STRERROR */
+118
View File
@@ -0,0 +1,118 @@
/* Copyright (C) 2011 Free Software Foundation, Inc.
This file is part of gnulib.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification */
#include <unistd.h>
#include <errno.h>
#include <string.h>
#if GNULIB_GETCWD
/* Favor GPL getcwd.c if both getcwd and getcwd-lgpl modules are in use. */
typedef int dummy;
#else
/* Get the name of the current working directory, and put it in SIZE
bytes of BUF. Returns NULL if the directory couldn't be determined
(perhaps because the absolute name was longer than PATH_MAX, or
because of missing read/search permissions on parent directories)
or SIZE was too small. If successful, returns BUF. If BUF is
NULL, an array is allocated with `malloc'; the array is SIZE bytes
long, unless SIZE == 0, in which case it is as big as
necessary. */
# undef getcwd
char *
rpl_getcwd (char *buf, size_t size)
{
char *ptr;
char *result;
/* Handle single size operations. */
if (buf)
return getcwd (buf, size);
if (size)
{
buf = malloc (size);
if (!buf)
{
errno = ENOMEM;
return NULL;
}
result = getcwd (buf, size);
if (!result)
{
int saved_errno = errno;
free (buf);
errno = saved_errno;
}
return result;
}
/* Flexible sizing requested. Avoid over-allocation for the common
case of a name that fits within a 4k page, minus some space for
local variables, to be sure we don't skip over a guard page. */
{
char tmp[4032];
size = sizeof tmp;
ptr = getcwd (tmp, size);
if (ptr)
{
result = strdup (ptr);
if (!result)
errno = ENOMEM;
return result;
}
if (errno != ERANGE)
return NULL;
}
/* My what a large directory name we have. */
do
{
size <<= 1;
ptr = realloc (buf, size);
if (ptr == NULL)
{
free (buf);
errno = ENOMEM;
return NULL;
}
buf = ptr;
result = getcwd (buf, size);
}
while (!result && errno == ERANGE);
if (!result)
{
int saved_errno = errno;
free (buf);
errno = saved_errno;
}
else
{
/* Trim to fit, if possible. */
result = realloc (buf, strlen (buf) + 1);
if (!result)
result = buf;
}
return result;
}
#endif
+2 -1
View File
@@ -46,7 +46,8 @@ rpl_getsockopt (int fd, int level, int optname, void *optval, socklen_t *optlen)
int milliseconds_len = sizeof (int);
struct timeval tv;
size_t n;
r = getsockopt (sock, level, optname, &milliseconds, &milliseconds_len);
r = getsockopt (sock, level, optname, (char *) &milliseconds,
&milliseconds_len);
tv.tv_sec = milliseconds / 1000;
tv.tv_usec = (milliseconds - 1000 * tv.tv_sec) * 1000;
n = sizeof (struct timeval);
+1 -1
View File
@@ -27,7 +27,7 @@
#include "hash.h"
#include "bitrotate.h"
#include "xalloc.h"
#include "xalloc-oversized.h"
#include <stdint.h>
#include <stdio.h>
+2
View File
@@ -1076,6 +1076,7 @@ _GL_WARN_ON_USE (imaxdiv, "imaxdiv is unportable - "
#if @GNULIB_STRTOIMAX@
# if !@HAVE_DECL_STRTOIMAX@
# undef strtoimax
extern intmax_t strtoimax (const char *, char **, int) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
@@ -1088,6 +1089,7 @@ _GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - "
#if @GNULIB_STRTOUMAX@
# if !@HAVE_DECL_STRTOUMAX@
# undef strtoumax
extern uintmax_t strtoumax (const char *, char **, int) _GL_ARG_NONNULL ((1));
# endif
#elif defined GNULIB_POSIXCHECK
+22 -21
View File
@@ -44,35 +44,36 @@ rpl_ioctl (int fd, int request, ... /* {void *,char *} arg */)
#else /* mingw */
# define WIN32_LEAN_AND_MEAN
/* Get winsock2.h. */
# include <sys/socket.h>
# include <errno.h>
/* Get set_winsock_errno, FD_TO_SOCKET etc. */
# include "w32sock.h"
# include "fd-hook.h"
int
ioctl (int fd, int req, ...)
static int
primary_ioctl (int fd, int request, void *arg)
{
void *buf;
va_list args;
SOCKET sock;
int r;
va_start (args, req);
buf = va_arg (args, void *);
va_end (args);
/* We don't support FIONBIO on pipes here. If you want to make pipe
fds non-blocking, use the gnulib 'nonblocking' module, until
gnulib implements fcntl F_GETFL / F_SETFL with O_NONBLOCK. */
sock = FD_TO_SOCKET (fd);
r = ioctlsocket (sock, req, buf);
if (r < 0)
set_winsock_errno ();
errno = ENOSYS;
return -1;
}
return r;
int
ioctl (int fd, int request, ... /* {void *,char *} arg */)
{
void *arg;
va_list args;
va_start (args, request);
arg = va_arg (args, void *);
va_end (args);
# if WINDOWS_SOCKETS
return execute_all_ioctl_hooks (primary_ioctl, fd, request, arg);
# else
return primary_ioctl (fd, request, arg);
# endif
}
#endif
+1 -4
View File
@@ -18,6 +18,7 @@
/* written by Jim Meyering and Bruno Haible */
#define _GL_USE_STDLIB_ALLOC 1
#include <config.h>
/* Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h. */
#ifdef malloc
@@ -28,14 +29,10 @@
# define NEED_MALLOC_GNU 1
#endif
/* Specification. */
#include <stdlib.h>
#include <errno.h>
/* Call the system's malloc below. */
#undef malloc
/* Allocate an N-byte block of memory from the heap.
If N is zero, allocate a 1-byte block. */
+1 -3
View File
@@ -16,6 +16,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#define _GL_USE_STDLIB_ALLOC 1
#include <config.h>
/* Specification. */
@@ -23,9 +24,6 @@
#include "verify.h"
/* Use the system functions, not the gnulib overrides in this file. */
#undef malloc
/* The speed critical point in this file is freea() applied to an alloca()
result: it must be fast, to match the speed of alloca(). The speed of
mmalloca() and freea() in the other case are not critical, because they
+1 -1
View File
@@ -335,7 +335,7 @@ rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
{
static mbstate_t internal_state;
/* Override mbrtowc's internal state. We can not call mbsinit() on the
/* Override mbrtowc's internal state. We cannot call mbsinit() on the
hidden internal state, but we can call it on our variable. */
if (ps == NULL)
ps = &internal_state;
+1 -12
View File
@@ -31,7 +31,7 @@
#endif
#include "getugroups.h"
#include "xalloc.h"
#include "xalloc-oversized.h"
static gid_t *
realloc_groupbuf (gid_t *g, size_t num)
@@ -193,14 +193,3 @@ mgetgroups (char const *username, gid_t gid, gid_t **groups)
return ng;
}
/* Like mgetgroups, but call xalloc_die on allocation failure. */
int
xgetgroups (char const *username, gid_t gid, gid_t **groups)
{
int result = mgetgroups (username, gid, groups);
if (result == -1 && errno == ENOMEM)
xalloc_die ();
return result;
}
+2
View File
@@ -17,4 +17,6 @@
#include <sys/types.h>
int mgetgroups (const char *username, gid_t gid, gid_t **groups);
#if GNULIB_XGETGROUPS
int xgetgroups (const char *username, gid_t gid, gid_t **groups);
#endif
+5 -1
View File
@@ -38,7 +38,11 @@
/* Generate a unique temporary file name from XTEMPLATE.
The last six characters of XTEMPLATE must be "XXXXXX";
they are replaced with a string that makes the file name unique.
Then open the file and return a fd. */
Then open the file and return a fd.
If you are creating temporary files which will later be removed,
consider using the clean-temp module, which avoids several pitfalls
of using mkstemp directly. */
int
mkstemp (char *xtemplate)
{
+53 -12
View File
@@ -41,6 +41,8 @@
'struct hostent' on MinGW. */
#include <sys/socket.h>
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
/* The definition of _GL_ARG_NONNULL is copied here. */
/* The definition of _GL_WARN_ON_USE is copied here. */
@@ -52,6 +54,10 @@
# if !@HAVE_STRUCT_ADDRINFO@
# ifdef __cplusplus
extern "C" {
# endif
# if !GNULIB_defined_struct_addrinfo
/* Structure to contain information about address of a service provider. */
struct addrinfo
@@ -67,6 +73,11 @@ struct addrinfo
};
# define GNULIB_defined_struct_addrinfo 1
# endif
# ifdef __cplusplus
}
# endif
# endif
/* Possible values for `ai_flags' field in `addrinfo' structure. */
@@ -153,37 +164,67 @@ struct addrinfo
socket addresses.
For more details, see the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */
extern int getaddrinfo (const char *restrict nodename,
const char *restrict servname,
const struct addrinfo *restrict hints,
struct addrinfo **restrict res)
_GL_ARG_NONNULL ((4));
_GL_FUNCDECL_SYS (getaddrinfo, int,
(const char *restrict nodename,
const char *restrict servname,
const struct addrinfo *restrict hints,
struct addrinfo **restrict res)
_GL_ARG_NONNULL ((4)));
# endif
_GL_CXXALIAS_SYS (getaddrinfo, int,
(const char *restrict nodename,
const char *restrict servname,
const struct addrinfo *restrict hints,
struct addrinfo **restrict res));
_GL_CXXALIASWARN (getaddrinfo);
# if !@HAVE_DECL_FREEADDRINFO@
/* Free `addrinfo' structure AI including associated storage.
For more details, see the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */
extern void freeaddrinfo (struct addrinfo *ai) _GL_ARG_NONNULL ((1));
_GL_FUNCDECL_SYS (freeaddrinfo, void, (struct addrinfo *ai)
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (freeaddrinfo, void, (struct addrinfo *ai));
_GL_CXXALIASWARN (freeaddrinfo);
# if !@HAVE_DECL_GAI_STRERROR@
# if @REPLACE_GAI_STRERROR@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef gai_strerror
# define gai_strerror rpl_gai_strerror
# endif
_GL_FUNCDECL_RPL (gai_strerror, const char *, (int ecode));
_GL_CXXALIAS_RPL (gai_strerror, const char *, (int ecode));
# else
# if !@HAVE_DECL_GAI_STRERROR@
/* Convert error return from getaddrinfo() to a string.
For more details, see the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/gai_strerror.html>. */
extern const char *gai_strerror (int ecode);
_GL_FUNCDECL_SYS (gai_strerror, const char *, (int ecode));
# endif
_GL_CXXALIAS_SYS (gai_strerror, const char *, (int ecode));
# endif
_GL_CXXALIASWARN (gai_strerror);
# if !@HAVE_DECL_GETNAMEINFO@
/* Convert socket address to printable node and service names.
For more details, see the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/getnameinfo.html>. */
extern int getnameinfo (const struct sockaddr *restrict sa, socklen_t salen,
_GL_FUNCDECL_SYS (getnameinfo, int,
(const struct sockaddr *restrict sa, socklen_t salen,
char *restrict node, socklen_t nodelen,
char *restrict service, socklen_t servicelen,
int flags)
_GL_ARG_NONNULL ((1)));
# endif
/* Need to cast, because on glibc systems, the seventh parameter is
unsigned int flags. */
_GL_CXXALIAS_SYS_CAST (getnameinfo, int,
(const struct sockaddr *restrict sa, socklen_t salen,
char *restrict node, socklen_t nodelen,
char *restrict service, socklen_t servicelen,
int flags)
_GL_ARG_NONNULL ((1));
# endif
int flags));
_GL_CXXALIASWARN (getnameinfo);
/* Possible flags for getnameinfo. */
# ifndef NI_NUMERICHOST
+1 -1
View File
@@ -113,7 +113,7 @@ set_nonblocking_flag (int desc, bool value)
# include <fcntl.h>
# if !O_NONBLOCK
# if GNULIB_defined_O_NONBLOCK
# error Please port nonblocking to your platform
# endif
+9
View File
@@ -63,6 +63,15 @@ open (const char *filename, int flags, ...)
va_end (arg);
}
#if GNULIB_defined_O_NONBLOCK
/* The only known platform that lacks O_NONBLOCK is mingw, but it
also lacks named pipes and Unix sockets, which are the only two
file types that require non-blocking handling in open().
Therefore, it is safe to ignore O_NONBLOCK here. It is handy
that mingw also lacks openat(), so that is also covered here. */
flags &= ~O_NONBLOCK;
#endif
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
if (strcmp (filename, "/dev/null") == 0)
filename = "NUL";
+41 -20
View File
@@ -24,20 +24,23 @@
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
#include <sys/socket.h>
#if HAVE_SYS_UN_H
# include <sys/un.h>
#endif
#include "cloexec.h"
/* The code that uses CMSG_FIRSTHDR is enabled on
Linux, MacOS X, FreeBSD, OpenBSD, NetBSD, AIX, OSF/1, Cygwin.
The code that uses HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS is enabled on
HP-UX, IRIX, Solaris. */
/* MSG_CMSG_CLOEXEC is defined only on Linux, as of 2011. */
#ifndef MSG_CMSG_CLOEXEC
# define MSG_CMSG_CLOEXEC 0
#endif
#if HAVE_SENDMSG
/* sendfd sends the file descriptor fd along the socket
to a process calling recvfd on the other end.
@@ -46,24 +49,24 @@
int
sendfd (int sock, int fd)
{
char send = 0;
char byte = 0;
struct iovec iov;
struct msghdr msg;
#if HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY
# ifdef CMSG_FIRSTHDR
struct cmsghdr *cmsg;
char buf[CMSG_SPACE (sizeof fd)];
#endif
# endif
/* send at least one char */
memset (&msg, 0, sizeof msg);
iov.iov_base = &send;
iov.iov_base = &byte;
iov.iov_len = 1;
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
msg.msg_name = NULL;
msg.msg_namelen = 0;
#if HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY
# ifdef CMSG_FIRSTHDR
msg.msg_control = buf;
msg.msg_controllen = sizeof buf;
cmsg = CMSG_FIRSTHDR (&msg);
@@ -72,19 +75,29 @@ sendfd (int sock, int fd)
cmsg->cmsg_len = CMSG_LEN (sizeof fd);
/* Initialize the payload: */
memcpy (CMSG_DATA (cmsg), &fd, sizeof fd);
#elif HAVE_UNIXSOCKET_SCM_RIGHTS_BSD43_WAY
# elif HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
msg.msg_accrights = &fd;
msg.msg_accrightslen = sizeof fd;
#else
# else
errno = ENOSYS;
return -1;
#endif
# endif
if (sendmsg (sock, &msg, 0) != iov.iov_len)
return -1;
return 0;
}
#else
int
sendfd (int sock _GL_UNUSED, int fd _GL_UNUSED)
{
errno = ENOSYS;
return -1;
}
#endif
#if HAVE_RECVMSG
/* recvfd receives a file descriptor through the socket.
The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>).
@@ -93,15 +106,15 @@ sendfd (int sock, int fd)
int
recvfd (int sock, int flags)
{
char recv = 0;
char byte = 0;
struct iovec iov;
struct msghdr msg;
int fd = -1;
#if HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY
# ifdef CMSG_FIRSTHDR
struct cmsghdr *cmsg;
char buf[CMSG_SPACE (sizeof fd)];
int flags_recvmsg = flags & O_CLOEXEC ? MSG_CMSG_CLOEXEC : 0;
#endif
# endif
if ((flags & ~O_CLOEXEC) != 0)
{
@@ -111,14 +124,14 @@ recvfd (int sock, int flags)
/* send at least one char */
memset (&msg, 0, sizeof msg);
iov.iov_base = &recv;
iov.iov_base = &byte;
iov.iov_len = 1;
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
msg.msg_name = NULL;
msg.msg_namelen = 0;
#if HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY
# ifdef CMSG_FIRSTHDR
msg.msg_control = buf;
msg.msg_controllen = sizeof buf;
cmsg = CMSG_FIRSTHDR (&msg);
@@ -156,7 +169,7 @@ recvfd (int sock, int flags)
}
}
#elif HAVE_UNIXSOCKET_SCM_RIGHTS_BSD43_WAY
# elif HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
msg.msg_accrights = &fd;
msg.msg_accrightslen = sizeof fd;
if (recvmsg (sock, &msg, 0) < 0)
@@ -173,9 +186,17 @@ recvfd (int sock, int flags)
return -1;
}
}
#else
# else
errno = ENOSYS;
#endif
# endif
return fd;
}
#else
int
recvfd (int sock _GL_UNUSED, int flags _GL_UNUSED)
{
errno = ENOSYS;
return -1;
}
#endif
-3
View File
@@ -102,9 +102,6 @@ nonintr_select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
#endif
/* Non-blocking I/O. */
#ifndef O_NONBLOCK
# define O_NONBLOCK O_NDELAY
#endif
#if HAVE_SELECT
# define IS_EAGAIN(errcode) 0
#else
+19 -15
View File
@@ -24,6 +24,7 @@
#include <fcntl.h>
#include "binary-io.h"
#include "nonblocking.h"
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
/* Native Woe32 API. */
@@ -55,34 +56,37 @@ pipe2 (int fd[2], int flags)
}
#endif
/* Check the supported flags. */
if ((flags & ~(O_CLOEXEC | O_NONBLOCK | O_BINARY | O_TEXT)) != 0)
{
errno = EINVAL;
return -1;
}
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
/* Native Woe32 API. */
/* Check the supported flags. */
if ((flags & ~(O_CLOEXEC | O_BINARY | O_TEXT)) != 0)
if (_pipe (fd, 4096, flags & ~O_NONBLOCK) < 0)
return -1;
if (flags & O_NONBLOCK)
{
errno = EINVAL;
return -1;
if (set_nonblocking_flag (fd[0], true) != 0
|| set_nonblocking_flag (fd[1], true) != 0)
goto fail;
}
return _pipe (fd, 4096, flags);
return 0;
#else
/* Unix API. */
/* Check the supported flags. */
if ((flags & ~(O_CLOEXEC | O_NONBLOCK | O_TEXT | O_BINARY)) != 0)
{
errno = EINVAL;
return -1;
}
if (pipe (fd) < 0)
return -1;
/* POSIX <http://www.opengroup.org/onlinepubs/9699919799/functions/pipe.html>
says that initially, the O_NONBLOCK and FD_CLOEXEC flags are cleared on
both fd[0] amd fd[1]. */
both fd[0] and fd[1]. */
if (flags & O_NONBLOCK)
{
@@ -121,6 +125,8 @@ pipe2 (int fd[2], int flags)
return 0;
#endif
fail:
{
int saved_errno = errno;
@@ -129,6 +135,4 @@ pipe2 (int fd[2], int flags)
errno = saved_errno;
return -1;
}
#endif
}
+1 -1
View File
@@ -16,6 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#define _GL_USE_STDLIB_ALLOC 1
#include <config.h>
/* Specification. */
@@ -94,7 +95,6 @@ extern char * canonicalize_file_name (const char *name);
#undef close
/* Use the system functions, not the gnulib overrides in this file. */
#undef malloc
#undef sprintf
#undef set_program_name
+3 -3
View File
@@ -168,10 +168,10 @@ set_custom_quoting (struct quoting_options *o,
static struct quoting_options
quoting_options_from_style (enum quoting_style style)
{
struct quoting_options o;
struct quoting_options o = { 0 };
if (style == custom_quoting_style)
abort ();
o.style = style;
o.flags = 0;
memset (o.quote_these_too, 0, sizeof o.quote_these_too);
return o;
}
+59
View File
@@ -0,0 +1,59 @@
/* POSIX compatible read() function.
Copyright (C) 2008-2011 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2011.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include <unistd.h>
/* Replace this function only if module 'nonblocking' is requested. */
#if GNULIB_NONBLOCKING
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
# include <errno.h>
# include <io.h>
# define WIN32_LEAN_AND_MEAN /* avoid including junk */
# include <windows.h>
ssize_t
rpl_read (int fd, void *buf, size_t count)
#undef read
{
ssize_t ret = read (fd, buf, count);
if (ret < 0
&& GetLastError () == ERROR_NO_DATA)
{
HANDLE h = (HANDLE) _get_osfhandle (fd);
if (GetFileType (h) == FILE_TYPE_PIPE)
{
/* h is a pipe or socket. */
DWORD state;
if (GetNamedPipeHandleState (h, &state, NULL, NULL, NULL, NULL, 0)
&& (state & PIPE_NOWAIT) != 0)
/* h is a pipe in non-blocking mode.
Change errno from EINVAL to EAGAIN. */
errno = EAGAIN;
}
}
return ret;
}
# endif
#endif
+1 -13
View File
@@ -18,6 +18,7 @@
/* written by Jim Meyering and Bruno Haible */
#define _GL_USE_STDLIB_ALLOC 1
#include <config.h>
/* Only the AC_FUNC_REALLOC macro defines 'realloc' already in config.h. */
@@ -34,23 +35,10 @@
# define SYSTEM_MALLOC_GLIBC_COMPATIBLE 1
#endif
/* Below we want to call the system's malloc and realloc.
Undefine the symbols here so that including <stdlib.h> provides a
declaration of malloc(), not of rpl_malloc(), and likewise for realloc. */
#undef malloc
#undef realloc
/* Specification. */
#include <stdlib.h>
#include <errno.h>
/* Below we want to call the system's malloc and realloc.
Undefine the symbols, if they were defined by gnulib's <stdlib.h>
replacement. */
#undef malloc
#undef realloc
/* Change the size of an allocated block of memory P to N bytes,
with error checking. If N is zero, change it to 1. If P is NULL,
use malloc. */
+1 -3
View File
@@ -25,6 +25,7 @@
# define _GNU_SOURCE 1
#endif
#define _GL_USE_STDLIB_ALLOC 1
#include <config.h>
/* Specification. */
@@ -86,9 +87,6 @@
# define FILE_SYSTEM_PREFIX_LEN(P) 0
#endif
/* Use the system functions, not the gnulib overrides in this file. */
#undef malloc
/* Original installation prefix. */
static char *orig_prefix;
static size_t orig_prefix_len;

Some files were not shown because too many files have changed in this diff Show More