aboutsummaryrefslogtreecommitdiff
path: root/stdio-common
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-12-14 15:06:39 +0000
committerUlrich Drepper <drepper@redhat.com>2005-12-14 15:06:39 +0000
commit9d13fb2413921c713f83efe331e8e4d219c62c6b (patch)
tree2d44d7ac45ab2d147eb8361bbff880c365aa8ad5 /stdio-common
parentb6ab06cef4670e02756bcdd4d2c33a49369a4346 (diff)
downloadglibc-9d13fb2413921c713f83efe331e8e4d219c62c6b.zip
glibc-9d13fb2413921c713f83efe331e8e4d219c62c6b.tar.gz
glibc-9d13fb2413921c713f83efe331e8e4d219c62c6b.tar.bz2
Moved to csu/errno-loc.c.
Diffstat (limited to 'stdio-common')
-rw-r--r--stdio-common/errlist.c37
-rw-r--r--stdio-common/flockfile.c30
-rw-r--r--stdio-common/ftrylockfile.c31
-rw-r--r--stdio-common/funlockfile.c30
-rw-r--r--stdio-common/printf_fphex.c490
-rw-r--r--stdio-common/remove.c33
-rw-r--r--stdio-common/rename.c41
-rw-r--r--stdio-common/renameat.c50
-rw-r--r--stdio-common/siglist.c38
-rw-r--r--stdio-common/tempname.c59
-rw-r--r--stdio-common/tmpfile.c66
-rw-r--r--stdio-common/tmpfile64.c3
12 files changed, 908 insertions, 0 deletions
diff --git a/stdio-common/errlist.c b/stdio-common/errlist.c
new file mode 100644
index 0000000..6a834fc
--- /dev/null
+++ b/stdio-common/errlist.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991, 1994, 1997, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stddef.h>
+
+
+const char *const _sys_errlist[] =
+ {
+ "Error 0", /* 0 */
+ "Argument out of function's domain", /* 1 = EDOM */
+ "Result out of range", /* 2 = ERANGE */
+ "Operation not implemented", /* 3 = ENOSYS */
+ "Invalid argument", /* 4 = EINVAL */
+ "Illegal seek", /* 5 = ESPIPE */
+ "Bad file descriptor", /* 6 = EBADF */
+ "Cannot allocate memory", /* 7 = ENOMEM */
+ "Permission denied", /* 8 = EACCES */
+ "Too many open files in system", /* 9 = ENFILE */
+ "Too many open files", /* 10 = EMFILE */
+ };
+
+const int _sys_nerr = sizeof (_sys_errlist) / sizeof (_sys_errlist[0]);
diff --git a/stdio-common/flockfile.c b/stdio-common/flockfile.c
new file mode 100644
index 0000000..571930e
--- /dev/null
+++ b/stdio-common/flockfile.c
@@ -0,0 +1,30 @@
+/* Lock I/O stream. Singlethreaded version.
+ Copyright (C) 1996, 1997, 2000, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdio.h>
+
+#undef _IO_flockfile
+
+void
+__flockfile (FILE *stream)
+{
+ /* Do nothing. Using this version does not do any locking. */
+}
+weak_alias (__flockfile, flockfile);
+weak_alias (__flockfile, _IO_flockfile)
diff --git a/stdio-common/ftrylockfile.c b/stdio-common/ftrylockfile.c
new file mode 100644
index 0000000..7bd3e9b
--- /dev/null
+++ b/stdio-common/ftrylockfile.c
@@ -0,0 +1,31 @@
+/* Try locking I/O stream. Singlethreaded version.
+ Copyright (C) 1996, 1997, 2000, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdio.h>
+
+#undef _IO_ftrylockfile
+
+int
+__ftrylockfile (FILE *stream)
+{
+ /* Do nothing. Using this version does not do any locking. */
+ return 1;
+}
+weak_alias (__ftrylockfile, ftrylockfile);
+weak_alias (__ftrylockfile, _IO_ftrylockfile)
diff --git a/stdio-common/funlockfile.c b/stdio-common/funlockfile.c
new file mode 100644
index 0000000..902d294
--- /dev/null
+++ b/stdio-common/funlockfile.c
@@ -0,0 +1,30 @@
+/* Unlock I/O stream. Singlethreaded version.
+ Copyright (C) 1996, 1997, 2000, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdio.h>
+
+#undef _IO_funlockfile
+
+void
+__funlockfile (FILE *stream)
+{
+ /* Do nothing. Using this version does not do any locking. */
+}
+weak_alias (__funlockfile, _IO_funlockfile)
+weak_alias (__funlockfile, funlockfile);
diff --git a/stdio-common/printf_fphex.c b/stdio-common/printf_fphex.c
new file mode 100644
index 0000000..fd790d5
--- /dev/null
+++ b/stdio-common/printf_fphex.c
@@ -0,0 +1,490 @@
+/* Print floating point number in hexadecimal notation according to ISO C99.
+ Copyright (C) 1997-2002,2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library 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 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <ctype.h>
+#include <ieee754.h>
+#include <math.h>
+#include <printf.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <wchar.h>
+#include "_itoa.h"
+#include "_itowa.h"
+#include <locale/localeinfo.h>
+
+/* #define NDEBUG 1*/ /* Undefine this for debugging assertions. */
+#include <assert.h>
+
+/* This defines make it possible to use the same code for GNU C library and
+ the GNU I/O library. */
+#ifdef USE_IN_LIBIO
+# include <libioP.h>
+# define PUT(f, s, n) _IO_sputn (f, s, n)
+# define PAD(f, c, n) (wide ? _IO_wpadn (f, c, n) : INTUSE(_IO_padn) (f, c, n))
+/* We use this file GNU C library and GNU I/O library. So make
+ names equal. */
+# undef putc
+# define putc(c, f) (wide \
+ ? (int)_IO_putwc_unlocked (c, f) : _IO_putc_unlocked (c, f))
+# define size_t _IO_size_t
+# define FILE _IO_FILE
+#else /* ! USE_IN_LIBIO */
+# define PUT(f, s, n) fwrite (s, 1, n, f)
+# define PAD(f, c, n) __printf_pad (f, c, n)
+ssize_t __printf_pad (FILE *, char pad, int n) __THROW; /* In vfprintf.c. */
+#endif /* USE_IN_LIBIO */
+
+/* Macros for doing the actual output. */
+
+#define outchar(ch) \
+ do \
+ { \
+ register const int outc = (ch); \
+ if (putc (outc, fp) == EOF) \
+ return -1; \
+ ++done; \
+ } while (0)
+
+#define PRINT(ptr, wptr, len) \
+ do \
+ { \
+ register size_t outlen = (len); \
+ if (wide) \
+ while (outlen-- > 0) \
+ outchar (*wptr++); \
+ else \
+ while (outlen-- > 0) \
+ outchar (*ptr++); \
+ } while (0)
+
+#define PADN(ch, len) \
+ do \
+ { \
+ if (PAD (fp, ch, len) != len) \
+ return -1; \
+ done += len; \
+ } \
+ while (0)
+
+#ifndef MIN
+# define MIN(a,b) ((a)<(b)?(a):(b))
+#endif
+
+
+int
+__printf_fphex (FILE *fp,
+ const struct printf_info *info,
+ const void *const *args)
+{
+ /* The floating-point value to output. */
+ union
+ {
+ union ieee754_double dbl;
+ union ieee854_long_double ldbl;
+ }
+ fpnum;
+
+ /* Locale-dependent representation of decimal point. */
+ const char *decimal;
+ wchar_t decimalwc;
+
+ /* "NaN" or "Inf" for the special cases. */
+ const char *special = NULL;
+ const wchar_t *wspecial = NULL;
+
+ /* Buffer for the generated number string for the mantissa. The
+ maximal size for the mantissa is 128 bits. */
+ char numbuf[32];
+ char *numstr;
+ char *numend;
+ wchar_t wnumbuf[32];
+ wchar_t *wnumstr;
+ wchar_t *wnumend;
+ int negative;
+
+ /* The maximal exponent of two in decimal notation has 5 digits. */
+ char expbuf[5];
+ char *expstr;
+ wchar_t wexpbuf[5];
+ wchar_t *wexpstr;
+ int expnegative;
+ int exponent;
+
+ /* Non-zero is mantissa is zero. */
+ int zero_mantissa;
+
+ /* The leading digit before the decimal point. */
+ char leading;
+
+ /* Precision. */
+ int precision = info->prec;
+
+ /* Width. */
+ int width = info->width;
+
+ /* Number of characters written. */
+ int done = 0;
+
+ /* Nonzero if this is output on a wide character stream. */
+ int wide = info->wide;
+
+
+ /* Figure out the decimal point character. */
+ if (info->extra == 0)
+ {
+ decimal = _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
+ decimalwc = _NL_CURRENT_WORD (LC_NUMERIC, _NL_NUMERIC_DECIMAL_POINT_WC);
+ }
+ else
+ {
+ decimal = _NL_CURRENT (LC_MONETARY, MON_DECIMAL_POINT);
+ decimalwc = _NL_CURRENT_WORD (LC_MONETARY,
+ _NL_MONETARY_DECIMAL_POINT_WC);
+ }
+ /* The decimal point character must never be zero. */
+ assert (*decimal != '\0' && decimalwc != L'\0');
+
+
+ /* Fetch the argument value. */
+#ifndef __NO_LONG_DOUBLE_MATH
+ if (info->is_long_double && sizeof (long double) > sizeof (double))
+ {
+ fpnum.ldbl.d = *(const long double *) args[0];
+
+ /* Check for special values: not a number or infinity. */
+ if (__isnanl (fpnum.ldbl.d))
+ {
+ if (isupper (info->spec))
+ {
+ special = "NAN";
+ wspecial = L"NAN";
+ }
+ else
+ {
+ special = "nan";
+ wspecial = L"nan";
+ }
+ negative = 0;
+ }
+ else
+ {
+ if (__isinfl (fpnum.ldbl.d))
+ {
+ if (isupper (info->spec))
+ {
+ special = "INF";
+ wspecial = L"INF";
+ }
+ else
+ {
+ special = "inf";
+ wspecial = L"inf";
+ }
+ }
+
+ negative = signbit (fpnum.ldbl.d);
+ }
+ }
+ else
+#endif /* no long double */
+ {
+ fpnum.dbl.d = *(const double *) args[0];
+
+ /* Check for special values: not a number or infinity. */
+ if (__isnan (fpnum.dbl.d))
+ {
+ if (isupper (info->spec))
+ {
+ special = "NAN";
+ wspecial = L"NAN";
+ }
+ else
+ {
+ special = "nan";
+ wspecial = L"nan";
+ }
+ negative = 0;
+ }
+ else
+ {
+ if (__isinf (fpnum.dbl.d))
+ {
+ if (isupper (info->spec))
+ {
+ special = "INF";
+ wspecial = L"INF";
+ }
+ else
+ {
+ special = "inf";
+ wspecial = L"inf";
+ }
+ }
+
+ negative = signbit (fpnum.dbl.d);
+ }
+ }
+
+ if (special)
+ {
+ int width = info->width;
+
+ if (negative || info->showsign || info->space)
+ --width;
+ width -= 3;
+
+ if (!info->left && width > 0)
+ PADN (' ', width);
+
+ if (negative)
+ outchar ('-');
+ else if (info->showsign)
+ outchar ('+');
+ else if (info->space)
+ outchar (' ');
+
+ PRINT (special, wspecial, 3);
+
+ if (info->left && width > 0)
+ PADN (' ', width);
+
+ return done;
+ }
+
+ if (info->is_long_double == 0 || sizeof (double) == sizeof (long double))
+ {
+ /* We have 52 bits of mantissa plus one implicit digit. Since
+ 52 bits are representable without rest using hexadecimal
+ digits we use only the implicit digits for the number before
+ the decimal point. */
+ unsigned long long int num;
+
+ num = (((unsigned long long int) fpnum.dbl.ieee.mantissa0) << 32
+ | fpnum.dbl.ieee.mantissa1);
+
+ zero_mantissa = num == 0;
+
+ if (sizeof (unsigned long int) > 6)
+ {
+ wnumstr = _itowa_word (num, wnumbuf + (sizeof wnumbuf) / sizeof (wchar_t), 16,
+ info->spec == 'A');
+ numstr = _itoa_word (num, numbuf + sizeof numbuf, 16,
+ info->spec == 'A');
+ }
+ else
+ {
+ wnumstr = _itowa (num, wnumbuf + sizeof wnumbuf / sizeof (wchar_t), 16,
+ info->spec == 'A');
+ numstr = _itoa (num, numbuf + sizeof numbuf, 16,
+ info->spec == 'A');
+ }
+
+ /* Fill with zeroes. */
+ while (wnumstr > wnumbuf + (sizeof wnumbuf - 52) / sizeof (wchar_t))
+ {
+ *--wnumstr = L'0';
+ *--numstr = '0';
+ }
+
+ leading = fpnum.dbl.ieee.exponent == 0 ? '0' : '1';
+
+ exponent = fpnum.dbl.ieee.exponent;
+
+ if (exponent == 0)
+ {
+ if (zero_mantissa)
+ expnegative = 0;
+ else
+ {
+ /* This is a denormalized number. */
+ expnegative = 1;
+ exponent = IEEE754_DOUBLE_BIAS - 1;
+ }
+ }
+ else if (exponent >= IEEE754_DOUBLE_BIAS)
+ {
+ expnegative = 0;
+ exponent -= IEEE754_DOUBLE_BIAS;
+ }
+ else
+ {
+ expnegative = 1;
+ exponent = -(exponent - IEEE754_DOUBLE_BIAS);
+ }
+ }
+#ifdef PRINT_FPHEX_LONG_DOUBLE
+ else
+ PRINT_FPHEX_LONG_DOUBLE;
+#endif
+
+ /* Look for trailing zeroes. */
+ if (! zero_mantissa)
+ {
+ wnumend = &wnumbuf[sizeof wnumbuf / sizeof wnumbuf[0]];
+ numend = &numbuf[sizeof numbuf / sizeof numbuf[0]];
+ while (wnumend[-1] == L'0')
+ {
+ --wnumend;
+ --numend;
+ }
+
+ if (precision == -1)
+ precision = numend - numstr;
+ else if (precision < numend - numstr
+ && (numstr[precision] > '8'
+ || (('A' < '0' || 'a' < '0')
+ && numstr[precision] < '0')
+ || (numstr[precision] == '8'
+ && (precision + 1 < numend - numstr
+ /* Round to even. */
+ || (precision > 0
+ && ((numstr[precision - 1] & 1)
+ ^ (isdigit (numstr[precision - 1]) == 0)))
+ || (precision == 0
+ && ((leading & 1)
+ ^ (isdigit (leading) == 0)))))))
+ {
+ /* Round up. */
+ int cnt = precision;
+ while (--cnt >= 0)
+ {
+ char ch = numstr[cnt];
+ /* We assume that the digits and the letters are ordered
+ like in ASCII. This is true for the rest of GNU, too. */
+ if (ch == '9')
+ {
+ wnumstr[cnt] = (wchar_t) info->spec;
+ numstr[cnt] = info->spec; /* This is tricky,
+ think about it! */
+ break;
+ }
+ else if (tolower (ch) < 'f')
+ {
+ ++numstr[cnt];
+ ++wnumstr[cnt];
+ break;
+ }
+ else
+ {
+ numstr[cnt] = '0';
+ wnumstr[cnt] = L'0';
+ }
+ }
+ if (cnt < 0)
+ {
+ /* The mantissa so far was fff...f Now increment the
+ leading digit. Here it is again possible that we
+ get an overflow. */
+ if (leading == '9')
+ leading = info->spec;
+ else if (tolower (leading) < 'f')
+ ++leading;
+ else
+ {
+ leading = 1;
+ if (expnegative)
+ {
+ exponent += 4;
+ if (exponent >= 0)
+ expnegative = 0;
+ }
+ else
+ exponent += 4;
+ }
+ }
+ }
+ }
+ else
+ {
+ if (precision == -1)
+ precision = 0;
+ numend = numstr;
+ wnumend = wnumstr;
+ }
+
+ /* Now we can compute the exponent string. */
+ expstr = _itoa_word (exponent, expbuf + sizeof expbuf, 10, 0);
+ wexpstr = _itowa_word (exponent,
+ wexpbuf + sizeof wexpbuf / sizeof (wchar_t), 10, 0);
+
+ /* Now we have all information to compute the size. */
+ width -= ((negative || info->showsign || info->space)
+ /* Sign. */
+ + 2 + 1 + 0 + precision + 1 + 1
+ /* 0x h . hhh P ExpoSign. */
+ + ((expbuf + sizeof expbuf) - expstr));
+ /* Exponent. */
+
+ /* Count the decimal point.
+ A special case when the mantissa or the precision is zero and the `#'
+ is not given. In this case we must not print the decimal point. */
+ if (precision > 0 || info->alt)
+ width -= wide ? 1 : strlen (decimal);
+
+ if (!info->left && info->pad != '0' && width > 0)
+ PADN (' ', width);
+
+ if (negative)
+ outchar ('-');
+ else if (info->showsign)
+ outchar ('+');
+ else if (info->space)
+ outchar (' ');
+
+ outchar ('0');
+ if ('X' - 'A' == 'x' - 'a')
+ outchar (info->spec + ('x' - 'a'));
+ else
+ outchar (info->spec == 'A' ? 'X' : 'x');
+
+ if (!info->left && info->pad == '0' && width > 0)
+ PADN ('0', width);
+
+ outchar (leading);
+
+ if (precision > 0 || info->alt)
+ {
+ const wchar_t *wtmp = &decimalwc;
+ PRINT (decimal, wtmp, wide ? 1 : strlen (decimal));
+ }
+
+ if (precision > 0)
+ {
+ ssize_t tofill = precision - (numend - numstr);
+ PRINT (numstr, wnumstr, MIN (numend - numstr, precision));
+ if (tofill > 0)
+ PADN ('0', tofill);
+ }
+
+ if ('P' - 'A' == 'p' - 'a')
+ outchar (info->spec + ('p' - 'a'));
+ else
+ outchar (info->spec == 'A' ? 'P' : 'p');
+
+ outchar (expnegative ? '-' : '+');
+
+ PRINT (expstr, wexpstr, (expbuf + sizeof expbuf) - expstr);
+
+ if (info->left && info->pad != '0' && width > 0)
+ PADN (info->pad, width);
+
+ return done;
+}
diff --git a/stdio-common/remove.c b/stdio-common/remove.c
new file mode 100644
index 0000000..5dc0e9e
--- /dev/null
+++ b/stdio-common/remove.c
@@ -0,0 +1,33 @@
+/* ANSI C `remove' function to delete a file or directory. Stub version.
+ Copyright (C) 1995,96,97,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stdio.h>
+
+int
+remove (file)
+ const char *file;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (remove)
+
+stub_warning (remove)
+#include <stub-tag.h>
diff --git a/stdio-common/rename.c b/stdio-common/rename.c
new file mode 100644
index 0000000..b7d8392
--- /dev/null
+++ b/stdio-common/rename.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdio.h>
+#include <errno.h>
+
+
+/* Rename the file OLD to NEW. */
+int
+rename (old, new)
+ const char *old;
+ const char *new;
+{
+ if (old == NULL || new == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (rename)
+#include <stub-tag.h>
diff --git a/stdio-common/renameat.c b/stdio-common/renameat.c
new file mode 100644
index 0000000..e862909
--- /dev/null
+++ b/stdio-common/renameat.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+
+
+/* Rename the file OLD relative to OLDFD to NEW relative to NEWFD. */
+int
+renameat (oldfd, old, newfd, new)
+ int oldfd;
+ const char *old;
+ int newfd;
+ const char *new;
+{
+ if ((oldfd < 0 & oldfd !_ AT_FDCWD) || (newfd < 0 && newfd != AT_FDCWD))
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+
+ if (old == NULL || new == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (renameat)
+#include <stub-tag.h>
diff --git a/stdio-common/siglist.c b/stdio-common/siglist.c
new file mode 100644
index 0000000..80847cd
--- /dev/null
+++ b/stdio-common/siglist.c
@@ -0,0 +1,38 @@
+/* Define list of all signal numbers and their names.
+ Copyright (C) 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stddef.h>
+#include <signal.h>
+#include <libintl.h>
+
+const char *const _sys_siglist[NSIG] =
+{
+#define init_sig(sig, abbrev, desc) [sig] = desc,
+#include <siglist.h>
+#undef init_sig
+};
+strong_alias (_sys_siglist, _sys_siglist_internal)
+
+
+const char *const _sys_sigabbrev[NSIG] =
+{
+#define init_sig(sig, abbrev, desc) [sig] = abbrev,
+#include <siglist.h>
+#undef init_sig
+};
diff --git a/stdio-common/tempname.c b/stdio-common/tempname.c
new file mode 100644
index 0000000..60c94d6
--- /dev/null
+++ b/stdio-common/tempname.c
@@ -0,0 +1,59 @@
+/* Copyright (C) 1991, 92, 93, 95-98, 99 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define __need_size_t
+#include <stddef.h>
+#include <stdio.h>
+#include <errno.h>
+
+/* Perform the "SVID path search malarkey" on DIR and PFX. Write a
+ template suitable for use in __gen_tempname into TMPL, bounded
+ by TMPL_LEN. */
+int
+__path_search (tmpl, tmpl_len, dir, pfx, try_tmpdir)
+ char *tmpl;
+ size_t tmpl_len;
+ const char *dir;
+ const char *pfx;
+ int try_tmpdir;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (__path_search)
+
+/* Generate a (hopefully) unique temporary filename
+ in DIR (if applicable), using template TMPL.
+ KIND determines what to do with that name. It may be one of:
+ __GT_FILE: create a file and return a read-write fd.
+ __GT_BIGFILE: same, but use open64() (or equivalent).
+ __GT_DIR: create a directory.
+ __GT_NOCREATE: just find a name not currently in use.
+ */
+
+int
+__gen_tempname (tmpl, kind)
+ char *tmpl;
+ int kind;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (__gen_tempname)
+#include <stub-tag.h>
diff --git a/stdio-common/tmpfile.c b/stdio-common/tmpfile.c
new file mode 100644
index 0000000..41f12bc
--- /dev/null
+++ b/stdio-common/tmpfile.c
@@ -0,0 +1,66 @@
+/* Open a stdio stream on an anonymous temporary file. Generic/POSIX version.
+ Copyright (C) 1991,93,1996-2000,2002,2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdio.h>
+#include <unistd.h>
+
+#ifdef USE_IN_LIBIO
+# include <iolibio.h>
+# define __fdopen INTUSE(_IO_fdopen)
+# ifndef tmpfile
+# define tmpfile __new_tmpfile
+# endif
+#endif
+
+#ifndef GEN_THIS
+# define GEN_THIS __GT_FILE
+#endif
+
+/* This returns a new stream opened on a temporary file (generated
+ by tmpnam). The file is opened with mode "w+b" (binary read/write).
+ If we couldn't generate a unique filename or the file couldn't
+ be opened, NULL is returned. */
+FILE *
+tmpfile (void)
+{
+ char buf[FILENAME_MAX];
+ int fd;
+ FILE *f;
+
+ if (__path_search (buf, FILENAME_MAX, NULL, "tmpf", 0))
+ return NULL;
+ fd = __gen_tempname (buf, GEN_THIS);
+ if (fd < 0)
+ return NULL;
+
+ /* Note that this relies on the Unix semantics that
+ a file is not really removed until it is closed. */
+ (void) __unlink (buf);
+
+ if ((f = __fdopen (fd, "w+b")) == NULL)
+ __close (fd);
+
+ return f;
+}
+
+#if defined USE_IN_LIBIO && GEN_THIS == __GT_FILE /* Not for tmpfile64. */
+# undef tmpfile
+# include <shlib-compat.h>
+versioned_symbol (libc, __new_tmpfile, tmpfile, GLIBC_2_1);
+#endif
diff --git a/stdio-common/tmpfile64.c b/stdio-common/tmpfile64.c
new file mode 100644
index 0000000..adce634
--- /dev/null
+++ b/stdio-common/tmpfile64.c
@@ -0,0 +1,3 @@
+#define GEN_THIS __GT_BIGFILE
+#define tmpfile tmpfile64
+#include "tmpfile.c"