+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[].
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)
__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;
/* 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>
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,
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;
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;
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;
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;
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 ();
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. */
/* 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;
}
-
/* 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
#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. */
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];
/* 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
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. */
/* 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
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);
/* 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>
#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;
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;
}
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);
}
__mach_port_deallocate (__mach_task_self (), sigexc);
assert_perror (err);
}
-
/* 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
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) \
__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;
}
}
-struct hurd_signal_preempter *_hurdsig_preempters;
+struct hurd_signal_preemptor *_hurdsig_preemptors;
sigset_t _hurdsig_preempted_set;
/* Mask of stop signals. */
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;
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);
}
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;
/* 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;
}
__mutex_unlock (&_hurd_siglock); /* Avoid deadlock during death rattle. */
- assert (! "removing absent preempter");
+ assert (! "removing absent preemptor");
}
register FTS *sp;
int type;
{
- struct dirent dirbuf, *dp;
+ struct dirent *dp;
register FTSENT *p, *head;
register int nitems;
FTSENT *cur, *tail;
/* 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))
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;
while (skip-- != 0)
{
__set_errno (0);
- if (__readdir_r (dirs[level], &dirbuf, &entry) < 0)
+ if (readdir (dirs[level]) == NULL)
return errno == 0 ? 0 : -1;
}
}
_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);
_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;
#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))
-/* 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
__spin_lock_solid (__lock);
}
\f
-/* 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
__mutex_unlock_solid (__lock);
}
+
+_EXTERN_INLINE int
+__mutex_trylock (void *__lock)
+{
+ return __spin_try_lock ((__spin_lock_t *) __lock);
+}
+
#endif /* lock-intern.h */
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:
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.
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.
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
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).
*/
#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
#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
*/
-#define HAVE_MEMCPY
+#define HAVE_MEMCPY 1
#ifndef USE_MEMCPY
#ifdef HAVE_MEMCPY
+#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 */
#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 */
#endif /* _LIBC */
-#if 0 && defined(_LIBC)
+#ifdef _LIBC
#define cALLOc __libc_calloc
#define fREe __libc_free
#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
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);
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();
*/
#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
\f
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);
/* Initialization routine. */
#if defined(_LIBC)
+#if 0
static void ptmalloc_init __MALLOC_P ((void)) __attribute__ ((constructor));
+#endif
static void
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
+
\f
#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;
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;
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);
/* 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))
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;
}
}
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;
}
}
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;
}
}
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;
}
}
}
/* 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;
}
}
check_inuse_chunk(ar_ptr, newp);
- (void)mutex_unlock(&ar_ptr->mutex);
- return chunk2mem(newp);
+ return newp;
}
{
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 */
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);
{
#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
}
*/
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);
{
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
}
check_inuse_chunk(ar_ptr, p);
- (void)mutex_unlock(&ar_ptr->mutex);
- return chunk2mem(p);
-
+ return p;
}
\f
/*
- calloc calls malloc, then zeroes out the allocated chunk.
+ calloc calls chunk_alloc, then zeroes out the allocated chunk.
*/
{
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;
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);
#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;
}
}
+\f
+#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
+\f
+
+#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.
#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));
/* 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
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.
%% 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.
% 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
\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
% 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
% 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 ...
%
% 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.
% @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
% 0pt means it depends on current normal line spacing.
%%%%
-% Dimensions
+% Dimensions
\newskip\multitableparskip
\newskip\multitableparindent
% 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
\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:
%% 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
\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.
% 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{%
% 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 %
% 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}%
}%
% 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}}
% 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
% 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.
__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)
/* 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"
/* 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"
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);
/* 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"
#define DATABASE_NAME shadow
#define ALTERNATE_NAME passwd
+#define DEFAULT_CONFIG "compat [NOTFOUND=return] files"
#include "XXX-lookup.c"
{
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;
__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;
-/* 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;
new->func.on.arg = arg;
return 0;
}
+weak_alias (__on_exit, on_exit)
#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
/* 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__ */
/* _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>
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);
/* 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>
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)
{
{
/* 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);
/* 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>
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)
if (signo)
/* We've already been run; don't interfere. */
return SIG_ERR;
-
+
signo = *sigp;
/* Make sure this is all kosher */
return pe->handler;
}
-
+
void
handler (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)
{
}
/* 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);
__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. */
#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))
#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
{
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;
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' ||
dev_t mydev;
ino_t myino;
DIR *dirstream;
- struct dirent dirbuf, *d;
+ struct dirent *d;
int save = errno;
if (!__isatty (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);
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] = '/';
}
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
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;
# Linux/m68k uses Motorola asm syntax and the ELF format.
m68k-syntax-flag = -DMOTOROLA_SYNTAX
+
+ifeq ($(subdir),misc)
+sysdep_routines += mremap
+endif
/* 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
/* 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, ...));
* 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)
*/
#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, ^\ */
*/
#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
};
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
char buf[20];
time_t t;
-#ifndef NO_MCHECK
mcheck (NULL);
-#endif
if (argc != 1)
fprintf(stderr, "Usage: %s\n", argv[0]);
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));
}
/* 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>
/* 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)
__libc_lock_lock (__tzset_lock);
/* Make sure the database is initialized. */
- __tzset ();
+ __tzset_internal ();
if (__use_tzfile)
{
# 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
/* Interpret the TZ envariable. */
void
-__tzset ()
+__tzset_internal ()
{
register const char *tz;
register size_t l;
long int
__tzname_max ()
{
- __tzset ();
+ __tzset_internal ();
return __tzname_cur_max;
}
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))
#undef tzset
void
-#ifdef weak_function
-weak_function
-#endif
-tzset (void)
+__tzset (void)
{
__libc_lock_lock (__tzset_lock);
- __tzset ();
+ __tzset_internal ();
if (!__use_tzfile)
{
__libc_lock_unlock (__tzset_lock);
}
+weak_alias (__tzset, tzset)
/* 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>
int
-iswctype (wint_t wc, wctype_t desc)
+__iswctype (wint_t wc, wctype_t desc)
{
size_t idx;
return __ctype32_b[idx] & desc;
}
+weak_alias (__iswctype, iswctype)
/* 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));
#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. */