diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-12-22 20:10:10 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-12-22 20:10:10 +0000 |
commit | a334319f6530564d22e775935d9c91663623a1b4 (patch) | |
tree | b5877475619e4c938e98757d518bb1e9cbead751 /misc | |
parent | 0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (diff) | |
download | glibc-a334319f6530564d22e775935d9c91663623a1b4.tar glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.gz glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.bz2 glibc-a334319f6530564d22e775935d9c91663623a1b4.zip |
(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
Diffstat (limited to 'misc')
99 files changed, 325 insertions, 3860 deletions
diff --git a/misc/Makefile b/misc/Makefile index 9eac1b6275..862eb1b800 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991-2002,2003,2004,2005,2006 Free Software Foundation, Inc. +# Copyright (C) 1991-2002, 2003, 2004 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -25,13 +25,11 @@ subdir := misc headers := sys/uio.h bits/uio.h sys/ioctl.h bits/ioctls.h bits/ioctl-types.h \ sys/ptrace.h sys/file.h sys/dir.h sys/cdefs.h \ ar.h a.out.h libgen.h stab.h bits/stab.def sgtty.h \ - ttyent.h paths.h sys/reboot.h \ + ttyent.h syslog.h sys/syslog.h paths.h sys/reboot.h \ sys/mman.h sys/param.h fstab.h mntent.h search.h err.h error.h \ sys/queue.h sysexits.h syscall.h sys/syscall.h sys/swap.h \ sys/select.h ustat.h sys/ustat.h bits/ustat.h sys/sysinfo.h \ - regexp.h bits/select.h bits/mman.h sys/xattr.h \ - syslog.h sys/syslog.h \ - bits/syslog.h bits/syslog-ldbl.h bits/syslog-path.h + regexp.h bits/select.h bits/mman.h sys/xattr.h routines := brk sbrk sstk ioctl \ readv writev \ @@ -49,7 +47,7 @@ routines := brk sbrk sstk ioctl \ gtty stty \ ptrace \ fstab mntent mntent_r \ - utimes lutimes futimes futimesat \ + utimes lutimes futimes \ truncate ftruncate truncate64 ftruncate64 \ chflags fchflags \ insremque getttyent getusershell getpass ttyslot \ @@ -67,8 +65,6 @@ routines := brk sbrk sstk ioctl \ distribute := device-nrs.h -generated := tst-error1.mtrace tst-error1-mem - include ../Makeconfig aux := init-misc @@ -77,11 +73,7 @@ install-lib := libbsd-compat.a libg.a endif gpl2lgpl := error.c error.h -tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \ - tst-error1 tst-pselect tst-insremque tst-mntent2 -ifeq (no,$(cross-compiling)) -tests: $(objpfx)tst-error1-mem -endif +tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch CFLAGS-tsearch.c = $(uses-callbacks) CFLAGS-lsearch.c = $(uses-callbacks) @@ -114,8 +106,3 @@ endif ifeq ($(build-bounded),yes) $(objpfx)tst-tsearch-bp: $(common-objpfx)math/libm_b.a endif - -tst-error1-ENV = MALLOC_TRACE=$(objpfx)tst-error1.mtrace -tst-error1-ARGS = $(objpfx)tst-error1.out -$(objpfx)tst-error1-mem: $(objpfx)tst-error1.out - $(common-objpfx)malloc/mtrace $(objpfx)tst-error1.mtrace > $@ diff --git a/misc/Versions b/misc/Versions index fdf2d9d2af..13b38eec72 100644 --- a/misc/Versions +++ b/misc/Versions @@ -130,8 +130,4 @@ libc { GLIBC_2.3.3 { remap_file_pages; } - GLIBC_2.4 { - futimesat; - __syslog_chk; __vsyslog_chk; - } } diff --git a/misc/acct.c b/misc/acct.c deleted file mode 100644 index b626b5d938..0000000000 --- a/misc/acct.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 <errno.h> -#include <unistd.h> - -/* Turn accounting on if NAME is an existing file. The system will then write - a record for each process as it terminates, to this file. If NAME is NULL, - turn accounting off. This call is restricted to the super-user. */ -int -acct (name) - const char *name; -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (acct) -#include <stub-tag.h> diff --git a/misc/bits/syslog-ldbl.h b/misc/bits/syslog-ldbl.h deleted file mode 100644 index d153c8f8cd..0000000000 --- a/misc/bits/syslog-ldbl.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -mlong-double-64 compatibility mode for syslog functions. - Copyright (C) 2006 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. */ - -#ifndef _SYS_SYSLOG_H -# error "Never include <bits/syslog-ldbl.h> directly; use <sys/syslog.h> instead." -#endif - -__LDBL_REDIR_DECL (syslog) - -#ifdef __USE_BSD -__LDBL_REDIR_DECL (vsyslog) -#endif - -#if __USE_FORTIFY_LEVEL > 0 && !defined __cplusplus -__LDBL_REDIR_DECL (__syslog_chk) - -# ifdef __USE_BSD -__LDBL_REDIR_DECL (__vsyslog_chk) -# endif -#endif diff --git a/misc/bits/syslog.h b/misc/bits/syslog.h deleted file mode 100644 index c0427214e3..0000000000 --- a/misc/bits/syslog.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Checking macros for syslog functions. - 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. */ - -#ifndef _SYS_SYSLOG_H -# error "Never include <bits/syslog.h> directly; use <sys/syslog.h> instead." -#endif - - -extern void __syslog_chk (int __pri, int __flag, __const char *__fmt, ...) - __attribute__ ((__format__ (__printf__, 3, 4))); - -#define syslog(pri, ...) \ - __syslog_chk (pri, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) - - -#ifdef __USE_BSD -extern void __vsyslog_chk (int __pri, int __flag, __const char *__fmt, - __gnuc_va_list __ap) - __attribute__ ((__format__ (__printf__, 3, 0))); - -# define vsyslog(pri, fmt, ap) \ - __vsyslog_chk (pri, __USE_FORTIFY_LEVEL - 1, fmt, ap) -#endif diff --git a/misc/brk.c b/misc/brk.c deleted file mode 100644 index b951819f21..0000000000 --- a/misc/brk.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 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 <unistd.h> - -/* sbrk.c expects this. */ -void *__curbrk; - -/* Set the end of the process's data space to ADDR. - Return 0 if successful, -1 if not. */ -int -__brk (addr) - void *addr; -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (brk) - -weak_alias (__brk, brk) -#include <stub-tag.h> diff --git a/misc/chflags.c b/misc/chflags.c deleted file mode 100644 index b678121265..0000000000 --- a/misc/chflags.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 2004 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 <stddef.h> -#include <sys/stat.h> - -/* Change the flags of FILE to FLAGS. */ - -int chflags (const char *file, int flags) __THROW; - -int -chflags (file, flags) - const char *file; - int flags; -{ - if (file == NULL) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} - -stub_warning (chflags) -#include <stub-tag.h> diff --git a/misc/chroot.c b/misc/chroot.c deleted file mode 100644 index f20ccf4c2b..0000000000 --- a/misc/chroot.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 <errno.h> -#include <unistd.h> - -/* Make PATH be the root directory (the starting point for absolute paths). - This call is restricted to the super-user. */ -int -chroot (path) - const char *path; -{ - __set_errno (ENOSYS); - return -1; -} - - -stub_warning (chroot) -#include <stub-tag.h> diff --git a/misc/efgcvt.c b/misc/efgcvt.c index b9fb4a9b71..915d00dfd5 100644 --- a/misc/efgcvt.c +++ b/misc/efgcvt.c @@ -1,6 +1,5 @@ /* Compatibility functions for floating point formatting. - Copyright (C) 1995, 1996, 1997, 1999, 2002, 2006 - Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 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 @@ -24,7 +23,6 @@ #include <sys/param.h> #include <float.h> #include <bits/libc-lock.h> -#include <math_ldbl_opt.h> #ifndef FLOAT_TYPE # define FLOAT_TYPE double @@ -46,14 +44,10 @@ # error "NDIGIT_MAX must be precomputed" # define NDIGIT_MAX (lrint (ceil (M_LN2 / M_LN10 * DBL_MANT_DIG + 1.0))) # endif -#else -# define LONG_DOUBLE_CVT #endif #define APPEND(a, b) APPEND2 (a, b) #define APPEND2(a, b) a##b -#define __APPEND(a, b) __APPEND2 (a, b) -#define __APPEND2(a, b) __##a##b #define FCVT_BUFFER APPEND (FUNC_PREFIX, fcvt_buffer) @@ -66,14 +60,14 @@ static char ECVT_BUFFER[MAXDIG]; libc_freeres_ptr (static char *FCVT_BUFPTR); char * -__APPEND (FUNC_PREFIX, fcvt) (value, ndigit, decpt, sign) +APPEND (FUNC_PREFIX, fcvt) (value, ndigit, decpt, sign) FLOAT_TYPE value; int ndigit, *decpt, *sign; { if (FCVT_BUFPTR == NULL) { - if (__APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, - FCVT_BUFFER, MAXDIG) != -1) + if (APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, + FCVT_BUFFER, MAXDIG) != -1) return FCVT_BUFFER; FCVT_BUFPTR = (char *) malloc (FCVT_MAXDIG); @@ -81,26 +75,26 @@ __APPEND (FUNC_PREFIX, fcvt) (value, ndigit, decpt, sign) return FCVT_BUFFER; } - (void) __APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, - FCVT_BUFPTR, FCVT_MAXDIG); + (void) APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, + FCVT_BUFPTR, FCVT_MAXDIG); return FCVT_BUFPTR; } char * -__APPEND (FUNC_PREFIX, ecvt) (value, ndigit, decpt, sign) +APPEND (FUNC_PREFIX, ecvt) (value, ndigit, decpt, sign) FLOAT_TYPE value; int ndigit, *decpt, *sign; { - (void) __APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, - ECVT_BUFFER, MAXDIG); + (void) APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, + ECVT_BUFFER, MAXDIG); return ECVT_BUFFER; } char * -__APPEND (FUNC_PREFIX, gcvt) (value, ndigit, buf) +APPEND (FUNC_PREFIX, gcvt) (value, ndigit, buf) FLOAT_TYPE value; int ndigit; char *buf; @@ -108,26 +102,3 @@ __APPEND (FUNC_PREFIX, gcvt) (value, ndigit, buf) sprintf (buf, "%.*" FLOAT_FMT_FLAG "g", MIN (ndigit, NDIGIT_MAX), value); return buf; } - -#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) -# ifdef LONG_DOUBLE_CVT -# define cvt_symbol(symbol) \ - cvt_symbol_1 (libc, __APPEND (FUNC_PREFIX, symbol), \ - APPEND (FUNC_PREFIX, symbol), GLIBC_2_4) -# define cvt_symbol_1(lib, local, symbol, version) \ - versioned_symbol (lib, local, symbol, version) -# else -# define cvt_symbol(symbol) \ - cvt_symbol_1 (libc, __APPEND (FUNC_PREFIX, symbol), \ - APPEND (q, symbol), GLIBC_2_0); \ - strong_alias (__APPEND (FUNC_PREFIX, symbol), APPEND (FUNC_PREFIX, symbol)) -# define cvt_symbol_1(lib, local, symbol, version) \ - compat_symbol (lib, local, symbol, version) -# endif -#else -# define cvt_symbol(symbol) \ - strong_alias (__APPEND (FUNC_PREFIX, symbol), APPEND (FUNC_PREFIX, symbol)) -#endif -cvt_symbol(fcvt); -cvt_symbol(ecvt); -cvt_symbol(gcvt); diff --git a/misc/efgcvt_r.c b/misc/efgcvt_r.c index ba9566d22c..69cca9038f 100644 --- a/misc/efgcvt_r.c +++ b/misc/efgcvt_r.c @@ -1,6 +1,5 @@ /* Compatibility functions for floating point formatting, reentrant versions. - Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2006 - Free Software Foundation, Inc. + Copyright (C) 1995,96,97,98,99,2000,01,02,04 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -26,7 +25,6 @@ #include <math.h> #include <stdlib.h> #include <sys/param.h> -#include <math_ldbl_opt.h> #ifndef FLOAT_TYPE # define FLOAT_TYPE double @@ -57,14 +55,10 @@ # error "FLOAT_MIN_10_NORM must be precomputed" # define FLOAT_MIN_10_NORM exp10 (DBL_MIN_10_EXP) # endif -#else -# define LONG_DOUBLE_CVT #endif #define APPEND(a, b) APPEND2 (a, b) #define APPEND2(a, b) a##b -#define __APPEND(a, b) __APPEND2 (a, b) -#define __APPEND2(a, b) __##a##b #define FLOOR APPEND(floor, FLOAT_NAME_EXT) #define FABS APPEND(fabs, FLOAT_NAME_EXT) @@ -73,7 +67,7 @@ int -__APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, buf, len) +APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, buf, len) FLOAT_TYPE value; int ndigit, *decpt, *sign; char *buf; @@ -169,9 +163,10 @@ __APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, buf, len) return 0; } +libc_hidden_def (APPEND (FUNC_PREFIX, fcvt_r)) int -__APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, buf, len) +APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, buf, len) FLOAT_TYPE value; int ndigit, *decpt, *sign; char *buf; @@ -234,32 +229,11 @@ __APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, buf, len) *sign = isfinite (value) ? signbit (value) != 0 : 0; } else - if (__APPEND (FUNC_PREFIX, fcvt_r) (value, MIN (ndigit, NDIGIT_MAX) - 1, - decpt, sign, buf, len)) + if (APPEND (FUNC_PREFIX, fcvt_r) (value, MIN (ndigit, NDIGIT_MAX) - 1, + decpt, sign, buf, len)) return -1; *decpt += exponent; return 0; } - -#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) -# ifdef LONG_DOUBLE_CVT -# define cvt_symbol(symbol) \ - cvt_symbol_1 (libc, __APPEND (FUNC_PREFIX, symbol), \ - APPEND (FUNC_PREFIX, symbol), GLIBC_2_4) -# define cvt_symbol_1(lib, local, symbol, version) \ - versioned_symbol (lib, local, symbol, version) -# else -# define cvt_symbol(symbol) \ - cvt_symbol_1 (libc, __APPEND (FUNC_PREFIX, symbol), \ - APPEND (q, symbol), GLIBC_2_0); \ - strong_alias (__APPEND (FUNC_PREFIX, symbol), APPEND (FUNC_PREFIX, symbol)) -# define cvt_symbol_1(lib, local, symbol, version) \ - compat_symbol (lib, local, symbol, version) -# endif -#else -# define cvt_symbol(symbol) \ - strong_alias (__APPEND (FUNC_PREFIX, symbol), APPEND (FUNC_PREFIX, symbol)) -#endif -cvt_symbol(fcvt_r); -cvt_symbol(ecvt_r); +libc_hidden_def (APPEND (FUNC_PREFIX, ecvt_r)) diff --git a/misc/error.c b/misc/error.c index 85d1cffbf9..2501583366 100644 --- a/misc/error.c +++ b/misc/error.c @@ -1,6 +1,7 @@ /* Error handler for noninteractive utilities - Copyright (C) 1990-1998, 2000-2005, 2006 Free Software Foundation, Inc. - This file is part of the GNU C Library. + Copyright (C) 1990-1998, 2000-2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. Its master source is NOT part of + the C library, however. The master source lives in /gd/gnu/lib. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -23,19 +24,33 @@ # include <config.h> #endif -#include <stdarg.h> #include <stdio.h> -#include <stdlib.h> -#include <string.h> - +#include <libintl.h> #ifdef _LIBC -# include <libintl.h> -# include <stdbool.h> -# include <stdint.h> # include <wchar.h> # define mbsrtowcs __mbsrtowcs #endif +#if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC +# if __STDC__ +# include <stdarg.h> +# define VA_START(args, lastarg) va_start(args, lastarg) +# else +# include <varargs.h> +# define VA_START(args, lastarg) va_start(args) +# endif +#else +# define va_alist a1, a2, a3, a4, a5, a6, a7, a8 +# define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8; +#endif + +#if STDC_HEADERS || _LIBC +# include <stdlib.h> +# include <string.h> +#else +void exit (); +#endif + #include "error.h" #ifndef _ @@ -45,7 +60,11 @@ /* If NULL, error will flush stdout, then print on stderr the program name, a colon and a space. Otherwise, error will call this function without parameters instead. */ -void (*error_print_progname) (void); +void (*error_print_progname) ( +#if __STDC__ - 0 + void +#endif + ); /* This variable is incremented each time `error' is called. */ unsigned int error_message_count; @@ -55,7 +74,6 @@ unsigned int error_message_count; # define program_name program_invocation_name # include <errno.h> -# include <limits.h> # include <libio/libioP.h> /* In GNU libc we want do not want to use the common name `error' directly. @@ -91,6 +109,27 @@ extern char *program_name; # if HAVE_STRERROR_R || defined strerror_r # define __strerror_r strerror_r +# else +# if HAVE_STRERROR +# ifndef HAVE_DECL_STRERROR +"this configure-time declaration test was not run" +# endif +# if !HAVE_DECL_STRERROR +char *strerror (); +# endif +# else +static char * +private_strerror (int errnum) +{ + extern char *sys_errlist[]; + extern int sys_nerr; + + if (errnum > 0 && errnum <= sys_nerr) + return _(sys_errlist[errnum]); + return _("Unknown system error"); +} +# define strerror private_strerror +# endif /* HAVE_STRERROR */ # endif /* HAVE_STRERROR_R || defined strerror_r */ #endif /* not _LIBC */ @@ -119,33 +158,38 @@ print_errno_message (int errnum) #endif #if _LIBC - __fxprintf (NULL, ": %s", s); -#else - fprintf (stderr, ": %s", s); + if (_IO_fwide (stderr, 0) > 0) + { + __fwprintf (stderr, L": %s", s); + return; + } #endif + + fprintf (stderr, ": %s", s); } +#ifdef VA_START static void error_tail (int status, int errnum, const char *message, va_list args) { -#if _LIBC +# if HAVE_VPRINTF || _LIBC +# if _LIBC if (_IO_fwide (stderr, 0) > 0) { -# define ALLOCA_LIMIT 2000 +# define ALLOCA_LIMIT 2000 size_t len = strlen (message) + 1; wchar_t *wmessage = NULL; mbstate_t st; size_t res; const char *tmp; - bool use_malloc = false; - while (1) + do { - if (__libc_use_alloca (len * sizeof (wchar_t))) + if (len < ALLOCA_LIMIT) wmessage = (wchar_t *) alloca (len * sizeof (wchar_t)); else { - if (!use_malloc) + if (wmessage != NULL && len / 2 < ALLOCA_LIMIT) wmessage = NULL; wchar_t *p = (wchar_t *) realloc (wmessage, @@ -157,69 +201,62 @@ error_tail (int status, int errnum, const char *message, va_list args) return; } wmessage = p; - use_malloc = true; } memset (&st, '\0', sizeof (st)); tmp = message; - - res = mbsrtowcs (wmessage, &tmp, len, &st); - if (res != len) - break; - - if (__builtin_expect (len >= SIZE_MAX / 2, 0)) - { - /* This really should not happen if everything is fine. */ - res = (size_t) -1; - break; - } - - len *= 2; } + while ((res = mbsrtowcs (wmessage, &tmp, len, &st)) == len); if (res == (size_t) -1) - { - /* The string cannot be converted. */ - if (use_malloc) - { - free (wmessage); - use_malloc = false; - } - wmessage = (wchar_t *) L"???"; - } + /* The string cannot be converted. */ + wmessage = (wchar_t *) L"???"; __vfwprintf (stderr, wmessage, args); - - if (use_malloc) - free (wmessage); } else -#endif +# endif vfprintf (stderr, message, args); +# else + _doprnt (message, args, stderr); +# endif va_end (args); ++error_message_count; if (errnum) print_errno_message (errnum); -#if _LIBC - __fxprintf (NULL, "\n"); -#else - putc ('\n', stderr); -#endif +# if _LIBC + if (_IO_fwide (stderr, 0) > 0) + putwc (L'\n', stderr); + else +# endif + putc ('\n', stderr); fflush (stderr); if (status) exit (status); } +#endif /* Print the program name and error message MESSAGE, which is a printf-style format string with optional args. If ERRNUM is nonzero, print its corresponding system error message. Exit with status STATUS if it is nonzero. */ +/* VARARGS */ void +#if defined VA_START && __STDC__ error (int status, int errnum, const char *message, ...) +#else +error (status, errnum, message, va_alist) + int status; + int errnum; + char *message; + va_dcl +#endif { +#ifdef VA_START va_list args; +#endif #if defined _LIBC && defined __libc_ptf_call /* We do not want this call to be cut short by a thread @@ -238,14 +275,27 @@ error (int status, int errnum, const char *message, ...) else { #if _LIBC - __fxprintf (NULL, "%s: ", program_name); -#else - fprintf (stderr, "%s: ", program_name); + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"%s: ", program_name); + else #endif + fprintf (stderr, "%s: ", program_name); } - va_start (args, message); +#ifdef VA_START + VA_START (args, message); error_tail (status, errnum, message, args); +#else + fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8); + + ++error_message_count; + if (errnum) + print_errno_message (errnum); + putc ('\n', stderr); + fflush (stderr); + if (status) + exit (status); +#endif #ifdef _LIBC _IO_funlockfile (stderr); @@ -260,10 +310,22 @@ error (int status, int errnum, const char *message, ...) int error_one_per_line; void +#if defined VA_START && __STDC__ error_at_line (int status, int errnum, const char *file_name, unsigned int line_number, const char *message, ...) +#else +error_at_line (status, errnum, file_name, line_number, message, va_alist) + int status; + int errnum; + const char *file_name; + unsigned int line_number; + char *message; + va_dcl +#endif { +#ifdef VA_START va_list args; +#endif if (error_one_per_line) { @@ -297,22 +359,37 @@ error_at_line (int status, int errnum, const char *file_name, else { #if _LIBC - __fxprintf (NULL, "%s:", program_name); -#else - fprintf (stderr, "%s:", program_name); + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"%s: ", program_name); + else #endif + fprintf (stderr, "%s:", program_name); } + if (file_name != NULL) + { #if _LIBC - __fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ", - file_name, line_number); -#else - fprintf (stderr, file_name != NULL ? "%s:%d: " : " ", - file_name, line_number); + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"%s:%d: ", file_name, line_number); + else #endif + fprintf (stderr, "%s:%d: ", file_name, line_number); + } - va_start (args, message); +#ifdef VA_START + VA_START (args, message); error_tail (status, errnum, message, args); +#else + fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8); + + ++error_message_count; + if (errnum) + print_errno_message (errnum); + putc ('\n', stderr); + fflush (stderr); + if (status) + exit (status); +#endif #ifdef _LIBC _IO_funlockfile (stderr); diff --git a/misc/error.h b/misc/error.h index f25005b0e8..3638bc6e98 100644 --- a/misc/error.h +++ b/misc/error.h @@ -1,5 +1,5 @@ /* Declaration for error-reporting function - Copyright (C) 1995, 1996, 1997, 2003, 2006 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 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 @@ -37,6 +37,8 @@ extern "C" { #endif +#if defined __STDC__ && __STDC__ + /* Print a message with `fprintf (stderr, FORMAT, ...)'; if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM). If STATUS is nonzero, terminate the program with `exit (STATUS)'. */ @@ -53,6 +55,12 @@ extern void error_at_line (int __status, int __errnum, const char *__fname, function without parameters instead. */ extern void (*error_print_progname) (void); +#else +void error (); +void error_at_line (); +extern void (*error_print_progname) (); +#endif + /* This variable is incremented each time `error' is called. */ extern unsigned int error_message_count; diff --git a/misc/fchflags.c b/misc/fchflags.c deleted file mode 100644 index f191194c12..0000000000 --- a/misc/fchflags.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 2004 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 <stddef.h> -#include <sys/stat.h> - -/* Change the flags of the file FD refers to to FLAGS. */ - -int fchflags (int fd, int flags) __THROW; - -int -fchflags (fd, flags) - int fd; - int flags; -{ - if (fd < 0) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} - -stub_warning (fchflags) -#include <stub-tag.h> diff --git a/misc/fdatasync.c b/misc/fdatasync.c deleted file mode 100644 index 3edeef0c9e..0000000000 --- a/misc/fdatasync.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (C) 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 <unistd.h> - - -/* Synchronize at least the data part of a file with the underlying - media. */ -int -fdatasync (int fildes) -{ - return fsync (fildes); -} diff --git a/misc/fgetxattr.c b/misc/fgetxattr.c deleted file mode 100644 index 610ed32d1f..0000000000 --- a/misc/fgetxattr.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 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 <sys/xattr.h> - -ssize_t -fgetxattr (int __fd, const char *__name, - void *__value, size_t __size) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (fgetxattr) -#include <stub-tag.h> diff --git a/misc/flistxattr.c b/misc/flistxattr.c deleted file mode 100644 index fc2863d31c..0000000000 --- a/misc/flistxattr.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 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 <sys/xattr.h> - -ssize_t -flistxattr (int __fd, char *__list, size_t __size) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (flistxattr) -#include <stub-tag.h> diff --git a/misc/fremovexattr.c b/misc/fremovexattr.c deleted file mode 100644 index 9719d42d40..0000000000 --- a/misc/fremovexattr.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 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 <sys/xattr.h> - -int -fremovexattr (int __fd, const char *__name) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (fremovexattr) -#include <stub-tag.h> diff --git a/misc/fsetxattr.c b/misc/fsetxattr.c deleted file mode 100644 index 8a52e72529..0000000000 --- a/misc/fsetxattr.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 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 <sys/xattr.h> - -int -fsetxattr (int __fd, const char *__name, const void *__value, - size_t __size, int __flags) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (fsetxattr) -#include <stub-tag.h> diff --git a/misc/fsync.c b/misc/fsync.c deleted file mode 100644 index e2a4d700d5..0000000000 --- a/misc/fsync.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 <errno.h> -#include <unistd.h> - -/* Make all changes done to FD actually appear on disk. */ -int -fsync (fd) - int fd; -{ - __set_errno (ENOSYS); - return -1; -} - - -stub_warning (fsync) -#include <stub-tag.h> diff --git a/misc/ftruncate.c b/misc/ftruncate.c deleted file mode 100644 index d4cca2e267..0000000000 --- a/misc/ftruncate.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 1998 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 <sys/types.h> -#include <unistd.h> - -/* Truncate the file FD refers to to LENGTH bytes. */ -int -__ftruncate (fd, length) - int fd; - off_t length; -{ - __set_errno (ENOSYS); - return -1; -} - -weak_alias (__ftruncate, ftruncate) - -stub_warning (ftruncate) -#include <stub-tag.h> diff --git a/misc/ftruncate64.c b/misc/ftruncate64.c deleted file mode 100644 index df84b7c3c1..0000000000 --- a/misc/ftruncate64.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 1997, 1998, 2001 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 <sys/types.h> -#include <errno.h> -#include <unistd.h> - -/* Truncate the file FD refers to to LENGTH bytes. */ -int -__ftruncate64 (fd, length) - int fd; - off64_t length; -{ - if ((off_t) length != length) - { - __set_errno (EINVAL); - return -1; - } - return __ftruncate (fd, (off_t) length); -} -weak_alias (__ftruncate64, ftruncate64) diff --git a/misc/futimes.c b/misc/futimes.c deleted file mode 100644 index 3378dbf416..0000000000 --- a/misc/futimes.c +++ /dev/null @@ -1,34 +0,0 @@ -/* futimes -- change access and modification times of open file. Stub version. - Copyright (C) 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 <sys/time.h> -#include <errno.h> - -/* Change the access time of FILE to TVP[0] and - the modification time of FILE to TVP[1], but do not follow symlinks. */ -int -__futimes (int fd, const struct timeval tvp[2]) -{ - __set_errno (ENOSYS); - return -1; -} -weak_alias (__futimes, futimes) - -stub_warning (futimes) -#include <stub-tag.h> diff --git a/misc/futimesat.c b/misc/futimesat.c deleted file mode 100644 index bf16ce8de0..0000000000 --- a/misc/futimesat.c +++ /dev/null @@ -1,46 +0,0 @@ -/* 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 <stddef.h> -#include <sys/time.h> - - -/* Change the access time of FILE relative to FD to TVP[0] and - the modification time of FILE to TVP[1]. */ -int -futimesat (fd, file, tvp) - int fd; - const char *file; - const struct timeval tvp[2]; -{ - if (fd < 0 - && (file == NULL - || (fd != AT_FDCWD && file[0] != '/'))) - { - __set_errno (EBADF); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} - -stub_warning (futimesat) -#include <stub-tag.h> diff --git a/misc/getclktck.c b/misc/getclktck.c deleted file mode 100644 index 897c6a25ba..0000000000 --- a/misc/getclktck.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 2000 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 <time.h> - -/* Return frequency of times(). */ -int -__getclktck () -{ -#ifdef CLK_TCK - return CLK_TCK; -#else - return 60; -#endif -} diff --git a/misc/getdomain.c b/misc/getdomain.c deleted file mode 100644 index 6074ccfb79..0000000000 --- a/misc/getdomain.c +++ /dev/null @@ -1,64 +0,0 @@ -/* Copyright (C) 1994,95,97,2000,02 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. */ - -/* Put the name of the current YP domain in no more than LEN bytes of NAME. - The result is null-terminated if LEN is large enough for the full - name and the terminator. */ - -#include <errno.h> -#include <unistd.h> -#include <sys/param.h> -#include <sys/utsname.h> -#include <string.h> - -#if _UTSNAME_DOMAIN_LENGTH -/* The `uname' information includes the domain name. */ - -int -getdomainname (name, len) - char *name; - size_t len; -{ - struct utsname u; - size_t u_len; - - if (uname (&u) < 0) - return -1; - - u_len = strlen (u.domainname); - memcpy (name, u.domainname, MIN (u_len + 1, len)); - return 0; -} - -#else - -int -getdomainname (name, len) - char *name; - size_t len; -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (getdomainname) -#include <stub-tag.h> - -#endif - -libc_hidden_def (getdomainname) diff --git a/misc/getdtsz.c b/misc/getdtsz.c deleted file mode 100644 index 38b7577914..0000000000 --- a/misc/getdtsz.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 <errno.h> -#include <unistd.h> - -/* Return the maximum number of file descriptors - the current process could possibly have. */ -int -__getdtablesize () -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (getdtablesize) - -weak_alias (__getdtablesize, getdtablesize) -#include <stub-tag.h> diff --git a/misc/gethostid.c b/misc/gethostid.c deleted file mode 100644 index 01baf12230..0000000000 --- a/misc/gethostid.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 <errno.h> -#include <unistd.h> - -/* Return the current machine's Internet number. */ -long int -gethostid () -{ - __set_errno (ENOSYS); - return -1L; -} - - -stub_warning (gethostid) -#include <stub-tag.h> diff --git a/misc/gethostname.c b/misc/gethostname.c deleted file mode 100644 index bc59ab57c6..0000000000 --- a/misc/gethostname.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 1991,1995,1996,1997,2000,2001 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 <unistd.h> - -/* Put the name of the current host in no more than LEN bytes of NAME. - The result is null-terminated if LEN is large enough for the full - name and the terminator. */ -int -__gethostname (name, len) - char *name; - size_t len; -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (gethostname) - -weak_alias (__gethostname, gethostname) -#include <stub-tag.h> diff --git a/misc/getloadavg.c b/misc/getloadavg.c deleted file mode 100644 index 070c879fd5..0000000000 --- a/misc/getloadavg.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Get system load averages. Stub version. - Copyright (C) 1999 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 <unistd.h> -#include <stdlib.h> - - -/* Put the 1 minute, 5 minute and 15 minute load averages - into the first NELEM elements of LOADAVG. - Return the number written (never more than 3, but may be less than NELEM), - or -1 if an error occurred. */ - -int -getloadavg (double loadavg[], int nelem) -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (getloadavg) -#include <stub-tag.h> diff --git a/misc/getpagesize.c b/misc/getpagesize.c deleted file mode 100644 index 40ed1ee2b1..0000000000 --- a/misc/getpagesize.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (C) 1991, 1993, 1995, 1996, 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 <unistd.h> - -/* Return the system page size. */ -int -__getpagesize () -{ - __set_errno (ENOSYS); - return 0; -} -libc_hidden_def (__getpagesize) -stub_warning (getpagesize) - -weak_alias (__getpagesize, getpagesize) -#include <stub-tag.h> diff --git a/misc/getpass.c b/misc/getpass.c index 5290c3c7d3..62e56866a1 100644 --- a/misc/getpass.c +++ b/misc/getpass.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-1999,2001,2003,2004,2005 Free Software Foundation, Inc. +/* Copyright (C) 1992-1999, 2001, 2003, 2004 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 @@ -91,7 +91,12 @@ getpass (prompt) tty_changed = 0; /* Write the prompt. */ - __fxprintf (out, "%s", prompt); +#ifdef USE_IN_LIBIO + if (_IO_fwide (out, 0) > 0) + __fwprintf (out, L"%s", prompt); + else +#endif + fputs_unlocked (prompt, out); fflush_unlocked (out); /* Read the password. */ @@ -105,8 +110,15 @@ getpass (prompt) /* Remove the newline. */ buf[nread - 1] = '\0'; if (tty_changed) - /* Write the newline that was not echoed. */ - __fxprintf (out, "\n"); + { + /* Write the newline that was not echoed. */ +#ifdef USE_IN_LIBIO + if (_IO_fwide (out, 0) > 0) + putwc_unlocked (L'\n', out); + else +#endif + putc_unlocked ('\n', out); + } } } diff --git a/misc/getsysstats.c b/misc/getsysstats.c deleted file mode 100644 index bc67e23e79..0000000000 --- a/misc/getsysstats.c +++ /dev/null @@ -1,69 +0,0 @@ -/* getsysstats - Determine various system internal values, stub version. - Copyright (C) 1996, 1997, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. - - 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 <sys/sysinfo.h> - -int -__get_nprocs_conf () -{ - /* We don't know how to determine the number. Simply return always 1. */ - return 1; -} -weak_alias (__get_nprocs_conf, get_nprocs_conf) - -link_warning (get_nprocs_conf, "warning: get_nprocs_conf will always return 1") - - - -int -__get_nprocs () -{ - /* We don't know how to determine the number. Simply return always 1. */ - return 1; -} -weak_alias (__get_nprocs, get_nprocs) - -link_warning (get_nprocs, "warning: get_nprocs will always return 1") - - -long int -__get_phys_pages () -{ - /* We have no general way to determine this value. */ - __set_errno (ENOSYS); - return -1; -} -weak_alias (__get_phys_pages, get_phys_pages) - -stub_warning (get_phys_pages) - - -long int -__get_avphys_pages () -{ - /* We have no general way to determine this value. */ - __set_errno (ENOSYS); - return -1; -} -weak_alias (__get_avphys_pages, get_avphys_pages) - -stub_warning (get_avphys_pages) -#include <stub-tag.h> diff --git a/misc/getusershell.c b/misc/getusershell.c index 636da322f9..95f0eab5e2 100644 --- a/misc/getusershell.c +++ b/misc/getusershell.c @@ -46,15 +46,7 @@ static char sccsid[] = "@(#)getusershell.c 8.1 (Berkeley) 6/4/93"; * /etc/shells. */ -/* NB: we do not initialize okshells here. The initialization needs - relocations. These interfaces are used so rarely that this is not - justified. Instead explicitly initialize the array when it is - used. */ -#if 0 -static const char *const okshells[] = { _PATH_BSHELL, _PATH_CSHELL, NULL }; -#else -static const char *okshells[3]; -#endif +static const char *okshells[] = { _PATH_BSHELL, _PATH_CSHELL, NULL }; static char **curshell, **shells, *strings; static char **initshells (void) __THROW; @@ -78,9 +70,11 @@ void endusershell() { - free(shells); + if (shells != NULL) + free(shells); shells = NULL; - free(strings); + if (strings != NULL) + free(strings); strings = NULL; curshell = NULL; } @@ -98,39 +92,40 @@ initshells() register char **sp, *cp; register FILE *fp; struct stat64 statb; - size_t flen; + int flen; - free(shells); + if (shells != NULL) + free(shells); shells = NULL; - free(strings); + if (strings != NULL) + free(strings); strings = NULL; if ((fp = fopen(_PATH_SHELLS, "rc")) == NULL) - goto init_okshells_noclose; + return (char **) okshells; if (fstat64(fileno(fp), &statb) == -1) { - init_okshells: (void)fclose(fp); - init_okshells_noclose: - okshells[0] = _PATH_BSHELL; - okshells[1] = _PATH_CSHELL; return (char **) okshells; } - if (statb.st_size > ~(size_t)0 / sizeof (char *) * 3) - goto init_okshells; - if ((strings = malloc(statb.st_size + 2)) == NULL) - goto init_okshells; - shells = malloc(statb.st_size / 3 * sizeof (char *)); + if ((strings = malloc((u_int)statb.st_size + 1)) == NULL) { + (void)fclose(fp); + return (char **) okshells; + } + shells = calloc((unsigned)statb.st_size / 3, sizeof (char *)); if (shells == NULL) { + (void)fclose(fp); free(strings); strings = NULL; - goto init_okshells; + return (char **) okshells; } + /* No threads using this stream. */ + __fsetlocking (fp, FSETLOCKING_BYCALLER); sp = shells; cp = strings; - flen = statb.st_size + 2; + flen = statb.st_size; while (fgets_unlocked(cp, flen - (cp - strings), fp) != NULL) { while (*cp != '#' && *cp != '/' && *cp != '\0') cp++; - if (*cp == '#' || *cp == '\0' || cp[1] == '\0') + if (*cp == '#' || *cp == '\0') continue; *sp++ = cp; while (!isspace(*cp) && *cp != '#' && *cp != '\0') diff --git a/misc/getxattr.c b/misc/getxattr.c deleted file mode 100644 index ebf7bf2b4d..0000000000 --- a/misc/getxattr.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 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 <sys/xattr.h> - -ssize_t -getxattr (const char *__path, const char *__name, - void *__value, size_t __size) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (getxattr) -#include <stub-tag.h> diff --git a/misc/gtty.c b/misc/gtty.c deleted file mode 100644 index 84e7fed55e..0000000000 --- a/misc/gtty.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (C) 1991, 1992, 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 <errno.h> -#include <sgtty.h> -#include <stddef.h> - -/* Fill in *PARAMS with terminal parameters associated with FD. */ -int -gtty (fd, params) - int fd; - struct sgttyb *params; -{ - if (params == NULL) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} - -stub_warning (gtty) -#include <stub-tag.h> diff --git a/misc/hsearch_r.c b/misc/hsearch_r.c index b03c12ce0b..398f0b6dd9 100644 --- a/misc/hsearch_r.c +++ b/misc/hsearch_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993,1995,1996,1997,2002,2005 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995, 1996, 1997, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1993. @@ -206,7 +206,7 @@ hsearch_r (item, action, retval, htab) { /* If table is full and another entry should be entered return with error. */ - if (htab->filled == htab->size) + if (action == ENTER && htab->filled == htab->size) { __set_errno (ENOMEM); *retval = NULL; diff --git a/misc/insremque.c b/misc/insremque.c index 7f086cd392..e366ac8063 100644 --- a/misc/insremque.c +++ b/misc/insremque.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1995, 1996, 2006 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1995, 1996 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,20 +24,12 @@ void insque (void *elem, void *prev) { - if (prev == NULL) - { - ((struct qelem *) elem)->q_forw = NULL; - ((struct qelem *) elem)->q_back = NULL; - } - else - { - struct qelem *next = ((struct qelem *) prev)->q_forw; - ((struct qelem *) prev)->q_forw = (struct qelem *) elem; - if (next != NULL) - next->q_back = (struct qelem *) elem; - ((struct qelem *) elem)->q_forw = next; - ((struct qelem *) elem)->q_back = (struct qelem *) prev; - } + struct qelem *next = ((struct qelem *) prev)->q_forw; + ((struct qelem *) prev)->q_forw = (struct qelem *) elem; + if (next != NULL) + next->q_back = (struct qelem *) elem; + ((struct qelem *) elem)->q_forw = next; + ((struct qelem *) elem)->q_back = (struct qelem *) prev; } /* Unlink ELEM from the doubly-linked list that it is in. */ diff --git a/misc/ioctl.c b/misc/ioctl.c deleted file mode 100644 index 3f71452cc1..0000000000 --- a/misc/ioctl.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (C) 1991, 93, 94, 95, 96, 97 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 <sys/ioctl.h> - -/* Perform the I/O control operation specified by REQUEST on FD. - The actual type and use of ARG and the return value depend on REQUEST. */ -int -__ioctl (fd, request) - int fd; - unsigned long int request; -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (ioctl) - -weak_alias (__ioctl, ioctl) -#include <stub-tag.h> diff --git a/misc/lgetxattr.c b/misc/lgetxattr.c deleted file mode 100644 index 6adf1fdf04..0000000000 --- a/misc/lgetxattr.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 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 <sys/xattr.h> - -ssize_t -lgetxattr (const char *__path, const char *__name, - void *__value, size_t __size) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (lgetxattr) -#include <stub-tag.h> diff --git a/misc/listxattr.c b/misc/listxattr.c deleted file mode 100644 index 490a092b75..0000000000 --- a/misc/listxattr.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 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 <sys/xattr.h> - -ssize_t -listxattr (const char *__path, char *__list, size_t __size) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (listxattr) -#include <stub-tag.h> diff --git a/misc/llistxattr.c b/misc/llistxattr.c deleted file mode 100644 index 1a7e1e4cfd..0000000000 --- a/misc/llistxattr.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 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 <sys/xattr.h> - -ssize_t -llistxattr (const char *__path, char *__list, size_t __size) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (llistxattr) -#include <stub-tag.h> diff --git a/misc/lremovexattr.c b/misc/lremovexattr.c deleted file mode 100644 index fad64e5150..0000000000 --- a/misc/lremovexattr.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 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 <sys/xattr.h> - -int -lremovexattr (const char *__path, const char *__name) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (lremovexattr) -#include <stub-tag.h> diff --git a/misc/lseek.c b/misc/lseek.c deleted file mode 100644 index 6daf6ef154..0000000000 --- a/misc/lseek.c +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 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 <unistd.h> -#include <sys/types.h> - -/* Seek to OFFSET on FD, starting from WHENCE. */ -off_t -__lseek (fd, offset, whence) - int fd; - off_t offset; - int whence; -{ - if (fd < 0) - { - __set_errno (EBADF); - return -1; - } - switch (whence) - { - case SEEK_SET: - case SEEK_CUR: - case SEEK_END: - break; - default: - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -stub_warning (lseek) -libc_hidden_def (__lseek) - -weak_alias (__lseek, lseek) -#include <stub-tag.h> diff --git a/misc/lsetxattr.c b/misc/lsetxattr.c deleted file mode 100644 index 6f8cdde1da..0000000000 --- a/misc/lsetxattr.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 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 <sys/xattr.h> - -int -lsetxattr (const char *__path, const char *__name, - const void *__value, size_t __size, int __flags) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (lsetxattr) -#include <stub-tag.h> diff --git a/misc/lutimes.c b/misc/lutimes.c deleted file mode 100644 index 34fc1838f0..0000000000 --- a/misc/lutimes.c +++ /dev/null @@ -1,35 +0,0 @@ -/* lutimes -- change access and modification times of a symlink. Stub version. - Copyright (C) 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 <sys/time.h> -#include <errno.h> -#include <stddef.h> - -/* Change the access time of FILE to TVP[0] and - the modification time of FILE to TVP[1], but do not follow symlinks. */ -int -__lutimes (const char *file, const struct timeval tvp[2]) -{ - __set_errno (ENOSYS); - return -1; -} -weak_alias (__lutimes, lutimes) - -stub_warning (lutimes) -#include <stub-tag.h> diff --git a/misc/madvise.c b/misc/madvise.c deleted file mode 100644 index 7a4aa8ab8e..0000000000 --- a/misc/madvise.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (C) 1994,1995,1996,1997,2000,2007 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 <sys/types.h> -#include <sys/mman.h> -#include <errno.h> - -/* Advise the system about particular usage patterns the program follows - for the region starting at ADDR and extending LEN bytes. */ - -int -madvise (__ptr_t addr, size_t len, int advice) -{ - __set_errno (ENOSYS); - return -1; -} -libc_hidden_def (madvise) -stub_warning (madvise) -#include <stub-tag.h> diff --git a/misc/mincore.c b/misc/mincore.c deleted file mode 100644 index 804447e8f3..0000000000 --- a/misc/mincore.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 2000 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 <sys/mman.h> -#include <errno.h> - -int -mincore (void *__start, size_t __len, unsigned char *__vec) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (mincore) -#include <stub-tag.h> diff --git a/misc/mlock.c b/misc/mlock.c deleted file mode 100644 index fd8dc8bc9d..0000000000 --- a/misc/mlock.c +++ /dev/null @@ -1,35 +0,0 @@ -/* mlock -- guarantee pages are resident in memory. Stub version. - Copyright (C) 2001 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 <sys/types.h> -#include <sys/mman.h> -#include <errno.h> - -/* Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to - be memory resident. */ - -int -mlock (const void *addr, size_t len) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (mlock) -#include <stub-tag.h> diff --git a/misc/mlockall.c b/misc/mlockall.c deleted file mode 100644 index 3d3ed6736d..0000000000 --- a/misc/mlockall.c +++ /dev/null @@ -1,36 +0,0 @@ -/* mlockall -- lock in core all the pages in this process. Stub version. - Copyright (C) 2001 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 <sys/types.h> -#include <sys/mman.h> -#include <errno.h> - -/* Cause all currently mapped pages of the process to be memory resident - until unlocked by a call to the `munlockall', until the process exits, - or until the process calls `execve'. */ - -int -mlockall (int flags) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (mlockall) -#include <stub-tag.h> diff --git a/misc/mmap.c b/misc/mmap.c deleted file mode 100644 index 43b25a06d2..0000000000 --- a/misc/mmap.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (C) 1994, 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 <sys/types.h> -#include <sys/mman.h> -#include <errno.h> - -/* Map addresses starting near ADDR and extending for LEN bytes. From - OFFSET into the file FD describes according to PROT and FLAGS. If ADDR - is nonzero, it is the desired mapping address. If the MAP_FIXED bit is - set in FLAGS, the mapping will be at ADDR exactly (which must be - page-aligned); otherwise the system chooses a convenient nearby address. - The return value is the actual mapping address chosen or MAP_FAILED - for errors (in which case `errno' is set). A successful `mmap' call - deallocates any previous mapping for the affected region. */ - -__ptr_t -__mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset) -{ - __set_errno (ENOSYS); - return MAP_FAILED; -} - -stub_warning (mmap) -#include <stub-tag.h> -weak_alias (__mmap, mmap) diff --git a/misc/mmap64.c b/misc/mmap64.c deleted file mode 100644 index 2c8aac808b..0000000000 --- a/misc/mmap64.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU 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 <sys/mman.h> -#include <sys/types.h> - -/* Map addresses starting near ADDR and extending for LEN bytes. From - OFFSET into the file FD describes according to PROT and FLAGS. If ADDR - is nonzero, it is the desired mapping address. If the MAP_FIXED bit is - set in FLAGS, the mapping will be at ADDR exactly (which must be - page-aligned); otherwise the system chooses a convenient nearby address. - The return value is the actual mapping address chosen or MAP_FAILED - for errors (in which case `errno' is set). A successful `mmap' call - deallocates any previous mapping for the affected region. */ - -__ptr_t -__mmap64 (__ptr_t addr, size_t len, int prot, int flags, int fd, - __off64_t offset) -{ - off_t small_offset = (off_t) offset; - - if (small_offset != offset) - { - /* We cannot do this since the offset is too large. */ - __set_errno (EOVERFLOW); - return MAP_FAILED; - } - - return __mmap (addr, len, prot, flags, fd, small_offset); -} - -weak_alias (__mmap64, mmap64) diff --git a/misc/mntent_r.c b/misc/mntent_r.c index 829750b395..1476c86ee2 100644 --- a/misc/mntent_r.c +++ b/misc/mntent_r.c @@ -1,6 +1,5 @@ /* Utilities for reading/writing fstab, mtab, etc. - Copyright (C) 1995-2000, 2001, 2002, 2003, 2006 - Free Software Foundation, Inc. + Copyright (C) 1995-2000, 2001, 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 @@ -279,11 +278,14 @@ __hasmntopt (const struct mntent *mnt, const char *opt) while ((p = strstr (rest, opt)) != NULL) { - if ((p == rest || p[-1] == ',') - && (p[optlen] == '\0' || p[optlen] == '=' || p[optlen] == ',')) + if (p == rest + || (p[-1] == ',' + && (p[optlen] == '\0' || + p[optlen] == '=' || + p[optlen] == ','))) return p; - rest = strchr (p, ','); + rest = strchr (rest, ','); if (rest == NULL) break; ++rest; diff --git a/misc/mprotect.c b/misc/mprotect.c deleted file mode 100644 index 9fefdfce71..0000000000 --- a/misc/mprotect.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 1994, 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 <sys/types.h> -#include <sys/mman.h> -#include <errno.h> - -/* Change the memory protection of the region starting at ADDR and - extending LEN bytes to PROT. Returns 0 if successful, -1 for errors - (and sets errno). */ - -int -__mprotect (__ptr_t addr, size_t len, int prot) -{ - __set_errno (ENOSYS); - return -1; -} -weak_alias (__mprotect, mprotect) - -stub_warning (mprotect) -#include <stub-tag.h> diff --git a/misc/msync.c b/misc/msync.c deleted file mode 100644 index 0ffd5c04f6..0000000000 --- a/misc/msync.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (C) 1994, 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 <sys/types.h> -#include <sys/mman.h> -#include <errno.h> - -/* Synchronize the region starting at ADDR and extending LEN bytes with the - file it maps. Filesystem operations on a file being mapped are - unpredictable before this is done. */ - -int -msync (__ptr_t addr, size_t len, int flags) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (msync) -#include <stub-tag.h> diff --git a/misc/munlock.c b/misc/munlock.c deleted file mode 100644 index 3c728c01d5..0000000000 --- a/misc/munlock.c +++ /dev/null @@ -1,34 +0,0 @@ -/* munlock -- undo the effects of prior mlock calls. Stub version. - Copyright (C) 2001 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 <sys/types.h> -#include <sys/mman.h> -#include <errno.h> - -/* Undo the effects on these whole pages of any prior mlock calls. */ - -int -munlock (const void *addr, size_t len) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (munlock) -#include <stub-tag.h> diff --git a/misc/munlockall.c b/misc/munlockall.c deleted file mode 100644 index ca7198265f..0000000000 --- a/misc/munlockall.c +++ /dev/null @@ -1,34 +0,0 @@ -/* munlockall -- undo the effects of all prior mlock calls. Stub version. - Copyright (C) 2001 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 <sys/types.h> -#include <sys/mman.h> -#include <errno.h> - -/* Undo the effects of all prior mlock calls in this process. */ - -int -munlockall (void) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (munlockall) -#include <stub-tag.h> diff --git a/misc/munmap.c b/misc/munmap.c deleted file mode 100644 index 4a78c324ad..0000000000 --- a/misc/munmap.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (C) 1994, 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 <sys/types.h> -#include <sys/mman.h> -#include <errno.h> - -/* Deallocate any mapping for the region starting at ADDR and extending LEN - bytes. Returns 0 if successful, -1 for errors (and sets errno). */ - -int -__munmap (__ptr_t addr, size_t len) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (munmap) -#include <stub-tag.h> -weak_alias (__munmap, munmap) diff --git a/misc/pselect.c b/misc/pselect.c deleted file mode 100644 index 80cf8be4b3..0000000000 --- a/misc/pselect.c +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright (C) 1996-1998,2001,2002,2003,2006 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. - - 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 <signal.h> -#include <stddef.h> /* For NULL. */ -#include <sys/time.h> -#include <sys/select.h> -#include <sysdep-cancel.h> - - -/* Check the first NFDS descriptors each in READFDS (if not NULL) for read - readiness, in WRITEFDS (if not NULL) for write readiness, and in EXCEPTFDS - (if not NULL) for exceptional conditions. If TIMEOUT is not NULL, time out - after waiting the interval specified therein. Additionally set the sigmask - SIGMASK for this call. Returns the number of ready descriptors, or -1 for - errors. */ -int -__pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, - const struct timespec *timeout, const sigset_t *sigmask) -{ - struct timeval tval; - int retval; - sigset_t savemask; - - /* Change nanosecond number to microseconds. This might mean losing - precision and therefore the `pselect` should be available. But - for now it is hardly found. */ - if (timeout != NULL) - TIMESPEC_TO_TIMEVAL (&tval, timeout); - - /* The setting and restoring of the signal mask and the select call - should be an atomic operation. This can't be done without kernel - help. */ - if (sigmask != NULL) - __sigprocmask (SIG_SETMASK, sigmask, &savemask); - - /* Note the pselect() is a cancellation point. But since we call - select() which itself is a cancellation point we do not have - to do anything here. */ - retval = __select (nfds, readfds, writefds, exceptfds, - timeout != NULL ? &tval : NULL); - - if (sigmask != NULL) - __sigprocmask (SIG_SETMASK, &savemask, NULL); - - return retval; -} -#ifndef __pselect -weak_alias (__pselect, pselect) -strong_alias (__pselect, __libc_pselect) -/* __select handles cancellation. */ -LIBC_CANCEL_HANDLED (); -#endif diff --git a/misc/ptrace.c b/misc/ptrace.c deleted file mode 100644 index 1825d57143..0000000000 --- a/misc/ptrace.c +++ /dev/null @@ -1,103 +0,0 @@ -/* Copyright (C) 1991, 92, 93, 95, 96, 97 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 <sys/ptrace.h> -#include <sys/types.h> -#include <stdarg.h> - -/* Perform process tracing functions. REQUEST is one of the values - in <sys/ptrace.h>, and determines the action to be taken. - For all requests except PTRACE_TRACEME, PID specifies the process to be - traced. - - PID and the other arguments described above for the various requests should - appear (those that are used for the particular request) as: - pid_t PID, void *ADDR, int DATA, void *ADDR2 - after PID. */ -int -ptrace (request) - enum __ptrace_request request; -{ - pid_t pid; - void *addr; - void *addr2; - int data; - va_list ap; - - switch (request) - { - case PTRACE_TRACEME: - case PTRACE_CONT: - case PTRACE_KILL: - case PTRACE_SINGLESTEP: - case PTRACE_ATTACH: - case PTRACE_DETACH: - break; - - case PTRACE_PEEKTEXT: - case PTRACE_PEEKDATA: - case PTRACE_PEEKUSER: - case PTRACE_GETREGS: - case PTRACE_SETREGS: -#ifdef PTRACE_GETFPREGS - case PTRACE_GETFPGEGS: -#endif - case PTRACE_SETFPREGS: - case PTRACE_GETFPAREGS: - case PTRACE_SETFPAREGS: - va_start(ap, request); - pid = va_arg(ap, pid_t); - addr = va_arg(ap, void *); - va_end(ap); - break; - - case PTRACE_POKETEXT: - case PTRACE_POKEDATA: - case PTRACE_POKEUSER: - va_start(ap, request); - pid = va_arg(ap, pid_t); - addr = va_arg(ap, void *); - data = va_arg(ap, int); - va_end(ap); - break; - - case PTRACE_READDATA: - case PTRACE_WRITEDATA: - case PTRACE_READTEXT: - case PTRACE_WRITETEXT: - va_start(ap, request); - pid = va_arg(ap, pid_t); - addr = va_arg(ap, void *); - data = va_arg(ap, int); - addr2 = va_arg(ap, void *); - va_end(ap); - break; - - default: - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} - - -stub_warning (ptrace) -#include <stub-tag.h> diff --git a/misc/qefgcvt_r.c b/misc/qefgcvt_r.c index a03ff748ef..d5b2a799b3 100644 --- a/misc/qefgcvt_r.c +++ b/misc/qefgcvt_r.c @@ -43,8 +43,6 @@ #endif #if LDBL_MIN_10_EXP == -37 # define FLOAT_MIN_10_NORM 1.0e-37L -#elif LDBL_MIN_10_EXP == -291 -# define FLOAT_MIN_10_NORM 1.0e-291L #elif LDBL_MIN_10_EXP == -307 # define FLOAT_MIN_10_NORM 1.0e-307L #elif LDBL_MIN_10_EXP == -4931 diff --git a/misc/readv.c b/misc/readv.c deleted file mode 100644 index b33444c036..0000000000 --- a/misc/readv.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (C) 1991,1995,1996,1997,1998,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 <unistd.h> -#include <sys/uio.h> - -/* Read data from file descriptor FD, and put the result in the - buffers described by VECTOR, which is a vector of COUNT `struct iovec's. - The buffers are filled in the order specified. - Operates just like `read' (see <unistd.h>) except that data are - put in VECTOR instead of a contiguous buffer. */ -ssize_t -__libc_readv (fd, vector, count) - int fd; - const struct iovec *vector; - int count; -{ - __set_errno (ENOSYS); - return -1; -} -strong_alias (__libc_readv, __readv) -weak_alias (__libc_readv, readv) - -stub_warning (readv) -#include <stub-tag.h> diff --git a/misc/reboot.c b/misc/reboot.c deleted file mode 100644 index 6036726c1f..0000000000 --- a/misc/reboot.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (C) 1992, 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 <errno.h> -#include <unistd.h> -#include <sys/reboot.h> - -/* Reboot the system. */ -int -reboot (howto) - int howto; -{ - __set_errno (ENOSYS); - return -1; -} - - -stub_warning (reboot) -#include <stub-tag.h> diff --git a/misc/remap_file_pages.c b/misc/remap_file_pages.c deleted file mode 100644 index 0f15ea44c2..0000000000 --- a/misc/remap_file_pages.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (C) 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 <sys/mman.h> -#include <errno.h> - -/* Remap arbitrary pages of a shared backing store within an existing - VMA. */ - -int -__remap_file_pages (void *start, size_t size, int prot, size_t pgoff, - int flags) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (remap_file_pages) -#include <stub-tag.h> -weak_alias (__remap_file_pages, remap_file_pages) diff --git a/misc/removexattr.c b/misc/removexattr.c deleted file mode 100644 index 8379ed10c8..0000000000 --- a/misc/removexattr.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 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 <sys/xattr.h> - -int -removexattr (const char *__path, const char *__name) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (removexattr) -#include <stub-tag.h> diff --git a/misc/revoke.c b/misc/revoke.c deleted file mode 100644 index fc757d80b4..0000000000 --- a/misc/revoke.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Revoke the access of all descriptors currently open on a file. - Copyright (C) 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 <unistd.h> -#include <errno.h> - -int -revoke (file) - const char *file; -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (revoke) -#include <stub-tag.h> diff --git a/misc/sbrk.c b/misc/sbrk.c deleted file mode 100644 index 0df60076cc..0000000000 --- a/misc/sbrk.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright (C) 1991,1995,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 <unistd.h> -#include <errno.h> - -/* Defined in brk.c. */ -extern void *__curbrk; -extern int __brk (void *addr); - -/* Defined in init-first.c. */ -extern int __libc_multiple_libcs attribute_hidden; - -/* Extend the process's data space by INCREMENT. - If INCREMENT is negative, shrink data space by - INCREMENT. - Return start of new space allocated, or -1 for errors. */ -void * -__sbrk (intptr_t increment) -{ - void *oldbrk; - - /* If this is not part of the dynamic library or the library is used - via dynamic loading in a statically linked program update - __curbrk from the kernel's brk value. That way two separate - instances of __brk and __sbrk can share the heap, returning - interleaved pieces of it. */ - if (__curbrk == NULL || __libc_multiple_libcs) - if (__brk (0) < 0) /* Initialize the break. */ - return (void *) -1; - - if (increment == 0) - return __curbrk; - - oldbrk = __curbrk; - if (__brk (oldbrk + increment) < 0) - return (void *) -1; - - return oldbrk; -} -libc_hidden_def (__sbrk) -weak_alias (__sbrk, sbrk) diff --git a/misc/select.c b/misc/select.c deleted file mode 100644 index 124f26aff7..0000000000 --- a/misc/select.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 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 <sys/time.h> -#include <sys/types.h> -#include <errno.h> - -/* Check the first NFDS descriptors each in READFDS (if not NULL) for read - readiness, in WRITEFDS (if not NULL) for write readiness, and in EXCEPTFDS - (if not NULL) for exceptional conditions. If TIMEOUT is not NULL, time out - after waiting the interval specified therein. Returns the number of ready - descriptors, or -1 for errors. */ -int -__select (nfds, readfds, writefds, exceptfds, timeout) - int nfds; - fd_set *readfds; - fd_set *writefds; - fd_set *exceptfds; - struct timeval *timeout; -{ - __set_errno (ENOSYS); - return -1; -} -libc_hidden_def (__select) -stub_warning (select) - -weak_alias (__select, select) -#include <stub-tag.h> diff --git a/misc/setdomain.c b/misc/setdomain.c deleted file mode 100644 index 4d9cbb7cac..0000000000 --- a/misc/setdomain.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (C) 1994, 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 <errno.h> -#include <unistd.h> - -/* Set the name of the current YP domain to NAME, which is LEN bytes long. - This call is restricted to the super-user. */ -int -setdomainname (name, len) - const char *name; - size_t len; -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (setdomainname) -#include <stub-tag.h> diff --git a/misc/setegid.c b/misc/setegid.c deleted file mode 100644 index 5b5e2cf4bb..0000000000 --- a/misc/setegid.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 1992,1994,1995,1996,1997,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 <unistd.h> - -/* Set the effective group ID of the calling process to GID. */ -int -setegid (gid) - __gid_t gid; -{ - __set_errno (ENOSYS); - return -1; -} -libc_hidden_def (setegid) -stub_warning (setegid) -#include <stub-tag.h> diff --git a/misc/seteuid.c b/misc/seteuid.c deleted file mode 100644 index 689000f993..0000000000 --- a/misc/seteuid.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 1992, 1995, 1996, 1997, 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 <unistd.h> - -/* Set the effective user ID of the calling process to UID. */ -int -seteuid (uid) - __uid_t uid; -{ - __set_errno (ENOSYS); - return -1; -} -libc_hidden_def (seteuid) -stub_warning (seteuid) -#include <stub-tag.h> diff --git a/misc/sethostid.c b/misc/sethostid.c deleted file mode 100644 index 6f393de06a..0000000000 --- a/misc/sethostid.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 <errno.h> -#include <unistd.h> - -/* Set the current machine's Internet number to ID. - This call is restricted to the super-user. */ -int -sethostid (id) - long int id; -{ - __set_errno (ENOSYS); - return -1; -} - - -stub_warning (sethostid) -#include <stub-tag.h> diff --git a/misc/sethostname.c b/misc/sethostname.c deleted file mode 100644 index 1f65b1e759..0000000000 --- a/misc/sethostname.c +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 <errno.h> -#include <unistd.h> - -/* Set the name of the current host to NAME, which is LEN bytes long. - This call is restricted to the super-user. */ -int -sethostname (name, len) - const char *name; - size_t len; -{ - __set_errno (ENOSYS); - return -1; -} - - -stub_warning (sethostname) -#include <stub-tag.h> diff --git a/misc/setregid.c b/misc/setregid.c deleted file mode 100644 index f8f33d1da7..0000000000 --- a/misc/setregid.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 1991, 1992, 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 <errno.h> -#include <unistd.h> -#include <sys/types.h> - -/* Set the real group ID of the calling process to RGID, - and the effective group ID of the calling process to EGID. */ -int -__setregid (effective_gid, real_gid) - gid_t effective_gid; - gid_t real_gid; -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (setregid) - -weak_alias (__setregid, setregid) -#include <stub-tag.h> diff --git a/misc/setreuid.c b/misc/setreuid.c deleted file mode 100644 index cce2d9d52b..0000000000 --- a/misc/setreuid.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 1991, 1992, 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 <errno.h> -#include <unistd.h> -#include <sys/types.h> - -/* Set the real user ID of the calling process to RUID, - and the effective user ID of the calling process to EUID. */ -int -__setreuid (effective_uid, real_uid) - uid_t effective_uid; - uid_t real_uid; -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (setreuid) - -weak_alias (__setreuid, setreuid) -#include <stub-tag.h> diff --git a/misc/setxattr.c b/misc/setxattr.c deleted file mode 100644 index 5b8743a7ce..0000000000 --- a/misc/setxattr.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 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 <sys/xattr.h> - -int -setxattr (const char *__path, const char *__name, - const void *__value, size_t __size, int __flags) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (setxattr) -#include <stub-tag.h> diff --git a/misc/sstk.c b/misc/sstk.c deleted file mode 100644 index 6cba9b7fba..0000000000 --- a/misc/sstk.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 2004 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> - -/* Increase the size of the stack by INCREMENT, - and return the address of the bottom of the stack. */ - -void *sstk (int increment) __THROW; - -void * -sstk (increment) - int increment; -{ - __set_errno (ENOSYS); - return (void *) -1; -} - -stub_warning (sstk) -#include <stub-tag.h> diff --git a/misc/stty.c b/misc/stty.c deleted file mode 100644 index 49c569a77b..0000000000 --- a/misc/stty.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (C) 1991, 1992, 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 <errno.h> -#include <sgtty.h> -#include <stddef.h> - -/* Set the terminal parameters associated with FD to *PARAMS. */ -int -stty (fd, params) - int fd; - const struct sgttyb *params; -{ - if (params == NULL) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} - -stub_warning (stty) -#include <stub-tag.h> diff --git a/misc/swapoff.c b/misc/swapoff.c deleted file mode 100644 index 033d841d95..0000000000 --- a/misc/swapoff.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 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 <errno.h> -#include <unistd.h> - -/* Stop using block special device PATH for swapping. */ -int -swapoff (const char *path) -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (swapoff) -#include <stub-tag.h> diff --git a/misc/swapon.c b/misc/swapon.c deleted file mode 100644 index 910781fa93..0000000000 --- a/misc/swapon.c +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 <errno.h> -#include <unistd.h> -#include <sys/swap.h> - -/* Make the block special device PATH available to the system for swapping. - This call is restricted to the super-user. */ -int -swapon (path) - const char *path; -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (swapon) -#include <stub-tag.h> diff --git a/misc/sync.c b/misc/sync.c deleted file mode 100644 index 5ccdb5d5bf..0000000000 --- a/misc/sync.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 2001 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 <unistd.h> - -/* Make all changes done to all files actually appear on disk. */ -void -sync () -{ - __set_errno (ENOSYS); -} - - -stub_warning (sync) -#include <stub-tag.h> diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h index ce5e83d571..475cf62961 100644 --- a/misc/sys/cdefs.h +++ b/misc/sys/cdefs.h @@ -1,5 +1,4 @@ -/* Copyright (C) 1992-2001, 2002, 2004, 2005, 2006 - Free Software Foundation, Inc. +/* Copyright (C) 1992-2001, 2002, 2004 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 @@ -131,7 +130,6 @@ /* Fortify support. */ #define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1) #define __bos0(ptr) __builtin_object_size (ptr, 0) -#define __warndecl(name, msg) extern void name (void) /* Support for flexible arrays. */ @@ -257,28 +255,6 @@ # define __nonnull(params) #endif -/* If fortification mode, we warn about unused results of certain - function calls which can lead to problems. */ -#if __GNUC_PREREQ (3,4) -# define __attribute_warn_unused_result__ \ - __attribute__ ((__warn_unused_result__)) -# if __USE_FORTIFY_LEVEL > 0 -# define __wur __attribute_warn_unused_result__ -# endif -#else -# define __attribute_warn_unused_result__ /* empty */ -#endif -#ifndef __wur -# define __wur /* Ignore */ -#endif - -/* Forces a function to be always inlined. */ -#if __GNUC_PREREQ (3,2) -# define __always_inline __inline __attribute__ ((__always_inline__)) -#else -# define __always_inline __inline -#endif - /* It is possible to compile containing GCC extensions even if GCC is run in pedantic mode if the uses are carefully marked using the `__extension__' keyword. But this is not generally available before @@ -310,29 +286,4 @@ # endif #endif -#include <bits/wordsize.h> - -#if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH -# define __LDBL_COMPAT 1 -# ifdef __REDIRECT -# define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias) -# define __LDBL_REDIR(name, proto) \ - __LDBL_REDIR1 (name, proto, __nldbl_##name) -# define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias) -# define __LDBL_REDIR_NTH(name, proto) \ - __LDBL_REDIR1_NTH (name, proto, __nldbl_##name) -# define __LDBL_REDIR1_DECL(name, alias) \ - extern __typeof (name) name __asm (__ASMNAME (#alias)); -# define __LDBL_REDIR_DECL(name) \ - extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name)); -# endif -#endif -#if !defined __LDBL_COMPAT || !defined __REDIRECT -# define __LDBL_REDIR1(name, proto, alias) name proto -# define __LDBL_REDIR(name, proto) name proto -# define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW -# define __LDBL_REDIR_NTH(name, proto) name proto __THROW -# define __LDBL_REDIR_DECL(name) -#endif - #endif /* sys/cdefs.h */ diff --git a/misc/sys/mman.h b/misc/sys/mman.h index 4cd8a3fe72..ae4dd64fc6 100644 --- a/misc/sys/mman.h +++ b/misc/sys/mman.h @@ -1,5 +1,5 @@ /* Definitions for BSD-style memory management. - Copyright (C) 1994-2000, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 1994-2000, 2003, 2004 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 @@ -116,6 +116,12 @@ extern int mlockall (int __flags) __THROW; extern int munlockall (void) __THROW; #ifdef __USE_MISC +/* Remap pages mapped by the range [ADDR,ADDR+OLD_LEN) to new length + NEW_LEN. If MAY_MOVE is MREMAP_MAYMOVE the returned address may + differ from ADDR. */ +extern void *mremap (void *__addr, size_t __old_len, size_t __new_len, + int __may_move) __THROW; + /* mincore returns the memory residency status of the pages in the current process's address space specified by [start, start + len). The status is returned in a vector of bytes. The least significant @@ -123,16 +129,6 @@ extern int munlockall (void) __THROW; it is zero. */ extern int mincore (void *__start, size_t __len, unsigned char *__vec) __THROW; -#endif - -#ifdef __USE_GNU -/* Remap pages mapped by the range [ADDR,ADDR+OLD_LEN) to new length - NEW_LEN. If MREMAP_MAYMOVE is set in FLAGS the returned address - may differ from ADDR. If MREMAP_FIXED is set in FLAGS the function - takes another paramter which is a fixed address at which the block - resides after a successful call. */ -extern void *mremap (void *__addr, size_t __old_len, size_t __new_len, - int __flags, ...) __THROW; /* Remap arbitrary pages of a shared backing store within an existing VMA. */ diff --git a/misc/sys/queue.h b/misc/sys/queue.h index b0e6b38c19..5b6e2a0a23 100644 --- a/misc/sys/queue.h +++ b/misc/sys/queue.h @@ -10,7 +10,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors + * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -26,46 +26,29 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)queue.h 8.5 (Berkeley) 8/20/94 + * @(#)queue.h 8.3 (Berkeley) 12/13/93 */ -#ifndef _SYS_QUEUE_H_ -#define _SYS_QUEUE_H_ +#ifndef _SYS_QUEUE_H +#define _SYS_QUEUE_H 1 /* - * This file defines five types of data structures: singly-linked lists, - * lists, simple queues, tail queues, and circular queues. - * - * A singly-linked list is headed by a single forward pointer. The - * elements are singly linked for minimum space and pointer manipulation - * overhead at the expense of O(n) removal for arbitrary elements. New - * elements can be added to the list after an existing element or at the - * head of the list. Elements being removed from the head of the list - * should use the explicit macro for this purpose for optimum - * efficiency. A singly-linked list may only be traversed in the forward - * direction. Singly-linked lists are ideal for applications with large - * datasets and few or no removals or for implementing a LIFO queue. + * This file defines three types of data structures: lists, tail queues, + * and circular queues. * * A list is headed by a single forward pointer (or an array of forward * pointers for a hash table header). The elements are doubly linked * so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before - * or after an existing element or at the head of the list. A list - * may only be traversed in the forward direction. - * - * A simple queue is headed by a pair of pointers, one the head of the - * list and the other to the tail of the list. The elements are singly - * linked to save space, so elements can only be removed from the - * head of the list. New elements can be added to the list after - * an existing element, at the head of the list, or at the end of the - * list. A simple queue may only be traversed in the forward direction. + * traverse the list. New elements can be added to the list after + * an existing element or at the head of the list. A list may only be + * traversed in the forward direction. * * A tail queue is headed by a pair of pointers, one to the head of the * list and the other to the tail of the list. The elements are doubly * linked so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before or - * after an existing element, at the head of the list, or at the end of - * the list. A tail queue may be traversed in either direction. + * traverse the list. New elements can be added to the list after + * an existing element, at the head of the list, or at the end of the + * list. A tail queue may only be traversed in the forward direction. * * A circle queue is headed by a pair of pointers, one to the head of the * list and the other to the tail of the list. The elements are doubly @@ -81,15 +64,12 @@ /* * List definitions. */ -#define LIST_HEAD(name, type) \ +#define LIST_HEAD(name, type) \ struct name { \ struct type *lh_first; /* first element */ \ } -#define LIST_HEAD_INITIALIZER(head) \ - { NULL } - -#define LIST_ENTRY(type) \ +#define LIST_ENTRY(type) \ struct { \ struct type *le_next; /* next element */ \ struct type **le_prev; /* address of previous next element */ \ @@ -98,307 +78,73 @@ struct { \ /* * List functions. */ -#define LIST_INIT(head) do { \ +#define LIST_INIT(head) { \ (head)->lh_first = NULL; \ -} while (/*CONSTCOND*/0) +} -#define LIST_INSERT_AFTER(listelm, elm, field) do { \ +#define LIST_INSERT_AFTER(listelm, elm, field) { \ if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ (listelm)->field.le_next->field.le_prev = \ &(elm)->field.le_next; \ (listelm)->field.le_next = (elm); \ (elm)->field.le_prev = &(listelm)->field.le_next; \ -} while (/*CONSTCOND*/0) - -#define LIST_INSERT_BEFORE(listelm, elm, field) do { \ - (elm)->field.le_prev = (listelm)->field.le_prev; \ - (elm)->field.le_next = (listelm); \ - *(listelm)->field.le_prev = (elm); \ - (listelm)->field.le_prev = &(elm)->field.le_next; \ -} while (/*CONSTCOND*/0) +} -#define LIST_INSERT_HEAD(head, elm, field) do { \ +#define LIST_INSERT_HEAD(head, elm, field) { \ if (((elm)->field.le_next = (head)->lh_first) != NULL) \ (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ (head)->lh_first = (elm); \ (elm)->field.le_prev = &(head)->lh_first; \ -} while (/*CONSTCOND*/0) +} -#define LIST_REMOVE(elm, field) do { \ +#define LIST_REMOVE(elm, field) { \ if ((elm)->field.le_next != NULL) \ (elm)->field.le_next->field.le_prev = \ (elm)->field.le_prev; \ *(elm)->field.le_prev = (elm)->field.le_next; \ -} while (/*CONSTCOND*/0) - -#define LIST_FOREACH(var, head, field) \ - for ((var) = ((head)->lh_first); \ - (var); \ - (var) = ((var)->field.le_next)) - -/* - * List access methods. - */ -#define LIST_EMPTY(head) ((head)->lh_first == NULL) -#define LIST_FIRST(head) ((head)->lh_first) -#define LIST_NEXT(elm, field) ((elm)->field.le_next) - - -/* - * Singly-linked List definitions. - */ -#define SLIST_HEAD(name, type) \ -struct name { \ - struct type *slh_first; /* first element */ \ -} - -#define SLIST_HEAD_INITIALIZER(head) \ - { NULL } - -#define SLIST_ENTRY(type) \ -struct { \ - struct type *sle_next; /* next element */ \ -} - -/* - * Singly-linked List functions. - */ -#define SLIST_INIT(head) do { \ - (head)->slh_first = NULL; \ -} while (/*CONSTCOND*/0) - -#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ - (elm)->field.sle_next = (slistelm)->field.sle_next; \ - (slistelm)->field.sle_next = (elm); \ -} while (/*CONSTCOND*/0) - -#define SLIST_INSERT_HEAD(head, elm, field) do { \ - (elm)->field.sle_next = (head)->slh_first; \ - (head)->slh_first = (elm); \ -} while (/*CONSTCOND*/0) - -#define SLIST_REMOVE_HEAD(head, field) do { \ - (head)->slh_first = (head)->slh_first->field.sle_next; \ -} while (/*CONSTCOND*/0) - -#define SLIST_REMOVE(head, elm, type, field) do { \ - if ((head)->slh_first == (elm)) { \ - SLIST_REMOVE_HEAD((head), field); \ - } \ - else { \ - struct type *curelm = (head)->slh_first; \ - while(curelm->field.sle_next != (elm)) \ - curelm = curelm->field.sle_next; \ - curelm->field.sle_next = \ - curelm->field.sle_next->field.sle_next; \ - } \ -} while (/*CONSTCOND*/0) - -#define SLIST_FOREACH(var, head, field) \ - for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next) - -/* - * Singly-linked List access methods. - */ -#define SLIST_EMPTY(head) ((head)->slh_first == NULL) -#define SLIST_FIRST(head) ((head)->slh_first) -#define SLIST_NEXT(elm, field) ((elm)->field.sle_next) - - -/* - * Singly-linked Tail queue declarations. - */ -#define STAILQ_HEAD(name, type) \ -struct name { \ - struct type *stqh_first; /* first element */ \ - struct type **stqh_last; /* addr of last next element */ \ -} - -#define STAILQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).stqh_first } - -#define STAILQ_ENTRY(type) \ -struct { \ - struct type *stqe_next; /* next element */ \ -} - -/* - * Singly-linked Tail queue functions. - */ -#define STAILQ_INIT(head) do { \ - (head)->stqh_first = NULL; \ - (head)->stqh_last = &(head)->stqh_first; \ -} while (/*CONSTCOND*/0) - -#define STAILQ_INSERT_HEAD(head, elm, field) do { \ - if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \ - (head)->stqh_last = &(elm)->field.stqe_next; \ - (head)->stqh_first = (elm); \ -} while (/*CONSTCOND*/0) - -#define STAILQ_INSERT_TAIL(head, elm, field) do { \ - (elm)->field.stqe_next = NULL; \ - *(head)->stqh_last = (elm); \ - (head)->stqh_last = &(elm)->field.stqe_next; \ -} while (/*CONSTCOND*/0) - -#define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ - if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\ - (head)->stqh_last = &(elm)->field.stqe_next; \ - (listelm)->field.stqe_next = (elm); \ -} while (/*CONSTCOND*/0) - -#define STAILQ_REMOVE_HEAD(head, field) do { \ - if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \ - (head)->stqh_last = &(head)->stqh_first; \ -} while (/*CONSTCOND*/0) - -#define STAILQ_REMOVE(head, elm, type, field) do { \ - if ((head)->stqh_first == (elm)) { \ - STAILQ_REMOVE_HEAD((head), field); \ - } else { \ - struct type *curelm = (head)->stqh_first; \ - while (curelm->field.stqe_next != (elm)) \ - curelm = curelm->field.stqe_next; \ - if ((curelm->field.stqe_next = \ - curelm->field.stqe_next->field.stqe_next) == NULL) \ - (head)->stqh_last = &(curelm)->field.stqe_next; \ - } \ -} while (/*CONSTCOND*/0) - -#define STAILQ_FOREACH(var, head, field) \ - for ((var) = ((head)->stqh_first); \ - (var); \ - (var) = ((var)->field.stqe_next)) - -/* - * Singly-linked Tail queue access methods. - */ -#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL) -#define STAILQ_FIRST(head) ((head)->stqh_first) -#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) - - -/* - * Simple queue definitions. - */ -#define SIMPLEQ_HEAD(name, type) \ -struct name { \ - struct type *sqh_first; /* first element */ \ - struct type **sqh_last; /* addr of last next element */ \ -} - -#define SIMPLEQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).sqh_first } - -#define SIMPLEQ_ENTRY(type) \ -struct { \ - struct type *sqe_next; /* next element */ \ } /* - * Simple queue functions. - */ -#define SIMPLEQ_INIT(head) do { \ - (head)->sqh_first = NULL; \ - (head)->sqh_last = &(head)->sqh_first; \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \ - if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \ - (head)->sqh_last = &(elm)->field.sqe_next; \ - (head)->sqh_first = (elm); \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \ - (elm)->field.sqe_next = NULL; \ - *(head)->sqh_last = (elm); \ - (head)->sqh_last = &(elm)->field.sqe_next; \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ - if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\ - (head)->sqh_last = &(elm)->field.sqe_next; \ - (listelm)->field.sqe_next = (elm); \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_REMOVE_HEAD(head, field) do { \ - if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \ - (head)->sqh_last = &(head)->sqh_first; \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_REMOVE(head, elm, type, field) do { \ - if ((head)->sqh_first == (elm)) { \ - SIMPLEQ_REMOVE_HEAD((head), field); \ - } else { \ - struct type *curelm = (head)->sqh_first; \ - while (curelm->field.sqe_next != (elm)) \ - curelm = curelm->field.sqe_next; \ - if ((curelm->field.sqe_next = \ - curelm->field.sqe_next->field.sqe_next) == NULL) \ - (head)->sqh_last = &(curelm)->field.sqe_next; \ - } \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_FOREACH(var, head, field) \ - for ((var) = ((head)->sqh_first); \ - (var); \ - (var) = ((var)->field.sqe_next)) - -/* - * Simple queue access methods. - */ -#define SIMPLEQ_EMPTY(head) ((head)->sqh_first == NULL) -#define SIMPLEQ_FIRST(head) ((head)->sqh_first) -#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next) - - -/* * Tail queue definitions. */ -#define _TAILQ_HEAD(name, type, qual) \ +#define TAILQ_HEAD(name, type) \ struct name { \ - qual type *tqh_first; /* first element */ \ - qual type *qual *tqh_last; /* addr of last next element */ \ + struct type *tqh_first; /* first element */ \ + struct type **tqh_last; /* addr of last next element */ \ } -#define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,) - -#define TAILQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).tqh_first } -#define _TAILQ_ENTRY(type, qual) \ +#define TAILQ_ENTRY(type) \ struct { \ - qual type *tqe_next; /* next element */ \ - qual type *qual *tqe_prev; /* address of previous next element */\ + struct type *tqe_next; /* next element */ \ + struct type **tqe_prev; /* address of previous next element */ \ } -#define TAILQ_ENTRY(type) _TAILQ_ENTRY(struct type,) /* * Tail queue functions. */ -#define TAILQ_INIT(head) do { \ +#define TAILQ_INIT(head) { \ (head)->tqh_first = NULL; \ (head)->tqh_last = &(head)->tqh_first; \ -} while (/*CONSTCOND*/0) +} -#define TAILQ_INSERT_HEAD(head, elm, field) do { \ +#define TAILQ_INSERT_HEAD(head, elm, field) { \ if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ - (head)->tqh_first->field.tqe_prev = \ + (elm)->field.tqe_next->field.tqe_prev = \ &(elm)->field.tqe_next; \ else \ (head)->tqh_last = &(elm)->field.tqe_next; \ (head)->tqh_first = (elm); \ (elm)->field.tqe_prev = &(head)->tqh_first; \ -} while (/*CONSTCOND*/0) +} -#define TAILQ_INSERT_TAIL(head, elm, field) do { \ +#define TAILQ_INSERT_TAIL(head, elm, field) { \ (elm)->field.tqe_next = NULL; \ (elm)->field.tqe_prev = (head)->tqh_last; \ *(head)->tqh_last = (elm); \ (head)->tqh_last = &(elm)->field.tqe_next; \ -} while (/*CONSTCOND*/0) +} -#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ +#define TAILQ_INSERT_AFTER(head, listelm, elm, field) { \ if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ (elm)->field.tqe_next->field.tqe_prev = \ &(elm)->field.tqe_next; \ @@ -406,60 +152,27 @@ struct { \ (head)->tqh_last = &(elm)->field.tqe_next; \ (listelm)->field.tqe_next = (elm); \ (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ - (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ - (elm)->field.tqe_next = (listelm); \ - *(listelm)->field.tqe_prev = (elm); \ - (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ -} while (/*CONSTCOND*/0) +} -#define TAILQ_REMOVE(head, elm, field) do { \ +#define TAILQ_REMOVE(head, elm, field) { \ if (((elm)->field.tqe_next) != NULL) \ (elm)->field.tqe_next->field.tqe_prev = \ (elm)->field.tqe_prev; \ else \ (head)->tqh_last = (elm)->field.tqe_prev; \ *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_FOREACH(var, head, field) \ - for ((var) = ((head)->tqh_first); \ - (var); \ - (var) = ((var)->field.tqe_next)) - -#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ - for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \ - (var); \ - (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last))) - -/* - * Tail queue access methods. - */ -#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) -#define TAILQ_FIRST(head) ((head)->tqh_first) -#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) - -#define TAILQ_LAST(head, headname) \ - (*(((struct headname *)((head)->tqh_last))->tqh_last)) -#define TAILQ_PREV(elm, headname, field) \ - (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) - +} /* * Circular queue definitions. */ -#define CIRCLEQ_HEAD(name, type) \ +#define CIRCLEQ_HEAD(name, type) \ struct name { \ struct type *cqh_first; /* first element */ \ struct type *cqh_last; /* last element */ \ } -#define CIRCLEQ_HEAD_INITIALIZER(head) \ - { (void *)&head, (void *)&head } - -#define CIRCLEQ_ENTRY(type) \ +#define CIRCLEQ_ENTRY(type) \ struct { \ struct type *cqe_next; /* next element */ \ struct type *cqe_prev; /* previous element */ \ @@ -468,12 +181,12 @@ struct { \ /* * Circular queue functions. */ -#define CIRCLEQ_INIT(head) do { \ +#define CIRCLEQ_INIT(head) { \ (head)->cqh_first = (void *)(head); \ (head)->cqh_last = (void *)(head); \ -} while (/*CONSTCOND*/0) +} -#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ +#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) { \ (elm)->field.cqe_next = (listelm)->field.cqe_next; \ (elm)->field.cqe_prev = (listelm); \ if ((listelm)->field.cqe_next == (void *)(head)) \ @@ -481,9 +194,9 @@ struct { \ else \ (listelm)->field.cqe_next->field.cqe_prev = (elm); \ (listelm)->field.cqe_next = (elm); \ -} while (/*CONSTCOND*/0) +} -#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ +#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) { \ (elm)->field.cqe_next = (listelm); \ (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ if ((listelm)->field.cqe_prev == (void *)(head)) \ @@ -491,9 +204,9 @@ struct { \ else \ (listelm)->field.cqe_prev->field.cqe_next = (elm); \ (listelm)->field.cqe_prev = (elm); \ -} while (/*CONSTCOND*/0) +} -#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ +#define CIRCLEQ_INSERT_HEAD(head, elm, field) { \ (elm)->field.cqe_next = (head)->cqh_first; \ (elm)->field.cqe_prev = (void *)(head); \ if ((head)->cqh_last == (void *)(head)) \ @@ -501,9 +214,9 @@ struct { \ else \ (head)->cqh_first->field.cqe_prev = (elm); \ (head)->cqh_first = (elm); \ -} while (/*CONSTCOND*/0) +} -#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ +#define CIRCLEQ_INSERT_TAIL(head, elm, field) { \ (elm)->field.cqe_next = (void *)(head); \ (elm)->field.cqe_prev = (head)->cqh_last; \ if ((head)->cqh_first == (void *)(head)) \ @@ -511,9 +224,9 @@ struct { \ else \ (head)->cqh_last->field.cqe_next = (elm); \ (head)->cqh_last = (elm); \ -} while (/*CONSTCOND*/0) +} -#define CIRCLEQ_REMOVE(head, elm, field) do { \ +#define CIRCLEQ_REMOVE(head, elm, field) { \ if ((elm)->field.cqe_next == (void *)(head)) \ (head)->cqh_last = (elm)->field.cqe_prev; \ else \ @@ -524,34 +237,5 @@ struct { \ else \ (elm)->field.cqe_prev->field.cqe_next = \ (elm)->field.cqe_next; \ -} while (/*CONSTCOND*/0) - -#define CIRCLEQ_FOREACH(var, head, field) \ - for ((var) = ((head)->cqh_first); \ - (var) != (const void *)(head); \ - (var) = ((var)->field.cqe_next)) - -#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \ - for ((var) = ((head)->cqh_last); \ - (var) != (const void *)(head); \ - (var) = ((var)->field.cqe_prev)) - -/* - * Circular queue access methods. - */ -#define CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head)) -#define CIRCLEQ_FIRST(head) ((head)->cqh_first) -#define CIRCLEQ_LAST(head) ((head)->cqh_last) -#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next) -#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev) - -#define CIRCLEQ_LOOP_NEXT(head, elm, field) \ - (((elm)->field.cqe_next == (void *)(head)) \ - ? ((head)->cqh_first) \ - : (elm->field.cqe_next)) -#define CIRCLEQ_LOOP_PREV(head, elm, field) \ - (((elm)->field.cqe_prev == (void *)(head)) \ - ? ((head)->cqh_last) \ - : (elm->field.cqe_prev)) - +} #endif /* sys/queue.h */ diff --git a/misc/sys/syslog.h b/misc/sys/syslog.h index 4ed57c2787..ace88a0979 100644 --- a/misc/sys/syslog.h +++ b/misc/sys/syslog.h @@ -36,8 +36,8 @@ #define __need___va_list #include <stdarg.h> -/* This file defines _PATH_LOG. */ -#include <bits/syslog-path.h> + +#define _PATH_LOG "/dev/log" /* * priorities/facilities are encoded into a single 32-bit quantity, where the @@ -168,7 +168,7 @@ CODE facilitynames[] = __BEGIN_DECLS -/* Close descriptor used to write to system logger. +/* Close desriptor used to write to system logger. This function is a possible cancellation point and therefore not marked with __THROW. */ @@ -188,7 +188,7 @@ extern int setlogmask (int __mask) __THROW; This function is a possible cancellation point and therefore not marked with __THROW. */ extern void syslog (int __pri, __const char *__fmt, ...) - __attribute__ ((__format__ (__printf__, 2, 3))); + __attribute__ ((__format__(__printf__, 2, 3))); #ifdef __USE_BSD /* Generate a log message using FMT and using arguments pointed to by AP. @@ -198,16 +198,7 @@ extern void syslog (int __pri, __const char *__fmt, ...) or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern void vsyslog (int __pri, __const char *__fmt, __gnuc_va_list __ap) - __attribute__ ((__format__ (__printf__, 2, 0))); -#endif - - -/* Define some macros helping to catch buffer overflows. */ -#if __USE_FORTIFY_LEVEL > 0 && !defined __cplusplus -# include <bits/syslog.h> -#endif -#ifdef __LDBL_COMPAT -# include <bits/syslog-ldbl.h> + __attribute__ ((__format__(__printf__, 2, 0))); #endif __END_DECLS diff --git a/misc/syscall.c b/misc/syscall.c deleted file mode 100644 index ad78a06b73..0000000000 --- a/misc/syscall.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (C) 1993, 1994, 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 <sysdep.h> -#include <errno.h> -#include <unistd.h> - -/* Do system call CALLNO, passing it the remaining arguments. - This only makes sense in certain operating systems. */ - -long int -syscall (callno) - long int callno; -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (syscall) -#include <stub-tag.h> diff --git a/misc/syslog.c b/misc/syslog.c index 5781b4a964..6916356da7 100644 --- a/misc/syslog.c +++ b/misc/syslog.c @@ -35,7 +35,6 @@ static char sccsid[] = "@(#)syslog.c 8.4 (Berkeley) 3/18/94"; #include <sys/socket.h> #include <sys/syslog.h> #include <sys/uio.h> -#include <sys/un.h> #include <netdb.h> #include <errno.h> @@ -58,8 +57,6 @@ static char sccsid[] = "@(#)syslog.c 8.4 (Berkeley) 3/18/94"; #endif #include <libio/iolibio.h> -#include <math_ldbl_opt.h> - #define ftell(s) INTUSE(_IO_ftell) (s) static int LogType = SOCK_DGRAM; /* type of socket connection */ @@ -76,13 +73,8 @@ __libc_lock_define_initialized (static, syslog_lock) static void openlog_internal(const char *, int, int) internal_function; static void closelog_internal(void); -#ifndef NO_SIGPIPE static void sigpipe_handler (int); -#endif -#ifndef send_flags -# define send_flags 0 -#endif struct cleanup_arg { @@ -93,13 +85,11 @@ struct cleanup_arg static void cancel_handler (void *ptr) { -#ifndef NO_SIGPIPE /* Restore the old signal handler. */ struct cleanup_arg *clarg = (struct cleanup_arg *) ptr; if (clarg != NULL && clarg->oldaction != NULL) __sigaction (SIGPIPE, clarg->oldaction, NULL); -#endif /* Free the lock. */ __libc_lock_unlock (syslog_lock); @@ -111,29 +101,32 @@ cancel_handler (void *ptr) * print message on log file; output is intended for syslogd(8). */ void -__syslog(int pri, const char *fmt, ...) +#if __STDC__ +syslog(int pri, const char *fmt, ...) +#else +syslog(pri, fmt, va_alist) + int pri; + char *fmt; + va_dcl +#endif { va_list ap; +#if __STDC__ va_start(ap, fmt); - __vsyslog_chk(pri, -1, fmt, ap); +#else + va_start(ap); +#endif + vsyslog(pri, fmt, ap); va_end(ap); } -ldbl_hidden_def (__syslog, syslog) -ldbl_strong_alias (__syslog, syslog) +libc_hidden_def (syslog) void -__syslog_chk(int pri, int flag, const char *fmt, ...) -{ +vsyslog(pri, fmt, ap) + int pri; + register const char *fmt; va_list ap; - - va_start(ap, fmt); - __vsyslog_chk(pri, flag, fmt, ap); - va_end(ap); -} - -void -__vsyslog_chk(int pri, int flag, const char *fmt, va_list ap) { struct tm now_tm; time_t now; @@ -142,10 +135,8 @@ __vsyslog_chk(int pri, int flag, const char *fmt, va_list ap) char *buf = 0; size_t bufsize = 0; size_t prioff, msgoff; -#ifndef NO_SIGPIPE struct sigaction action, oldaction; int sigpipe; -#endif int saved_errno = errno; char failbuf[3 * sizeof (pid_t) + sizeof "out of memory []"]; @@ -199,7 +190,7 @@ __vsyslog_chk(int pri, int flag, const char *fmt, va_list ap) - f->_IO_write_ptr, "%h %e %T ", __localtime_r (&now, &now_tm), - _nl_C_locobj_ptr); + &_nl_C_locobj); msgoff = ftell (f); if (LogTag == NULL) LogTag = __progname; @@ -218,10 +209,7 @@ __vsyslog_chk(int pri, int flag, const char *fmt, va_list ap) /* We have the header. Print the user's format into the buffer. */ - if (flag == -1) - vfprintf (f, fmt, ap); - else - __vfprintf_chk (f, flag, fmt, ap); + vfprintf (f, fmt, ap); /* Close the memory stream; this will finalize the data into a malloc'd buffer in BUF. */ @@ -259,7 +247,6 @@ __vsyslog_chk(int pri, int flag, const char *fmt, va_list ap) __libc_cleanup_push (cancel_handler, &clarg); __libc_lock_lock (syslog_lock); -#ifndef NO_SIGPIPE /* Prepare for a broken connection. */ memset (&action, 0, sizeof (action)); action.sa_handler = sigpipe_handler; @@ -267,7 +254,6 @@ __vsyslog_chk(int pri, int flag, const char *fmt, va_list ap) sigpipe = __sigaction (SIGPIPE, &action, &oldaction); if (sigpipe == 0) clarg.oldaction = &oldaction; -#endif /* Get connected, output the message to the local logger. */ if (!connected) @@ -278,7 +264,7 @@ __vsyslog_chk(int pri, int flag, const char *fmt, va_list ap) if (LogType == SOCK_STREAM) ++bufsize; - if (!connected || __send(LogFile, buf, bufsize, send_flags) < 0) + if (!connected || __send(LogFile, buf, bufsize, 0) < 0) { if (connected) { @@ -288,7 +274,7 @@ __vsyslog_chk(int pri, int flag, const char *fmt, va_list ap) openlog_internal(LogTag, LogStat | LOG_NDELAY, 0); } - if (!connected || __send(LogFile, buf, bufsize, send_flags) < 0) + if (!connected || __send(LogFile, buf, bufsize, 0) < 0) { closelog_internal (); /* attempt re-open next time */ /* @@ -306,10 +292,8 @@ __vsyslog_chk(int pri, int flag, const char *fmt, va_list ap) } } -#ifndef NO_SIGPIPE if (sigpipe == 0) __sigaction (SIGPIPE, &oldaction, (struct sigaction *) NULL); -#endif /* End of critical section. */ __libc_cleanup_pop (0); @@ -318,17 +302,9 @@ __vsyslog_chk(int pri, int flag, const char *fmt, va_list ap) if (buf != failbuf) free (buf); } -libc_hidden_def (__vsyslog_chk) - -void -__vsyslog(int pri, const char *fmt, va_list ap) -{ - __vsyslog_chk (pri, -1, fmt, ap); -} -ldbl_hidden_def (__vsyslog, vsyslog) -ldbl_strong_alias (__vsyslog, vsyslog) +libc_hidden_def (vsyslog) -static struct sockaddr_un SyslogAddr; /* AF_UNIX address of local logger */ +static struct sockaddr SyslogAddr; /* AF_UNIX address of local logger */ static void @@ -344,9 +320,9 @@ openlog_internal(const char *ident, int logstat, int logfac) int retry = 0; while (retry < 2) { if (LogFile == -1) { - SyslogAddr.sun_family = AF_UNIX; - (void)strncpy(SyslogAddr.sun_path, _PATH_LOG, - sizeof(SyslogAddr.sun_path)); + SyslogAddr.sa_family = AF_UNIX; + (void)strncpy(SyslogAddr.sa_data, _PATH_LOG, + sizeof(SyslogAddr.sa_data)); if (LogStat & LOG_NDELAY) { if ((LogFile = __socket(AF_UNIX, LogType, 0)) == -1) @@ -392,13 +368,11 @@ openlog (const char *ident, int logstat, int logfac) __libc_cleanup_pop (1); } -#ifndef NO_SIGPIPE static void sigpipe_handler (int signo) { closelog_internal (); } -#endif static void closelog_internal() diff --git a/misc/truncate.c b/misc/truncate.c deleted file mode 100644 index 6d0f0c3bcb..0000000000 --- a/misc/truncate.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 2004 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 <sys/types.h> -#include <errno.h> - -/* Truncate PATH to LENGTH bytes. */ -int -__truncate (path, length) - const char *path; - off_t length; -{ - __set_errno (ENOSYS); - return -1; -} -weak_alias (__truncate, truncate) - -stub_warning (truncate) -#include <stub-tag.h> diff --git a/misc/truncate64.c b/misc/truncate64.c deleted file mode 100644 index d7e80dc3ae..0000000000 --- a/misc/truncate64.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU 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 <sys/types.h> -#include <errno.h> -#include <unistd.h> - -/* Truncate PATH to LENGTH bytes. */ -int -truncate64 (path, length) - const char *path; - off64_t length; -{ - if ((off_t) length != length) - { - __set_errno (EINVAL); - return -1; - } - return truncate (path, (off_t) length); -} diff --git a/misc/tsearch.c b/misc/tsearch.c index 1e94d64595..7c3a0aaa78 100644 --- a/misc/tsearch.c +++ b/misc/tsearch.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997, 2000, 2006 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>, 1997. @@ -285,12 +285,11 @@ __tsearch (const void *key, void **vrootp, __compar_fn_t compar) q->key = key; /* initialize new node */ q->red = 1; q->left = q->right = NULL; - - if (nextp != rootp) - /* There may be two red edges in a row now, which we must avoid by - rotating the tree. */ - maybe_split_for_insert (nextp, rootp, parentp, r, p_r, 1); } + if (nextp != rootp) + /* There may be two red edges in a row now, which we must avoid by + rotating the tree. */ + maybe_split_for_insert (nextp, rootp, parentp, r, p_r, 1); return q; } @@ -447,7 +446,7 @@ __tdelete (const void *key, void **vrootp, __compar_fn_t compar) /* Q is R's brother, P is R's parent. The subtree with root R has one black edge less than the subtree with root Q. */ q = p->right; - if (q->red) + if (q != NULL && q->red) { /* If Q is red, we know that P is black. We rotate P left so that Q becomes the top node in the tree, with P below @@ -535,7 +534,7 @@ __tdelete (const void *key, void **vrootp, __compar_fn_t compar) { /* Comments: see above. */ q = p->left; - if (q->red) + if (q != NULL && q->red) { q->red = 0; p->red = 1; diff --git a/misc/tst-error1.c b/misc/tst-error1.c deleted file mode 100644 index e84843ed2f..0000000000 --- a/misc/tst-error1.c +++ /dev/null @@ -1,26 +0,0 @@ -#include <error.h> -#include <mcheck.h> -#include <stdio.h> -#include <string.h> -#include <wchar.h> - -static int -do_test (int argc, char *argv[]) -{ - mtrace (); - (void) freopen (argc == 1 ? "/dev/stdout" : argv[1], "a", stderr); - /* Orient the stream. */ - fwprintf (stderr, L"hello world\n"); - char buf[20000]; - static const char str[] = "hello world! "; - for (int i = 0; i < 1000; ++i) - memcpy (&buf[i * (sizeof (str) - 1)], str, sizeof (str)); - error (0, 0, str); - error (0, 0, buf); - error (0, 0, buf); - error (0, 0, str); - return 0; -} - -#define TEST_FUNCTION do_test (argc, argv) -#include "../test-skeleton.c" diff --git a/misc/tst-insremque.c b/misc/tst-insremque.c deleted file mode 100644 index 9f17055ef5..0000000000 --- a/misc/tst-insremque.c +++ /dev/null @@ -1,61 +0,0 @@ -#include <search.h> -#include <stdio.h> -#include <string.h> - -#define CHECK(cond) \ - do \ - if (! (cond)) \ - { \ - printf ("Condition " #cond " not true on line %d\n", __LINE__); \ - ret = 1; \ - } \ - while (0) - -static int -do_test (void) -{ - struct qelem elements[4]; - int ret = 0; - - /* Linear list. */ - memset (elements, 0xff, sizeof (elements)); - insque (&elements[0], NULL); - remque (&elements[0]); - insque (&elements[0], NULL); - insque (&elements[2], &elements[0]); - insque (&elements[1], &elements[0]); - insque (&elements[3], &elements[2]); - remque (&elements[2]); - insque (&elements[2], &elements[0]); - CHECK (elements[0].q_back == NULL); - CHECK (elements[0].q_forw == &elements[2]); - CHECK (elements[1].q_back == &elements[2]); - CHECK (elements[1].q_forw == &elements[3]); - CHECK (elements[2].q_back == &elements[0]); - CHECK (elements[2].q_forw == &elements[1]); - CHECK (elements[3].q_back == &elements[1]); - CHECK (elements[3].q_forw == NULL); - - /* Circular list. */ - memset (elements, 0xff, sizeof (elements)); - elements[0].q_back = &elements[0]; - elements[0].q_forw = &elements[0]; - insque (&elements[2], &elements[0]); - insque (&elements[1], &elements[0]); - insque (&elements[3], &elements[2]); - remque (&elements[2]); - insque (&elements[2], &elements[0]); - CHECK (elements[0].q_back == &elements[3]); - CHECK (elements[0].q_forw == &elements[2]); - CHECK (elements[1].q_back == &elements[2]); - CHECK (elements[1].q_forw == &elements[3]); - CHECK (elements[2].q_back == &elements[0]); - CHECK (elements[2].q_forw == &elements[1]); - CHECK (elements[3].q_back == &elements[1]); - CHECK (elements[3].q_forw == &elements[0]); - - return ret; -} - -#define TEST_FUNCTION do_test () -#include "../test-skeleton.c" diff --git a/misc/tst-mntent2.c b/misc/tst-mntent2.c deleted file mode 100644 index 6c25e0127c..0000000000 --- a/misc/tst-mntent2.c +++ /dev/null @@ -1,41 +0,0 @@ -#include <mntent.h> -#include <stdio.h> -#include <string.h> - - -int -main (void) -{ - int result = 0; - struct mntent mef; - - mef.mnt_fsname = strdupa ("/dev/sdf6"); - mef.mnt_dir = strdupa ("/some dir"); - mef.mnt_type = strdupa ("ext3"); - mef.mnt_opts = strdupa ("opt1,opt2,noopt=6,rw,norw,brw"); - mef.mnt_freq = 1; - mef.mnt_passno = 2; - -#define TEST(opt, found) \ - if (!!hasmntopt (&mef, (opt)) != (found)) \ - { \ - printf ("Option %s was %sfound\n", (opt), (found) ? "not " : ""); \ - result = 1; \ - } - - TEST ("opt1", 1) - TEST ("opt2", 1) - TEST ("noopt", 1) - TEST ("rw", 1) - TEST ("norw", 1) - TEST ("brw", 1) - TEST ("opt", 0) - TEST ("oopt", 0) - TEST ("w", 0) - TEST ("r", 0) - TEST ("br", 0) - TEST ("nor", 0) - TEST ("or", 0) - - return result; -} diff --git a/misc/tst-pselect.c b/misc/tst-pselect.c deleted file mode 100644 index 35d51d8ee0..0000000000 --- a/misc/tst-pselect.c +++ /dev/null @@ -1,128 +0,0 @@ -#include <errno.h> -#include <signal.h> -#include <stdio.h> -#include <unistd.h> -#include <sys/select.h> -#include <sys/wait.h> - - -static volatile int handler_called; - -static void -handler (int sig) -{ - handler_called = 1; -} - - -static int -do_test (void) -{ - struct sigaction sa; - sa.sa_handler = handler; - sa.sa_flags = 0; - sigemptyset (&sa.sa_mask); - - if (sigaction (SIGUSR1, &sa, NULL) != 0) - { - puts ("sigaction failed"); - return 1; - } - - sa.sa_handler = SIG_IGN; - sa.sa_flags = SA_NOCLDWAIT; - - if (sigaction (SIGCHLD, &sa, NULL) != 0) - { - puts ("2nd sigaction failed"); - return 1; - } - - if (sigblock (sigmask (SIGUSR1)) != 0) - { - puts ("sigblock failed"); - return 1; - } - - int fds[2][2]; - - if (pipe (fds[0]) != 0 || pipe (fds[1]) != 0) - { - puts ("pipe failed"); - return 1; - } - - fd_set rfds; - FD_ZERO (&rfds); - - sigset_t ss; - sigprocmask (SIG_SETMASK, NULL, &ss); - sigdelset (&ss, SIGUSR1); - - struct timespec to = { .tv_sec = 0, .tv_nsec = 500000000 }; - - pid_t parent = getpid (); - pid_t p = fork (); - if (p == 0) - { - close (fds[0][1]); - close (fds[1][0]); - - FD_SET (fds[0][0], &rfds); - - int e; - do - { - if (getppid () != parent) - exit (2); - - errno = 0; - e = pselect (fds[0][0] + 1, &rfds, NULL, NULL, &to, &ss); - } - while (e == 0); - - if (e != -1) - { - puts ("child: pselect did not fail"); - return 0; - } - if (errno != EINTR) - { - puts ("child: pselect did not set errno to EINTR"); - return 0; - } - - TEMP_FAILURE_RETRY (write (fds[1][1], "foo", 3)); - - exit (0); - } - - close (fds[0][0]); - close (fds[1][1]); - - FD_SET (fds[1][0], &rfds); - - kill (p, SIGUSR1); - - int e = pselect (fds[1][0] + 1, &rfds, NULL, NULL, NULL, &ss); - if (e == -1) - { - puts ("parent: pselect failed"); - return 1; - } - if (e != 1) - { - puts ("parent: pselect did not report readable fd"); - return 1; - } - if (!FD_ISSET (fds[1][0], &rfds)) - { - puts ("parent: pselect reports wrong fd"); - return 1; - } - - return 0; -} - -#define TEST_FUNCTION do_test () -#include "../test-skeleton.c" diff --git a/misc/ualarm.c b/misc/ualarm.c deleted file mode 100644 index 4ca0847576..0000000000 --- a/misc/ualarm.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 1999 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 <unistd.h> - -/* Set an alarm to go off (generating a SIGALRM signal) in VALUE microseconds. - If INTERVAL is nonzero, when the alarm goes off, the timer is reset to go - off every INTERVAL microseconds thereafter. - - Returns the number of microseconds remaining before the alarm. */ -useconds_t -ualarm (value, interval) - useconds_t value; - useconds_t interval; -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (ualarm) -#include <stub-tag.h> diff --git a/misc/usleep.c b/misc/usleep.c deleted file mode 100644 index 8f419f901a..0000000000 --- a/misc/usleep.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 1991,1995,1996,1997,1999,2001 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 <unistd.h> - -/* Sleep USECONDS microseconds, or until a previously set timer goes off. */ -int -usleep (useconds) - useconds_t useconds; -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (usleep) -#include <stub-tag.h> diff --git a/misc/ustat.c b/misc/ustat.c deleted file mode 100644 index 0aeee620c5..0000000000 --- a/misc/ustat.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Return info on filesystem. - Copyright (C) 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 <unistd.h> -#include <errno.h> -#include <sys/ustat.h> - -int -ustat (dev, ust) - dev_t dev; - struct ustat * ust; -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (ustat) -#include <stub-tag.h> diff --git a/misc/utimes.c b/misc/utimes.c deleted file mode 100644 index e4a6f0427f..0000000000 --- a/misc/utimes.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (C) 1991,95,96,97,2000,02 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 <sys/time.h> -#include <errno.h> -#include <stddef.h> - -/* Change the access time of FILE to TVP[0] and - the modification time of FILE to TVP[1]. */ -int -__utimes (file, tvp) - const char *file; - const struct timeval tvp[2]; -{ - if (file == NULL) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} - -weak_alias (__utimes, utimes) - -stub_warning (utimes) -#include <stub-tag.h> diff --git a/misc/vhangup.c b/misc/vhangup.c deleted file mode 100644 index 329fddbf24..0000000000 --- a/misc/vhangup.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 <errno.h> -#include <unistd.h> - -/* Revoke access permissions to all processes currently communicating - with the control terminal, and then send a SIGHUP signal to the process - group of the control terminal. */ -int -vhangup () -{ - __set_errno (ENOSYS); - return -1; -} - -stub_warning (vhangup) -#include <stub-tag.h> diff --git a/misc/writev.c b/misc/writev.c deleted file mode 100644 index d424c72143..0000000000 --- a/misc/writev.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (C) 1991,1995,1996,1997,1998,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 <unistd.h> -#include <sys/uio.h> - -/* Write data pointed by the buffers described by VECTOR, which - is a vector of COUNT `struct iovec's, to file descriptor FD. - The data is written in the order specified. - Operates just like `write' (see <unistd.h>) except that the data - are taken from VECTOR instead of a contiguous buffer. */ -ssize_t -__libc_writev (fd, vector, count) - int fd; - const struct iovec *vector; - int count; -{ - __set_errno (ENOSYS); - return -1; -} -strong_alias (__libc_writev, __writev) -weak_alias (__libc_writev, writev) - -stub_warning (writev) -#include <stub-tag.h> |