diff options
49 files changed, 1114 insertions, 576 deletions
@@ -1,3 +1,106 @@ +Wed Dec 18 03:31:58 1996 Ulrich Drepper <drepper@cygnus.com> + + * dirent/scandir.c: Undo change from Mon Dec 2 15:32:15 1996. + The stream is private and usages outside glibc don't care about + reentrancy. + * io/fts.c: Likewise. + * io/ftw.c: Likewise. + * sysdeps/posix/getcwd.c: Likewise. + * sysdeps/posix/ttyname.c: Likewise. + * sysdeps/posix/ttyname_r.c: Likewise. + * sysdeps/posix/glob.c: Likewise. + + * libio/iovsprintf.c: Add cast to prevent warning. + * libio/iovsscanf.c: Likewise. + + * libio/libioP.h: Define mmap to __mmap and munmap to __munmap + to keep namespace clean. + + * new-malloc/malloc.c: Update to last version from Wolfram Gloger. + Add hooks and check functions from old GNU malloc. + * new-malloc/malloc.h: Likewise. + + * nis/ypclnt.c: Remove prototype for xdr_free. + * snrpc/rpc/xdr.h: Add prototype for xdr_free. + + * manual/nss.texi: Correct description of default values and don't + meantion NSS as an add-on. + + * nss/grp-lookup.c: Provide default value as + "compat [NOTFOUND=return] files". + * nss/pwd-lookup.c: Likewise. + * nss/spwd-lookup.c: Likewise. + * nss/network-lookup.c: Correct default to + "dns [!UNAVAIL=return] files". + * nss/nsswitch.c: Change default-default value to "nis + [NOTFOUND=return] files" since compat is only available for group, + passwd, and shadow. + + * stdlib/on_exit.c (on_exit): Rename to __on_exit and make old name + a weak alias. + * stdlib/stdlib.h: Add prototype for __on_exit. + + * sysdeps/unix/sysv/linux/schedbits.h: Add prototype for __clone. + + * time/Makefile: Undo change from Sun Dec 8 06:56:49 1996. + The new malloc now has mcheck. + * time/ap.c: Likewise. + + * time/tzset.c (__tzset): Rename to __tzset_internal. + (tzset): Rename to __tzset. Make tzset a weak alias for __tzset. + * time/localtime.c: Use __tzset_internal not __tzset. + * time/strftime.c [_LIBC]: Define tzname as __tzname and tzset + as __tzset to prevent namespace pollution. + + * wctype/iswctype.h (icwctype): Rename to __iswctype. Make iswctype + a weak alias of __iswctype. + * wctype/wctype.h: Add prototype for __iswctype. + (iswalnum, iswalpha, iswcntrl, iswdigit, iswlower, iswgraph, + iswprint, iswpunct, iswspace, iswupper, iswxdigit, iswblank): + Use __iswctype for the test, not iswctype. + +1996-12-16 Paul Eggert <eggert@twinsun.com> + + * hurd/hurd/sigpreempt.h + (struct hurd_signal_preemptor.preemptor, _hurdsig_preemptors), + hurd/hurd/signal.h (struct hurd_sigstate.preemptors), + hurd/hurdfault.c, hurd/hurdfault.h (_hurdsig_fault_preemptor), + hurd/hurdsig.c (_hurdsig_preempters): + Renamed to fix spelling from `preempter' to `preemptor'. + All uses changed. + +1996-12-15 Paul Eggert <eggert@twinsun.com> + + * ctime.c (ctime): Return asctime (localtime (t)), as the C + standard requires. + +Tue Dec 17 02:05:48 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> + + * sysdeps/mach/libc-lock.h (__libc_lock_trylock): Invert return + value because Mach/cthreads uses the opposite convention from + Posix/glibc. + +Mon Dec 16 22:41:01 1996 Ulrich Drepper <drepper@cygnus.com> + + * stdio-common/fcloseall.c: Correct test of already_called. + Reported by Thomas Bushnell, n/BSG. + +Mon Dec 16 14:52:07 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> + + * mach/lock-intern.h (__mutex_try_lock): New function. + +Sun Dec 15 16:33:44 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * termios/sys/ttydefaults.h (TTYDEF_OFLAG): Only use OXTABS if + defined, else XTABS. + (CEOL, CSTATUS): Use _POSIX_VDISABLE if defined. + +Sun Dec 15 11:56:19 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * sysdeps/unix/sysv/linux/m68k/mremap.S: New file. + * sysdeps/unix/sysv/linux/m68k/Dist: Distribute it. + * sysdeps/unix/sysv/linux/m68k/Makefile (sysdep_routines): Add mremap. + Mon Dec 16 02:15:42 1996 Ulrich Drepper <drepper@cygnus.com> Make sure tzset() sets always tzname[]. diff --git a/dirent/scandir.c b/dirent/scandir.c index b1fc55fbb2..ac625d89f3 100644 --- a/dirent/scandir.c +++ b/dirent/scandir.c @@ -31,7 +31,7 @@ scandir (dir, namelist, select, cmp) DIR *dp = opendir (dir); struct dirent **v = NULL; size_t vsize = 0, i; - struct dirent dirbuf, *d; + struct dirent *d; int save; if (dp == NULL) @@ -41,7 +41,7 @@ scandir (dir, namelist, select, cmp) __set_errno (0); i = 0; - while (__readdir_r (dp, &dirbuf, &d) >= 0) + while ((d = __readdir (dp)) != NULL) if (select == NULL || (*select) (d)) { size_t dsize; diff --git a/hurd/catch-signal.c b/hurd/catch-signal.c index c148193f71..a03785328a 100644 --- a/hurd/catch-signal.c +++ b/hurd/catch-signal.c @@ -1,21 +1,21 @@ /* Convenience function to catch expected signals during an operation. -Copyright (C) 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. + Copyright (C) 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 -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #include <hurd/signal.h> #include <hurd/sigpreempt.h> @@ -25,14 +25,14 @@ Cambridge, MA 02139, USA. */ error_t hurd_catch_signal (sigset_t sigset, unsigned long int first, unsigned long int last, - error_t (*operate) (struct hurd_signal_preempter *), + error_t (*operate) (struct hurd_signal_preemptor *), sighandler_t handler) { jmp_buf buf; void throw (int signo, long int sigcode, struct sigcontext *scp) { longjmp (buf, scp->sc_error ?: EGRATUITOUS); } - struct hurd_signal_preempter preempter = + struct hurd_signal_preemptor preemptor = { sigset, first, last, NULL, handler == SIG_ERR ? (sighandler_t) &throw : handler, @@ -50,23 +50,23 @@ hurd_catch_signal (sigset_t sigset, if (error == 0) { - /* Install a signal preempter for the thread. */ + /* Install a signal preemptor for the thread. */ __spin_lock (&ss->lock); - preempter.next = ss->preempters; - ss->preempters = &preempter; + preemptor.next = ss->preemptors; + ss->preemptors = &preemptor; __spin_unlock (&ss->lock); /* Try the operation that might crash. */ - (*operate) (&preempter); + (*operate) (&preemptor); } /* Either FUNCTION completed happily and ERROR is still zero, or it hit an expected signal and `throw' made setjmp return the signal error - code in ERROR. Now we can remove the preempter and return. */ + code in ERROR. Now we can remove the preemptor and return. */ __spin_lock (&ss->lock); - assert (ss->preempters == &preempter); - ss->preempters = preempter.next; + assert (ss->preemptors == &preemptor); + ss->preemptors = preemptor.next; __spin_unlock (&ss->lock); return error; @@ -76,7 +76,7 @@ hurd_catch_signal (sigset_t sigset, error_t hurd_safe_memset (void *dest, int byte, size_t nbytes) { - error_t operate (struct hurd_signal_preempter *preempter) + error_t operate (struct hurd_signal_preemptor *preemptor) { memset (dest, byte, nbytes); return 0; @@ -90,7 +90,7 @@ hurd_safe_memset (void *dest, int byte, size_t nbytes) error_t hurd_safe_copyout (void *dest, const void *src, size_t nbytes) { - error_t operate (struct hurd_signal_preempter *preempter) + error_t operate (struct hurd_signal_preemptor *preemptor) { memcpy (dest, src, nbytes); return 0; @@ -103,7 +103,7 @@ hurd_safe_copyout (void *dest, const void *src, size_t nbytes) error_t hurd_safe_copyin (void *dest, const void *src, size_t nbytes) { - error_t operate (struct hurd_signal_preempter *preempter) + error_t operate (struct hurd_signal_preemptor *preemptor) { memcpy (dest, src, nbytes); return 0; @@ -120,18 +120,18 @@ hurd_safe_memmove (void *dest, const void *src, size_t nbytes) void throw (int signo, long int sigcode, struct sigcontext *scp) { longjmp (buf, scp->sc_error ?: EGRATUITOUS); } - struct hurd_signal_preempter src_preempter = + struct hurd_signal_preemptor src_preemptor = { sigmask (SIGBUS) | sigmask (SIGSEGV), (vm_address_t) src, (vm_address_t) src + nbytes, NULL, (sighandler_t) &throw, }; - struct hurd_signal_preempter dest_preempter = + struct hurd_signal_preemptor dest_preemptor = { sigmask (SIGBUS) | sigmask (SIGSEGV), (vm_address_t) dest, (vm_address_t) dest + nbytes, NULL, (sighandler_t) &throw, - &src_preempter + &src_preemptor }; struct hurd_sigstate *const ss = _hurd_self_sigstate (); @@ -142,10 +142,10 @@ hurd_safe_memmove (void *dest, const void *src, size_t nbytes) if (error == 0) { - /* Install a signal preempter for the thread. */ + /* Install a signal preemptor for the thread. */ __spin_lock (&ss->lock); - src_preempter.next = ss->preempters; - ss->preempters = &dest_preempter; + src_preemptor.next = ss->preemptors; + ss->preemptors = &dest_preemptor; __spin_unlock (&ss->lock); /* Do the copy; it might fault. */ @@ -154,13 +154,12 @@ hurd_safe_memmove (void *dest, const void *src, size_t nbytes) /* Either memmove completed happily and ERROR is still zero, or it hit an expected signal and `throw' made setjmp return the signal error - code in ERROR. Now we can remove the preempter and return. */ + code in ERROR. Now we can remove the preemptor and return. */ __spin_lock (&ss->lock); - assert (ss->preempters == &dest_preempter); - ss->preempters = src_preempter.next; + assert (ss->preemptors == &dest_preemptor); + ss->preemptors = src_preemptor.next; __spin_unlock (&ss->lock); return error; } - diff --git a/hurd/hurd/signal.h b/hurd/hurd/signal.h index 7dee18c1ed..468599c581 100644 --- a/hurd/hurd/signal.h +++ b/hurd/hurd/signal.h @@ -1,21 +1,21 @@ /* Implementing POSIX.1 signals under the Hurd. -Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. + Copyright (C) 1993, 1994, 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 -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #ifndef _HURD_SIGNAL_H @@ -40,7 +40,7 @@ Cambridge, MA 02139, USA. */ #include <cthreads.h> /* For `struct mutex'. */ #include <spin-lock.h> #include <hurd/threadvar.h> /* We cache sigstate in a threadvar. */ -struct hurd_signal_preempter; /* <hurd/sigpreempt.h> */ +struct hurd_signal_preemptor; /* <hurd/sigpreempt.h> */ /* Full details of a signal. */ @@ -71,11 +71,11 @@ struct hurd_sigstate struct sigaction actions[NSIG]; struct sigaltstack sigaltstack; - /* Chain of thread-local signal preempters; see <hurd/sigpreempt.h>. + /* Chain of thread-local signal preemptors; see <hurd/sigpreempt.h>. Each element of this chain is in local stack storage, and the chain parallels the stack: the head of this chain is in the innermost stack frame, and each next element in an outermore frame. */ - struct hurd_signal_preempter *preempters; + struct hurd_signal_preemptor *preemptors; /* For each signal that may be pending, the details to deliver it with. */ struct hurd_signal_detail pending_data[NSIG]; diff --git a/hurd/hurd/sigpreempt.h b/hurd/hurd/sigpreempt.h index 1bd6589e32..44572a6d27 100644 --- a/hurd/hurd/sigpreempt.h +++ b/hurd/hurd/sigpreempt.h @@ -1,21 +1,21 @@ /* Preemption of Hurd signals before POSIX.1 semantics take over. -Copyright (C) 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. + Copyright (C) 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 -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #ifndef _HURD_SIGPREEMPT_H @@ -25,7 +25,7 @@ Cambridge, MA 02139, USA. */ struct hurd_sigstate; /* <hurd/signal.h> */ struct hurd_signal_detail; /* <hurd/signal.h> */ -struct hurd_signal_preempter +struct hurd_signal_preemptor { /* These members select which signals this structure will apply to. The rest of the structure is only consulted if these match. */ @@ -34,35 +34,35 @@ struct hurd_signal_preempter /* This function will be called (with SS->lock held) to decide what to do with the signal described. It may modify the codes of the signal - passed. If the return value is SIG_ERR, the next matching preempter + passed. If the return value is SIG_ERR, the next matching preemptor is tried, or the normal handling is done for the signal (which may - have been changed by the preempter function). Otherwise, the signal + have been changed by the preemptor function). Otherwise, the signal is processed as if the return value were its handler setting. */ - sighandler_t (*preempter) (struct hurd_signal_preempter *preempter, + sighandler_t (*preemptor) (struct hurd_signal_preemptor *preemptor, struct hurd_sigstate *ss, int *signo, struct hurd_signal_detail *detail); - /* If PREEMPTER is null, act as if it returned HANDLER. */ + /* If PREEMPTOR is null, act as if it returned HANDLER. */ sighandler_t handler; - struct hurd_signal_preempter *next; /* List structure. */ + struct hurd_signal_preemptor *next; /* List structure. */ }; -#define HURD_PREEMPT_SIGNAL_P(preempter, signo, sigcode) \ - (((preempter)->signals & sigmask (signo)) && \ - (sigcode) >= (preempter)->first && (sigcode) <= (preempter)->last) +#define HURD_PREEMPT_SIGNAL_P(preemptor, signo, sigcode) \ + (((preemptor)->signals & sigmask (signo)) && \ + (sigcode) >= (preemptor)->first && (sigcode) <= (preemptor)->last) -/* Signal preempters applying to all threads; locked by _hurd_siglock. */ -extern struct hurd_signal_preempter *_hurdsig_preempters; +/* Signal preemptors applying to all threads; locked by _hurd_siglock. */ +extern struct hurd_signal_preemptor *_hurdsig_preemptors; extern sigset_t _hurdsig_preempted_set; -/* The caller must initialize all members of *PREEMPTER except `next'. - The preempter is registered on the global list. */ -void hurd_preempt_signals (struct hurd_signal_preempter *preempter); +/* The caller must initialize all members of *PREEMPTOR except `next'. + The preemptor is registered on the global list. */ +void hurd_preempt_signals (struct hurd_signal_preemptor *preemptor); -/* Remove a preempter registered with hurd_preempt_signals. */ -void hurd_unpreempt_signals (struct hurd_signal_preempter *preempter); +/* Remove a preemptor registered with hurd_preempt_signals. */ +void hurd_unpreempt_signals (struct hurd_signal_preemptor *preemptor); /* Call *OPERATE and return its value. If a signal in SIGSET with a sigcode @@ -72,13 +72,13 @@ void hurd_unpreempt_signals (struct hurd_signal_preempter *preempter); hurd_catch_signal returns the sc_error value from the signal (or EGRATUITOUS if that is zero). - The preempter structure is passed to *OPERATE, which may modify its + The preemptor structure is passed to *OPERATE, which may modify its sigcode range or functions at any time during which it is guaranteed no signal in SIGSET will arrive. */ error_t hurd_catch_signal (sigset_t sigset, unsigned long int first, unsigned long int last, - error_t (*operate) (struct hurd_signal_preempter *), + error_t (*operate) (struct hurd_signal_preemptor *), sighandler_t handler); diff --git a/hurd/hurdfault.c b/hurd/hurdfault.c index e1b06a3f9f..2865ff7d34 100644 --- a/hurd/hurdfault.c +++ b/hurd/hurdfault.c @@ -1,21 +1,21 @@ /* Handle faults in the signal thread. -Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. + Copyright (C) 1994, 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 -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #include <hurd.h> #include <hurd/signal.h> @@ -29,7 +29,7 @@ Cambridge, MA 02139, USA. */ #include <assert.h> jmp_buf _hurdsig_fault_env; -struct hurd_signal_preempter _hurdsig_fault_preempter; +struct hurd_signal_preemptor _hurdsig_fault_preemptor; static mach_port_t forward_sigexc; @@ -56,7 +56,7 @@ _hurdsig_fault_catch_exception_raise (mach_port_t port, codes into a signal number and subcode. */ _hurd_exception2signal (&d, &signo); - return HURD_PREEMPT_SIGNAL_P (&_hurdsig_fault_preempter, signo, d.code) + return HURD_PREEMPT_SIGNAL_P (&_hurdsig_fault_preemptor, signo, d.code) ? 0 : EGREGIOUS; } @@ -97,7 +97,7 @@ faulted (void) if (reply.result) __libc_fatal ("BUG: unexpected fault in signal thread\n"); - _hurdsig_fault_preempter.signals = 0; + _hurdsig_fault_preemptor.signals = 0; longjmp (_hurdsig_fault_env, 1); } @@ -158,4 +158,3 @@ _hurdsig_fault_init (void) __mach_port_deallocate (__mach_task_self (), sigexc); assert_perror (err); } - diff --git a/hurd/hurdfault.h b/hurd/hurdfault.h index 4b6aaed6ae..aa03568d29 100644 --- a/hurd/hurdfault.h +++ b/hurd/hurdfault.h @@ -1,21 +1,21 @@ /* Declarations for handling faults in the signal thread. -Copyright (C) 1994, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. + Copyright (C) 1994, 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 -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #ifndef _HURD_FAULT_H #define _HURD_FAULT_H @@ -29,18 +29,18 @@ Cambridge, MA 02139, USA. */ does arrive. */ #define _hurdsig_catch_fault(sigset, firstcode, lastcode) \ - (_hurdsig_fault_preempter.signals = (sigset), \ - _hurdsig_fault_preempter.first = (long int) (firstcode), \ - _hurdsig_fault_preempter.last = (long int) (lastcode), \ + (_hurdsig_fault_preemptor.signals = (sigset), \ + _hurdsig_fault_preemptor.first = (long int) (firstcode), \ + _hurdsig_fault_preemptor.last = (long int) (lastcode), \ setjmp (_hurdsig_fault_env)) /* Call this at the end of a section protected by _hurdsig_catch_fault. */ #define _hurdsig_end_catch_fault() \ - (_hurdsig_fault_preempter.signals = 0) + (_hurdsig_fault_preemptor.signals = 0) extern jmp_buf _hurdsig_fault_env; -extern struct hurd_signal_preempter _hurdsig_fault_preempter; +extern struct hurd_signal_preemptor _hurdsig_fault_preemptor; #define _hurdsig_catch_memory_fault(object) \ diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c index 30e2919d82..b30134ca5b 100644 --- a/hurd/hurdsig.c +++ b/hurd/hurdsig.c @@ -78,7 +78,7 @@ _hurd_thread_sigstate (thread_t thread) __sigemptyset (&ss->blocked); __sigemptyset (&ss->pending); memset (&ss->sigaltstack, 0, sizeof (ss->sigaltstack)); - ss->preempters = NULL; + ss->preemptors = NULL; ss->suspended = 0; ss->intr_port = MACH_PORT_NULL; ss->context = NULL; @@ -421,7 +421,7 @@ abort_all_rpcs (int signo, struct machine_thread_all_state *state, int live) } } -struct hurd_signal_preempter *_hurdsig_preempters; +struct hurd_signal_preemptor *_hurdsig_preemptors; sigset_t _hurdsig_preempted_set; /* Mask of stop signals. */ @@ -439,7 +439,7 @@ _hurd_internal_post_signal (struct hurd_sigstate *ss, error_t err; struct machine_thread_all_state thread_state; enum { stop, ignore, core, term, handle } act; - struct hurd_signal_preempter *pe; + struct hurd_signal_preemptor *pe; sighandler_t handler; sigset_t pending; int ss_suspended; @@ -542,16 +542,16 @@ _hurd_internal_post_signal (struct hurd_sigstate *ss, critical sections. */ handler = SIG_ERR; - for (pe = ss->preempters; pe && handler == SIG_ERR; pe = pe->next) + for (pe = ss->preemptors; pe && handler == SIG_ERR; pe = pe->next) if (HURD_PREEMPT_SIGNAL_P (pe, signo, detail->code)) - handler = (*pe->preempter) (pe, ss, &signo, detail); + handler = (*pe->preemptor) (pe, ss, &signo, detail); if (handler == SIG_ERR && (__sigmask (signo) & _hurdsig_preempted_set)) { __mutex_lock (&_hurd_siglock); - for (pe = _hurdsig_preempters; pe && handler == SIG_ERR; pe = pe->next) + for (pe = _hurdsig_preemptors; pe && handler == SIG_ERR; pe = pe->next) if (HURD_PREEMPT_SIGNAL_P (pe, signo, detail->code)) - handler = (*pe->preempter) (pe, ss, &signo, detail); + handler = (*pe->preemptor) (pe, ss, &signo, detail); __mutex_unlock (&_hurd_siglock); } @@ -1250,22 +1250,22 @@ _hurdsig_getenv (const char *variable) while (*ep) { const char *p = *ep; - _hurdsig_fault_preempter.first = (long int) p; - _hurdsig_fault_preempter.last = VM_MAX_ADDRESS; + _hurdsig_fault_preemptor.first = (long int) p; + _hurdsig_fault_preemptor.last = VM_MAX_ADDRESS; if (! strncmp (p, variable, len) && p[len] == '=') { char *value; size_t valuelen; p += len + 1; valuelen = strlen (p); - _hurdsig_fault_preempter.last = (long int) (p + valuelen); + _hurdsig_fault_preemptor.last = (long int) (p + valuelen); value = malloc (++valuelen); if (value) memcpy (value, p, valuelen); break; } - _hurdsig_fault_preempter.first = (long int) ++ep; - _hurdsig_fault_preempter.last = (long int) (ep + 1); + _hurdsig_fault_preemptor.first = (long int) ++ep; + _hurdsig_fault_preemptor.last = (long int) (ep + 1); } _hurdsig_end_catch_fault (); return value; diff --git a/hurd/preempt-sig.c b/hurd/preempt-sig.c index 6596089f1b..e703a9050a 100644 --- a/hurd/preempt-sig.c +++ b/hurd/preempt-sig.c @@ -1,55 +1,55 @@ /* Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. + This file is part of the GNU C Library. -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #include <hurd/sigpreempt.h> #include <hurd/signal.h> #include <assert.h> void -hurd_preempt_signals (struct hurd_signal_preempter *preempter) +hurd_preempt_signals (struct hurd_signal_preemptor *preemptor) { __mutex_lock (&_hurd_siglock); - preempter->next = _hurdsig_preempters; - _hurdsig_preempters = preempter; - _hurdsig_preempted_set |= preempter->signals; + preemptor->next = _hurdsig_preemptors; + _hurdsig_preemptors = preemptor; + _hurdsig_preempted_set |= preemptor->signals; __mutex_unlock (&_hurd_siglock); } void -hurd_unpreempt_signals (struct hurd_signal_preempter *preempter) +hurd_unpreempt_signals (struct hurd_signal_preemptor *preemptor) { - struct hurd_signal_preempter **p; + struct hurd_signal_preemptor **p; sigset_t preempted = 0; __mutex_lock (&_hurd_siglock); - p = &_hurdsig_preempters; + p = &_hurdsig_preemptors; while (*p) - if (*p == preempter) + if (*p == preemptor) { /* Found it; take it off the chain. */ *p = (*p)->next; - if ((preempter->signals & preempted) != preempter->signals) + if ((preemptor->signals & preempted) != preemptor->signals) { - /* This might have been the only preempter for some + /* This might have been the only preemptor for some of those signals, so we must collect the full mask from the others. */ - struct hurd_signal_preempter *pp; + struct hurd_signal_preemptor *pp; for (pp = *p; pp; pp = pp->next) preempted |= pp->signals; _hurdsig_preempted_set = preempted; @@ -64,5 +64,5 @@ hurd_unpreempt_signals (struct hurd_signal_preempter *preempter) } __mutex_unlock (&_hurd_siglock); /* Avoid deadlock during death rattle. */ - assert (! "removing absent preempter"); + assert (! "removing absent preemptor"); } @@ -570,7 +570,7 @@ fts_build(sp, type) register FTS *sp; int type; { - struct dirent dirbuf, *dp; + struct dirent *dp; register FTSENT *p, *head; register int nitems; FTSENT *cur, *tail; @@ -660,8 +660,7 @@ fts_build(sp, type) /* Read the directory, attaching each entry to the `link' pointer. */ adjaddr = NULL; - for (head = tail = NULL, nitems = 0; - __readdir_r (dirp, &dirbuf, &dp) >= 0;) { + for (head = tail = NULL, nitems = 0; dp = readdir(dirp);) { int namlen; if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name)) @@ -39,13 +39,13 @@ ftw_dir (DIR **dirs, int level, int descriptors, char *dir, size_t len, int (*func) (const char *file, struct stat *status, int flag)) { int got; - struct dirent dirbuf, *entry; + struct dirent *entry; got = 0; __set_errno (0); - while (__readdir_r (dirs[level], &dirbuf, &entry) >= 0) + while ((entry = readdir (dirs[level])) != NULL) { struct stat s; int flag, retval, newlev; @@ -136,7 +136,7 @@ ftw_dir (DIR **dirs, int level, int descriptors, char *dir, size_t len, while (skip-- != 0) { __set_errno (0); - if (__readdir_r (dirs[level], &dirbuf, &entry) < 0) + if (readdir (dirs[level]) == NULL) return errno == 0 ? 0 : -1; } } diff --git a/libio/iovsprintf.c b/libio/iovsprintf.c index a4fc949333..fc01d82ee0 100644 --- a/libio/iovsprintf.c +++ b/libio/iovsprintf.c @@ -44,7 +44,7 @@ _IO_vsprintf (string, format, args) _IO_JUMPS ((_IO_FILE *) &sf) = &_IO_str_jumps; _IO_str_init_static ((_IO_FILE *) &sf, string, -1, string); _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, &sf); - _IO_flockfile (&sf); + _IO_flockfile ((_IO_FILE *) &sf); ret = _IO_vfprintf ((_IO_FILE *) &sf, format, args); _IO_putc_unlocked ('\0', (_IO_FILE *) &sf); _IO_cleanup_region_end (1); diff --git a/libio/iovsscanf.c b/libio/iovsscanf.c index 6546e2dd40..4a21cce4b0 100644 --- a/libio/iovsscanf.c +++ b/libio/iovsscanf.c @@ -39,7 +39,7 @@ DEFUN(_IO_vsscanf, (string, format, args), _IO_JUMPS((_IO_FILE*)&sf) = &_IO_str_jumps; _IO_str_init_static ((_IO_FILE*)&sf, (char*)string, 0, NULL); _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, &sf); - _IO_flockfile (&sf); + _IO_flockfile ((_IO_FILE *) &sf); ret = _IO_vfscanf((_IO_FILE*)&sf, format, args, NULL); _IO_cleanup_region_end (1); return ret; diff --git a/libio/libioP.h b/libio/libioP.h index 1f8d89038b..4fa3fd911c 100644 --- a/libio/libioP.h +++ b/libio/libioP.h @@ -428,6 +428,12 @@ extern void (*_IO_cleanup_registration_needed) __P ((void)); #if _G_HAVE_MMAP +#ifdef _LIBC +/* When using this code in the GNU libc we must not pollute the name space. */ +#define mmap __mmap +#define munmap __munmap +#endif + #define ROUND_TO_PAGE(_S) \ (((_S) + EXEC_PAGESIZE - 1) & ~(EXEC_PAGESIZE - 1)) diff --git a/mach/lock-intern.h b/mach/lock-intern.h index 9c6bab5ae2..1f022f5b0a 100644 --- a/mach/lock-intern.h +++ b/mach/lock-intern.h @@ -1,20 +1,20 @@ -/* Copyright (C) 1994 Free Software Foundation, Inc. -This file is part of the GNU C Library. +/* Copyright (C) 1994, 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 -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #ifndef _LOCK_INTERN_H #define _LOCK_INTERN_H @@ -47,7 +47,7 @@ __spin_lock (__spin_lock_t *__lock) __spin_lock_solid (__lock); } -/* Name space-clean internal interface to mutex locks. +/* Name space-clean internal interface to mutex locks. Code internal to the C library uses these functions to lock and unlock mutex locks. These locks are of type `struct mutex', defined in @@ -86,4 +86,11 @@ __mutex_unlock (void *__lock) __mutex_unlock_solid (__lock); } + +_EXTERN_INLINE int +__mutex_trylock (void *__lock) +{ + return __spin_try_lock ((__spin_lock_t *) __lock); +} + #endif /* lock-intern.h */ diff --git a/malloc/malloc.c b/malloc/malloc.c index 8b99da9f28..c2a94a4f8d 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -19,7 +19,7 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* VERSION 2.6.4-pt Wed Dec 4 00:35:54 MET 1996 +/* V2.6.4-pt2 Sat Dec 14 1996 This work is mainly derived from malloc-2.6.4 by Doug Lea <dl@cs.oswego.edu>, which is available from: @@ -52,8 +52,8 @@ ptmalloc_init(); Initialize global configuration. When compiled for multiple threads, this function must be called once before any other function in the - package. It is not required otherwise. It is called automatically - in the Linux/GNU C libray. + package. It is not required otherwise. It is called automatically + in the Linux/GNU C libray or when compiling with MALLOC_HOOKS. malloc(size_t n); Return a pointer to a newly allocated chunk of at least n bytes, or null if no space is available. @@ -154,7 +154,6 @@ Here are some features that are NOT currently supported - * No user-definable hooks for callbacks and the like. * No automated mechanism for fully checking that all accesses to malloced memory stay within their bounds. * No support for compaction. @@ -180,6 +179,9 @@ Define to enable debugging. Adds fairly extensive assertion-based checking to help track down memory errors, but noticeably slows down execution. + MALLOC_HOOKS (default: NOT defined) + Define to enable support run-time replacement of the allocation + functions through user-defined `hooks'. REALLOC_ZERO_BYTES_FREES (default: NOT defined) Define this if you think that realloc(p, 0) should be equivalent to free(p). Otherwise, since malloc returns a unique pointer for @@ -234,6 +236,10 @@ These values may also be changed dynamically via mallopt(). The preset defaults are those that give best performance for typical programs/systems. + DEFAULT_CHECK_ACTION + When the standard debugging hooks are in place, and a pointer is + detected as corrupt, do nothing (0), print an error message (1), + or call abort() (2). */ @@ -290,9 +296,12 @@ #endif /*Void_t*/ #if __STD_C -#include <stddef.h> /* for size_t */ +# include <stddef.h> /* for size_t */ +# if defined(_LIBC) || defined(MALLOC_HOOKS) +# include <stdlib.h> /* for getenv() */ +# endif #else -#include <sys/types.h> +# include <sys/types.h> #endif /* Macros for handling mutexes and thread-specific data. This is @@ -306,6 +315,13 @@ extern "C" { #include <stdio.h> /* needed for malloc_stats */ +/* We must not pollute the name space in the GNU libc. */ +#ifdef _LIBC +#define malloc_stats __malloc_stats +#define malloc_usable_size __malloc_usable_size +#define malloc_trim __malloc_trim +#endif + /* Compile-time options @@ -380,7 +396,7 @@ extern "C" { */ -#define HAVE_MEMCPY +#define HAVE_MEMCPY 1 #ifndef USE_MEMCPY #ifdef HAVE_MEMCPY @@ -768,6 +784,16 @@ do { \ +#ifndef DEFAULT_CHECK_ACTION +#define DEFAULT_CHECK_ACTION 1 +#endif + +/* What to do if the standard debugging hooks are in place and a + corrupt pointer is detected: do nothing (0), print an error message + (1), or call abort() (2). */ + + + #define HEAP_MIN_SIZE (32*1024) #define HEAP_MAX_SIZE (1024*1024) /* must be a power of two */ @@ -813,6 +839,11 @@ static Void_t *(*__morecore)() = __default_morecore; #define MORECORE (*__morecore) #define MORECORE_FAILURE 0 #define MORECORE_CLEARS 1 +#define mmap __mmap +#define munmap __munmap +#define mremap __mremap +#undef malloc_getpagesize +#define malloc_getpagesize __getpagesize() #else /* _LIBC */ @@ -836,7 +867,7 @@ extern Void_t* sbrk(); #endif /* _LIBC */ -#if 0 && defined(_LIBC) +#ifdef _LIBC #define cALLOc __libc_calloc #define fREe __libc_free @@ -848,17 +879,6 @@ extern Void_t* sbrk(); #define mALLINFo __libc_mallinfo #define mALLOPt __libc_mallopt -#pragma weak calloc = __libc_calloc -#pragma weak free = __libc_free -#pragma weak cfree = __libc_free -#pragma weak malloc = __libc_malloc -#pragma weak memalign = __libc_memalign -#pragma weak realloc = __libc_realloc -#pragma weak valloc = __libc_valloc -#pragma weak pvalloc = __libc_pvalloc -#pragma weak mallinfo = __libc_mallinfo -#pragma weak mallopt = __libc_mallopt - #else #define cALLOc calloc @@ -888,8 +908,11 @@ Void_t* vALLOc(size_t); Void_t* pvALLOc(size_t); Void_t* cALLOc(size_t, size_t); void cfree(Void_t*); +int __malloc_trim(size_t); int malloc_trim(size_t); +size_t __malloc_usable_size(Void_t*); size_t malloc_usable_size(Void_t*); +void __malloc_stats(void); void malloc_stats(void); int mALLOPt(int, int); struct mallinfo mALLINFo(void); @@ -905,8 +928,11 @@ Void_t* vALLOc(); Void_t* pvALLOc(); Void_t* cALLOc(); void cfree(); +int __malloc_trim(); int malloc_trim(); +size_t _malloc_usable_size(); size_t malloc_usable_size(); +void __malloc_stats(); void malloc_stats(); int mALLOPt(); struct mallinfo mALLINFo(); @@ -1136,19 +1162,41 @@ typedef struct _heap_info { */ #if __STD_C + static void chunk_free(arena *ar_ptr, mchunkptr p); static mchunkptr chunk_alloc(arena *ar_ptr, INTERNAL_SIZE_T size); +static mchunkptr chunk_realloc(arena *ar_ptr, mchunkptr oldp, + INTERNAL_SIZE_T oldsize, INTERNAL_SIZE_T nb); +static mchunkptr chunk_align(arena *ar_ptr, INTERNAL_SIZE_T nb, + size_t alignment); static int main_trim(size_t pad); #ifndef NO_THREADS static int heap_trim(heap_info *heap, size_t pad); #endif +#if defined(_LIBC) || defined(MALLOC_HOOKS) +static Void_t* malloc_check(size_t sz); +static void free_check(Void_t* mem); +static Void_t* realloc_check(Void_t* oldmem, size_t bytes); +static Void_t* memalign_check(size_t alignment, size_t bytes); +#endif + #else + static void chunk_free(); static mchunkptr chunk_alloc(); +static mchunkptr chunk_realloc(); +static mchunkptr chunk_align(); static int main_trim(); #ifndef NO_THREADS static int heap_trim(); #endif +#if defined(_LIBC) || defined(MALLOC_HOOKS) +static Void_t* malloc_check(); +static void free_check(); +static Void_t* realloc_check(); +static Void_t* memalign_check(); +#endif + #endif @@ -1416,6 +1464,7 @@ static unsigned long trim_threshold = DEFAULT_TRIM_THRESHOLD; static unsigned long top_pad = DEFAULT_TOP_PAD; static unsigned int n_mmaps_max = DEFAULT_MMAP_MAX; static unsigned long mmap_threshold = DEFAULT_MMAP_THRESHOLD; +static int check_action = DEFAULT_CHECK_ACTION; /* The first value returned from sbrk */ static char* sbrk_base = (char*)(-1); @@ -1444,7 +1493,9 @@ static unsigned long max_mmapped_mem = 0; /* Initialization routine. */ #if defined(_LIBC) +#if 0 static void ptmalloc_init __MALLOC_P ((void)) __attribute__ ((constructor)); +#endif static void ptmalloc_init __MALLOC_P((void)) @@ -1454,24 +1505,103 @@ ptmalloc_init __MALLOC_P((void)) #endif { static int first = 1; +#if defined(_LIBC) || defined(MALLOC_HOOKS) + const char* s; +#endif + if(!first) return; + first = 0; #if defined(_LIBC) /* Initialize the pthreads interface. */ if (__pthread_initialize != NULL) __pthread_initialize(); #endif - - if(first) { - first = 0; #ifndef NO_THREADS - mutex_init(&main_arena.mutex); - mutex_init(&list_lock); - tsd_key_create(&arena_key, NULL); - tsd_setspecific(arena_key, (Void_t *)&main_arena); -#endif + mutex_init(&main_arena.mutex); + mutex_init(&list_lock); + tsd_key_create(&arena_key, NULL); + tsd_setspecific(arena_key, (Void_t *)&main_arena); +#endif +#if defined(_LIBC) || defined(MALLOC_HOOKS) + s = getenv("MALLOC_CHECK_"); + if(s) { + if(s[0]) mallopt(M_CHECK_ACTION, (int)(s[0] - '0')); + malloc_check_init(); } + if(__malloc_initialize_hook != NULL) + (*__malloc_initialize_hook)(); +#endif } +#if defined(_LIBC) || defined(MALLOC_HOOKS) + +/* Hooks for debugging versions. The initial hooks just call the + initialization routine, then do the normal work. */ + +static Void_t* +#if __STD_C +malloc_hook_ini(size_t sz) +#else +malloc_hook_ini(sz) size_t sz; +#endif +{ + __malloc_hook = NULL; + __realloc_hook = NULL; + __memalign_hook = NULL; + ptmalloc_init(); + return mALLOc(sz); +} + +static Void_t* +#if __STD_C +realloc_hook_ini(Void_t* ptr, size_t sz) +#else +realloc_hook_ini(ptr, sz) Void_t* ptr; size_t sz; +#endif +{ + __malloc_hook = NULL; + __realloc_hook = NULL; + __memalign_hook = NULL; + ptmalloc_init(); + return rEALLOc(ptr, sz); +} + +static Void_t* +#if __STD_C +memalign_hook_ini(size_t sz, size_t alignment) +#else +memalign_hook_ini(sz, alignment) size_t sz; size_t alignment; +#endif +{ + __malloc_hook = NULL; + __realloc_hook = NULL; + __memalign_hook = NULL; + ptmalloc_init(); + return mEMALIGn(sz, alignment); +} + +void (*__malloc_initialize_hook) __MALLOC_P ((void)) = NULL; +void (*__free_hook) __MALLOC_P ((__malloc_ptr_t __ptr)) = NULL; +__malloc_ptr_t (*__malloc_hook) + __MALLOC_P ((size_t __size)) = malloc_hook_ini; +__malloc_ptr_t (*__realloc_hook) + __MALLOC_P ((__malloc_ptr_t __ptr, size_t __size)) = realloc_hook_ini; +__malloc_ptr_t (*__memalign_hook) + __MALLOC_P ((size_t __size, size_t __alignment)) = memalign_hook_ini; + +/* Activate a standard set of debugging hooks. */ +void +malloc_check_init() +{ + __malloc_hook = malloc_check; + __free_hook = free_check; + __realloc_hook = realloc_check; + __memalign_hook = memalign_check; + fprintf(stderr, "Using debugging hooks\n"); +} + +#endif + @@ -2224,9 +2354,19 @@ Void_t* mALLOc(bytes) size_t bytes; #endif { arena *ar_ptr; - INTERNAL_SIZE_T nb = request2size(bytes); /* padded request size; */ + INTERNAL_SIZE_T nb; /* padded request size */ mchunkptr victim; +#if defined(_LIBC) || defined(MALLOC_HOOKS) + if (__malloc_hook != NULL) { + Void_t* result; + + result = (*__malloc_hook)(bytes); + return result; + } +#endif + + nb = request2size(bytes); arena_get(ar_ptr, nb + top_pad); if(!ar_ptr) return 0; @@ -2501,6 +2641,13 @@ void fREe(mem) Void_t* mem; arena *ar_ptr; mchunkptr p; /* chunk corresponding to mem */ +#if defined(_LIBC) || defined(MALLOC_HOOKS) + if (__free_hook != NULL) { + (*__free_hook)(mem); + return; + } +#endif + if (mem == 0) /* free(0) has no effect */ return; @@ -2676,38 +2823,33 @@ Void_t* rEALLOc(oldmem, bytes) Void_t* oldmem; size_t bytes; INTERNAL_SIZE_T oldsize; /* its size */ mchunkptr newp; /* chunk to return */ - INTERNAL_SIZE_T newsize; /* its size */ - Void_t* newmem; /* corresponding user mem */ - - mchunkptr next; /* next contiguous chunk after oldp */ - INTERNAL_SIZE_T nextsize; /* its size */ - mchunkptr prev; /* previous contiguous chunk before oldp */ - INTERNAL_SIZE_T prevsize; /* its size */ +#if defined(_LIBC) || defined(MALLOC_HOOKS) + if (__realloc_hook != NULL) { + Void_t* result; - mchunkptr remainder; /* holds split off extra space from newp */ - INTERNAL_SIZE_T remainder_size; /* its size */ - - mchunkptr bck; /* misc temp for linking */ - mchunkptr fwd; /* misc temp for linking */ + result = (*__realloc_hook)(oldmem, bytes); + return result; + } +#endif #ifdef REALLOC_ZERO_BYTES_FREES if (bytes == 0) { fREe(oldmem); return 0; } #endif - /* realloc of null is supposed to be same as malloc */ if (oldmem == 0) return mALLOc(bytes); - newp = oldp = mem2chunk(oldmem); - newsize = oldsize = chunksize(oldp); - + oldp = mem2chunk(oldmem); + oldsize = chunksize(oldp); nb = request2size(bytes); #if HAVE_MMAP if (chunk_is_mmapped(oldp)) { + Void_t* newmem; + #if HAVE_MREMAP newp = mremap_chunk(oldp, nb); if(newp) return chunk2mem(newp); @@ -2738,6 +2880,36 @@ Void_t* rEALLOc(oldmem, bytes) Void_t* oldmem; size_t bytes; /* As in malloc(), remember this arena for the next allocation. */ tsd_setspecific(arena_key, (Void_t *)ar_ptr); + newp = chunk_realloc(ar_ptr, oldp, oldsize, nb); + + (void)mutex_unlock(&ar_ptr->mutex); + return newp ? chunk2mem(newp) : NULL; +} + +static mchunkptr +#if __STD_C +chunk_realloc(arena* ar_ptr, mchunkptr oldp, INTERNAL_SIZE_T oldsize, + INTERNAL_SIZE_T nb) +#else +chunk_realloc(ar_ptr, oldp, oldsize, nb) +arena* ar_ptr; mchunkptr oldp; INTERNAL_SIZE_T oldsize, nb; +#endif +{ + mchunkptr newp = oldp; /* chunk to return */ + INTERNAL_SIZE_T newsize = oldsize; /* its size */ + + mchunkptr next; /* next contiguous chunk after oldp */ + INTERNAL_SIZE_T nextsize; /* its size */ + + mchunkptr prev; /* previous contiguous chunk before oldp */ + INTERNAL_SIZE_T prevsize; /* its size */ + + mchunkptr remainder; /* holds split off extra space from newp */ + INTERNAL_SIZE_T remainder_size; /* its size */ + + mchunkptr bck; /* misc temp for linking */ + mchunkptr fwd; /* misc temp for linking */ + check_inuse_chunk(ar_ptr, oldp); if ((long)(oldsize) < (long)(nb)) @@ -2759,8 +2931,7 @@ Void_t* rEALLOc(oldmem, bytes) Void_t* oldmem; size_t bytes; top(ar_ptr) = chunk_at_offset(oldp, nb); set_head(top(ar_ptr), (newsize - nb) | PREV_INUSE); set_head_size(oldp, nb); - (void)mutex_unlock(&ar_ptr->mutex); - return chunk2mem(oldp); + return oldp; } } @@ -2797,13 +2968,11 @@ Void_t* rEALLOc(oldmem, bytes) Void_t* oldmem; size_t bytes; unlink(prev, bck, fwd); newp = prev; newsize += prevsize + nextsize; - newmem = chunk2mem(newp); - MALLOC_COPY(newmem, oldmem, oldsize - SIZE_SZ); + MALLOC_COPY(chunk2mem(newp), chunk2mem(oldp), oldsize - SIZE_SZ); top(ar_ptr) = chunk_at_offset(newp, nb); set_head(top(ar_ptr), (newsize - nb) | PREV_INUSE); set_head_size(newp, nb); - (void)mutex_unlock(&ar_ptr->mutex); - return newmem; + return newp; } } @@ -2814,8 +2983,7 @@ Void_t* rEALLOc(oldmem, bytes) Void_t* oldmem; size_t bytes; unlink(prev, bck, fwd); newp = prev; newsize += nextsize + prevsize; - newmem = chunk2mem(newp); - MALLOC_COPY(newmem, oldmem, oldsize - SIZE_SZ); + MALLOC_COPY(chunk2mem(newp), chunk2mem(oldp), oldsize - SIZE_SZ); goto split; } } @@ -2826,8 +2994,7 @@ Void_t* rEALLOc(oldmem, bytes) Void_t* oldmem; size_t bytes; unlink(prev, bck, fwd); newp = prev; newsize += prevsize; - newmem = chunk2mem(newp); - MALLOC_COPY(newmem, oldmem, oldsize - SIZE_SZ); + MALLOC_COPY(chunk2mem(newp), chunk2mem(oldp), oldsize - SIZE_SZ); goto split; } } @@ -2850,11 +3017,9 @@ Void_t* rEALLOc(oldmem, bytes) Void_t* oldmem; size_t bytes; } /* Otherwise copy, free, and exit */ - newmem = chunk2mem(newp); - MALLOC_COPY(newmem, oldmem, oldsize - SIZE_SZ); + MALLOC_COPY(chunk2mem(newp), chunk2mem(oldp), oldsize - SIZE_SZ); chunk_free(ar_ptr, oldp); - (void)mutex_unlock(&ar_ptr->mutex); - return newmem; + return newp; } @@ -2876,8 +3041,7 @@ Void_t* rEALLOc(oldmem, bytes) Void_t* oldmem; size_t bytes; } check_inuse_chunk(ar_ptr, newp); - (void)mutex_unlock(&ar_ptr->mutex); - return chunk2mem(newp); + return newp; } @@ -2910,14 +3074,16 @@ Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes; { arena *ar_ptr; INTERNAL_SIZE_T nb; /* padded request size */ - char* m; /* memory returned by malloc call */ - mchunkptr p; /* corresponding chunk */ - char* brk; /* alignment point within p */ - mchunkptr newp; /* chunk to return */ - INTERNAL_SIZE_T newsize; /* its size */ - INTERNAL_SIZE_T leadsize; /* leading space befor alignment point */ - mchunkptr remainder; /* spare room at end to split off */ - long remainder_size; /* its size */ + mchunkptr p; + +#if defined(_LIBC) || defined(MALLOC_HOOKS) + if (__memalign_hook != NULL) { + Void_t* result; + + result = (*__memalign_hook)(alignment, bytes); + return result; + } +#endif /* If need less alignment than we give anyway, just relay to malloc */ @@ -2927,18 +3093,36 @@ Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes; if (alignment < MINSIZE) alignment = MINSIZE; - /* Call malloc with worst case padding to hit alignment. */ - nb = request2size(bytes); arena_get(ar_ptr, nb + alignment + MINSIZE); if(!ar_ptr) return 0; - p = chunk_alloc(ar_ptr, nb + alignment + MINSIZE); + p = chunk_align(ar_ptr, nb, alignment); + (void)mutex_unlock(&ar_ptr->mutex); + return p ? chunk2mem(p) : NULL; +} - if (p == 0) { - (void)mutex_unlock(&ar_ptr->mutex); +static mchunkptr +#if __STD_C +chunk_align(arena* ar_ptr, INTERNAL_SIZE_T nb, size_t alignment) +#else +chunk_align(ar_ptr, nb, alignment) +arena* ar_ptr; INTERNAL_SIZE_T nb; size_t alignment; +#endif +{ + char* m; /* memory returned by malloc call */ + mchunkptr p; /* corresponding chunk */ + char* brk; /* alignment point within p */ + mchunkptr newp; /* chunk to return */ + INTERNAL_SIZE_T newsize; /* its size */ + INTERNAL_SIZE_T leadsize; /* leading space befor alignment point */ + mchunkptr remainder; /* spare room at end to split off */ + long remainder_size; /* its size */ + + /* Call chunk_alloc with worst case padding to hit alignment. */ + p = chunk_alloc(ar_ptr, nb + alignment + MINSIZE); + if (p == 0) return 0; /* propagate failure */ - } m = chunk2mem(p); @@ -2946,8 +3130,7 @@ Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes; { #if HAVE_MMAP if(chunk_is_mmapped(p)) { - (void)mutex_unlock(&ar_ptr->mutex); - return chunk2mem(p); /* nothing more to do */ + return p; /* nothing more to do */ } #endif } @@ -2963,7 +3146,7 @@ Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes; */ brk = (char*)mem2chunk(((unsigned long)(m + alignment - 1)) & -alignment); - if ((long)(brk - (char*)(p)) < (long)MINSIZE) brk = brk + alignment; + if ((long)(brk - (char*)(p)) < (long)MINSIZE) brk += alignment; newp = (mchunkptr)brk; leadsize = brk - (char*)(p); @@ -2974,8 +3157,7 @@ Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes; { newp->prev_size = p->prev_size + leadsize; set_head(newp, newsize|IS_MMAPPED); - (void)mutex_unlock(&ar_ptr->mutex); - return chunk2mem(newp); + return newp; } #endif @@ -3003,9 +3185,7 @@ Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes; } check_inuse_chunk(ar_ptr, p); - (void)mutex_unlock(&ar_ptr->mutex); - return chunk2mem(p); - + return p; } @@ -3044,7 +3224,7 @@ Void_t* pvALLOc(bytes) size_t bytes; /* - calloc calls malloc, then zeroes out the allocated chunk. + calloc calls chunk_alloc, then zeroes out the allocated chunk. */ @@ -3056,11 +3236,23 @@ Void_t* cALLOc(n, elem_size) size_t n; size_t elem_size; { arena *ar_ptr; mchunkptr p, oldtop; - INTERNAL_SIZE_T csz, oldtopsize; + INTERNAL_SIZE_T sz, csz, oldtopsize; Void_t* mem; - INTERNAL_SIZE_T sz = request2size(n * elem_size); +#if defined(_LIBC) || defined(MALLOC_HOOKS) + if (__malloc_hook != NULL) { + sz = n * elem_size; + mem = (*__malloc_hook)(sz); +#ifdef HAVE_MEMCPY + memset(mem, 0, sz); +#else + while(sz > 0) mem[--sz] = 0; /* rather inefficient */ +#endif + return mem; + } +#endif + sz = request2size(n * elem_size); arena_get(ar_ptr, sz); if(!ar_ptr) return 0; @@ -3232,7 +3424,7 @@ heap_trim(heap, pad) heap_info *heap; size_t pad; assert(p->size == (0|PREV_INUSE)); /* must be fencepost */ p = prev_chunk(p); new_size = chunksize(p) + (MINSIZE-2*SIZE_SZ); - assert(new_size>0 && new_size<(long int)(2*MINSIZE)); + assert(new_size>0 && new_size<(long)(2*MINSIZE)); if(!prev_inuse(p)) new_size += p->prev_size; assert(new_size>0 && new_size<HEAP_MAX_SIZE); @@ -3513,29 +3705,241 @@ int mALLOPt(param_number, value) int param_number; int value; #else if (value != 0) return 0; else n_mmaps_max = value; return 1; #endif + case M_CHECK_ACTION: + check_action = value; return 1; default: return 0; } } + +#ifdef _LIBC +weak_alias (__libc_calloc, __calloc) weak_alias (__libc_calloc, calloc) +weak_alias (__libc_free, __cfree) weak_alias (__libc_free, cfree) +weak_alias (__libc_free, __free) weak_alias (__libc_free, free) +weak_alias (__libc_malloc, __malloc) weak_alias (__libc_malloc, malloc) +weak_alias (__libc_memalign, __memalign) weak_alias (__libc_memalign, memalign) +weak_alias (__libc_realloc, __realloc) weak_alias (__libc_realloc, realloc) +weak_alias (__libc_valloc, __valloc) weak_alias (__libc_valloc, valloc) +weak_alias (__libc_pvalloc, __pvalloc) weak_alias (__libc_pvalloc, pvalloc) +weak_alias (__libc_mallinfo, __mallinfo) weak_alias (__libc_mallinfo, mallinfo) +weak_alias (__libc_mallopt, __mallopt) weak_alias (__libc_mallopt, mallopt) + +#undef malloc_stats +weak_alias (__malloc_stats, malloc_stats) +#undef malloc_usable_size +weak_alias (__malloc_usable_size, malloc_usable_size) +#undef malloc_trim +weak_alias (__malloc_trim, malloc_trim) +#endif + + +#if defined(_LIBC) || defined(MALLOC_HOOKS) + +/* A simple, standard set of debugging hooks. Overhead is `only' one + byte per chunk; still this will catch most cases of double frees or + overruns. */ + +#define MAGICBYTE ((char)0xd7) -#if 0 && defined(_LIBC) -weak_alias (__libc_calloc, calloc) -weak_alias (__libc_free, cfree) -weak_alias (__libc_free, free) -weak_alias (__libc_malloc, malloc) -weak_alias (__libc_memalign, memalign) -weak_alias (__libc_realloc, realloc) -weak_alias (__libc_valloc, valloc) -weak_alias (__libc_pvalloc, pvalloc) -weak_alias (__libc_mallinfo, mallinfo) -weak_alias (__libc_mallopt, mallopt) +/* Convert a pointer to be free()d or realloc()ed to a valid chunk + pointer. If the provided pointer is not valid, return NULL. The + goal here is to avoid crashes, unlike in the MALLOC_DEBUG code. */ + +static mchunkptr +#if __STD_C +mem2chunk_check(Void_t* mem) +#else +mem2chunk_check(mem) Void_t* mem; #endif +{ + mchunkptr p; + INTERNAL_SIZE_T sz; + + p = mem2chunk(mem); + if(!aligned_OK(p)) return NULL; + if( (char*)p>=sbrk_base && (char*)p<(sbrk_base+sbrked_mem) ) { + /* Must be a chunk in conventional memory. */ + if(chunk_is_mmapped(p) || + ( (sz = chunksize(p)), ((char*)p + sz)>=(sbrk_base+sbrked_mem) ) || + sz<MINSIZE || sz&MALLOC_ALIGN_MASK || !inuse(p) ) return NULL; + if(*((char*)p + sz + (SIZE_SZ-1)) != MAGICBYTE) return NULL; + *((char*)p + sz + (SIZE_SZ-1)) = 0; + } else { + unsigned long offset, page_mask = malloc_getpagesize-1; + + /* mmap()ed chunks have MALLOC_ALIGNMENT or higher power-of two + alignment relative to the beginning of a page. Check this + first. */ + offset = (unsigned long)mem & page_mask; + if((offset!=MALLOC_ALIGNMENT && offset!=0 && offset!=0x10 && + offset!=0x20 && offset!=0x40 && offset!=0x80 && offset!=0x100 && + offset!=0x200 && offset!=0x400 && offset!=0x800 && offset!=0x1000 && + offset<0x2000) || + !chunk_is_mmapped(p) || (p->size & PREV_INUSE) || + ( (((unsigned long)p - p->prev_size) & page_mask) != 0 ) || + ( (sz = chunksize(p)), ((p->prev_size + sz) & page_mask) != 0 ) ) + return NULL; + if(*((char*)p + sz - 1) != MAGICBYTE) return NULL; + *((char*)p + sz - 1) = 0; + } + return p; +} + +static Void_t* +#if __STD_C +malloc_check(size_t sz) +#else +malloc_check(sz) size_t sz; +#endif +{ + mchunkptr victim; + INTERNAL_SIZE_T nb = request2size(sz + 1); + + (void)mutex_lock(&main_arena.mutex); + victim = chunk_alloc(&main_arena, nb); + (void)mutex_unlock(&main_arena.mutex); + if(!victim) return NULL; + nb = chunksize(victim); + if(chunk_is_mmapped(victim)) + --nb; + else + nb += SIZE_SZ - 1; + *((char*)victim + nb) = MAGICBYTE; + return chunk2mem(victim); +} + +static void +#if __STD_C +free_check(Void_t* mem) +#else +free_check(mem) Void_t* mem; +#endif +{ + mchunkptr p; + + if(!mem) return; + p = mem2chunk_check(mem); + if(!p) { + switch(check_action) { + case 1: + fprintf(stderr, "free(): invalid pointer %lx!\n", (long)(mem)); + break; + case 2: + abort(); + } + return; + } +#if HAVE_MMAP + if (chunk_is_mmapped(p)) { + munmap_chunk(p); + return; + } +#endif + (void)mutex_lock(&main_arena.mutex); + chunk_free(&main_arena, p); + (void)mutex_unlock(&main_arena.mutex); +} + +static Void_t* +#if __STD_C +realloc_check(Void_t* oldmem, size_t bytes) +#else +realloc_check(oldmem, bytes) Void_t* oldmem; size_t bytes; +#endif +{ + mchunkptr oldp, newp; + INTERNAL_SIZE_T nb, oldsize; + + if (oldmem == 0) return malloc_check(bytes); + oldp = mem2chunk_check(oldmem); + if(!oldp) { + switch(check_action) { + case 1: + fprintf(stderr, "realloc(): invalid pointer %lx!\n", (long)(oldmem)); + break; + case 2: + abort(); + } + return malloc_check(bytes); + } + oldsize = chunksize(oldp); + + nb = request2size(bytes+1); + + (void)mutex_lock(&main_arena.mutex); +#if HAVE_MMAP + if (chunk_is_mmapped(oldp)) { +#if HAVE_MREMAP + newp = mremap_chunk(oldp, nb); + if(!newp) { +#endif + /* Note the extra SIZE_SZ overhead. */ + if(oldsize - SIZE_SZ >= nb) newp = oldp; /* do nothing */ + else { + /* Must alloc, copy, free. */ + newp = chunk_alloc(&main_arena, nb); + if (newp) { + MALLOC_COPY(chunk2mem(newp), oldmem, oldsize - 2*SIZE_SZ); + munmap_chunk(oldp); + } + } +#if HAVE_MREMAP + } +#endif + } else +#endif /* HAVE_MMAP */ + newp = chunk_realloc(&main_arena, oldp, oldsize, nb); + (void)mutex_unlock(&main_arena.mutex); + + if(!newp) return NULL; + nb = chunksize(newp); + if(chunk_is_mmapped(newp)) + --nb; + else + nb += SIZE_SZ - 1; + *((char*)newp + nb) = MAGICBYTE; + return chunk2mem(newp); +} + +static Void_t* +#if __STD_C +memalign_check(size_t alignment, size_t bytes) +#else +memalign_check(alignment, bytes) size_t alignment; size_t bytes; +#endif +{ + INTERNAL_SIZE_T nb; + mchunkptr p; + + if (alignment <= MALLOC_ALIGNMENT) return malloc_check(bytes); + if (alignment < MINSIZE) alignment = MINSIZE; + + nb = request2size(bytes+1); + (void)mutex_lock(&main_arena.mutex); + p = chunk_align(&main_arena, nb, alignment); + (void)mutex_unlock(&main_arena.mutex); + if(!p) return NULL; + nb = chunksize(p); + if(chunk_is_mmapped(p)) + --nb; + else + nb += SIZE_SZ - 1; + *((char*)p + nb) = MAGICBYTE; + return chunk2mem(p); +} + +#endif /* defined(_LIBC) || defined(MALLOC_HOOKS) */ /* History: + V2.6.4-pt2 Sat Dec 14 1996 Wolfram Gloger (wmglo@dent.med.uni-muenchen.de) + * Added debugging hooks + * Fixed possible deadlock in realloc() when out of memory + * Don't pollute namespace in glibc: use __getpagesize, __mmap, etc. + V2.6.4-pt Wed Dec 4 1996 Wolfram Gloger (wmglo@dent.med.uni-muenchen.de) * Very minor updates from the released 2.6.4 version. * Trimmed include file down to exported data structures. diff --git a/malloc/malloc.h b/malloc/malloc.h index 4b013e9fee..ad36ca7592 100644 --- a/malloc/malloc.h +++ b/malloc/malloc.h @@ -147,6 +147,7 @@ extern struct mallinfo mallinfo __MALLOC_P ((void)); #define M_TOP_PAD -2 #define M_MMAP_THRESHOLD -3 #define M_MMAP_MAX -4 +#define M_CHECK_ACTION -5 /* General SVID/XPG interface to tunable parameters. */ extern int mallopt __MALLOC_P ((int __param, int __val)); @@ -162,6 +163,22 @@ extern size_t malloc_usable_size __MALLOC_P ((__malloc_ptr_t __ptr)); /* Prints brief summary statistics on stderr. */ extern void malloc_stats __MALLOC_P ((void)); +#if defined(__GLIBC__) || defined(MALLOC_HOOKS) + +/* Hooks for debugging versions. */ +extern void (*__malloc_initialize_hook) __MALLOC_P ((void)); +extern void (*__free_hook) __MALLOC_P ((__malloc_ptr_t __ptr)); +extern __malloc_ptr_t (*__malloc_hook) __MALLOC_P ((size_t __size)); +extern __malloc_ptr_t (*__realloc_hook) __MALLOC_P ((__malloc_ptr_t __ptr, + size_t __size)); +extern __malloc_ptr_t (*__memalign_hook) __MALLOC_P ((size_t __size, + size_t __alignment)); + +/* Activate a standard set of debugging hooks. */ +extern void malloc_check_init __MALLOC_P ((void)); + +#endif + #ifdef __cplusplus }; /* end of extern "C" */ #endif diff --git a/manual/nss.texi b/manual/nss.texi index 4a81edca13..e6c8649ddc 100644 --- a/manual/nss.texi +++ b/manual/nss.texi @@ -267,20 +267,25 @@ For the @code{hosts} and @code{network} databases the default value is the DNS service not to be available but if it is available the answer it returns is ultimative. +The @code{passwd}, @code{group}, and @code{shadow} databases are +traditionally handled in a special way. The appropriate files in the +@file{/etc} directory are read but if an entry with a name starting +with a @code{+} character is found NIS is used. This kind of lookup +remains possible by using the special lookup service @code{compat} +and the default value for the three databases above is +@code{compat [NOTFOUND=return] files}. + For all other databases the default value is -@code{compat [NOTFOUND=return] files}. This solution give the best -chance to be correct since NIS and file based lookup is used. The -@code{compat} service is available in a separate add-on to GNU C -library, available in the same place you got the GNU C library source -from. +@code{nis [NOTFOUND=return] files}. This solution give the best +chance to be correct since NIS and file based lookup is used. @cindex optimizing NSS A second point is that the user should try to optimize the lookup -process. The different service have different response times. A simple -file look up on a local file could be fast, but if the file is long and the -needed entry is near the end of the file this may take quite some time. -In this case it might be better to use the @code{db} service which -allows fast local access to large data sets. +process. The different service have different response times. +A simple file look up on a local file could be fast, but if the file +is long and the needed entry is near the end of the file this may take +quite some time. In this case it might be better to use the @code{db} +service which allows fast local access to large data sets. Often the situation is that some global information like NIS must be used. So it is unavoidable to use service entries like @code{nis} etc. diff --git a/manual/texinfo.tex b/manual/texinfo.tex index c79e160eac..c1a911a1b2 100644 --- a/manual/texinfo.tex +++ b/manual/texinfo.tex @@ -1,5 +1,5 @@ %% TeX macros to handle Texinfo files. -%% $Id: texinfo.tex,v 2.194 1996/12/17 06:25:17 eggert Exp $ +%% $Id: texinfo.tex,v 2.195 1996/12/18 03:22:53 drepper Exp $ % Copyright (C) 1985, 86, 88, 90, 91, 92, 93, % 94, 95, 1996 Free Software Foundation, Inc. @@ -36,7 +36,7 @@ % This automatically updates the version number based on RCS. \def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}} -\deftexinfoversion$Revision: 2.194 $ +\deftexinfoversion$Revision: 2.195 $ \message{Loading texinfo package [Version \texinfoversion]:} % If in a .fmt file, print the version number @@ -105,8 +105,8 @@ \hyphenation{eshell} % Margin to add to right of even pages, to left of odd pages. -\newdimen \bindingoffset -\newdimen \normaloffset +\newdimen \bindingoffset +\newdimen \normaloffset \newdimen\pagewidth \newdimen\pageheight % Sometimes it is convenient to have everything in the transcript file @@ -1349,7 +1349,7 @@ where each line of input produces a line of output.} % Computer Modern typewriter fonts have zero interword stretch (and % shrink), and it is reasonable to expect all typewriter fonts to have % this property, we can check that font parameter. -% +% \def\ifmonospace{\ifdim\fontdimen3\font=0pt } % Typeset a dimension, e.g., `in' or `pt'. The only reason for the @@ -1910,7 +1910,7 @@ July\or August\or September\or October\or November\or December\fi % To make preamble: % -% Either define widths of columns in terms of percent of \hsize: +% Either define widths of columns in terms of percent of \hsize: % @multitable @columnfractions .25 .3 .45 % @item ... % @@ -1928,13 +1928,13 @@ July\or August\or September\or October\or November\or December\fi % the preamble, break the line within one argument and it % will parse correctly, i.e., % -% @multitable {Column 1 template} {Column 2 template} {Column 3 +% @multitable {Column 1 template} {Column 2 template} {Column 3 % template} % Not: -% @multitable {Column 1 template} {Column 2 template} +% @multitable {Column 1 template} {Column 2 template} % {Column 3 template} -% Each new table line starts with @item, each subsequent new column +% Each new table line starts with @item, each subsequent new column % starts with @tab. Empty columns may be produced by supplying @tab's % with nothing between them for as many times as empty columns are needed, % ie, @tab@tab@tab will produce two empty columns. @@ -1946,15 +1946,15 @@ July\or August\or September\or October\or November\or December\fi % @multitable {Column 1 template} {Column 2 template} {Column 3 template} % @item first col stuff @tab second col stuff @tab third col -% @item -% first col stuff -% @tab -% second col stuff -% @tab -% third col -% @item first col stuff @tab second col stuff +% @item +% first col stuff +% @tab +% second col stuff +% @tab +% third col +% @item first col stuff @tab second col stuff % @tab Many paragraphs of text may be used in any column. -% +% % They will wrap at the width determined by the template. % @item@tab@tab This will be in third column. % @end multitable @@ -1968,7 +1968,7 @@ July\or August\or September\or October\or November\or December\fi % 0pt means it depends on current normal line spacing. %%%% -% Dimensions +% Dimensions \newskip\multitableparskip \newskip\multitableparindent @@ -2038,18 +2038,18 @@ July\or August\or September\or October\or November\or December\fi % To parse everything between @multitable and @item : \setuptable#1 \endsetuptable % Need to reset this to 0 after \setuptable. -\global\colcount=0\relax% +\global\colcount=0\relax% % % This preamble sets up a generic column definition, which will % be used as many times as user calls for columns. - % \vtop will set a single line and will also let text wrap and + % \vtop will set a single line and will also let text wrap and % continue for many paragraphs if desired. \halign\bgroup&\global\advance\colcount by 1\relax% \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname % In order to keep entries from bumping into each other % we will add a \leftskip of \multitablecolspace to all columns after % the first one. - % If a template has been used, we will add \multitablecolspace + % If a template has been used, we will add \multitablecolspace % to the width of each template entry. % If user has set preamble in terms of percent of \hsize % we will use that dimension as the width of the column, and @@ -2061,7 +2061,7 @@ July\or August\or September\or October\or November\or December\fi \ifsetpercent \else % If user has <not> set preamble in terms of percent of \hsize - % we will advance \hsize by \multitablecolspace + % we will advance \hsize by \multitablecolspace \advance\hsize by \multitablecolspace \fi % In either case we will make \leftskip=\multitablecolspace: @@ -2097,7 +2097,7 @@ July\or August\or September\or October\or November\or December\fi %% to keep lines equally spaced \let\multistrut = \strut %% Test to see if parskip is larger than space between lines of -%% table. If not, do nothing. +%% table. If not, do nothing. %% If so, set to same dimension as multitablelinespace. \else \gdef\multistrut{\vrule height\multitablelinespace depth\dp0 @@ -2613,7 +2613,7 @@ width0pt\relax} \fi \endgroup % Back to normal single-column typesetting, but take account of the % fact that we just accumulated some stuff on the output page. - \pagegoal=\vsize + \pagegoal=\vsize } \def\balancecolumns{% % Called on the last page of the double column material. @@ -3139,7 +3139,7 @@ width0pt\relax} \fi % Print any size section title. -% +% % #1 is the section type (sec/subsec/subsubsec), #2 is the section % number (maybe empty), #3 the text. \def\sectionheading#1#2#3{% @@ -3772,7 +3772,7 @@ width0pt\relax} \fi % This is used for \def{tp,vr}parsebody. It could probably be used for % some of the others, too, with some judicious conditionals. -% +% \def\parsebodycommon#1#2#3{% \begingroup\inENV % \medbreak % @@ -3807,13 +3807,13 @@ width0pt\relax} \fi % Fine, but then we have to eventually remove the \empty *and* the % braces (if any). That's what this does. -% +% \def\removeemptybraces\empty#1\relax{#1} % After \spacesplit has done its work, this is called -- #1 is the final % thing to call, #2 the type name (which starts with \empty), and #3 % (which might be empty) the arguments. -% +% \def\parsetpheaderline#1#2#3{% #1{\removeemptybraces#2\relax}{#3}% }% @@ -4186,7 +4186,7 @@ width0pt\relax} \fi % Use \turnoffactive so that punctuation chars such as underscore % work in node names. -\def\dosetq #1#2{{\let\folio=0 \turnoffactive +\def\dosetq #1#2{{\let\folio=0 \turnoffactive \edef\next{\write\auxfile{\internalsetq {#1}{#2}}}% \next}} @@ -4302,11 +4302,11 @@ width0pt\relax} \fi % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first % argument, and \hat is not an expandable control sequence. It could % all be worked out, but why? Either we support ^^ or we don't. - % + % % The other change necessary for this was to define \auxhat: % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter % and then to call \auxhat in \setq. - % + % \catcode`\~=\other \catcode`\[=\other \catcode`\]=\other @@ -4389,7 +4389,7 @@ width0pt\relax} \fi % Don't bother with the trickery in plain.tex to not require the % footnote text as a parameter. Our footnotes don't need to be so general. -% +% % Oh yes, they do; otherwise, @ifset and anything else that uses % \parseargline fail inside footnotes because the tokens are fixed when % the footnote is read. --karl, 16nov96. diff --git a/nis/ypclnt.c b/nis/ypclnt.c index d503434127..6644118ac8 100644 --- a/nis/ypclnt.c +++ b/nis/ypclnt.c @@ -42,7 +42,6 @@ static char __ypdomainname[MAXHOSTNAMELEN + 1] = "\0"; __libc_lock_define_initialized (static, ypbindlist_lock) static dom_binding *__ypbindlist = NULL; -extern void xdr_free (xdrproc_t proc, char *objp); static int __yp_bind (const char *domain, dom_binding ** ypdb) diff --git a/nss/grp-lookup.c b/nss/grp-lookup.c index ce3753c665..e68e8657e8 100644 --- a/nss/grp-lookup.c +++ b/nss/grp-lookup.c @@ -1,22 +1,23 @@ /* Copyright (C) 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. -Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. + 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 Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #define DATABASE_NAME group +#define DEFAULT_CONFIG "compat [NOTFOUND=return] files" #include "XXX-lookup.c" diff --git a/nss/network-lookup.c b/nss/network-lookup.c index 39a5ebd8c1..6ed24e249b 100644 --- a/nss/network-lookup.c +++ b/nss/network-lookup.c @@ -1,23 +1,23 @@ /* Copyright (C) 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. -Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. + 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 Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #define DATABASE_NAME networks -#define DEFAULT_CONFIG "dns files" +#define DEFAULT_CONFIG "dns [!UNAVAIL=return] files" #include "XXX-lookup.c" diff --git a/nss/nsswitch.c b/nss/nsswitch.c index 413cc0daa7..1b061fa3cd 100644 --- a/nss/nsswitch.c +++ b/nss/nsswitch.c @@ -119,7 +119,7 @@ __nss_database_lookup (const char *database, const char *alternate_name, or null to use the most common default. */ if (*ni == NULL) *ni = nss_parse_service_list (defconfig - ?: "compat [NOTFOUND=return] files"); + ?: "nis [NOTFOUND=return] files"); __libc_lock_unlock (lock); diff --git a/nss/pwd-lookup.c b/nss/pwd-lookup.c index e792560bad..f7cbd5a493 100644 --- a/nss/pwd-lookup.c +++ b/nss/pwd-lookup.c @@ -1,22 +1,23 @@ /* Copyright (C) 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. -Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. + 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 Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #define DATABASE_NAME passwd +#define DEFAULT_CONFIG "compat [NOTFOUND=return] files" #include "XXX-lookup.c" diff --git a/nss/spwd-lookup.c b/nss/spwd-lookup.c index fd0a04cc7c..52f2465243 100644 --- a/nss/spwd-lookup.c +++ b/nss/spwd-lookup.c @@ -19,5 +19,6 @@ #define DATABASE_NAME shadow #define ALTERNATE_NAME passwd +#define DEFAULT_CONFIG "compat [NOTFOUND=return] files" #include "XXX-lookup.c" diff --git a/posix/glob.c b/posix/glob.c index ba5f2368f3..ac26a1af21 100644 --- a/posix/glob.c +++ b/posix/glob.c @@ -843,24 +843,10 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) { const char *name; size_t len; - struct dirent dirbuf, *d; - int success; - - if (flags & GLOB_ALTDIRFUNC) - { - d = (*pglob->gl_readdir) (stream); - success = d != NULL; - } - else - { -#if defined HAVE_READDIR_R || defined _LIBC - success = __readdir_r ((DIR *) stream, &dirbuf, &d) >= 0; -#else - d = readdir ((DIR *) stream); - success = d != NULL; -#endif - } - if (! success) + struct dirent *d = ((flags & GLOB_ALTDIRFUNC) ? + (*pglob->gl_readdir) (stream) : + readdir ((DIR *) stream)); + if (d == NULL) break; if (! REAL_DIR_ENTRY (d)) continue; diff --git a/stdio-common/fcloseall.c b/stdio-common/fcloseall.c index d056b902ab..0b1702e112 100644 --- a/stdio-common/fcloseall.c +++ b/stdio-common/fcloseall.c @@ -30,7 +30,7 @@ void __close_all_streams (void) { /* We must be prepared for multi-threading on multiple calls. */ - if (! __libc_lock_trylock (lock) && already_called) + if (! __libc_lock_trylock (lock) && ! already_called) { /* Signal that we already did this. */ already_called = 1; diff --git a/stdlib/on_exit.c b/stdlib/on_exit.c index bd100be895..25b45e5f87 100644 --- a/stdlib/on_exit.c +++ b/stdlib/on_exit.c @@ -1,31 +1,29 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. -This file is part of the GNU C Library. +/* Copyright (C) 1991, 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 -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ -#include <ansidecl.h> #include <stdlib.h> #include "exit.h" /* Register a function to be called by exit. */ int -DEFUN(on_exit, (func, arg), - void EXFUN((*func), (int status, PTR arg)) AND PTR arg) +__on_exit (void (*func) (int status, void *arg), void *arg) { - struct exit_function *new = __new_exitfn(); + struct exit_function *new = __new_exitfn (); if (new == NULL) return -1; @@ -35,3 +33,4 @@ DEFUN(on_exit, (func, arg), new->func.on.arg = arg; return 0; } +weak_alias (__on_exit, on_exit) diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h index 9e08d81c77..99fcf2e7c7 100644 --- a/stdlib/stdlib.h +++ b/stdlib/stdlib.h @@ -367,6 +367,8 @@ extern int atexit __P ((void (*__func) (void))); #ifdef __USE_MISC /* Register a function to be called with the status given to `exit' and the given argument. */ +extern int __on_exit __P ((void (*__func) (int __status, __ptr_t __arg), + __ptr_t __arg)); extern int on_exit __P ((void (*__func) (int __status, __ptr_t __arg), __ptr_t __arg)); #endif diff --git a/sunrpc/rpc/xdr.h b/sunrpc/rpc/xdr.h index ad5b83e798..1cc9af9375 100644 --- a/sunrpc/rpc/xdr.h +++ b/sunrpc/rpc/xdr.h @@ -298,6 +298,9 @@ extern bool_t xdrrec_skiprecord __P ((XDR *__xdrs)); /* true if no more input */ extern bool_t xdrrec_eof __P ((XDR *__xdrs)); +/* free memory buffers for xdr */ +extern void xdr_free __P ((xdrproc_t __proc, char *__objp)); + __END_DECLS #endif /* !__XDR_HEADER__ */ diff --git a/sysdeps/mach/hurd/jmp-unwind.c b/sysdeps/mach/hurd/jmp-unwind.c index 46e4b6157d..2d5804c71e 100644 --- a/sysdeps/mach/hurd/jmp-unwind.c +++ b/sysdeps/mach/hurd/jmp-unwind.c @@ -1,21 +1,21 @@ /* _longjmp_unwind -- Clean up stack frames unwound by longjmp. Hurd version. -Copyright (C) 1995, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. + Copyright (C) 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 -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #include <setjmp.h> #include <hurd/userlink.h> @@ -44,10 +44,10 @@ _longjmp_unwind (jmp_buf env, int val) assert (! __spin_lock_locked (&ss->critical_section_lock)); __spin_lock (&ss->critical_section_lock); - /* Remove local signal preempters being unwound past. */ - while (ss->preempters && - _JMPBUF_UNWINDS (env[0].__jmpbuf, ss->preempters)) - ss->preempters = ss->preempters->next; + /* Remove local signal preemptors being unwound past. */ + while (ss->preemptors && + _JMPBUF_UNWINDS (env[0].__jmpbuf, ss->preemptors)) + ss->preemptors = ss->preemptors->next; __spin_unlock (&ss->lock); diff --git a/sysdeps/mach/hurd/setitimer.c b/sysdeps/mach/hurd/setitimer.c index 0b2ace3f4c..6cad6eab2e 100644 --- a/sysdeps/mach/hurd/setitimer.c +++ b/sysdeps/mach/hurd/setitimer.c @@ -1,20 +1,20 @@ /* Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. + This file is part of the GNU C Library. -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #include <ansidecl.h> #include <stddef.h> @@ -112,7 +112,7 @@ timer_thread (void) static sighandler_t -restart_itimer (struct hurd_signal_preempter *preempter, +restart_itimer (struct hurd_signal_preemptor *preemptor, struct hurd_sigstate *ss, int *signo, struct hurd_signal_detail *detail) { @@ -170,18 +170,18 @@ setitimer_locked (const struct itimerval *new, struct itimerval *old, { /* Make sure the itimer thread is set up. */ - /* Set up a signal preempter global for all threads to + /* Set up a signal preemptor global for all threads to run `restart_itimer' each time a SIGALRM would arrive. */ - static struct hurd_signal_preempter preempter = + static struct hurd_signal_preemptor preemptor = { __sigmask (SIGALRM), 0, 0, &restart_itimer, }; __mutex_lock (&_hurd_siglock); - if (! preempter.next && _hurdsig_preempters != &preempter) + if (! preemptor.next && _hurdsig_preemptors != &preemptor) { - preempter.next = _hurdsig_preempters; - _hurdsig_preempters = &preempter; + preemptor.next = _hurdsig_preemptors; + _hurdsig_preemptors = &preemptor; } __mutex_unlock (&_hurd_siglock); diff --git a/sysdeps/mach/hurd/sigwait.c b/sysdeps/mach/hurd/sigwait.c index b3916f83ae..b8e5ade84f 100644 --- a/sysdeps/mach/hurd/sigwait.c +++ b/sysdeps/mach/hurd/sigwait.c @@ -1,20 +1,20 @@ /* Copyright (C) 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. + This file is part of the GNU C Library. -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #include <errno.h> #include <hurd.h> @@ -30,13 +30,13 @@ __sigwait (const sigset_t *set, int *sig) struct hurd_sigstate *ss; sigset_t mask; int signo = 0; - struct hurd_signal_preempter preempter; + struct hurd_signal_preemptor preemptor; jmp_buf buf; mach_port_t wait; mach_msg_header_t msg; - + sighandler_t - preempt_fun (struct hurd_signal_preempter *pe, + preempt_fun (struct hurd_signal_preemptor *pe, struct hurd_sigstate *ss, int *sigp, struct hurd_signal_detail *detail) @@ -44,7 +44,7 @@ __sigwait (const sigset_t *set, int *sig) if (signo) /* We've already been run; don't interfere. */ return SIG_ERR; - + signo = *sigp; /* Make sure this is all kosher */ @@ -55,7 +55,7 @@ __sigwait (const sigset_t *set, int *sig) return pe->handler; } - + void handler (int sig) { @@ -68,10 +68,10 @@ __sigwait (const sigset_t *set, int *sig) if (set != NULL) /* Crash before locking */ mask = *set; - + ss = _hurd_self_sigstate (); __spin_lock (&ss->lock); - + /* See if one of these signals is currently pending */ if (ss->pending & mask) { @@ -86,22 +86,22 @@ __sigwait (const sigset_t *set, int *sig) } /* Wait for one of them to show up */ - + if (!setjmp (buf)) { - /* Make the preempter */ - preempter.signals = mask; - preempter.first = 0; - preempter.last = -1; - preempter.preempter = preempt_fun; - preempter.handler = handler; - - /* Install this preempter */ - preempter.next = ss->preempters; - ss->preempters = &preempter; - + /* Make the preemptor */ + preemptor.signals = mask; + preemptor.first = 0; + preemptor.last = -1; + preemptor.preemptor = preempt_fun; + preemptor.handler = handler; + + /* Install this preemptor */ + preemptor.next = ss->preemptors; + ss->preemptors = &preemptor; + __spin_unlock (&ss->lock); - + /* Wait. */ __mach_msg (&msg, MACH_RCV_MSG, 0, sizeof (msg), wait, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); @@ -113,11 +113,11 @@ __sigwait (const sigset_t *set, int *sig) __spin_lock (&ss->lock); - /* Delete our preempter. */ - assert (ss->preempters == &preempter); - ss->preempters = preempter.next; + /* Delete our preemptor. */ + assert (ss->preemptors == &preemptor); + ss->preemptors = preemptor.next; } - + all_done: /* Cause the pointless side-effect. */ diff --git a/sysdeps/mach/libc-lock.h b/sysdeps/mach/libc-lock.h index e2caa82b9b..36bf2c1038 100644 --- a/sysdeps/mach/libc-lock.h +++ b/sysdeps/mach/libc-lock.h @@ -54,7 +54,7 @@ typedef struct __libc_lock_opaque__ __libc_lock_t; #define __libc_lock_lock(NAME) __mutex_lock (&(NAME)) /* Lock the named lock variable. */ -#define __libc_lock_trylock(NAME) __mutex_trylock (&(NAME)) +#define __libc_lock_trylock(NAME) (!__mutex_trylock (&(NAME))) /* Unlock the named lock variable. */ #define __libc_lock_unlock(NAME) __mutex_unlock (&(NAME)) diff --git a/sysdeps/posix/getcwd.c b/sysdeps/posix/getcwd.c index 4ea90a7320..a83b286380 100644 --- a/sysdeps/posix/getcwd.c +++ b/sysdeps/posix/getcwd.c @@ -187,10 +187,6 @@ extern char *alloca (); #define __getcwd getcwd #endif -#if defined HAVE_READDIR_R && !defined _LIBC -#define __readdir_r readdir_r -#endif - /* Get the pathname of the current working directory, and put it in SIZE bytes of BUF. Returns NULL if the directory couldn't be determined or SIZE was too small. If successful, returns BUF. In GNU, if BUF is @@ -254,9 +250,6 @@ __getcwd (buf, size) { register DIR *dirstream; struct dirent *d; -#if defined HAVE_READDIR_R || defined _LIBC - struct dirent dirbuf; -#endif dev_t dotdev; ino_t dotino; char mount_point; @@ -299,13 +292,7 @@ __getcwd (buf, size) dirstream = __opendir (dotp); if (dirstream == NULL) goto lose; - while ( -#if defined HAVE_READDIR_R || defined _LIBC - __readdir_r (dirstream, &dirbuf, &d) >= 0 -#else - (d = __readdir (dirstream)) != NULL -#endif - ) + while ((d = __readdir (dirstream)) != NULL) { if (d->d_name[0] == '.' && (d->d_name[1] == '\0' || diff --git a/sysdeps/posix/ttyname.c b/sysdeps/posix/ttyname.c index 043e91b084..ce384ebc0e 100644 --- a/sysdeps/posix/ttyname.c +++ b/sysdeps/posix/ttyname.c @@ -41,7 +41,7 @@ ttyname (fd) dev_t mydev; ino_t myino; DIR *dirstream; - struct dirent dirbuf, *d; + struct dirent *d; int save = errno; if (!__isatty (fd)) @@ -56,7 +56,7 @@ ttyname (fd) if (dirstream == NULL) return NULL; - while (__readdir_r (dirstream, &dirbuf, &d) >= 0) + while ((d = readdir (dirstream)) != NULL) if ((ino_t) d->d_fileno == myino) { size_t dlen = _D_ALLOC_NAMLEN (d); @@ -66,7 +66,11 @@ ttyname (fd) namelen = 2 * (sizeof (dev) + dlen); /* Big enough. */ name = malloc (namelen); if (! name) - return NULL; + { + /* Perhaps it helps to free the directory stream buffer. */ + (void) closedir (dirstream); + return NULL; + } (void) memcpy (name, dev, sizeof (dev) - 1); name[sizeof (dev) - 1] = '/'; } diff --git a/sysdeps/posix/ttyname_r.c b/sysdeps/posix/ttyname_r.c index c7cf21aeee..d404245be5 100644 --- a/sysdeps/posix/ttyname_r.c +++ b/sysdeps/posix/ttyname_r.c @@ -43,7 +43,7 @@ __ttyname_r (fd, buf, buflen) dev_t mydev; ino_t myino; DIR *dirstream; - struct dirent dirbuf, *d; + struct dirent *d; int save = errno; /* Test for the absolute minimal size. This makes life easier inside @@ -74,7 +74,7 @@ __ttyname_r (fd, buf, buflen) buf[sizeof (dev) - 1] = '/'; buflen -= sizeof (dev); - while (__readdir_r (dirstream, &dirbuf, &d) >= 0) + while ((d = readdir (dirstream)) != NULL) if ((ino_t) d->d_fileno == myino) { char *cp; diff --git a/sysdeps/unix/sysv/linux/m68k/Dist b/sysdeps/unix/sysv/linux/m68k/Dist index 738b9cc542..e7d5949d51 100644 --- a/sysdeps/unix/sysv/linux/m68k/Dist +++ b/sysdeps/unix/sysv/linux/m68k/Dist @@ -1 +1,2 @@ clone.S +mremap.S diff --git a/sysdeps/unix/sysv/linux/m68k/Makefile b/sysdeps/unix/sysv/linux/m68k/Makefile index bdbd1057c4..12e95f11bf 100644 --- a/sysdeps/unix/sysv/linux/m68k/Makefile +++ b/sysdeps/unix/sysv/linux/m68k/Makefile @@ -1,3 +1,7 @@ # Linux/m68k uses Motorola asm syntax and the ELF format. m68k-syntax-flag = -DMOTOROLA_SYNTAX + +ifeq ($(subdir),misc) +sysdep_routines += mremap +endif diff --git a/sysdeps/unix/sysv/linux/schedbits.h b/sysdeps/unix/sysv/linux/schedbits.h index 2af419ec4e..97683cd3ef 100644 --- a/sysdeps/unix/sysv/linux/schedbits.h +++ b/sysdeps/unix/sysv/linux/schedbits.h @@ -1,22 +1,22 @@ /* Definitions of constants and data structure for POSIX 1003.1b-1993 scheduling interface. -Copyright (C) 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. + Copyright (C) 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 -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #ifndef _SCHEDBITS_H #define _SCHEDBITS_H 1 @@ -44,6 +44,8 @@ struct sched_param /* Clone current process. The parameter list of FN is not for true. Only dots is not allowed by ISO C and without argument the compiler would complain about a missing parameter list. */ +extern int __clone __P ((int (*__fn) (void *, ...), void *__child_stack, + int __flags, int __nargs, ...)); extern int clone __P ((int (*__fn) (void *, ...), void *__child_stack, int __flags, int __nargs, ...)); diff --git a/termios/sys/ttydefaults.h b/termios/sys/ttydefaults.h index 1a8aaa5bd0..a615b3d6c6 100644 --- a/termios/sys/ttydefaults.h +++ b/termios/sys/ttydefaults.h @@ -48,7 +48,11 @@ * Defaults on "first" open. */ #define TTYDEF_IFLAG (BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY) +#ifdef OXTABS #define TTYDEF_OFLAG (OPOST | ONLCR | OXTABS) +#else +#define TTYDEF_OFLAG (OPOST | ONLCR | XTABS) +#endif #define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL) #define TTYDEF_CFLAG (CREAD | CS7 | PARENB | HUPCL) #define TTYDEF_SPEED (B9600) @@ -58,10 +62,18 @@ */ #define CTRL(x) (x&037) #define CEOF CTRL('d') +#ifdef _POSIX_VDISABLE +#define CEOL _POSIX_VDISABLE +#else #define CEOL ((unsigned char)'\377') /* XXX avoid _POSIX_VDISABLE */ +#endif #define CERASE 0177 #define CINTR CTRL('c') +#ifdef _POSIX_VDISABLE +#define CSTATUS _POSIX_VDISABLE +#else #define CSTATUS ((unsigned char)'\377') /* XXX avoid _POSIX_VDISABLE */ +#endif #define CKILL CTRL('u') #define CMIN 1 #define CQUIT 034 /* FS, ^\ */ @@ -88,7 +100,7 @@ */ #ifdef TTYDEFCHARS cc_t ttydefchars[NCCS] = { - CEOF, CEOL, CEOL, CERASE, CWERASE, CKILL, CREPRINT, + CEOF, CEOL, CEOL, CERASE, CWERASE, CKILL, CREPRINT, _POSIX_VDISABLE, CINTR, CQUIT, CSUSP, CDSUSP, CSTART, CSTOP, CLNEXT, CDISCARD, CMIN, CTIME, CSTATUS, _POSIX_VDISABLE }; diff --git a/time/Makefile b/time/Makefile index e55b6641d3..966d9f2790 100644 --- a/time/Makefile +++ b/time/Makefile @@ -146,7 +146,3 @@ CFLAGS-zic.c = -Wno-strict-prototypes -DNOID $(tz-cflags) CFLAGS-ialloc.c = -Wno-strict-prototypes -DNOID CFLAGS-scheck.c = -Wno-strict-prototypes -DNOID CFLAGS-tzfile.c = $(tz-cflags) - -ifeq ($(malloc),new-malloc) -CFLAGS-ap.c = -DNO_MCHECK -endif @@ -29,9 +29,7 @@ main (int argc, char **argv) char buf[20]; time_t t; -#ifndef NO_MCHECK mcheck (NULL); -#endif if (argc != 1) fprintf(stderr, "Usage: %s\n", argv[0]); diff --git a/time/ctime.c b/time/ctime.c index f13d00e551..4f06f1e533 100644 --- a/time/ctime.c +++ b/time/ctime.c @@ -27,10 +27,7 @@ char * ctime (const time_t *t) { - static char buf[64]; /* POSIX.1 suggests at least 26 bytes. */ - struct tm tm; - struct tm *tp = __localtime_r (t, &tm); - if (tp == NULL) - return NULL; - return __asctime_r (tp, buf); + /* The C Standard says ctime (t) is equivalent to asctime (localtime (t)). + In particular, ctime and asctime must yield the same pointer. */ + return asctime (localtime (t)); } diff --git a/time/localtime.c b/time/localtime.c index 833d708b8d..5e1dd0a5b5 100644 --- a/time/localtime.c +++ b/time/localtime.c @@ -1,21 +1,21 @@ /* localtime -- convert `time_t' to `struct tm' in local time zone -Copyright (C) 1991, 92, 93, 95, 96 Free Software Foundation, Inc. -This file is part of the GNU C Library. + Copyright (C) 1991, 92, 93, 95, 96 Free Software Foundation, Inc. + This file is part of the GNU C Library. -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #include <errno.h> #include <time.h> @@ -24,6 +24,10 @@ Cambridge, MA 02139, USA. */ /* The C Standard says that localtime and gmtime return the same pointer. */ struct tm _tmbuf; +/* Prototype for the internal function to get information based on TZ. */ +extern void __tzset_internal __P ((void)); + + /* Return the `struct tm' representation of *TIMER in the local timezone. */ struct tm * localtime (timer) @@ -57,7 +61,7 @@ __localtime_r (timer, tp) __libc_lock_lock (__tzset_lock); /* Make sure the database is initialized. */ - __tzset (); + __tzset_internal (); if (__use_tzfile) { diff --git a/time/strftime.c b/time/strftime.c index ddea0240f6..fea545cd38 100644 --- a/time/strftime.c +++ b/time/strftime.c @@ -128,6 +128,8 @@ extern char *tzname[]; # define gmtime_r __gmtime_r # define localtime_r __localtime_r extern int __tz_compute __P ((time_t timer, const struct tm *tm)); +# define tzname __tzname +# define tzset __tzset #else # if ! HAVE_LOCALTIME_R # if ! HAVE_TM_GMTOFF diff --git a/time/tzset.c b/time/tzset.c index bbd562db6a..085dfcaa33 100644 --- a/time/tzset.c +++ b/time/tzset.c @@ -78,7 +78,7 @@ static char *old_tz = NULL; /* Interpret the TZ envariable. */ void -__tzset () +__tzset_internal () { register const char *tz; register size_t l; @@ -374,7 +374,7 @@ size_t __tzname_cur_max; long int __tzname_max () { - __tzset (); + __tzset_internal (); return __tzname_cur_max; } @@ -472,7 +472,7 @@ __tz_compute (timer, tm) time_t timer; const struct tm *tm; { - __tzset (); + __tzset_internal (); if (! compute_change (&tz_rules[0], 1900 + tm->tm_year) || ! compute_change (&tz_rules[1], 1900 + tm->tm_year)) @@ -505,14 +505,11 @@ __libc_lock_define (, __tzset_lock) #undef tzset void -#ifdef weak_function -weak_function -#endif -tzset (void) +__tzset (void) { __libc_lock_lock (__tzset_lock); - __tzset (); + __tzset_internal (); if (!__use_tzfile) { @@ -523,3 +520,4 @@ tzset (void) __libc_lock_unlock (__tzset_lock); } +weak_alias (__tzset, tzset) diff --git a/wctype/iswctype.c b/wctype/iswctype.c index 041548b2dc..58a2a5288f 100644 --- a/wctype/iswctype.c +++ b/wctype/iswctype.c @@ -1,21 +1,21 @@ /* Copyright (C) 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. -Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>. -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #include <ctype.h> #include <wctype.h> @@ -27,7 +27,7 @@ extern unsigned int *__ctype32_b; int -iswctype (wint_t wc, wctype_t desc) +__iswctype (wint_t wc, wctype_t desc) { size_t idx; @@ -37,3 +37,4 @@ iswctype (wint_t wc, wctype_t desc) return __ctype32_b[idx] & desc; } +weak_alias (__iswctype, iswctype) diff --git a/wctype/wctype.h b/wctype/wctype.h index 1b83b6821c..3ba8ae7614 100644 --- a/wctype/wctype.h +++ b/wctype/wctype.h @@ -152,6 +152,7 @@ extern wctype_t wctype __P ((__const char *__property)); /* Determine whether the wide-character WC has the property described by DESC. */ +extern int __iswctype __P ((wint_t __wc, wctype_t __desc)); extern int iswctype __P ((wint_t __wc, wctype_t __desc)); @@ -179,20 +180,20 @@ extern wint_t towctrans __P ((wint_t __wc, wctrans_t __desc)); #ifndef __NO_WCTYPE -#define iswalnum(wc) iswctype ((wc), _ISalnum) -#define iswalpha(wc) iswctype ((wc), _ISalpha) -#define iswcntrl(wc) iswctype ((wc), _IScntrl) -#define iswdigit(wc) iswctype ((wc), _ISdigit) -#define iswlower(wc) iswctype ((wc), _ISlower) -#define iswgraph(wc) iswctype ((wc), _ISgraph) -#define iswprint(wc) iswctype ((wc), _ISprint) -#define iswpunct(wc) iswctype ((wc), _ISpunct) -#define iswspace(wc) iswctype ((wc), _ISspace) -#define iswupper(wc) iswctype ((wc), _ISupper) -#define iswxdigit(wc) iswctype ((wc), _ISxdigit) +#define iswalnum(wc) __iswctype ((wc), _ISalnum) +#define iswalpha(wc) __iswctype ((wc), _ISalpha) +#define iswcntrl(wc) __iswctype ((wc), _IScntrl) +#define iswdigit(wc) __iswctype ((wc), _ISdigit) +#define iswlower(wc) __iswctype ((wc), _ISlower) +#define iswgraph(wc) __iswctype ((wc), _ISgraph) +#define iswprint(wc) __iswctype ((wc), _ISprint) +#define iswpunct(wc) __iswctype ((wc), _ISpunct) +#define iswspace(wc) __iswctype ((wc), _ISspace) +#define iswupper(wc) __iswctype ((wc), _ISupper) +#define iswxdigit(wc) __iswctype ((wc), _ISxdigit) #ifdef __USE_GNU -#define iswblank(wc) iswctype ((wc), _ISblank) +#define iswblank(wc) __iswctype ((wc), _ISblank) #endif /* Pointer to conversion tables. */ |