compat core reorg.
This commit is contained in:
parent
ba2a95bba7
commit
5b84b3983f
@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile,v 1.122 2005/05/30 16:04:18 thorpej Exp $
|
||||
# $NetBSD: Makefile,v 1.123 2005/09/13 01:44:08 christos Exp $
|
||||
# @(#)Makefile 8.2 (Berkeley) 2/3/94
|
||||
#
|
||||
# All library objects contain sccsid strings by default; they may be
|
||||
@ -87,6 +87,7 @@ assym.h: ${ARCHDIR}/genassym.cf
|
||||
.include "${.CURDIR}/db/Makefile.inc"
|
||||
.include "${.CURDIR}/citrus/Makefile.inc"
|
||||
.include "${.CURDIR}/compat-43/Makefile.inc"
|
||||
.include "${.CURDIR}/compat/Makefile.inc"
|
||||
.include "${.CURDIR}/dlfcn/Makefile.inc"
|
||||
.include "${.CURDIR}/gen/Makefile.inc"
|
||||
.include "${.CURDIR}/gmon/Makefile.inc"
|
||||
|
@ -1,7 +1,7 @@
|
||||
# $NetBSD: Makefile.inc,v 1.18 2003/09/06 22:56:47 christos Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.19 2005/09/13 01:44:08 christos Exp $
|
||||
|
||||
KMSRCS= bcmp.S bcopy.S bzero.S ffs.S index.S rindex.S \
|
||||
memchr.S memcmp.S memcpy.S memmove.S memset.S \
|
||||
strcat.S strchr.S strcmp.S strcpy.S strlen.S strrchr.S
|
||||
|
||||
SRCS+= __sigaction14_sigtramp.c __sigtramp1.S __sigtramp2.S
|
||||
SRCS+= __sigaction14_sigtramp.c __sigtramp2.S
|
||||
|
@ -1,13 +1,11 @@
|
||||
# $NetBSD: Makefile.inc,v 1.21 2005/04/15 22:39:11 kleink Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.22 2005/09/13 01:44:08 christos Exp $
|
||||
|
||||
# objects built from assembler sources (need lint stubs)
|
||||
SRCS+= alloca.S byte_swap_2.S byte_swap_4.S fabs.S modf.S \
|
||||
flt_rounds.S fpgetmask.S fpgetround.S fpgetsticky.S \
|
||||
fpsetmask.S fpsetround.S fpsetsticky.S
|
||||
|
||||
SRCS+= setjmp.S __setjmp14.S
|
||||
SRCS+= _setjmp.S
|
||||
SRCS+= sigsetjmp.S __sigsetjmp14.S
|
||||
SRCS+= setjmp.S sigsetjmp.S
|
||||
|
||||
SRCS+= resumecontext.S swapcontext.S
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: setjmp.S,v 1.13 2003/08/07 16:42:07 agc Exp $ */
|
||||
/* $NetBSD: setjmp.S,v 1.14 2005/09/13 01:44:08 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
#include <machine/asm.h>
|
||||
#if defined(LIBC_SCCS)
|
||||
RCSID("$NetBSD: setjmp.S,v 1.13 2003/08/07 16:42:07 agc Exp $")
|
||||
RCSID("$NetBSD: setjmp.S,v 1.14 2005/09/13 01:44:08 christos Exp $")
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -49,18 +49,7 @@
|
||||
* The previous signal state is restored.
|
||||
*/
|
||||
|
||||
ENTRY(setjmp)
|
||||
|
||||
PIC_PROLOGUE
|
||||
pushl $0
|
||||
#ifdef PIC
|
||||
call PIC_PLT(_C_LABEL(sigblock))
|
||||
#else
|
||||
call _C_LABEL(sigblock)
|
||||
#endif
|
||||
addl $4,%esp
|
||||
PIC_EPILOGUE
|
||||
|
||||
ENTRY(__setjmp14)
|
||||
movl 4(%esp),%ecx
|
||||
movl 0(%esp),%edx
|
||||
movl %edx, 0(%ecx)
|
||||
@ -69,21 +58,40 @@ ENTRY(setjmp)
|
||||
movl %ebp,12(%ecx)
|
||||
movl %esi,16(%ecx)
|
||||
movl %edi,20(%ecx)
|
||||
movl %eax,24(%ecx)
|
||||
|
||||
/* Get the signal mask. */
|
||||
leal 24(%ecx),%edx
|
||||
|
||||
PIC_PROLOGUE
|
||||
pushl %edx
|
||||
pushl $0
|
||||
pushl $0
|
||||
#ifdef PIC
|
||||
call PIC_PLT(_C_LABEL(__sigprocmask14))
|
||||
#else
|
||||
call _C_LABEL(__sigprocmask14)
|
||||
#endif
|
||||
addl $12,%esp
|
||||
PIC_EPILOGUE
|
||||
|
||||
xorl %eax,%eax
|
||||
ret
|
||||
|
||||
ENTRY(longjmp)
|
||||
movl 4(%esp),%edx
|
||||
ENTRY(__longjmp14)
|
||||
/* Restore the signal mask. */
|
||||
movl 4(%esp),%ecx
|
||||
leal 24(%ecx),%edx
|
||||
|
||||
PIC_PROLOGUE
|
||||
pushl 24(%edx)
|
||||
pushl $0
|
||||
pushl %edx
|
||||
pushl $3 /* SIG_SETMASK */
|
||||
#ifdef PIC
|
||||
call PIC_PLT(_C_LABEL(sigsetmask))
|
||||
call PIC_PLT(_C_LABEL(__sigprocmask14))
|
||||
#else
|
||||
call _C_LABEL(sigsetmask)
|
||||
call _C_LABEL(__sigprocmask14)
|
||||
#endif
|
||||
addl $4,%esp
|
||||
addl $12,%esp
|
||||
PIC_EPILOGUE
|
||||
|
||||
movl 4(%esp),%edx
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sigsetjmp.S,v 1.15 2003/08/07 16:42:07 agc Exp $ */
|
||||
/* $NetBSD: sigsetjmp.S,v 1.16 2005/09/13 01:44:08 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -36,51 +36,62 @@
|
||||
|
||||
#include <machine/asm.h>
|
||||
#if defined(LIBC_SCCS)
|
||||
RCSID("$NetBSD: sigsetjmp.S,v 1.15 2003/08/07 16:42:07 agc Exp $")
|
||||
RCSID("$NetBSD: sigsetjmp.S,v 1.16 2005/09/13 01:44:08 christos Exp $")
|
||||
#endif
|
||||
|
||||
ENTRY(sigsetjmp)
|
||||
ENTRY(__sigsetjmp14)
|
||||
movl 4(%esp),%ecx
|
||||
movl 8(%esp),%eax
|
||||
movl %eax,28(%ecx)
|
||||
testl %eax,%eax
|
||||
jz 2f
|
||||
|
||||
PIC_PROLOGUE
|
||||
pushl $0
|
||||
#ifdef PIC
|
||||
call PIC_PLT(_C_LABEL(sigblock))
|
||||
#else
|
||||
call _C_LABEL(sigblock)
|
||||
#endif
|
||||
addl $4,%esp
|
||||
PIC_EPILOGUE
|
||||
|
||||
movl 4(%esp),%ecx
|
||||
movl %eax,24(%ecx)
|
||||
2: movl 0(%esp),%edx
|
||||
movl 0(%esp),%edx
|
||||
movl %edx, 0(%ecx)
|
||||
movl %ebx, 4(%ecx)
|
||||
movl %esp, 8(%ecx)
|
||||
movl %ebp,12(%ecx)
|
||||
movl %esi,16(%ecx)
|
||||
movl %edi,20(%ecx)
|
||||
xorl %eax,%eax
|
||||
ret
|
||||
|
||||
ENTRY(siglongjmp)
|
||||
movl 4(%esp),%edx
|
||||
cmpl $0,28(%edx)
|
||||
jz 2f
|
||||
/* Check if we should save the signal mask, and remember it. */
|
||||
movl 8(%esp),%eax
|
||||
movl %eax,40(%ecx)
|
||||
testl %eax,%eax
|
||||
jz 2f /* no, skip */
|
||||
|
||||
/* Get the signal mask. */
|
||||
leal 24(%ecx),%edx
|
||||
|
||||
PIC_PROLOGUE
|
||||
pushl 24(%edx)
|
||||
pushl %edx
|
||||
pushl $0
|
||||
pushl $0
|
||||
#ifdef PIC
|
||||
call PIC_PLT(_C_LABEL(sigsetmask))
|
||||
call PIC_PLT(_C_LABEL(__sigprocmask14))
|
||||
#else
|
||||
call _C_LABEL(sigsetmask)
|
||||
call _C_LABEL(__sigprocmask14)
|
||||
#endif
|
||||
addl $4,%esp
|
||||
addl $12,%esp
|
||||
PIC_EPILOGUE
|
||||
|
||||
2: xorl %eax,%eax
|
||||
ret
|
||||
|
||||
ENTRY(__siglongjmp14)
|
||||
/* Check to see if we need to restore the signal mask. */
|
||||
movl 4(%esp),%ecx
|
||||
cmpl $0,40(%ecx)
|
||||
jz 2f /* no, skip */
|
||||
|
||||
/* Restore the signal mask. */
|
||||
leal 24(%ecx),%edx
|
||||
|
||||
PIC_PROLOGUE
|
||||
pushl $0
|
||||
pushl %edx
|
||||
pushl $3 /* SIG_SETMASK */
|
||||
#ifdef PIC
|
||||
call PIC_PLT(_C_LABEL(__sigprocmask14))
|
||||
#else
|
||||
call _C_LABEL(__sigprocmask14)
|
||||
#endif
|
||||
addl $12,%esp
|
||||
PIC_EPILOGUE
|
||||
|
||||
2: movl 4(%esp),%edx
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: __sigaction14_sigtramp.c,v 1.9 2005/06/12 05:21:26 lukem Exp $ */
|
||||
/* $NetBSD: __sigaction14_sigtramp.c,v 1.10 2005/09/13 01:44:08 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
@ -38,7 +38,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: __sigaction14_sigtramp.c,v 1.9 2005/06/12 05:21:26 lukem Exp $");
|
||||
__RCSID("$NetBSD: __sigaction14_sigtramp.c,v 1.10 2005/09/13 01:44:08 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -53,9 +53,11 @@ __weak_alias(__sigaction14, __libc_sigaction14)
|
||||
int
|
||||
__libc_sigaction14(int sig, const struct sigaction *act, struct sigaction *oact)
|
||||
{
|
||||
extern const int __sigtramp_sigcontext_1[];
|
||||
extern const int __sigtramp_siginfo_2[];
|
||||
#ifdef __LIBC12_SOURCE__
|
||||
int rv;
|
||||
extern const int __sigtramp_sigcontext_1[];
|
||||
#endif
|
||||
extern const int __sigtramp_siginfo_2[];
|
||||
|
||||
/*
|
||||
* If no sigaction, use the "default" trampoline since it won't
|
||||
@ -64,6 +66,7 @@ __libc_sigaction14(int sig, const struct sigaction *act, struct sigaction *oact)
|
||||
if (act == NULL)
|
||||
return __sigaction_sigtramp(sig, act, oact, NULL, 0);
|
||||
|
||||
#ifdef __LIBC12_SOURCE__
|
||||
/*
|
||||
* We select the non-SA_SIGINFO trampoline if SA_SIGINFO is not
|
||||
* set in the sigaction.
|
||||
@ -76,6 +79,7 @@ __libc_sigaction14(int sig, const struct sigaction *act, struct sigaction *oact)
|
||||
return rv;
|
||||
errno = sav;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If SA_SIGINFO was specified or the compatibility trampolines
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sigcompat.c,v 1.11 2003/08/07 16:42:40 agc Exp $ */
|
||||
/* $NetBSD: sigcompat.c,v 1.12 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -34,20 +34,19 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)sigcompat.c 8.1 (Berkeley) 6/2/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: sigcompat.c,v 1.11 2003/08/07 16:42:40 agc Exp $");
|
||||
__RCSID("$NetBSD: sigcompat.c,v 1.12 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <signal.h>
|
||||
#include <compat/sys/signal.h>
|
||||
|
||||
static __inline void sv2sa __P((struct sigaction *, const struct sigvec *));
|
||||
static __inline void sa2sv __P((struct sigvec *, const struct sigaction *));
|
||||
static __inline void sv2sa(struct sigaction *, const struct sigvec *);
|
||||
static __inline void sa2sv(struct sigvec *, const struct sigaction *);
|
||||
|
||||
static __inline void
|
||||
sv2sa(sa, sv)
|
||||
struct sigaction *sa;
|
||||
const struct sigvec *sv;
|
||||
sv2sa(struct sigaction *sa, const struct sigvec *sv)
|
||||
{
|
||||
sigemptyset(&sa->sa_mask);
|
||||
sa->sa_mask.__bits[0] = sv->sv_mask;
|
||||
@ -56,9 +55,7 @@ sv2sa(sa, sv)
|
||||
}
|
||||
|
||||
static __inline void
|
||||
sa2sv(sv, sa)
|
||||
struct sigvec *sv;
|
||||
const struct sigaction *sa;
|
||||
sa2sv(struct sigvec *sv, const struct sigaction *sa)
|
||||
{
|
||||
sv->sv_mask = sa->sa_mask.__bits[0];
|
||||
sv->sv_handler = sa->sa_handler;
|
||||
@ -66,9 +63,7 @@ sa2sv(sv, sa)
|
||||
}
|
||||
|
||||
int
|
||||
sigvec(signo, nsv, osv)
|
||||
int signo;
|
||||
struct sigvec *nsv, *osv;
|
||||
sigvec(int signo, struct sigvec *nsv, struct sigvec *osv)
|
||||
{
|
||||
int ret;
|
||||
struct sigaction osa, nsa;
|
||||
@ -85,8 +80,7 @@ sigvec(signo, nsv, osv)
|
||||
}
|
||||
|
||||
int
|
||||
sigsetmask(mask)
|
||||
int mask;
|
||||
sigsetmask(int mask)
|
||||
{
|
||||
sigset_t nmask, omask;
|
||||
int n;
|
||||
@ -101,8 +95,7 @@ sigsetmask(mask)
|
||||
}
|
||||
|
||||
int
|
||||
sigblock(mask)
|
||||
int mask;
|
||||
sigblock(int mask)
|
||||
{
|
||||
sigset_t nmask, omask;
|
||||
int n;
|
||||
@ -117,8 +110,7 @@ sigblock(mask)
|
||||
}
|
||||
|
||||
int
|
||||
sigpause(mask)
|
||||
int mask;
|
||||
sigpause(int mask)
|
||||
{
|
||||
sigset_t nmask;
|
||||
|
||||
|
17
lib/libc/compat/Makefile.inc
Normal file
17
lib/libc/compat/Makefile.inc
Normal file
@ -0,0 +1,17 @@
|
||||
# $NetBSD: Makefile.inc,v 1.1 2005/09/13 01:44:08 christos Exp $
|
||||
|
||||
# compat sources
|
||||
|
||||
CPPFLAGS+=-I${NETBSDSRCDIR}/sys
|
||||
|
||||
.include "${.CURDIR}/compat/db/Makefile.inc"
|
||||
.include "${.CURDIR}/compat/gen/Makefile.inc"
|
||||
.include "${.CURDIR}/compat/stdlib/Makefile.inc"
|
||||
.include "${.CURDIR}/compat/sys/Makefile.inc"
|
||||
|
||||
# XXX: Conditional until all archs are converted.
|
||||
.if exists(${.CURDIR}/compat/arch/${ARCHSUBDIR}/Makefile.inc)
|
||||
COMPATARCHDIR=${.CURDIR}/compat/arch/${ARCHSUBDIR}
|
||||
.PATH: ${COMPATARCHDIR}/gen ${COMPATARCHDIR}/sys
|
||||
.include "${.CURDIR}/compat/arch/${ARCHSUBDIR}/Makefile.inc"
|
||||
.endif
|
4
lib/libc/compat/arch/i386/Makefile.inc
Normal file
4
lib/libc/compat/arch/i386/Makefile.inc
Normal file
@ -0,0 +1,4 @@
|
||||
# $NetBSD: Makefile.inc,v 1.1 2005/09/13 01:44:08 christos Exp $
|
||||
|
||||
.include "${.CURDIR}/compat/arch/i386/gen/Makefile.inc"
|
||||
.include "${.CURDIR}/compat/arch/i386/sys/Makefile.inc"
|
10
lib/libc/compat/arch/i386/gen/Makefile.inc
Normal file
10
lib/libc/compat/arch/i386/gen/Makefile.inc
Normal file
@ -0,0 +1,10 @@
|
||||
# $NetBSD: Makefile.inc,v 1.1 2005/09/13 01:44:08 christos Exp $
|
||||
|
||||
# objects built from assembler sources (need lint stubs)
|
||||
SRCS+= compat_setjmp.S compat__setjmp.S compat_sigsetjmp.S
|
||||
|
||||
SRCS.i386.gen=Lint__setjmp.c
|
||||
|
||||
LSRCS+= ${SRCS.i386.gen}
|
||||
DPSRCS+= ${SRCS.i386.gen}
|
||||
CLEANFILES+= ${SRCS.i386.gen}
|
77
lib/libc/compat/arch/i386/gen/compat__setjmp.S
Normal file
77
lib/libc/compat/arch/i386/gen/compat__setjmp.S
Normal file
@ -0,0 +1,77 @@
|
||||
/* $NetBSD: compat__setjmp.S,v 1.1 2005/09/13 01:44:08 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* William Jolitz.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)_setjmp.s 5.1 (Berkeley) 4/23/90
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
#if defined(LIBC_SCCS)
|
||||
RCSID("$NetBSD: compat__setjmp.S,v 1.1 2005/09/13 01:44:08 christos Exp $")
|
||||
#endif
|
||||
|
||||
/*
|
||||
* C library -- _setjmp, _longjmp
|
||||
*
|
||||
* _longjmp(a,v)
|
||||
* will generate a "return(v)" from the last call to
|
||||
* _setjmp(a)
|
||||
* by restoring registers from the stack.
|
||||
* The previous signal state is NOT restored.
|
||||
*/
|
||||
|
||||
ENTRY(_setjmp)
|
||||
movl 4(%esp),%eax
|
||||
movl 0(%esp),%edx
|
||||
movl %edx, 0(%eax) /* rta */
|
||||
movl %ebx, 4(%eax)
|
||||
movl %esp, 8(%eax)
|
||||
movl %ebp,12(%eax)
|
||||
movl %esi,16(%eax)
|
||||
movl %edi,20(%eax)
|
||||
xorl %eax,%eax
|
||||
ret
|
||||
|
||||
ENTRY(_longjmp)
|
||||
movl 4(%esp),%edx
|
||||
movl 8(%esp),%eax
|
||||
movl 0(%edx),%ecx
|
||||
movl 4(%edx),%ebx
|
||||
movl 8(%edx),%esp
|
||||
movl 12(%edx),%ebp
|
||||
movl 16(%edx),%esi
|
||||
movl 20(%edx),%edi
|
||||
testl %eax,%eax
|
||||
jnz 1f
|
||||
incl %eax
|
||||
1: movl %ecx,0(%esp)
|
||||
ret
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: __setjmp14.S,v 1.4 2003/08/07 16:42:06 agc Exp $ */
|
||||
/* $NetBSD: compat_setjmp.S,v 1.1 2005/09/13 01:44:08 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
#include <machine/asm.h>
|
||||
#if defined(LIBC_SCCS)
|
||||
RCSID("$NetBSD: __setjmp14.S,v 1.4 2003/08/07 16:42:06 agc Exp $")
|
||||
RCSID("$NetBSD: compat_setjmp.S,v 1.1 2005/09/13 01:44:08 christos Exp $")
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -49,7 +49,18 @@
|
||||
* The previous signal state is restored.
|
||||
*/
|
||||
|
||||
ENTRY(__setjmp14)
|
||||
ENTRY(setjmp)
|
||||
|
||||
PIC_PROLOGUE
|
||||
pushl $0
|
||||
#ifdef PIC
|
||||
call PIC_PLT(_C_LABEL(sigblock))
|
||||
#else
|
||||
call _C_LABEL(sigblock)
|
||||
#endif
|
||||
addl $4,%esp
|
||||
PIC_EPILOGUE
|
||||
|
||||
movl 4(%esp),%ecx
|
||||
movl 0(%esp),%edx
|
||||
movl %edx, 0(%ecx)
|
||||
@ -58,40 +69,21 @@ ENTRY(__setjmp14)
|
||||
movl %ebp,12(%ecx)
|
||||
movl %esi,16(%ecx)
|
||||
movl %edi,20(%ecx)
|
||||
|
||||
/* Get the signal mask. */
|
||||
leal 24(%ecx),%edx
|
||||
|
||||
PIC_PROLOGUE
|
||||
pushl %edx
|
||||
pushl $0
|
||||
pushl $0
|
||||
#ifdef PIC
|
||||
call PIC_PLT(_C_LABEL(__sigprocmask14))
|
||||
#else
|
||||
call _C_LABEL(__sigprocmask14)
|
||||
#endif
|
||||
addl $12,%esp
|
||||
PIC_EPILOGUE
|
||||
|
||||
movl %eax,24(%ecx)
|
||||
xorl %eax,%eax
|
||||
ret
|
||||
|
||||
ENTRY(__longjmp14)
|
||||
/* Restore the signal mask. */
|
||||
movl 4(%esp),%ecx
|
||||
leal 24(%ecx),%edx
|
||||
ENTRY(longjmp)
|
||||
movl 4(%esp),%edx
|
||||
|
||||
PIC_PROLOGUE
|
||||
pushl $0
|
||||
pushl %edx
|
||||
pushl $3 /* SIG_SETMASK */
|
||||
pushl 24(%edx)
|
||||
#ifdef PIC
|
||||
call PIC_PLT(_C_LABEL(__sigprocmask14))
|
||||
call PIC_PLT(_C_LABEL(sigsetmask))
|
||||
#else
|
||||
call _C_LABEL(__sigprocmask14)
|
||||
call _C_LABEL(sigsetmask)
|
||||
#endif
|
||||
addl $12,%esp
|
||||
addl $4,%esp
|
||||
PIC_EPILOGUE
|
||||
|
||||
movl 4(%esp),%edx
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: __sigsetjmp14.S,v 1.5 2003/08/07 16:42:06 agc Exp $ */
|
||||
/* $NetBSD: compat_sigsetjmp.S,v 1.1 2005/09/13 01:44:08 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -36,62 +36,51 @@
|
||||
|
||||
#include <machine/asm.h>
|
||||
#if defined(LIBC_SCCS)
|
||||
RCSID("$NetBSD: __sigsetjmp14.S,v 1.5 2003/08/07 16:42:06 agc Exp $")
|
||||
RCSID("$NetBSD: compat_sigsetjmp.S,v 1.1 2005/09/13 01:44:08 christos Exp $")
|
||||
#endif
|
||||
|
||||
ENTRY(__sigsetjmp14)
|
||||
ENTRY(sigsetjmp)
|
||||
movl 4(%esp),%ecx
|
||||
movl 0(%esp),%edx
|
||||
movl 8(%esp),%eax
|
||||
movl %eax,28(%ecx)
|
||||
testl %eax,%eax
|
||||
jz 2f
|
||||
|
||||
PIC_PROLOGUE
|
||||
pushl $0
|
||||
#ifdef PIC
|
||||
call PIC_PLT(_C_LABEL(sigblock))
|
||||
#else
|
||||
call _C_LABEL(sigblock)
|
||||
#endif
|
||||
addl $4,%esp
|
||||
PIC_EPILOGUE
|
||||
|
||||
movl 4(%esp),%ecx
|
||||
movl %eax,24(%ecx)
|
||||
2: movl 0(%esp),%edx
|
||||
movl %edx, 0(%ecx)
|
||||
movl %ebx, 4(%ecx)
|
||||
movl %esp, 8(%ecx)
|
||||
movl %ebp,12(%ecx)
|
||||
movl %esi,16(%ecx)
|
||||
movl %edi,20(%ecx)
|
||||
|
||||
/* Check if we should save the signal mask, and remember it. */
|
||||
movl 8(%esp),%eax
|
||||
movl %eax,40(%ecx)
|
||||
testl %eax,%eax
|
||||
jz 2f /* no, skip */
|
||||
|
||||
/* Get the signal mask. */
|
||||
leal 24(%ecx),%edx
|
||||
|
||||
PIC_PROLOGUE
|
||||
pushl %edx
|
||||
pushl $0
|
||||
pushl $0
|
||||
#ifdef PIC
|
||||
call PIC_PLT(_C_LABEL(__sigprocmask14))
|
||||
#else
|
||||
call _C_LABEL(__sigprocmask14)
|
||||
#endif
|
||||
addl $12,%esp
|
||||
PIC_EPILOGUE
|
||||
|
||||
2: xorl %eax,%eax
|
||||
xorl %eax,%eax
|
||||
ret
|
||||
|
||||
ENTRY(__siglongjmp14)
|
||||
/* Check to see if we need to restore the signal mask. */
|
||||
movl 4(%esp),%ecx
|
||||
cmpl $0,40(%ecx)
|
||||
jz 2f /* no, skip */
|
||||
|
||||
/* Restore the signal mask. */
|
||||
leal 24(%ecx),%edx
|
||||
ENTRY(siglongjmp)
|
||||
movl 4(%esp),%edx
|
||||
cmpl $0,28(%edx)
|
||||
jz 2f
|
||||
|
||||
PIC_PROLOGUE
|
||||
pushl $0
|
||||
pushl %edx
|
||||
pushl $3 /* SIG_SETMASK */
|
||||
pushl 24(%edx)
|
||||
#ifdef PIC
|
||||
call PIC_PLT(_C_LABEL(__sigprocmask14))
|
||||
call PIC_PLT(_C_LABEL(sigsetmask))
|
||||
#else
|
||||
call _C_LABEL(__sigprocmask14)
|
||||
call _C_LABEL(sigsetmask)
|
||||
#endif
|
||||
addl $12,%esp
|
||||
addl $4,%esp
|
||||
PIC_EPILOGUE
|
||||
|
||||
2: movl 4(%esp),%edx
|
6
lib/libc/compat/arch/i386/sys/Makefile.inc
Normal file
6
lib/libc/compat/arch/i386/sys/Makefile.inc
Normal file
@ -0,0 +1,6 @@
|
||||
# $NetBSD: Makefile.inc,v 1.1 2005/09/13 01:44:08 christos Exp $
|
||||
|
||||
SRCS+=compat_Ovfork.S compat___semctl.S compat___sigreturn14.S \
|
||||
compat___sigtramp1.S compat_msgctl.S compat_shmctl.S compat_sigaction.S \
|
||||
compat_sigpending.S compat_sigprocmask.S compat_sigreturn.S \
|
||||
compat_sigsuspend.S
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: Ovfork.S,v 1.16 2003/08/07 16:42:08 agc Exp $ */
|
||||
/* $NetBSD: compat_Ovfork.S,v 1.1 2005/09/13 01:44:08 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
#include <machine/asm.h>
|
||||
#if defined(SYSLIBC_SCCS) && !defined(lint)
|
||||
RCSID("$NetBSD: Ovfork.S,v 1.16 2003/08/07 16:42:08 agc Exp $")
|
||||
RCSID("$NetBSD: compat_Ovfork.S,v 1.1 2005/09/13 01:44:08 christos Exp $")
|
||||
#endif /* SYSLIBC_SCCS and not lint */
|
||||
|
||||
#include "SYS.h"
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: __semctl.S,v 1.1 1999/08/25 05:09:29 thorpej Exp $ */
|
||||
/* $NetBSD: compat___semctl.S,v 1.1 2005/09/13 01:44:08 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: __sigreturn14.S,v 1.7 2004/03/26 21:29:07 drochner Exp $ */
|
||||
/* $NetBSD: compat___sigreturn14.S,v 1.1 2005/09/13 01:44:08 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
#include <machine/asm.h>
|
||||
#if defined(SYSLIBC_SCCS) && !defined(lint)
|
||||
RCSID("$NetBSD: __sigreturn14.S,v 1.7 2004/03/26 21:29:07 drochner Exp $")
|
||||
RCSID("$NetBSD: compat___sigreturn14.S,v 1.1 2005/09/13 01:44:08 christos Exp $")
|
||||
#endif /* SYSLIBC_SCCS and not lint */
|
||||
|
||||
#include "SYS.h"
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: __sigtramp1.S,v 1.4 2004/03/26 21:29:07 drochner Exp $ */
|
||||
/* $NetBSD: compat___sigtramp1.S,v 1.1 2005/09/13 01:44:08 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: msgctl.S,v 1.1 1999/08/25 05:09:29 thorpej Exp $ */
|
||||
/* $NetBSD: compat_msgctl.S,v 1.1 2005/09/13 01:44:08 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: shmctl.S,v 1.1 1999/08/25 05:09:29 thorpej Exp $ */
|
||||
/* $NetBSD: compat_shmctl.S,v 1.1 2005/09/13 01:44:08 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sigaction.S,v 1.2 1998/12/02 01:01:03 thorpej Exp $ */
|
||||
/* $NetBSD: compat_sigaction.S,v 1.1 2005/09/13 01:44:08 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sigpending.S,v 1.6 2003/08/07 16:42:09 agc Exp $ */
|
||||
/* $NetBSD: compat_sigpending.S,v 1.1 2005/09/13 01:44:08 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
#include <machine/asm.h>
|
||||
#if defined(SYSLIBC_SCCS) && !defined(lint)
|
||||
RCSID("$NetBSD: sigpending.S,v 1.6 2003/08/07 16:42:09 agc Exp $")
|
||||
RCSID("$NetBSD: compat_sigpending.S,v 1.1 2005/09/13 01:44:08 christos Exp $")
|
||||
#endif /* SYSLIBC_SCCS and not lint */
|
||||
|
||||
#include "SYS.h"
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sigprocmask.S,v 1.17 2003/08/07 16:42:09 agc Exp $ */
|
||||
/* $NetBSD: compat_sigprocmask.S,v 1.1 2005/09/13 01:44:08 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
#include <machine/asm.h>
|
||||
#if defined(SYSLIBC_SCCS) && !defined(lint)
|
||||
RCSID("$NetBSD: sigprocmask.S,v 1.17 2003/08/07 16:42:09 agc Exp $")
|
||||
RCSID("$NetBSD: compat_sigprocmask.S,v 1.1 2005/09/13 01:44:08 christos Exp $")
|
||||
#endif /* SYSLIBC_SCCS and not lint */
|
||||
|
||||
#include "SYS.h"
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sigreturn.S,v 1.10 2004/03/26 22:15:03 drochner Exp $ */
|
||||
/* $NetBSD: compat_sigreturn.S,v 1.1 2005/09/13 01:44:08 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
#include <machine/asm.h>
|
||||
#if defined(SYSLIBC_SCCS) && !defined(lint)
|
||||
RCSID("$NetBSD: sigreturn.S,v 1.10 2004/03/26 22:15:03 drochner Exp $")
|
||||
RCSID("$NetBSD: compat_sigreturn.S,v 1.1 2005/09/13 01:44:08 christos Exp $")
|
||||
#endif /* SYSLIBC_SCCS and not lint */
|
||||
|
||||
#include "SYS.h"
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sigsuspend.S,v 1.15 2003/08/07 16:42:09 agc Exp $ */
|
||||
/* $NetBSD: compat_sigsuspend.S,v 1.1 2005/09/13 01:44:08 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
#include <machine/asm.h>
|
||||
#if defined(SYSLIBC_SCCS) && !defined(lint)
|
||||
RCSID("$NetBSD: sigsuspend.S,v 1.15 2003/08/07 16:42:09 agc Exp $")
|
||||
RCSID("$NetBSD: compat_sigsuspend.S,v 1.1 2005/09/13 01:44:08 christos Exp $")
|
||||
#endif /* SYSLIBC_SCCS and not lint */
|
||||
|
||||
#include "SYS.h"
|
2
lib/libc/compat/db/Makefile.inc
Normal file
2
lib/libc/compat/db/Makefile.inc
Normal file
@ -0,0 +1,2 @@
|
||||
# $NetBSD: Makefile.inc,v 1.1 2005/09/13 01:44:09 christos Exp $
|
||||
.include "${.CURDIR}/compat/db/hash/Makefile.inc"
|
4
lib/libc/compat/db/hash/Makefile.inc
Normal file
4
lib/libc/compat/db/hash/Makefile.inc
Normal file
@ -0,0 +1,4 @@
|
||||
# $NetBSD: Makefile.inc,v 1.1 2005/09/13 01:44:09 christos Exp $
|
||||
|
||||
.PATH: ${.CURDIR}/compat/db/hash
|
||||
SRCS+=compat_ndbmdatum.c
|
31
lib/libc/compat/db/hash/compat_ndbmdatum.c
Normal file
31
lib/libc/compat/db/hash/compat_ndbmdatum.c
Normal file
@ -0,0 +1,31 @@
|
||||
/* $NetBSD: compat_ndbmdatum.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Written by Klaus Klein <kleink@NetBSD.org>, April 28, 2004.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
#include "namespace.h"
|
||||
#include <sys/cdefs.h>
|
||||
#include <ndbm.h>
|
||||
#include <compat/include/ndbm.h>
|
||||
|
||||
__warn_references(dbm_delete,
|
||||
"warning: reference to compatibility dbm_delete();"
|
||||
" include <ndbm.h> for correct reference")
|
||||
__warn_references(dbm_fetch,
|
||||
"warning: reference to compatibility dbm_fetch();"
|
||||
" include <ndbm.h> for correct reference")
|
||||
__warn_references(dbm_firstkey,
|
||||
"warning: reference to compatibility dbm_firstkey();"
|
||||
" include <ndbm.h> for correct reference")
|
||||
__warn_references(dbm_nextkey,
|
||||
"warning: reference to compatibility dbm_nextkey();"
|
||||
" include <ndbm.h> for correct reference")
|
||||
__warn_references(dbm_store,
|
||||
"warning: reference to compatibility dbm_store();"
|
||||
" include <ndbm.h> for correct reference")
|
||||
|
||||
#define datum datum12
|
||||
#include "db/hash/ndbmdatum.c"
|
8
lib/libc/compat/gen/Makefile.inc
Normal file
8
lib/libc/compat/gen/Makefile.inc
Normal file
@ -0,0 +1,8 @@
|
||||
# $NetBSD: Makefile.inc,v 1.1 2005/09/13 01:44:09 christos Exp $
|
||||
|
||||
.PATH: ${.CURDIR}/compat/gen
|
||||
SRCS+=compat_errlist.c compat_fts.c compat___fts13.c compat_getmntinfo.c \
|
||||
compat_glob.c compat_opendir.c compat_readdir.c compat_scandir.c \
|
||||
compat_siglist.c compat_signame.c compat_sigsetops.c compat_times.c \
|
||||
compat_timezone.c compat_unvis.c compat_utmpx.c compat__sys_errlist.c \
|
||||
compat__sys_nerr.c compat__sys_siglist.c
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: __fts13.c,v 1.45 2005/08/19 02:04:54 christos Exp $ */
|
||||
/* $NetBSD: compat___fts13.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/cdefs.h>
|
||||
@ -23,15 +23,16 @@ __warn_references(__fts_set13,
|
||||
" include <fts.h> for correct reference")
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <compat/sys/stat.h>
|
||||
|
||||
#define __fts_stat_t struct stat13
|
||||
#define __fts_nlink_t nlink_t
|
||||
#define __fts_ino_t u_int32_t
|
||||
|
||||
#define stat __stat13
|
||||
#define lstat __lstat13
|
||||
#define fstat __fstat13
|
||||
|
||||
#define __fts_stat_t struct stat13
|
||||
#define __fts_nlink_t nlink_t
|
||||
#define __fts_ino_t u_int32_t
|
||||
|
||||
#undef fts_children
|
||||
#define fts_children __fts_children13
|
||||
#undef fts_close
|
||||
@ -43,4 +44,7 @@ __warn_references(__fts_set13,
|
||||
#undef fts_set
|
||||
#define fts_set __fts_set13
|
||||
|
||||
#include "__fts30.c"
|
||||
#include <fts.h>
|
||||
#include <compat/include/fts.h>
|
||||
|
||||
#include "gen/fts.c"
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: _sys_errlist.c,v 1.9 2005/07/30 15:21:20 christos Exp $ */
|
||||
/* $NetBSD: compat__sys_errlist.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Written by J.T. Conklin, December 12, 1994
|
||||
@ -7,7 +7,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: _sys_errlist.c,v 1.9 2005/07/30 15:21:20 christos Exp $");
|
||||
__RCSID("$NetBSD: compat__sys_errlist.c,v 1.1 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
__warn_references(sys_errlist,
|
||||
@ -21,7 +21,7 @@ __warn_references(__sys_nerr,
|
||||
"warning: reference to deprecated __sys_nerr; include <errno.h> and use sys_nerr")
|
||||
|
||||
|
||||
#if defined(__indr_reference) && !defined(__lint__)
|
||||
#if defined(__indr_reference)
|
||||
__indr_reference(_sys_errlist, sys_errlist)
|
||||
__indr_reference(_sys_errlist, __sys_errlist) /* Backwards compat with v.12 */
|
||||
#else
|
||||
@ -32,7 +32,7 @@ __indr_reference(_sys_errlist, __sys_errlist) /* Backwards compat with v.12 */
|
||||
#define _sys_errlist sys_errlist
|
||||
#define _sys_nerr sys_nerr
|
||||
#define rcsid _rcsid
|
||||
#include "errlist.c"
|
||||
#include "__errlist.c"
|
||||
|
||||
#undef _sys_errlist
|
||||
#undef _sys_nerr
|
||||
@ -40,6 +40,6 @@ __indr_reference(_sys_errlist, __sys_errlist) /* Backwards compat with v.12 */
|
||||
#define _sys_errlist __sys_errlist
|
||||
#define _sys_nerr __sys_nerr
|
||||
#define rcsid __rcsid
|
||||
#include "errlist.c"
|
||||
#include "__errlist.c"
|
||||
|
||||
#endif
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: _sys_nerr.c,v 1.9 2005/07/30 15:21:20 christos Exp $ */
|
||||
/* $NetBSD: compat__sys_nerr.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Written by J.T. Conklin, December 12, 1994
|
||||
@ -7,7 +7,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: _sys_nerr.c,v 1.9 2005/07/30 15:21:20 christos Exp $");
|
||||
__RCSID("$NetBSD: compat__sys_nerr.c,v 1.1 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#if defined(__indr_reference) && !defined(__lint__)
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: _sys_siglist.c,v 1.10 2005/07/30 15:21:20 christos Exp $ */
|
||||
/* $NetBSD: compat__sys_siglist.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Written by J.T. Conklin, December 12, 1994
|
||||
@ -7,7 +7,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: _sys_siglist.c,v 1.10 2005/07/30 15:21:20 christos Exp $");
|
||||
__RCSID("$NetBSD: compat__sys_siglist.c,v 1.1 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
__warn_references(sys_siglist,
|
||||
@ -24,12 +24,12 @@ __indr_reference(_sys_siglist, __sys_siglist) /* Backwards compat with v.12 */
|
||||
#undef rcsid
|
||||
#define _sys_siglist sys_siglist
|
||||
#define rcsid _rcsid
|
||||
#include "siglist.c"
|
||||
#include "compat_siglist.c"
|
||||
|
||||
#undef _sys_siglist
|
||||
#undef rcsid
|
||||
#define _sys_siglist __sys_siglist
|
||||
#define rcsid __rcsid
|
||||
#include "siglist.c"
|
||||
#include "compat_siglist.c"
|
||||
|
||||
#endif
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: __errlist14.c,v 1.9 2005/01/20 13:14:09 kleink Exp $ */
|
||||
/* $NetBSD: compat_errlist.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1985, 1993
|
||||
@ -34,11 +34,22 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)errlst.c 8.2 (Berkeley) 11/16/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: __errlist14.c,v 1.9 2005/01/20 13:14:09 kleink Exp $");
|
||||
__RCSID("$NetBSD: compat_errlist.c,v 1.1 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
static const char *const __errlist14[] = {
|
||||
#include "namespace.h"
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
#include <errno.h>
|
||||
#ifdef __weak_alias
|
||||
__weak_alias(sys_errlist, _sys_errlist)
|
||||
__weak_alias(__sys_errlist, _sys_errlist)
|
||||
__weak_alias(sys_nerr, _sys_nerr)
|
||||
__weak_alias(__sys_nerr, _sys_nerr)
|
||||
#endif
|
||||
|
||||
const char *const sys_errlist[] = {
|
||||
"Undefined error: 0", /* 0 - ENOERROR */
|
||||
"Operation not permitted", /* 1 - EPERM */
|
||||
"No such file or directory", /* 2 - ENOENT */
|
||||
@ -138,35 +149,5 @@ static const char *const __errlist14[] = {
|
||||
"Function not implemented", /* 78 - ENOSYS */
|
||||
|
||||
"Inappropriate file type or format", /* 79 - EFTYPE */
|
||||
"Authentication error", /* 80 - EAUTH */
|
||||
"Need authenticator", /* 81 - ENEEDAUTH */
|
||||
|
||||
/* SystemV IPC */
|
||||
"Identifier removed", /* 82 - EIDRM */
|
||||
"No message of desired type", /* 83 - ENOMSG */
|
||||
/* 84 - EOVERFLOW */
|
||||
"Value too large to be stored in data type",
|
||||
|
||||
/* Wide/multibyte-character handling, ISO/IEC 9899/AMD1:1995 */
|
||||
"Illegal byte sequence", /* 85 - EILSEQ */
|
||||
|
||||
/* Base, Realtime, Threads or Thread Priority Scheduling option errors */
|
||||
"Not supported", /* 86 - ENOTSUP */
|
||||
|
||||
/* Realtime option errors */
|
||||
"Operation Canceled", /* 87 - ECANCELED */
|
||||
|
||||
/* Realtime, XSI STREAMS option errors */
|
||||
"Bad or Corrupt message", /* 88 - EBADMSG */
|
||||
|
||||
/* XSI STREAMS option errors */
|
||||
"No message available", /* 89 - ENODATA */
|
||||
"No STREAM resources", /* 90 - ENOSR */
|
||||
"Not a STREAM", /* 91 - ENOSTR */
|
||||
"STREAM ioctl timeout", /* 92 - ETIME */
|
||||
"Attribute not found" /* 93 - ENOATTR */
|
||||
};
|
||||
|
||||
const int __sys_nerr14 = sizeof(__errlist14) / sizeof(__errlist14[0]);
|
||||
|
||||
const char * const *__sys_errlist14 = __errlist14;
|
||||
const int sys_nerr = { sizeof(sys_errlist) / sizeof(sys_errlist[0]) };
|
47
lib/libc/compat/gen/compat_fts.c
Normal file
47
lib/libc/compat/gen/compat_fts.c
Normal file
@ -0,0 +1,47 @@
|
||||
/* $NetBSD: compat_fts.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Written by Jason R. Thorpe <thorpej@NetBSD.org>, October 21, 1997.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/cdefs.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
#include <sys/stat.h>
|
||||
#include <compat/sys/stat.h>
|
||||
|
||||
#define __fts_stat_t struct stat12
|
||||
#define __fts_nlink_t u_int16_t
|
||||
#define __fts_ino_t u_int32_t
|
||||
|
||||
#include <fts.h>
|
||||
#include <compat/include/fts.h>
|
||||
|
||||
#ifdef __weak_alias
|
||||
__weak_alias(fts_children,_fts_children)
|
||||
__weak_alias(fts_close,_fts_close)
|
||||
__weak_alias(fts_open,_fts_open)
|
||||
__weak_alias(fts_read,_fts_read)
|
||||
__weak_alias(fts_set,_fts_set)
|
||||
#endif /* __weak_alias */
|
||||
|
||||
__warn_references(fts_children,
|
||||
"warning: reference to compatibility fts_children();"
|
||||
" include <fts.h> for correct reference")
|
||||
__warn_references(fts_close,
|
||||
"warning: reference to compatibility fts_close();"
|
||||
" include <fts.h> for correct reference")
|
||||
__warn_references(fts_open,
|
||||
"warning: reference to compatibility fts_open();"
|
||||
" include <fts.h> for correct reference")
|
||||
__warn_references(fts_read,
|
||||
"warning: reference to compatibility fts_read();"
|
||||
" include <fts.h> for correct reference")
|
||||
__warn_references(fts_set,
|
||||
"warning: reference to compatibility fts_set();"
|
||||
" include <fts.h> for correct reference")
|
||||
|
||||
#include "gen/fts.c"
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: __getmntinfo13.c,v 1.2 2005/04/12 20:49:19 drochner Exp $ */
|
||||
/* $NetBSD: compat_getmntinfo.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -34,46 +34,53 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)getmntinfo.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: __getmntinfo13.c,v 1.2 2005/04/12 20:49:19 drochner Exp $");
|
||||
__RCSID("$NetBSD: compat_getmntinfo.c,v 1.1 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/ucred.h>
|
||||
#include <sys/mount.h>
|
||||
#include <compat/sys/mount.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __weak_alias
|
||||
__weak_alias(getmntinfo,_getmntinfo)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Return information about mounted filesystems.
|
||||
*/
|
||||
int
|
||||
getmntinfo(mntbufp, flags)
|
||||
struct statvfs **mntbufp;
|
||||
struct statfs12 **mntbufp;
|
||||
int flags;
|
||||
{
|
||||
static struct statvfs *mntbuf;
|
||||
static struct statfs12 *mntbuf;
|
||||
static int mntsize;
|
||||
static size_t bufsize;
|
||||
|
||||
_DIAGASSERT(mntbufp != NULL);
|
||||
|
||||
if (mntsize <= 0 &&
|
||||
(mntsize = getvfsstat(NULL, (size_t)0, MNT_NOWAIT)) == -1)
|
||||
(mntsize = getfsstat(NULL, 0L, MNT_NOWAIT)) == -1)
|
||||
return (0);
|
||||
if (bufsize > 0 &&
|
||||
(mntsize = getvfsstat(mntbuf, bufsize, flags)) == -1)
|
||||
(mntsize = getfsstat(mntbuf, (long)bufsize, flags)) == -1)
|
||||
return (0);
|
||||
while (bufsize <= mntsize * sizeof(struct statvfs)) {
|
||||
while (bufsize <= mntsize * sizeof(struct statfs12)) {
|
||||
if (mntbuf)
|
||||
free(mntbuf);
|
||||
bufsize = (mntsize + 1) * sizeof(struct statvfs);
|
||||
bufsize = (mntsize + 1) * sizeof(struct statfs12);
|
||||
if ((mntbuf = malloc(bufsize)) == NULL)
|
||||
return (0);
|
||||
if ((mntsize = getvfsstat(mntbuf, bufsize, flags)) == -1)
|
||||
if ((mntsize = getfsstat(mntbuf, (long)bufsize, flags)) == -1)
|
||||
return (0);
|
||||
}
|
||||
*mntbufp = mntbuf;
|
30
lib/libc/compat/gen/compat_glob.c
Normal file
30
lib/libc/compat/gen/compat_glob.c
Normal file
@ -0,0 +1,30 @@
|
||||
/* $NetBSD: compat_glob.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Written by Jason R. Thorpe <thorpej@NetBSD.org>, October 21, 1997.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/stat.h>
|
||||
#include <compat/sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#include <compat/include/dirent.h>
|
||||
#define __gl_stat_t struct stat12
|
||||
|
||||
#include <glob.h>
|
||||
#include <compat/include/glob.h>
|
||||
|
||||
#ifdef __weak_alias
|
||||
__weak_alias(glob,_glob)
|
||||
__weak_alias(globfree,_globfree)
|
||||
#endif /* __weak_alias */
|
||||
|
||||
__warn_references(glob,
|
||||
"warning: reference to compatibility glob(); include <glob.h> for correct reference")
|
||||
__warn_references(globfree,
|
||||
"warning: reference to compatibility globfree(); include <glob.h> for correct reference")
|
||||
|
||||
#include "gen/glob.c"
|
24
lib/libc/compat/gen/compat_opendir.c
Normal file
24
lib/libc/compat/gen/compat_opendir.c
Normal file
@ -0,0 +1,24 @@
|
||||
/* $NetBSD: compat_opendir.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/stat.h>
|
||||
#include <signal.h>
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
#include <dirent.h>
|
||||
#include <compat/include/dirent.h>
|
||||
|
||||
#ifdef __weak_alias
|
||||
__weak_alias(opendir,_opendir)
|
||||
#endif
|
||||
|
||||
#ifdef __warn_references
|
||||
__warn_references(opendir,
|
||||
"warning: reference to compatibility opendir(); include <dirent.h> for correct reference")
|
||||
__warn_references(__opendir2,
|
||||
"warning: reference to compatibility __opendir2(); include <dirent.h> for correct reference")
|
||||
#endif
|
||||
|
||||
#define dirent dirent12
|
||||
|
||||
#include "gen/opendir.c"
|
22
lib/libc/compat/gen/compat_readdir.c
Normal file
22
lib/libc/compat/gen/compat_readdir.c
Normal file
@ -0,0 +1,22 @@
|
||||
/* $NetBSD: compat_readdir.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
#include "namespace.h"
|
||||
#include <dirent.h>
|
||||
#include <compat/include/dirent.h>
|
||||
|
||||
#ifdef __weak_alias
|
||||
__weak_alias(readdir,_readdir)
|
||||
__weak_alias(readdir_r,_readdir_r)
|
||||
#endif
|
||||
|
||||
#ifdef __warn_references
|
||||
__warn_references(readdir,
|
||||
"warning: reference to compatibility readdir(); include <dirent.h> for correct reference")
|
||||
__warn_references(readdir_r,
|
||||
"warning: reference to compatibility readdir_r(); include <dirent.h> for correct reference")
|
||||
#endif
|
||||
|
||||
#define dirent dirent12
|
||||
|
||||
#include "gen/readdir.c"
|
20
lib/libc/compat/gen/compat_scandir.c
Normal file
20
lib/libc/compat/gen/compat_scandir.c
Normal file
@ -0,0 +1,20 @@
|
||||
/* $NetBSD: compat_scandir.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
#include <sys/stat.h>
|
||||
#define __LIBC12_SOURCE__
|
||||
#include "namespace.h"
|
||||
#include <dirent.h>
|
||||
#include <compat/include/dirent.h>
|
||||
|
||||
#ifdef __weak_alias
|
||||
__weak_alias(scandir,_scandir)
|
||||
#endif
|
||||
|
||||
#ifdef __warn_references
|
||||
__warn_references(scandir,
|
||||
"warning: reference to compatibility scandir(); include <dirent.h> for correct reference")
|
||||
#endif
|
||||
|
||||
#define dirent dirent12
|
||||
|
||||
#include "gen/scandir.c"
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: __times13.c,v 1.3 2005/04/09 12:52:54 dsl Exp $ */
|
||||
/* $NetBSD: compat_siglist.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -32,65 +32,48 @@
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)times.c 8.1 (Berkeley) 6/4/93";
|
||||
static char sccsid[] = "@(#)siglist.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: __times13.c,v 1.3 2005/04/09 12:52:54 dsl Exp $");
|
||||
__RCSID("$NetBSD: compat_siglist.c,v 1.1 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/times.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef __weak_alias
|
||||
#ifdef __LIBC12_SOURCE__
|
||||
__weak_alias(times,_times)
|
||||
#endif
|
||||
__weak_alias(sys_siglist, _sys_siglist)
|
||||
__weak_alias(__sys_siglist, _sys_siglist)
|
||||
#endif
|
||||
|
||||
#ifdef __LIBC12_SOURCE__
|
||||
__warn_references(times,
|
||||
"warning: reference to compatibility times(); include <sys/times.h> for correct reference")
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Convert usec to clock ticks; could do (usec * CLK_TCK) / 1000000,
|
||||
* but this would overflow if we switch to nanosec.
|
||||
*/
|
||||
#define CONVTCK(r) (r.tv_sec * clk_tck + r.tv_usec / (1000000 / (uint)clk_tck))
|
||||
|
||||
clock_t
|
||||
times(tp)
|
||||
struct tms *tp;
|
||||
{
|
||||
struct rusage ru;
|
||||
struct timeval t;
|
||||
static clock_t clk_tck;
|
||||
|
||||
_DIAGASSERT(tp != NULL);
|
||||
|
||||
/*
|
||||
* we use a local copy of CLK_TCK because it expands to a
|
||||
* moderately expensive function call.
|
||||
*/
|
||||
if (clk_tck == 0)
|
||||
clk_tck = (clock_t)CLK_TCK;
|
||||
|
||||
if (getrusage(RUSAGE_SELF, &ru) < 0)
|
||||
return ((clock_t)-1);
|
||||
tp->tms_utime = CONVTCK(ru.ru_utime);
|
||||
tp->tms_stime = CONVTCK(ru.ru_stime);
|
||||
if (getrusage(RUSAGE_CHILDREN, &ru) < 0)
|
||||
return ((clock_t)-1);
|
||||
tp->tms_cutime = CONVTCK(ru.ru_utime);
|
||||
tp->tms_cstime = CONVTCK(ru.ru_stime);
|
||||
if (gettimeofday(&t, (struct timezone *)0))
|
||||
return ((clock_t)-1);
|
||||
return ((clock_t)(CONVTCK(t)));
|
||||
}
|
||||
const char *const _sys_siglist[] = {
|
||||
"Signal 0",
|
||||
"Hangup", /* SIGHUP */
|
||||
"Interrupt", /* SIGINT */
|
||||
"Quit", /* SIGQUIT */
|
||||
"Illegal instruction", /* SIGILL */
|
||||
"Trace/BPT trap", /* SIGTRAP */
|
||||
"Abort trap", /* SIGABRT */
|
||||
"EMT trap", /* SIGEMT */
|
||||
"Floating point exception", /* SIGFPE */
|
||||
"Killed", /* SIGKILL */
|
||||
"Bus error", /* SIGBUS */
|
||||
"Segmentation fault", /* SIGSEGV */
|
||||
"Bad system call", /* SIGSYS */
|
||||
"Broken pipe", /* SIGPIPE */
|
||||
"Alarm clock", /* SIGALRM */
|
||||
"Terminated", /* SIGTERM */
|
||||
"Urgent I/O condition", /* SIGURG */
|
||||
"Suspended (signal)", /* SIGSTOP */
|
||||
"Suspended", /* SIGTSTP */
|
||||
"Continued", /* SIGCONT */
|
||||
"Child exited", /* SIGCHLD */
|
||||
"Stopped (tty input)", /* SIGTTIN */
|
||||
"Stopped (tty output)", /* SIGTTOU */
|
||||
"I/O possible", /* SIGIO */
|
||||
"Cputime limit exceeded", /* SIGXCPU */
|
||||
"Filesize limit exceeded", /* SIGXFSZ */
|
||||
"Virtual timer expired", /* SIGVTALRM */
|
||||
"Profiling timer expired", /* SIGPROF */
|
||||
"Window size changes", /* SIGWINCH */
|
||||
"Information request", /* SIGINFO */
|
||||
"User defined signal 1", /* SIGUSR1 */
|
||||
"User defined signal 2" /* SIGUSR2 */
|
||||
};
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: __signame14.c,v 1.3 2003/08/07 16:42:45 agc Exp $ */
|
||||
/* $NetBSD: compat_signame.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983 Regents of the University of California.
|
||||
@ -34,14 +34,14 @@
|
||||
#if 0
|
||||
static char sccsid[] = "from: @(#)siglist.c 5.6 (Berkeley) 2/23/91";*/
|
||||
#else
|
||||
__RCSID("$NetBSD: __signame14.c,v 1.3 2003/08/07 16:42:45 agc Exp $");
|
||||
__RCSID("$NetBSD: compat_signame.c,v 1.1 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
__warn_references(sys_signame,
|
||||
"warning: reference to compatibility sys_signame[]; include <signal.h> for correct reference")
|
||||
|
||||
static const char *const __signame14[] = {
|
||||
const char *const sys_signame[] = {
|
||||
"Signal 0", /* 0 */
|
||||
"HUP", /* 1 SIGHUP */
|
||||
"INT", /* 2 SIGINT */
|
||||
@ -74,38 +74,4 @@ static const char *const __signame14[] = {
|
||||
"INFO", /* 29 SIGINFO */
|
||||
"USR1", /* 30 SIGUSR1 */
|
||||
"USR2", /* 31 SIGUSR2 */
|
||||
"PWR", /* 32 SIGPWR */
|
||||
"RT0", /* 33 SIGRTMIN + 0 */
|
||||
"RT1", /* 34 SIGRTMIN + 1 */
|
||||
"RT2", /* 35 SIGRTMIN + 2 */
|
||||
"RT3", /* 36 SIGRTMIN + 3 */
|
||||
"RT4", /* 37 SIGRTMIN + 4 */
|
||||
"RT5", /* 38 SIGRTMIN + 5 */
|
||||
"RT6", /* 39 SIGRTMIN + 6 */
|
||||
"RT7", /* 40 SIGRTMIN + 7 */
|
||||
"RT8", /* 41 SIGRTMIN + 8 */
|
||||
"RT9", /* 42 SIGRTMIN + 9 */
|
||||
"RT10", /* 43 SIGRTMIN + 10 */
|
||||
"RT11", /* 44 SIGRTMIN + 11 */
|
||||
"RT12", /* 45 SIGRTMIN + 12 */
|
||||
"RT13", /* 46 SIGRTMIN + 13 */
|
||||
"RT14", /* 47 SIGRTMIN + 14 */
|
||||
"RT15", /* 48 SIGRTMIN + 15 */
|
||||
"RT16", /* 49 SIGRTMIN + 16 */
|
||||
"RT17", /* 50 SIGRTMIN + 17 */
|
||||
"RT18", /* 51 SIGRTMIN + 18 */
|
||||
"RT19", /* 52 SIGRTMIN + 19 */
|
||||
"RT20", /* 53 SIGRTMIN + 20 */
|
||||
"RT21", /* 54 SIGRTMIN + 21 */
|
||||
"RT22", /* 55 SIGRTMIN + 22 */
|
||||
"RT23", /* 56 SIGRTMIN + 23 */
|
||||
"RT24", /* 57 SIGRTMIN + 24 */
|
||||
"RT25", /* 58 SIGRTMIN + 25 */
|
||||
"RT26", /* 59 SIGRTMIN + 26 */
|
||||
"RT27", /* 60 SIGRTMIN + 27 */
|
||||
"RT28", /* 61 SIGRTMIN + 28 */
|
||||
"RT29", /* 62 SIGRTMIN + 29 */
|
||||
"RT30", /* 63 SIGRTMIN + 30 */
|
||||
};
|
||||
|
||||
const char * const *__sys_signame14 = __signame14;
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: __sigsetops14.c,v 1.2 2003/08/07 16:42:45 agc Exp $ */
|
||||
/* $NetBSD: compat_sigsetops.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -36,7 +36,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)sigsetops.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: __sigsetops14.c,v 1.2 2003/08/07 16:42:45 agc Exp $");
|
||||
__RCSID("$NetBSD: compat_sigsetops.c,v 1.1 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
@ -44,6 +44,7 @@ __RCSID("$NetBSD: __sigsetops14.c,v 1.2 2003/08/07 16:42:45 agc Exp $");
|
||||
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <compat/include/signal.h>
|
||||
|
||||
#undef sigemptyset
|
||||
#undef sigfillset
|
||||
@ -51,58 +52,67 @@ __RCSID("$NetBSD: __sigsetops14.c,v 1.2 2003/08/07 16:42:45 agc Exp $");
|
||||
#undef sigdelset
|
||||
#undef sigismember
|
||||
|
||||
int
|
||||
__sigemptyset14(set)
|
||||
sigset_t *set;
|
||||
{
|
||||
__warn_references(sigaddset,
|
||||
"warning: reference to compatibility sigaddset(); include <signal.h> for correct reference")
|
||||
__warn_references(sigdelset,
|
||||
"warning: reference to compatibility sigdelset(); include <signal.h> for correct reference")
|
||||
__warn_references(sigemptyset,
|
||||
"warning: reference to compatibility sigemptyset(); include <signal.h> for correct reference")
|
||||
__warn_references(sigfillset,
|
||||
"warning: reference to compatibility sigfillset(); include <signal.h> for correct reference")
|
||||
__warn_references(sigismember,
|
||||
"warning: reference to compatibility sigismember(); include <signal.h> for correct reference")
|
||||
|
||||
__sigemptyset(set);
|
||||
int
|
||||
sigemptyset(set)
|
||||
sigset13_t *set;
|
||||
{
|
||||
*set = 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
__sigfillset14(set)
|
||||
sigset_t *set;
|
||||
sigfillset(set)
|
||||
sigset13_t *set;
|
||||
{
|
||||
|
||||
__sigfillset(set);
|
||||
*set = ~(sigset13_t)0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
__sigaddset14(set, signo)
|
||||
sigset_t *set;
|
||||
sigaddset(set, signo)
|
||||
sigset13_t *set;
|
||||
int signo;
|
||||
{
|
||||
if (signo <= 0 || signo >= NSIG) {
|
||||
if (signo <= 0 || signo >= NSIG13) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
__sigaddset(set, signo);
|
||||
*set |= __sigmask13(signo);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
__sigdelset14(set, signo)
|
||||
sigset_t *set;
|
||||
sigdelset(set, signo)
|
||||
sigset13_t *set;
|
||||
int signo;
|
||||
{
|
||||
if (signo <= 0 || signo >= NSIG) {
|
||||
if (signo <= 0 || signo >= NSIG13) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
__sigdelset(set, signo);
|
||||
*set &= ~__sigmask13(signo);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
__sigismember14(set, signo)
|
||||
const sigset_t *set;
|
||||
sigismember(set, signo)
|
||||
const sigset13_t *set;
|
||||
int signo;
|
||||
{
|
||||
if (signo <= 0 || signo >= NSIG) {
|
||||
if (signo <= 0 || signo >= NSIG13) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
return (__sigismember(set, signo));
|
||||
return ((*set & __sigmask13(signo)) != 0);
|
||||
}
|
24
lib/libc/compat/gen/compat_times.c
Normal file
24
lib/libc/compat/gen/compat_times.c
Normal file
@ -0,0 +1,24 @@
|
||||
/* $NetBSD: compat_times.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Ben Harris, 2002.
|
||||
* This file is in the Public Domain.
|
||||
*/
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
#include "namespace.h"
|
||||
#include <sys/cdefs.h>
|
||||
#include <time.h>
|
||||
#include <compat/include/time.h>
|
||||
#include <sys/times.h>
|
||||
#include <compat/sys/times.h>
|
||||
|
||||
#ifdef __weak_alias
|
||||
__weak_alias(times,_times)
|
||||
#endif
|
||||
|
||||
__warn_references(times,
|
||||
"warning: reference to compatibility times(); include <sys/times.h> for correct reference")
|
||||
|
||||
|
||||
#include "gen/times.c"
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: timezone.c,v 1.18 2003/08/07 16:42:58 agc Exp $ */
|
||||
/* $NetBSD: compat_timezone.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1993
|
||||
@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)timezone.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: timezone.c,v 1.18 2003/08/07 16:42:58 agc Exp $");
|
||||
__RCSID("$NetBSD: compat_timezone.c,v 1.1 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
@ -42,7 +42,8 @@ __RCSID("$NetBSD: timezone.c,v 1.18 2003/08/07 16:42:58 agc Exp $");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <compat/include/time.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
68
lib/libc/compat/gen/compat_unvis.c
Normal file
68
lib/libc/compat/gen/compat_unvis.c
Normal file
@ -0,0 +1,68 @@
|
||||
/* $NetBSD: compat_unvis.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)unvis.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: compat_unvis.c,v 1.1 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <vis.h>
|
||||
#include <compat/include/vis.h>
|
||||
|
||||
#ifdef __weak_alias
|
||||
__weak_alias(unvis,_unvis)
|
||||
#endif
|
||||
|
||||
#ifdef __warn_references
|
||||
__warn_references(unvis,
|
||||
"warning: reference to compatibility unvis(); include <vis.h> for correct reference")
|
||||
#endif
|
||||
|
||||
int
|
||||
unvis(cp, c, astate, flag)
|
||||
char *cp;
|
||||
int c;
|
||||
int *astate, flag;
|
||||
{
|
||||
return __unvis13(cp, c, astate, flag);
|
||||
}
|
98
lib/libc/compat/gen/compat_utmpx.c
Normal file
98
lib/libc/compat/gen/compat_utmpx.c
Normal file
@ -0,0 +1,98 @@
|
||||
/* $NetBSD: compat_utmpx.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Christos Zoulas.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: compat_utmpx.c,v 1.1 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <db.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <utmp.h>
|
||||
/* don't define earlier, has side effects in fcntl.h */
|
||||
#define __LIBC12_SOURCE__
|
||||
#include <utmpx.h>
|
||||
#include <compat/include/utmpx.h>
|
||||
|
||||
__warn_references(getlastlogx,
|
||||
"warning: reference to compatibility getlastlogx(); include <utmpx.h> for correct reference")
|
||||
__warn_references(lastlogxname,
|
||||
"warning: reference to deprecated lastlogxname()")
|
||||
|
||||
static char llfile[MAXPATHLEN] = _PATH_LASTLOGX;
|
||||
|
||||
int
|
||||
lastlogxname(const char *fname)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
_DIAGASSERT(fname != NULL);
|
||||
|
||||
len = strlen(fname);
|
||||
|
||||
if (len >= sizeof(llfile))
|
||||
return 0;
|
||||
|
||||
/* must end in x! */
|
||||
if (fname[len - 1] != 'x')
|
||||
return 0;
|
||||
|
||||
(void)strlcpy(llfile, fname, sizeof(llfile));
|
||||
return 1;
|
||||
}
|
||||
|
||||
struct lastlogx *
|
||||
getlastlogx(uid_t uid, struct lastlogx *ll)
|
||||
{
|
||||
|
||||
return __getlastlogx13(llfile, uid, ll);
|
||||
}
|
60
lib/libc/compat/include/dirent.h
Normal file
60
lib/libc/compat/include/dirent.h
Normal file
@ -0,0 +1,60 @@
|
||||
/* $NetBSD: dirent.h,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)dirent.h 8.2 (Berkeley) 7/28/94
|
||||
*/
|
||||
|
||||
#ifndef _COMPAT_DIRENT_H_
|
||||
#define _COMPAT_DIRENT_H_
|
||||
|
||||
#include <compat/sys/dirent.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
DIR *opendir(const char *);
|
||||
struct dirent12 *readdir(DIR *);
|
||||
int readdir_r(DIR *, struct dirent12 * __restrict,
|
||||
struct dirent12 ** __restrict);
|
||||
struct dirent *__readdir30(DIR *);
|
||||
int __readdir_r30(DIR *, struct dirent * __restrict,
|
||||
struct dirent ** __restrict);
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
DIR *__opendir2(const char *, int);
|
||||
DIR *__opendir230(const char *, int);
|
||||
int scandir(const char *, struct dirent12 ***,
|
||||
int (*)(const struct dirent12 *), int (*)(const void *, const void *));
|
||||
int __scandir30(const char *, struct dirent ***,
|
||||
int (*)(const struct dirent *), int (*)(const void *, const void *));
|
||||
int getdents(int, char *, size_t);
|
||||
int getdirentries(int, char *, int, long *);
|
||||
int __getdents30(int, char *, size_t);
|
||||
#endif /* defined(_NETBSD_SOURCE) */
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_COMPAT_DIRENT_H_ */
|
46
lib/libc/compat/include/fts.h
Normal file
46
lib/libc/compat/include/fts.h
Normal file
@ -0,0 +1,46 @@
|
||||
/* $NetBSD: fts.h,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)fts.h 8.3 (Berkeley) 8/14/94
|
||||
*/
|
||||
|
||||
#ifndef _COMPAT_FTS_H_
|
||||
#define _COMPAT_FTS_H_
|
||||
|
||||
__BEGIN_DECLS
|
||||
FTSENT *fts_children(FTS *, int);
|
||||
int fts_close(FTS *);
|
||||
FTS *fts_open(char * const *, int,
|
||||
int (*)(const FTSENT **, const FTSENT **));
|
||||
FTSENT *fts_read(FTS *);
|
||||
int fts_set(FTS *, FTSENT *, int);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_COMPAT_FTS_H_ */
|
46
lib/libc/compat/include/glob.h
Normal file
46
lib/libc/compat/include/glob.h
Normal file
@ -0,0 +1,46 @@
|
||||
/* $NetBSD: glob.h,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Guido van Rossum.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)glob.h 8.1 (Berkeley) 6/2/93
|
||||
*/
|
||||
|
||||
#ifndef _COMPAT_GLOB_H_
|
||||
#define _COMPAT_GLOB_H_
|
||||
|
||||
__BEGIN_DECLS
|
||||
int glob(const char * __restrict, int,
|
||||
int (*)(const char *, int), glob_t * __restrict);
|
||||
void globfree(glob_t *);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_COMPAT_GLOB_H_ */
|
53
lib/libc/compat/include/ndbm.h
Normal file
53
lib/libc/compat/include/ndbm.h
Normal file
@ -0,0 +1,53 @@
|
||||
/* $NetBSD: ndbm.h,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Margo Seltzer.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ndbm.h 8.1 (Berkeley) 6/2/93
|
||||
*/
|
||||
|
||||
#ifndef _COMPAT_NDBM_H_
|
||||
#define _COMPAT_NDBM_H_
|
||||
|
||||
typedef struct {
|
||||
void *dptr;
|
||||
int dsize;
|
||||
} datum12;
|
||||
|
||||
__BEGIN_DECLS
|
||||
int dbm_delete(DBM *, datum12);
|
||||
datum12 dbm_fetch(DBM *, datum12);
|
||||
datum12 dbm_firstkey(DBM *);
|
||||
datum12 dbm_nextkey(DBM *);
|
||||
int dbm_store(DBM *, datum12, datum12, int);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_COMPAT_NDBM_H_ */
|
50
lib/libc/compat/include/setjmp.h
Normal file
50
lib/libc/compat/include/setjmp.h
Normal file
@ -0,0 +1,50 @@
|
||||
/* $NetBSD: setjmp.h,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
* (c) UNIX System Laboratories, Inc.
|
||||
* All or some portions of this file are derived from material licensed
|
||||
* to the University of California by American Telephone and Telegraph
|
||||
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
|
||||
* the permission of UNIX System Laboratories, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)setjmp.h 8.2 (Berkeley) 1/21/94
|
||||
*/
|
||||
|
||||
#ifndef _COMPAT_SETJMP_H_
|
||||
#define _COMPAT_SETJMP_H_
|
||||
|
||||
__BEGIN_DECLS
|
||||
int __setjmp14(jmp_buf);
|
||||
void __longjmp14(jmp_buf, int) __attribute__((__noreturn__));
|
||||
|
||||
int __sigsetjmp14(sigjmp_buf, int);
|
||||
void __siglongjmp14(sigjmp_buf, int) __attribute__((__noreturn__));
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_COMPAT_SETJMP_H_ */
|
75
lib/libc/compat/include/signal.h
Normal file
75
lib/libc/compat/include/signal.h
Normal file
@ -0,0 +1,75 @@
|
||||
/* $NetBSD: signal.h,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)signal.h 8.3 (Berkeley) 3/30/94
|
||||
*/
|
||||
|
||||
#ifndef _COMPAT_SIGNAL_H_
|
||||
#define _COMPAT_SIGNAL_H_
|
||||
|
||||
#include <compat/sys/signal.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
int sigaction(int, const struct sigaction13 * __restrict,
|
||||
struct sigaction13 * __restrict);
|
||||
int __sigaction14(int, const struct sigaction * __restrict,
|
||||
struct sigaction * __restrict);
|
||||
int sigaddset(sigset13_t *, int);
|
||||
int __sigaddset14(sigset_t *, int);
|
||||
int sigdelset(sigset13_t *, int);
|
||||
int __sigdelset14(sigset_t *, int);
|
||||
int sigemptyset(sigset13_t *);
|
||||
int __sigemptyset14(sigset_t *);
|
||||
int sigfillset(sigset13_t *);
|
||||
int __sigfillset14(sigset_t *);
|
||||
int sigismember(const sigset13_t *, int);
|
||||
int __sigismember14(const sigset_t *, int);
|
||||
int sigpending(sigset13_t *);
|
||||
int __sigpending14(sigset_t *);
|
||||
int sigprocmask(int, const sigset13_t * __restrict,
|
||||
sigset13_t * __restrict);
|
||||
int __sigprocmask14(int, const sigset_t * __restrict,
|
||||
sigset_t * __restrict);
|
||||
int sigsuspend(const sigset13_t *);
|
||||
int __sigsuspend14(const sigset_t *);
|
||||
|
||||
/*
|
||||
* X/Open CAE Specification Issue 4 Version 2
|
||||
*/
|
||||
#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
|
||||
(_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
|
||||
int sigaltstack(const struct sigaltstack13 * __restrict,
|
||||
struct sigaltstack13 * __restrict);
|
||||
int __sigaltstack14(const stack_t * __restrict, stack_t * __restrict);
|
||||
#endif /* _XOPEN_SOURCE_EXTENDED || _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_COMPAT_SIGNAL_H_ */
|
42
lib/libc/compat/include/stdlib.h
Normal file
42
lib/libc/compat/include/stdlib.h
Normal file
@ -0,0 +1,42 @@
|
||||
/* $NetBSD: stdlib.h,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)stdlib.h 8.5 (Berkeley) 5/19/95
|
||||
*/
|
||||
|
||||
#ifndef _COMPAT_STDLIB_H_
|
||||
#define _COMPAT_STDLIB_H_
|
||||
|
||||
__BEGIN_DECLS
|
||||
void unsetenv(const char *);
|
||||
int __unsetenv13(const char *);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_COMPAT_STDLIB_H_ */
|
58
lib/libc/compat/include/time.h
Normal file
58
lib/libc/compat/include/time.h
Normal file
@ -0,0 +1,58 @@
|
||||
/* $NetBSD: time.h,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
* (c) UNIX System Laboratories, Inc.
|
||||
* All or some portions of this file are derived from material licensed
|
||||
* to the University of California by American Telephone and Telegraph
|
||||
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
|
||||
* the permission of UNIX System Laboratories, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)time.h 8.3 (Berkeley) 1/21/94
|
||||
*/
|
||||
|
||||
#ifndef _COMPAT_TIME_H_
|
||||
#define _COMPAT_TIME_H_
|
||||
|
||||
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
|
||||
defined(_NETBSD_SOURCE)
|
||||
#define CLK_TCK 100
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
#if (_XOPEN_SOURCE - 0) >= 4 || defined(_NETBSD_SOURCE)
|
||||
char *strptime(const char * __restrict, const char * __restrict,
|
||||
struct tm * __restrict);
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
char *timezone(int, int);
|
||||
#endif /* _NETBSD_SOURCE */
|
||||
|
||||
#endif /* !_ANSI_SOURCE */
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_COMPAT_TIME_H_ */
|
78
lib/libc/compat/include/unistd.h
Normal file
78
lib/libc/compat/include/unistd.h
Normal file
@ -0,0 +1,78 @@
|
||||
/* $NetBSD: unistd.h,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Klaus Klein.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)unistd.h 8.12 (Berkeley) 4/27/95
|
||||
*/
|
||||
|
||||
#ifndef _COMPAT_UNISTD_H_
|
||||
#define _COMPAT_UNISTD_H_
|
||||
|
||||
__BEGIN_DECLS
|
||||
pid_t vfork(void);
|
||||
pid_t __vfork14(void);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_COMPAT_UNISTD_H_ */
|
49
lib/libc/compat/include/utmpx.h
Normal file
49
lib/libc/compat/include/utmpx.h
Normal file
@ -0,0 +1,49 @@
|
||||
/* $NetBSD: utmpx.h,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Christos Zoulas.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef _COMPAT_UTMPX_H_
|
||||
#define _COMPAT_UTMPX_H_
|
||||
|
||||
__BEGIN_DECLS
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
int lastlogxname(const char *);
|
||||
struct lastlogx *getlastlogx(uid_t, struct lastlogx *);
|
||||
struct lastlogx *__getlastlogx13(const char *, uid_t, struct lastlogx *);
|
||||
#endif /* _NETBSD_SOURCE */
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_COMPAT_UTMPX_H_ */
|
42
lib/libc/compat/include/vis.h
Normal file
42
lib/libc/compat/include/vis.h
Normal file
@ -0,0 +1,42 @@
|
||||
/* $NetBSD: vis.h,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vis.h 8.1 (Berkeley) 6/2/93
|
||||
*/
|
||||
|
||||
#ifndef _COMPAT_VIS_H_
|
||||
#define _COMPAT_VIS_H_
|
||||
|
||||
__BEGIN_DECLS
|
||||
int unvis(char *, int, int *, int);
|
||||
int __unvis13(char *, int, int *, int);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_COMPAT_VIS_H_ */
|
5
lib/libc/compat/stdlib/Makefile.inc
Normal file
5
lib/libc/compat/stdlib/Makefile.inc
Normal file
@ -0,0 +1,5 @@
|
||||
# $NetBSD: Makefile.inc,v 1.1 2005/09/13 01:44:09 christos Exp $
|
||||
|
||||
.PATH: ${.CURDIR}/compat/stdlib
|
||||
CPPFLAGS+=-I${.CURDIR}/stdlib
|
||||
SRCS+=compat_unsetenv.c
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: __unsetenv13.c,v 1.3 2003/08/07 16:43:37 agc Exp $ */
|
||||
/* $NetBSD: compat_unsetenv.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1993
|
||||
@ -34,34 +34,32 @@
|
||||
#if 0
|
||||
static char sccsid[] = "from: @(#)setenv.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: __unsetenv13.c,v 1.3 2003/08/07 16:43:37 agc Exp $");
|
||||
__RCSID("$NetBSD: compat_unsetenv.c,v 1.1 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
#include "namespace.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <compat/include/stdlib.h>
|
||||
#include <string.h>
|
||||
#include "local.h"
|
||||
#include "reentrant.h"
|
||||
|
||||
#ifdef __weak_alias
|
||||
#ifdef __LIBC12_SOURCE__
|
||||
__weak_alias(unsetenv,_unsetenv)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _REENTRANT
|
||||
extern rwlock_t __environ_lock;
|
||||
#endif
|
||||
|
||||
#ifdef __LIBC12_SOURCE__
|
||||
__warn_references(unsetenv,
|
||||
"warning: reference to compatibility unsetenv();"
|
||||
" include <stdlib.h> for correct reference")
|
||||
#endif
|
||||
|
||||
extern char **environ;
|
||||
|
||||
@ -69,34 +67,18 @@ extern char **environ;
|
||||
* unsetenv(name) --
|
||||
* Delete environmental variable "name".
|
||||
*/
|
||||
#ifdef __LIBC12_SOURCE__
|
||||
void
|
||||
#else
|
||||
int
|
||||
#endif
|
||||
unsetenv(name)
|
||||
const char *name;
|
||||
unsetenv(const char *name)
|
||||
{
|
||||
char **p;
|
||||
int offset;
|
||||
|
||||
_DIAGASSERT(name != NULL);
|
||||
|
||||
#ifndef __LIBC12_SOURCE__
|
||||
if (name == NULL || *name == '\0' || strchr(name, '=') != NULL) {
|
||||
errno = EINVAL;
|
||||
return (-1);
|
||||
}
|
||||
#endif
|
||||
|
||||
rwlock_wrlock(&__environ_lock);
|
||||
while (__findenv(name, &offset)) /* if set multiple times */
|
||||
for (p = &environ[offset];; ++p)
|
||||
if (!(*p = *(p + 1)))
|
||||
break;
|
||||
rwlock_unlock(&__environ_lock);
|
||||
|
||||
#ifndef __LIBC12_SOURCE__
|
||||
return (0);
|
||||
#endif
|
||||
}
|
7
lib/libc/compat/sys/Makefile.inc
Normal file
7
lib/libc/compat/sys/Makefile.inc
Normal file
@ -0,0 +1,7 @@
|
||||
# $NetBSD: Makefile.inc,v 1.1 2005/09/13 01:44:09 christos Exp $
|
||||
|
||||
.PATH: ${.CURDIR}/compat/sys
|
||||
SRCS+= compat_getdents.c compat_getdirentries.c compat_msync.c \
|
||||
compat_semctl.c compat_sigaltstack.c compat_stat.c compat___stat13.c \
|
||||
compat_statfs.c
|
||||
MAN+= getdirentries.3
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: __stat13.c,v 1.1 2005/08/19 02:04:54 christos Exp $ */
|
||||
/* $NetBSD: compat___stat13.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Frank van der Linden
|
||||
@ -33,13 +33,14 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: __stat13.c,v 1.1 2005/08/19 02:04:54 christos Exp $");
|
||||
__RCSID("$NetBSD: compat___stat13.c,v 1.1 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <compat/sys/stat.h>
|
||||
|
||||
__warn_references(__stat13,
|
||||
"warning: reference to compatibility __stat13(); include <sys/stat.h> to generate correct reference")
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: getdents.c,v 1.1 2005/08/19 02:04:54 christos Exp $ */
|
||||
/* $NetBSD: compat_getdents.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005 The NetBSD Foundation, Inc.
|
||||
@ -38,7 +38,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: getdents.c,v 1.1 2005/08/19 02:04:54 christos Exp $");
|
||||
__RCSID("$NetBSD: compat_getdents.c,v 1.1 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
@ -46,6 +46,7 @@ __RCSID("$NetBSD: getdents.c,v 1.1 2005/08/19 02:04:54 christos Exp $");
|
||||
#include "namespace.h"
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
#include <compat/include/dirent.h>
|
||||
#include <string.h>
|
||||
|
||||
/*
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: getdirentries.c,v 1.5 2005/08/19 02:04:54 christos Exp $ */
|
||||
/* $NetBSD: compat_getdirentries.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Frank van der Linden
|
||||
@ -34,13 +34,14 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: getdirentries.c,v 1.5 2005/08/19 02:04:54 christos Exp $");
|
||||
__RCSID("$NetBSD: compat_getdirentries.c,v 1.1 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
#include "namespace.h"
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
#include <compat/include/dirent.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: msync.c,v 1.4 2005/06/12 05:21:28 lukem Exp $ */
|
||||
/* $NetBSD: compat_msync.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Frank van der Linden
|
||||
@ -33,13 +33,14 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: msync.c,v 1.4 2005/06/12 05:21:28 lukem Exp $");
|
||||
__RCSID("$NetBSD: compat_msync.c,v 1.1 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
#include <compat/sys/mman.h>
|
||||
|
||||
__warn_references(msync,
|
||||
"warning: reference to compatibility msync(); include <sys/mman.h> for correct reference")
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: semctl.c,v 1.11 2003/07/26 19:24:55 salo Exp $ */
|
||||
/* $NetBSD: compat_semctl.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Christopher G. Demetriou
|
||||
@ -36,14 +36,14 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: semctl.c,v 1.11 2003/07/26 19:24:55 salo Exp $");
|
||||
__RCSID("$NetBSD: compat_semctl.c,v 1.1 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
#include <sys/types.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/sem.h>
|
||||
#include <compat/sys/sem.h>
|
||||
|
||||
int
|
||||
semctl(int semid, int semnum, int cmd, union __semun semun)
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sigaltstack.c,v 1.2 2005/06/12 05:21:28 lukem Exp $ */
|
||||
/* $NetBSD: compat_sigaltstack.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
@ -38,13 +38,14 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: sigaltstack.c,v 1.2 2005/06/12 05:21:28 lukem Exp $");
|
||||
__RCSID("$NetBSD: compat_sigaltstack.c,v 1.1 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
|
||||
#include <limits.h>
|
||||
#include <signal.h>
|
||||
#include <compat/include/signal.h>
|
||||
#include <stddef.h>
|
||||
|
||||
int
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: stat.c,v 1.5 2005/08/19 02:04:54 christos Exp $ */
|
||||
/* $NetBSD: compat_stat.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Frank van der Linden
|
||||
@ -33,13 +33,14 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: stat.c,v 1.5 2005/08/19 02:04:54 christos Exp $");
|
||||
__RCSID("$NetBSD: compat_stat.c,v 1.1 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <compat/sys/stat.h>
|
||||
|
||||
__warn_references(stat,
|
||||
"warning: reference to compatibility stat(); include <sys/stat.h> to generate correct reference")
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: statfs.c,v 1.5 2005/06/12 05:21:28 lukem Exp $ */
|
||||
/* $NetBSD: compat_statfs.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2004 The NetBSD Foundation, Inc.
|
||||
@ -38,7 +38,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: statfs.c,v 1.5 2005/06/12 05:21:28 lukem Exp $");
|
||||
__RCSID("$NetBSD: compat_statfs.c,v 1.1 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
@ -47,6 +47,7 @@ __RCSID("$NetBSD: statfs.c,v 1.5 2005/06/12 05:21:28 lukem Exp $");
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/mount.h>
|
||||
#include <compat/sys/mount.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: getdirentries.3,v 1.15 2004/05/13 10:20:58 wiz Exp $
|
||||
.\" $NetBSD: getdirentries.3,v 1.1 2005/09/13 01:44:09 christos Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1989, 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
@ -1,7 +1,7 @@
|
||||
# $NetBSD: Makefile.inc,v 1.8 2004/04/28 00:10:52 kleink Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.9 2005/09/13 01:44:09 christos Exp $
|
||||
# @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
|
||||
|
||||
.PATH: ${.CURDIR}/db/hash
|
||||
|
||||
SRCS+= hash.c hash_bigkey.c hash_buf.c hash_func.c hash_log2.c \
|
||||
hash_page.c __ndbm13.c ndbm.c
|
||||
hash_page.c ndbmdatum.c ndbm.c
|
||||
|
@ -1,10 +1,121 @@
|
||||
/* $NetBSD: ndbm.c,v 1.19 2004/04/28 00:10:52 kleink Exp $ */
|
||||
/* $NetBSD: ndbm.c,v 1.20 2005/09/13 01:44:09 christos Exp $ */
|
||||
/* from: NetBSD: ndbm.c,v 1.18 2004/04/27 20:03:45 kleink Exp */
|
||||
|
||||
/*
|
||||
* Written by Klaus Klein <kleink@NetBSD.org>, April 28, 2004.
|
||||
* Public domain.
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Margo Seltzer.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)ndbm.c 8.4 (Berkeley) 7/21/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: ndbm.c,v 1.20 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include "__ndbm13.c"
|
||||
/*
|
||||
* This package provides a dbm compatible interface to the new hashing
|
||||
* package described in db(3).
|
||||
*/
|
||||
#include "namespace.h"
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <ndbm.h>
|
||||
#include "hash.h"
|
||||
|
||||
/*
|
||||
* Returns:
|
||||
* *DBM on success
|
||||
* NULL on failure
|
||||
*/
|
||||
extern DBM *
|
||||
dbm_open(file, flags, mode)
|
||||
const char *file;
|
||||
int flags;
|
||||
mode_t mode;
|
||||
{
|
||||
HASHINFO info;
|
||||
char path[MAXPATHLEN];
|
||||
|
||||
info.bsize = 4096;
|
||||
info.ffactor = 40;
|
||||
info.nelem = 1;
|
||||
info.cachesize = 0;
|
||||
info.hash = NULL;
|
||||
info.lorder = 0;
|
||||
(void)strncpy(path, file, sizeof(path) - 1);
|
||||
(void)strncat(path, DBM_SUFFIX, sizeof(path) - strlen(path) - 1);
|
||||
if ((flags & O_ACCMODE) == O_WRONLY) {
|
||||
flags &= ~O_WRONLY;
|
||||
flags |= O_RDWR;
|
||||
}
|
||||
return ((DBM *)__hash_open(path, flags, mode, &info, 0));
|
||||
}
|
||||
|
||||
extern void
|
||||
dbm_close(db)
|
||||
DBM *db;
|
||||
{
|
||||
(void)(db->close)(db);
|
||||
}
|
||||
|
||||
extern int
|
||||
dbm_error(db)
|
||||
DBM *db;
|
||||
{
|
||||
HTAB *hp;
|
||||
|
||||
hp = (HTAB *)db->internal;
|
||||
return (hp->err);
|
||||
}
|
||||
|
||||
extern int
|
||||
dbm_clearerr(db)
|
||||
DBM *db;
|
||||
{
|
||||
HTAB *hp;
|
||||
|
||||
hp = (HTAB *)db->internal;
|
||||
hp->err = 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
extern int
|
||||
dbm_dirfno(db)
|
||||
DBM *db;
|
||||
{
|
||||
return(((HTAB *)db->internal)->fp);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: __ndbm13.c,v 1.2 2004/04/29 18:37:20 kleink Exp $ */
|
||||
/* $NetBSD: ndbmdatum.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */
|
||||
/* from: NetBSD: ndbm.c,v 1.18 2004/04/27 20:03:45 kleink Exp */
|
||||
|
||||
/*-
|
||||
@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)ndbm.c 8.4 (Berkeley) 7/21/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: __ndbm13.c,v 1.2 2004/04/29 18:37:20 kleink Exp $");
|
||||
__RCSID("$NetBSD: ndbmdatum.c,v 1.1 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
@ -56,62 +56,6 @@ __RCSID("$NetBSD: __ndbm13.c,v 1.2 2004/04/29 18:37:20 kleink Exp $");
|
||||
#include <ndbm.h>
|
||||
#include "hash.h"
|
||||
|
||||
#ifdef __LIBC12_SOURCE__
|
||||
__warn_references(dbm_delete,
|
||||
"warning: reference to compatibility dbm_delete();"
|
||||
" include <ndbm.h> for correct reference")
|
||||
__warn_references(dbm_fetch,
|
||||
"warning: reference to compatibility dbm_fetch();"
|
||||
" include <ndbm.h> for correct reference")
|
||||
__warn_references(dbm_firstkey,
|
||||
"warning: reference to compatibility dbm_firstkey();"
|
||||
" include <ndbm.h> for correct reference")
|
||||
__warn_references(dbm_nextkey,
|
||||
"warning: reference to compatibility dbm_nextkey();"
|
||||
" include <ndbm.h> for correct reference")
|
||||
__warn_references(dbm_store,
|
||||
"warning: reference to compatibility dbm_store();"
|
||||
" include <ndbm.h> for correct reference")
|
||||
#endif
|
||||
|
||||
#ifndef __LIBC12_SOURCE__
|
||||
/*
|
||||
* Returns:
|
||||
* *DBM on success
|
||||
* NULL on failure
|
||||
*/
|
||||
extern DBM *
|
||||
dbm_open(file, flags, mode)
|
||||
const char *file;
|
||||
int flags;
|
||||
mode_t mode;
|
||||
{
|
||||
HASHINFO info;
|
||||
char path[MAXPATHLEN];
|
||||
|
||||
info.bsize = 4096;
|
||||
info.ffactor = 40;
|
||||
info.nelem = 1;
|
||||
info.cachesize = 0;
|
||||
info.hash = NULL;
|
||||
info.lorder = 0;
|
||||
(void)strncpy(path, file, sizeof(path) - 1);
|
||||
(void)strncat(path, DBM_SUFFIX, sizeof(path) - strlen(path) - 1);
|
||||
if ((flags & O_ACCMODE) == O_WRONLY) {
|
||||
flags &= ~O_WRONLY;
|
||||
flags |= O_RDWR;
|
||||
}
|
||||
return ((DBM *)__hash_open(path, flags, mode, &info, 0));
|
||||
}
|
||||
|
||||
extern void
|
||||
dbm_close(db)
|
||||
DBM *db;
|
||||
{
|
||||
(void)(db->close)(db);
|
||||
}
|
||||
#endif /* !__LIBC12_SOURCE__ */
|
||||
|
||||
/*
|
||||
* Returns:
|
||||
* DATUM on success
|
||||
@ -223,33 +167,3 @@ dbm_store(db, key, data, flags)
|
||||
return ((db->put)(db, &dbtkey, &dbtdata,
|
||||
(u_int)((flags == DBM_INSERT) ? R_NOOVERWRITE : 0)));
|
||||
}
|
||||
|
||||
#ifndef __LIBC12_SOURCE__
|
||||
extern int
|
||||
dbm_error(db)
|
||||
DBM *db;
|
||||
{
|
||||
HTAB *hp;
|
||||
|
||||
hp = (HTAB *)db->internal;
|
||||
return (hp->err);
|
||||
}
|
||||
|
||||
extern int
|
||||
dbm_clearerr(db)
|
||||
DBM *db;
|
||||
{
|
||||
HTAB *hp;
|
||||
|
||||
hp = (HTAB *)db->internal;
|
||||
hp->err = 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
extern int
|
||||
dbm_dirfno(db)
|
||||
DBM *db;
|
||||
{
|
||||
return(((HTAB *)db->internal)->fp);
|
||||
}
|
||||
#endif /* !__LIBC12_SOURCE__ */
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile.inc,v 1.144 2005/08/19 02:04:54 christos Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.145 2005/09/13 01:44:09 christos Exp $
|
||||
# from: @(#)Makefile.inc 8.6 (Berkeley) 5/4/95
|
||||
|
||||
# gen sources
|
||||
@ -6,34 +6,34 @@
|
||||
|
||||
SRCS+= _errno.c alarm.c alphasort.c arc4random.c assert.c basename.c clock.c \
|
||||
closedir.c closefrom.c confstr.c ctermid.c ctype_.c daemon.c \
|
||||
devname.c dirname.c disklabel.c err.c errx.c __errlist14.c errlist.c \
|
||||
devname.c dirname.c disklabel.c err.c errx.c errlist.c \
|
||||
errno.c execl.c execle.c execlp.c execv.c execvp.c extattr.c \
|
||||
fmtcheck.c fmtmsg.c fnmatch.c fstab.c ftok.c __fts13.c __fts30.c \
|
||||
fmtcheck.c fmtmsg.c fnmatch.c fstab.c ftok.c \
|
||||
fts.c getbsize.c getcap.c getcwd.c \
|
||||
getdevmajor.c getdomainname.c getgrent.c \
|
||||
getgrouplist.c getgroupmembership.c gethostname.c \
|
||||
getloadavg.c getlogin.c getmntinfo.c __getmntinfo13.c \
|
||||
getloadavg.c getlogin.c getmntinfo.c \
|
||||
getnetgrent.c getpagesize.c \
|
||||
getpass.c getprogname.c getpwent.c getttyent.c \
|
||||
getusershell.c __glob13.c glob.c humanize_number.c initgroups.c \
|
||||
getusershell.c glob.c humanize_number.c initgroups.c \
|
||||
isascii.c isatty.c isctype.c lockf.c nice.c nlist.c nlist_aout.c \
|
||||
nlist_coff.c nlist_ecoff.c nlist_elf32.c nlist_elf64.c opendir.c \
|
||||
__opendir30.c pause.c popen.c psignal.c pthread_atfork.c pwcache.c \
|
||||
pw_scan.c raise.c randomid.c readdir.c __readdir30.c rewinddir.c \
|
||||
scandir.c __scandir30.c seekdir.c setdomainname.c \
|
||||
pause.c popen.c psignal.c pthread_atfork.c pwcache.c \
|
||||
pw_scan.c raise.c randomid.c readdir.c rewinddir.c \
|
||||
scandir.c seekdir.c setdomainname.c \
|
||||
sethostname.c setjmperr.c setmode.c setproctitle.c setprogname.c \
|
||||
shquote.c shquotev.c sighold.c sigignore.c siginterrupt.c \
|
||||
__siglist14.c siglist.c signal.c __signame14.c signame.c sigrelse.c \
|
||||
sigset.c __sigsetops14.c sigsetops.c sleep.c \
|
||||
siglist.c signal.c signame.c sigrelse.c \
|
||||
sigset.c sigsetops.c sleep.c \
|
||||
stringlist.c sysconf.c sysctl.c sysctlbyname.c sysctlgetmibinfo.c \
|
||||
sysctlnametomib.c syslog.c telldir.c time.c __times13.c \
|
||||
times.c timezone.c toascii.c tolower_.c ttyname.c ttyslot.c \
|
||||
sysctlnametomib.c syslog.c telldir.c time.c \
|
||||
times.c toascii.c tolower_.c ttyname.c ttyslot.c \
|
||||
toupper_.c ualarm.c ulimit.c uname.c unvis.c usleep.c utime.c utmp.c \
|
||||
utmpx.c valloc.c vis.c wait.c wait3.c waitpid.c warn.c warnx.c \
|
||||
vwarn.c vwarnx.c verr.c verrx.c wordexp.c
|
||||
|
||||
# indirect reference stubs, to be removed soon.
|
||||
SRCS+= _err.c _errx.c _sys_errlist.c _sys_nerr.c _sys_siglist.c \
|
||||
SRCS+= _err.c _errx.c \
|
||||
_sysconf.c _verr.c _verrx.c _vwarn.c _vwarnx.c _warn.c _warnx.c
|
||||
|
||||
# machine-dependent gen sources
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,326 +0,0 @@
|
||||
/* $NetBSD: __opendir30.c,v 1.1 2005/08/19 02:04:54 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)opendir.c 8.7 (Berkeley) 12/10/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: __opendir30.c,v 1.1 2005/08/19 02:04:54 christos Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include "namespace.h"
|
||||
#include "reentrant.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef __weak_alias
|
||||
__weak_alias(opendir,_opendir)
|
||||
#endif
|
||||
|
||||
#ifdef __LIBC12_SOURCE__
|
||||
#define dirent dirent12
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Open a directory.
|
||||
*/
|
||||
DIR *
|
||||
opendir(name)
|
||||
const char *name;
|
||||
{
|
||||
|
||||
_DIAGASSERT(name != NULL);
|
||||
|
||||
return (__opendir2(name, DTF_HIDEW|DTF_NODUP));
|
||||
}
|
||||
|
||||
DIR *
|
||||
__opendir2(name, flags)
|
||||
const char *name;
|
||||
int flags;
|
||||
{
|
||||
DIR *dirp = NULL;
|
||||
int fd;
|
||||
int serrno;
|
||||
struct stat sb;
|
||||
int pagesz;
|
||||
int incr;
|
||||
int unionstack, nfsdir;
|
||||
struct statvfs sfb;
|
||||
|
||||
_DIAGASSERT(name != NULL);
|
||||
|
||||
if ((fd = open(name, O_RDONLY | O_NONBLOCK)) == -1 ||
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
|
||||
goto error;
|
||||
if (fstat(fd, &sb) || !S_ISDIR(sb.st_mode)) {
|
||||
errno = ENOTDIR;
|
||||
goto error;
|
||||
}
|
||||
if ((dirp = (DIR *)malloc(sizeof(DIR))) == NULL)
|
||||
goto error;
|
||||
dirp->dd_buf = NULL;
|
||||
|
||||
/*
|
||||
* If the machine's page size is an exact multiple of DIRBLKSIZ,
|
||||
* use a buffer that is cluster boundary aligned.
|
||||
* Hopefully this can be a big win someday by allowing page trades
|
||||
* to user space to be done by getdirentries()
|
||||
*/
|
||||
if (((pagesz = getpagesize()) % DIRBLKSIZ) == 0)
|
||||
incr = pagesz;
|
||||
else
|
||||
incr = DIRBLKSIZ;
|
||||
|
||||
/*
|
||||
* Determine whether this directory is the top of a union stack.
|
||||
*/
|
||||
|
||||
if (fstatvfs1(fd, &sfb, ST_NOWAIT) < 0)
|
||||
goto error;
|
||||
|
||||
if (flags & DTF_NODUP)
|
||||
unionstack = !(strncmp(sfb.f_fstypename, MOUNT_UNION,
|
||||
MFSNAMELEN)) || (sfb.f_flag & MNT_UNION);
|
||||
else
|
||||
unionstack = 0;
|
||||
|
||||
nfsdir = !(strncmp(sfb.f_fstypename, MOUNT_NFS, MFSNAMELEN));
|
||||
|
||||
if (unionstack || nfsdir) {
|
||||
size_t len;
|
||||
size_t space;
|
||||
char *buf, *nbuf;
|
||||
char *ddptr;
|
||||
char *ddeptr;
|
||||
int n;
|
||||
struct dirent **dpv;
|
||||
|
||||
/*
|
||||
* The strategy here for directories on top of a union stack
|
||||
* is to read all the directory entries into a buffer, sort
|
||||
* the buffer, and remove duplicate entries by setting the
|
||||
* inode number to zero.
|
||||
*
|
||||
* For directories on an NFS mounted filesystem, we try
|
||||
* to get a consistent snapshot by trying until we have
|
||||
* successfully read all of the directory without errors
|
||||
* (i.e. 'bad cookie' errors from the server because
|
||||
* the directory was modified). These errors should not
|
||||
* happen often, but need to be dealt with.
|
||||
*/
|
||||
retry:
|
||||
len = 0;
|
||||
space = 0;
|
||||
buf = 0;
|
||||
ddptr = 0;
|
||||
|
||||
do {
|
||||
/*
|
||||
* Always make at least DIRBLKSIZ bytes
|
||||
* available to getdirentries
|
||||
*/
|
||||
if (space < DIRBLKSIZ) {
|
||||
space += incr;
|
||||
len += incr;
|
||||
nbuf = realloc(buf, len);
|
||||
if (nbuf == NULL) {
|
||||
dirp->dd_buf = buf;
|
||||
goto error;
|
||||
}
|
||||
buf = nbuf;
|
||||
ddptr = buf + (len - space);
|
||||
}
|
||||
|
||||
dirp->dd_seek = lseek(fd, (off_t)0, SEEK_CUR);
|
||||
n = getdents(fd, ddptr, space);
|
||||
/*
|
||||
* For NFS: EINVAL means a bad cookie error
|
||||
* from the server. Keep trying to get a
|
||||
* consistent view, in this case this means
|
||||
* starting all over again.
|
||||
*/
|
||||
if (n == -1 && errno == EINVAL && nfsdir) {
|
||||
free(buf);
|
||||
lseek(fd, (off_t)0, SEEK_SET);
|
||||
goto retry;
|
||||
}
|
||||
if (n > 0) {
|
||||
ddptr += n;
|
||||
space -= n;
|
||||
}
|
||||
} while (n > 0);
|
||||
|
||||
ddeptr = ddptr;
|
||||
flags |= __DTF_READALL;
|
||||
|
||||
/*
|
||||
* Re-open the directory.
|
||||
* This has the effect of rewinding back to the
|
||||
* top of the union stack and is needed by
|
||||
* programs which plan to fchdir to a descriptor
|
||||
* which has also been read -- see fts.c.
|
||||
*/
|
||||
if (flags & DTF_REWIND) {
|
||||
(void) close(fd);
|
||||
if ((fd = open(name, O_RDONLY)) == -1 ||
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) {
|
||||
dirp->dd_buf = buf;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* There is now a buffer full of (possibly) duplicate
|
||||
* names.
|
||||
*/
|
||||
dirp->dd_buf = buf;
|
||||
|
||||
/*
|
||||
* Go round this loop twice...
|
||||
*
|
||||
* Scan through the buffer, counting entries.
|
||||
* On the second pass, save pointers to each one.
|
||||
* Then sort the pointers and remove duplicate names.
|
||||
*/
|
||||
if (!nfsdir) {
|
||||
for (dpv = 0;;) {
|
||||
for (n = 0, ddptr = buf; ddptr < ddeptr;) {
|
||||
struct dirent *dp;
|
||||
|
||||
dp = (struct dirent *)(void *)ddptr;
|
||||
if ((long)dp & _DIRENT_ALIGN(dp))
|
||||
break;
|
||||
/*
|
||||
* d_reclen is unsigned,
|
||||
* so no need to compare <= 0
|
||||
*/
|
||||
if (dp->d_reclen > (ddeptr + 1 - ddptr))
|
||||
break;
|
||||
ddptr += dp->d_reclen;
|
||||
if (dp->d_fileno) {
|
||||
if (dpv)
|
||||
dpv[n] = dp;
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
||||
if (dpv) {
|
||||
struct dirent *xp;
|
||||
|
||||
/*
|
||||
* This sort must be stable.
|
||||
*/
|
||||
mergesort(dpv, (size_t)n, sizeof(*dpv),
|
||||
alphasort);
|
||||
|
||||
dpv[n] = NULL;
|
||||
xp = NULL;
|
||||
|
||||
/*
|
||||
* Scan through the buffer in sort
|
||||
* order, zapping the inode number
|
||||
* of any duplicate names.
|
||||
*/
|
||||
for (n = 0; dpv[n]; n++) {
|
||||
struct dirent *dp = dpv[n];
|
||||
|
||||
if ((xp == NULL) ||
|
||||
strcmp(dp->d_name,
|
||||
xp->d_name))
|
||||
xp = dp;
|
||||
else
|
||||
dp->d_fileno = 0;
|
||||
if (dp->d_type == DT_WHT &&
|
||||
(flags & DTF_HIDEW))
|
||||
dp->d_fileno = 0;
|
||||
}
|
||||
|
||||
free(dpv);
|
||||
break;
|
||||
} else {
|
||||
dpv = malloc((n + 1) *
|
||||
sizeof(struct dirent *));
|
||||
if (dpv == NULL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dirp->dd_len = len;
|
||||
dirp->dd_size = ddptr - dirp->dd_buf;
|
||||
} else {
|
||||
dirp->dd_len = incr;
|
||||
dirp->dd_buf = malloc((size_t)dirp->dd_len);
|
||||
if (dirp->dd_buf == NULL)
|
||||
goto error;
|
||||
dirp->dd_seek = 0;
|
||||
flags &= ~DTF_REWIND;
|
||||
}
|
||||
|
||||
dirp->dd_loc = 0;
|
||||
dirp->dd_fd = fd;
|
||||
dirp->dd_flags = flags;
|
||||
|
||||
/*
|
||||
* Set up seek point for rewinddir.
|
||||
*/
|
||||
#ifdef _REENTRANT
|
||||
if (__isthreaded) {
|
||||
if ((dirp->dd_lock = malloc(sizeof(mutex_t))) == NULL)
|
||||
goto error;
|
||||
mutex_init((mutex_t *)dirp->dd_lock, NULL);
|
||||
}
|
||||
#endif
|
||||
dirp->dd_rewind = telldir(dirp);
|
||||
return (dirp);
|
||||
error:
|
||||
serrno = errno;
|
||||
if (dirp && dirp->dd_buf)
|
||||
free(dirp->dd_buf);
|
||||
if (dirp)
|
||||
free(dirp);
|
||||
if (fd != -1)
|
||||
(void)close(fd);
|
||||
errno = serrno;
|
||||
return NULL;
|
||||
}
|
@ -1,150 +0,0 @@
|
||||
/* $NetBSD: __readdir30.c,v 1.1 2005/08/19 02:04:54 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)readdir.c 8.3 (Berkeley) 9/29/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: __readdir30.c,v 1.1 2005/08/19 02:04:54 christos Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include "namespace.h"
|
||||
#include "reentrant.h"
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef __weak_alias
|
||||
__weak_alias(readdir,_readdir)
|
||||
__weak_alias(readdir_r,_readdir_r)
|
||||
#endif
|
||||
|
||||
#ifdef __LIBC12_SOURCE__
|
||||
#define dirent dirent12
|
||||
#endif
|
||||
|
||||
/*
|
||||
* get next entry in a directory.
|
||||
*/
|
||||
static struct dirent *
|
||||
_readdir_unlocked(DIR *dirp)
|
||||
{
|
||||
struct dirent *dp;
|
||||
|
||||
|
||||
for (;;) {
|
||||
if (dirp->dd_loc >= dirp->dd_size) {
|
||||
if (dirp->dd_flags & __DTF_READALL)
|
||||
return (NULL);
|
||||
dirp->dd_loc = 0;
|
||||
}
|
||||
if (dirp->dd_loc == 0 && !(dirp->dd_flags & __DTF_READALL)) {
|
||||
dirp->dd_seek = lseek(dirp->dd_fd, (off_t)0, SEEK_CUR);
|
||||
dirp->dd_size = getdents(dirp->dd_fd,
|
||||
dirp->dd_buf, (size_t)dirp->dd_len);
|
||||
if (dirp->dd_size <= 0)
|
||||
return (NULL);
|
||||
}
|
||||
dp = (struct dirent *)
|
||||
(void *)(dirp->dd_buf + (size_t)dirp->dd_loc);
|
||||
if ((intptr_t)dp & _DIRENT_ALIGN(dp))/* bogus pointer check */
|
||||
return (NULL);
|
||||
/* d_reclen is unsigned; no need to compare it <= 0 */
|
||||
if (dp->d_reclen > dirp->dd_len + 1 - dirp->dd_loc)
|
||||
return (NULL);
|
||||
dirp->dd_loc += dp->d_reclen;
|
||||
if (dp->d_ino == 0)
|
||||
continue;
|
||||
if (dp->d_type == DT_WHT && (dirp->dd_flags & DTF_HIDEW))
|
||||
continue;
|
||||
return (dp);
|
||||
}
|
||||
}
|
||||
|
||||
struct dirent *
|
||||
readdir(dirp)
|
||||
DIR *dirp;
|
||||
{
|
||||
struct dirent *dp;
|
||||
|
||||
#ifdef _REENTRANT
|
||||
if (__isthreaded) {
|
||||
mutex_lock((mutex_t *)dirp->dd_lock);
|
||||
dp = _readdir_unlocked(dirp);
|
||||
mutex_unlock((mutex_t *)dirp->dd_lock);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
dp = _readdir_unlocked(dirp);
|
||||
return (dp);
|
||||
}
|
||||
|
||||
int
|
||||
readdir_r(dirp, entry, result)
|
||||
DIR *dirp;
|
||||
struct dirent *entry;
|
||||
struct dirent **result;
|
||||
{
|
||||
struct dirent *dp;
|
||||
int saved_errno;
|
||||
|
||||
saved_errno = errno;
|
||||
errno = 0;
|
||||
#ifdef _REENTRANT
|
||||
if (__isthreaded) {
|
||||
mutex_lock((mutex_t *)dirp->dd_lock);
|
||||
if ((dp = _readdir_unlocked(dirp)) != NULL)
|
||||
memcpy(entry, dp, (size_t)_DIRENT_SIZE(dp));
|
||||
mutex_unlock((mutex_t *)dirp->dd_lock);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if ((dp = _readdir_unlocked(dirp)) != NULL)
|
||||
memcpy(entry, dp, (size_t)_DIRENT_SIZE(dp));
|
||||
|
||||
if (errno != 0) {
|
||||
if (dp == NULL)
|
||||
return (errno);
|
||||
} else
|
||||
errno = saved_errno;
|
||||
|
||||
if (dp != NULL)
|
||||
*result = entry;
|
||||
else
|
||||
*result = NULL;
|
||||
|
||||
return (0);
|
||||
}
|
@ -1,141 +0,0 @@
|
||||
/* $NetBSD: __scandir30.c,v 1.1 2005/08/19 02:04:54 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)scandir.c 8.3 (Berkeley) 1/2/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: __scandir30.c,v 1.1 2005/08/19 02:04:54 christos Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
/*
|
||||
* Scan the directory dirname calling selectfn to make a list of selected
|
||||
* directory entries then sort using qsort and compare routine dcomp.
|
||||
* Returns the number of entries and a pointer to a list of pointers to
|
||||
* struct dirent (through namelist). Returns -1 if there were any errors.
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <dirent.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __weak_alias
|
||||
__weak_alias(scandir,_scandir)
|
||||
#endif
|
||||
|
||||
#ifdef __LIBC12_SOURCE__
|
||||
#define dirent dirent12
|
||||
#endif
|
||||
|
||||
int
|
||||
scandir(dirname, namelist, selectfn, dcomp)
|
||||
const char *dirname;
|
||||
struct dirent ***namelist;
|
||||
int (*selectfn) __P((const struct dirent *));
|
||||
int (*dcomp) __P((const void *, const void *));
|
||||
{
|
||||
struct dirent *d, *p, **names, **newnames;
|
||||
size_t nitems, arraysz;
|
||||
struct stat stb;
|
||||
DIR *dirp;
|
||||
|
||||
_DIAGASSERT(dirname != NULL);
|
||||
_DIAGASSERT(namelist != NULL);
|
||||
|
||||
if ((dirp = opendir(dirname)) == NULL)
|
||||
return (-1);
|
||||
if (fstat(dirp->dd_fd, &stb) < 0)
|
||||
goto bad;
|
||||
|
||||
/*
|
||||
* estimate the array size by taking the size of the directory file
|
||||
* and dividing it by a multiple of the minimum size entry.
|
||||
*/
|
||||
arraysz = (size_t)(stb.st_size / 24);
|
||||
names = malloc(arraysz * sizeof(struct dirent *));
|
||||
if (names == NULL)
|
||||
goto bad;
|
||||
|
||||
nitems = 0;
|
||||
while ((d = readdir(dirp)) != NULL) {
|
||||
if (selectfn != NULL && !(*selectfn)(d))
|
||||
continue; /* just selected names */
|
||||
|
||||
/*
|
||||
* Check to make sure the array has space left and
|
||||
* realloc the maximum size.
|
||||
*/
|
||||
if (nitems >= arraysz) {
|
||||
if (fstat(dirp->dd_fd, &stb) < 0)
|
||||
goto bad2; /* just might have grown */
|
||||
arraysz = (size_t)(stb.st_size / 12);
|
||||
newnames = realloc(names,
|
||||
arraysz * sizeof(struct dirent *));
|
||||
if (newnames == NULL)
|
||||
goto bad2;
|
||||
names = newnames;
|
||||
}
|
||||
|
||||
/*
|
||||
* Make a minimum size copy of the data
|
||||
*/
|
||||
p = (struct dirent *)malloc((size_t)_DIRENT_SIZE(d));
|
||||
if (p == NULL)
|
||||
goto bad2;
|
||||
p->d_fileno = d->d_fileno;
|
||||
p->d_reclen = d->d_reclen;
|
||||
p->d_type = d->d_type;
|
||||
p->d_namlen = d->d_namlen;
|
||||
memmove(p->d_name, d->d_name, (size_t)(p->d_namlen + 1));
|
||||
names[nitems++] = p;
|
||||
}
|
||||
closedir(dirp);
|
||||
if (nitems && dcomp != NULL)
|
||||
qsort(names, nitems, sizeof(struct dirent *), dcomp);
|
||||
*namelist = names;
|
||||
return (nitems);
|
||||
|
||||
bad2:
|
||||
while (nitems-- > 0)
|
||||
free(names[nitems]);
|
||||
free(names);
|
||||
bad:
|
||||
closedir(dirp);
|
||||
return (-1);
|
||||
}
|
@ -1,113 +0,0 @@
|
||||
/* $NetBSD: __siglist14.c,v 1.3 2003/08/07 16:42:45 agc Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)siglist.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: __siglist14.c,v 1.3 2003/08/07 16:42:45 agc Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <signal.h>
|
||||
|
||||
static const char *const __siglist14[] = {
|
||||
"Signal 0", /* 0 */
|
||||
"Hangup", /* 1 SIGHUP */
|
||||
"Interrupt", /* 2 SIGINT */
|
||||
"Quit", /* 3 SIGQUIT */
|
||||
"Illegal instruction", /* 4 SIGILL */
|
||||
"Trace/BPT trap", /* 5 SIGTRAP */
|
||||
"Abort trap", /* 6 SIGABRT */
|
||||
"EMT trap", /* 7 SIGEMT */
|
||||
"Floating point exception", /* 8 SIGFPE */
|
||||
"Killed", /* 9 SIGKILL */
|
||||
"Bus error", /* 10 SIGBUS */
|
||||
"Segmentation fault", /* 11 SIGSEGV */
|
||||
"Bad system call", /* 12 SIGSYS */
|
||||
"Broken pipe", /* 13 SIGPIPE */
|
||||
"Alarm clock", /* 14 SIGALRM */
|
||||
"Terminated", /* 15 SIGTERM */
|
||||
"Urgent I/O condition", /* 16 SIGURG */
|
||||
"Suspended (signal)", /* 17 SIGSTOP */
|
||||
"Suspended", /* 18 SIGTSTP */
|
||||
"Continued", /* 19 SIGCONT */
|
||||
"Child exited", /* 20 SIGCHLD */
|
||||
"Stopped (tty input)", /* 21 SIGTTIN */
|
||||
"Stopped (tty output)", /* 22 SIGTTOU */
|
||||
"I/O possible", /* 23 SIGIO */
|
||||
"Cputime limit exceeded", /* 24 SIGXCPU */
|
||||
"Filesize limit exceeded", /* 25 SIGXFSZ */
|
||||
"Virtual timer expired", /* 26 SIGVTALRM */
|
||||
"Profiling timer expired", /* 27 SIGPROF */
|
||||
"Window size changes", /* 28 SIGWINCH */
|
||||
"Information request", /* 29 SIGINFO */
|
||||
"User defined signal 1", /* 30 SIGUSR1 */
|
||||
"User defined signal 2", /* 31 SIGUSR2 */
|
||||
"Power fail/restart", /* 32 SIGPWR */
|
||||
"Real time signal 0", /* 33 SIGRTMIN + 0 */
|
||||
"Real time signal 1", /* 34 SIGRTMIN + 1 */
|
||||
"Real time signal 2", /* 35 SIGRTMIN + 2 */
|
||||
"Real time signal 3", /* 36 SIGRTMIN + 3 */
|
||||
"Real time signal 4", /* 37 SIGRTMIN + 4 */
|
||||
"Real time signal 5", /* 38 SIGRTMIN + 5 */
|
||||
"Real time signal 6", /* 39 SIGRTMIN + 6 */
|
||||
"Real time signal 7", /* 40 SIGRTMIN + 7 */
|
||||
"Real time signal 8", /* 41 SIGRTMIN + 8 */
|
||||
"Real time signal 9", /* 42 SIGRTMIN + 9 */
|
||||
"Real time signal 10", /* 43 SIGRTMIN + 10 */
|
||||
"Real time signal 11", /* 44 SIGRTMIN + 11 */
|
||||
"Real time signal 12", /* 45 SIGRTMIN + 12 */
|
||||
"Real time signal 13", /* 46 SIGRTMIN + 13 */
|
||||
"Real time signal 14", /* 47 SIGRTMIN + 14 */
|
||||
"Real time signal 15", /* 48 SIGRTMIN + 15 */
|
||||
"Real time signal 16", /* 49 SIGRTMIN + 16 */
|
||||
"Real time signal 17", /* 50 SIGRTMIN + 17 */
|
||||
"Real time signal 18", /* 51 SIGRTMIN + 18 */
|
||||
"Real time signal 19", /* 52 SIGRTMIN + 19 */
|
||||
"Real time signal 20", /* 53 SIGRTMIN + 20 */
|
||||
"Real time signal 21", /* 54 SIGRTMIN + 21 */
|
||||
"Real time signal 22", /* 55 SIGRTMIN + 22 */
|
||||
"Real time signal 23", /* 56 SIGRTMIN + 23 */
|
||||
"Real time signal 24", /* 57 SIGRTMIN + 24 */
|
||||
"Real time signal 25", /* 58 SIGRTMIN + 25 */
|
||||
"Real time signal 26", /* 59 SIGRTMIN + 26 */
|
||||
"Real time signal 27", /* 60 SIGRTMIN + 27 */
|
||||
"Real time signal 28", /* 61 SIGRTMIN + 28 */
|
||||
"Real time signal 29", /* 62 SIGRTMIN + 29 */
|
||||
"Real time signal 30", /* 63 SIGRTMIN + 30 */
|
||||
};
|
||||
|
||||
const int __sys_nsig14 = sizeof(__siglist14) / sizeof(__siglist14[0]);
|
||||
|
||||
const char * const *__sys_siglist14 = __siglist14;
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: _err.c,v 1.10 2005/07/16 18:01:38 christos Exp $ */
|
||||
/* $NetBSD: _err.c,v 1.11 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* J.T. Conklin, December 12, 1994
|
||||
@ -7,17 +7,24 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: _err.c,v 1.10 2005/07/16 18:01:38 christos Exp $");
|
||||
__RCSID("$NetBSD: _err.c,v 1.11 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#if defined(__indr_reference) && !defined(__lint__)
|
||||
#if defined(__indr_reference)
|
||||
__indr_reference(_err, err)
|
||||
#else
|
||||
|
||||
#define __NO_NAMESPACE_H /* XXX */
|
||||
#define _err err
|
||||
#define _verr verr
|
||||
#define rcsid _rcsid
|
||||
#include "err.c"
|
||||
#include <stdarg.h>
|
||||
|
||||
__dead void _verr(int eval, const char *, _BSD_VA_LIST_);
|
||||
|
||||
__dead void
|
||||
err(int eval, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
_verr(eval, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: _errx.c,v 1.10 2005/07/16 18:01:38 christos Exp $ */
|
||||
/* $NetBSD: _errx.c,v 1.11 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* J.T. Conklin, December 12, 1994
|
||||
@ -7,17 +7,24 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: _errx.c,v 1.10 2005/07/16 18:01:38 christos Exp $");
|
||||
__RCSID("$NetBSD: _errx.c,v 1.11 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#if defined(__indr_reference) && !defined(__lint__)
|
||||
#if defined(__indr_reference)
|
||||
__indr_reference(_errx, errx)
|
||||
#else
|
||||
|
||||
#define __NO_NAMESPACE_H /* XXX */
|
||||
#define _errx errx
|
||||
#define _verrx verrx
|
||||
#define rcsid _rcsid
|
||||
#include "errx.c"
|
||||
#include <stdarg.h>
|
||||
|
||||
__dead void _verrx(int eval, const char *, _BSD_VA_LIST_);
|
||||
|
||||
__dead void
|
||||
errx(int eval, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
_verrx(eval, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: _sysconf.c,v 1.3 2005/07/30 15:21:20 christos Exp $ */
|
||||
/* $NetBSD: _sysconf.c,v 1.4 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christos Zoulas. All rights reserved.
|
||||
@ -31,10 +31,10 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: _sysconf.c,v 1.3 2005/07/30 15:21:20 christos Exp $");
|
||||
__RCSID("$NetBSD: _sysconf.c,v 1.4 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#if defined(__indr_reference) && !defined(__lint__)
|
||||
#if defined(__indr_reference)
|
||||
__indr_reference(__sysconf, sysconf)
|
||||
#else
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: _verr.c,v 1.9 2005/07/16 18:01:38 christos Exp $ */
|
||||
/* $NetBSD: _verr.c,v 1.10 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* J.T. Conklin, December 12, 1994
|
||||
@ -7,16 +7,19 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: _verr.c,v 1.9 2005/07/16 18:01:38 christos Exp $");
|
||||
__RCSID("$NetBSD: _verr.c,v 1.10 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#if defined(__indr_reference) && !defined(__lint__)
|
||||
#if defined(__indr_reference)
|
||||
__indr_reference(_verr, verr)
|
||||
#else
|
||||
|
||||
#define __NO_NAMESPACE_H /* XXX */
|
||||
#define _verr verr
|
||||
#define rcsid _rcsid
|
||||
#include "verr.c"
|
||||
__dead void _verr(int, const char *, _BSD_VA_LIST_);
|
||||
|
||||
void
|
||||
verr(int eval, const char *fmt, _BSD_VA_LIST_ ap)
|
||||
{
|
||||
_verr(eval, fmt, ap);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: _verrx.c,v 1.9 2005/07/16 18:01:38 christos Exp $ */
|
||||
/* $NetBSD: _verrx.c,v 1.10 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* J.T. Conklin, December 12, 1994
|
||||
@ -7,16 +7,19 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: _verrx.c,v 1.9 2005/07/16 18:01:38 christos Exp $");
|
||||
__RCSID("$NetBSD: _verrx.c,v 1.10 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#if defined(__indr_reference) && !defined(__lint__)
|
||||
#if defined(__indr_reference)
|
||||
__indr_reference(_verrx, verrx)
|
||||
#else
|
||||
|
||||
#define __NO_NAMESPACE_H /* XXX */
|
||||
#define _verrx verrx
|
||||
#define rcsid _rcsid
|
||||
#include "verrx.c"
|
||||
__dead void _verrx(int, const char *, _BSD_VA_LIST_);
|
||||
|
||||
void
|
||||
verrx(int eval, const char *fmt, _BSD_VA_LIST_ ap)
|
||||
{
|
||||
_verrx(eval, fmt, ap);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: _vwarn.c,v 1.9 2005/07/16 18:01:38 christos Exp $ */
|
||||
/* $NetBSD: _vwarn.c,v 1.10 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* J.T. Conklin, December 12, 1994
|
||||
@ -7,16 +7,19 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: _vwarn.c,v 1.9 2005/07/16 18:01:38 christos Exp $");
|
||||
__RCSID("$NetBSD: _vwarn.c,v 1.10 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#if defined(__indr_reference) && !defined(__lint__)
|
||||
#if defined(__indr_reference)
|
||||
__indr_reference(_vwarn, vwarn)
|
||||
#else
|
||||
|
||||
#define __NO_NAMESPACE_H /* XXX */
|
||||
#define _vwarn vwarn
|
||||
#define rcsid _rcsid
|
||||
#include "vwarn.c"
|
||||
void _vwarn(const char *, _BSD_VA_LIST_);
|
||||
|
||||
void
|
||||
vwarn(const char *fmt, _BSD_VA_LIST_ ap)
|
||||
{
|
||||
_vwarn(fmt, ap);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: _vwarnx.c,v 1.9 2005/07/16 18:01:38 christos Exp $ */
|
||||
/* $NetBSD: _vwarnx.c,v 1.10 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* J.T. Conklin, December 12, 1994
|
||||
@ -7,16 +7,19 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: _vwarnx.c,v 1.9 2005/07/16 18:01:38 christos Exp $");
|
||||
__RCSID("$NetBSD: _vwarnx.c,v 1.10 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#if defined(__indr_reference) && !defined(__lint__)
|
||||
#if defined(__indr_reference)
|
||||
__indr_reference(_vwarnx, vwarnx)
|
||||
#else
|
||||
|
||||
#define __NO_NAMESPACE_H /* XXX */
|
||||
#define _vwarnx vwarnx
|
||||
#define rcsid _rcsid
|
||||
#include "vwarnx.c"
|
||||
void _vwarnx(const char *, _BSD_VA_LIST_);
|
||||
|
||||
void
|
||||
vwarnx(const char *fmt, _BSD_VA_LIST_ ap)
|
||||
{
|
||||
_vwarnx(fmt, ap);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: _warn.c,v 1.9 2005/07/16 18:01:38 christos Exp $ */
|
||||
/* $NetBSD: _warn.c,v 1.10 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* J.T. Conklin, December 12, 1994
|
||||
@ -7,17 +7,24 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: _warn.c,v 1.9 2005/07/16 18:01:38 christos Exp $");
|
||||
__RCSID("$NetBSD: _warn.c,v 1.10 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#if defined(__indr_reference) && !defined(__lint__)
|
||||
#if defined(__indr_reference)
|
||||
__indr_reference(_warn, warn)
|
||||
#else
|
||||
|
||||
#define __NO_NAMESPACE_H /* XXX */
|
||||
#define _warn warn
|
||||
#define _vwarn vwarn
|
||||
#define rcsid _rcsid
|
||||
#include "warn.c"
|
||||
#include <stdarg.h>
|
||||
|
||||
void _vwarn(const char *, _BSD_VA_LIST_);
|
||||
|
||||
void
|
||||
warn(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
_vwarn(eval, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: _warnx.c,v 1.9 2005/07/16 18:01:38 christos Exp $ */
|
||||
/* $NetBSD: _warnx.c,v 1.10 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* J.T. Conklin, December 12, 1994
|
||||
@ -7,17 +7,25 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: _warnx.c,v 1.9 2005/07/16 18:01:38 christos Exp $");
|
||||
__RCSID("$NetBSD: _warnx.c,v 1.10 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#if defined(__indr_reference) && !defined(__lint__)
|
||||
#if defined(__indr_reference)
|
||||
__indr_reference(_warnx, warnx)
|
||||
#else
|
||||
|
||||
#define __NO_NAMESPACE_H /* XXX */
|
||||
#define _warnx warnx
|
||||
#define _vwarnx vwarnx
|
||||
#define rcsid _rcsid
|
||||
#include "warnx.c"
|
||||
#include <stdarg.h>
|
||||
|
||||
void _vwarnx(const char *, _BSD_VA_LIST_);
|
||||
|
||||
void
|
||||
warnx(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
_vwarnx(eval, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: err.c,v 1.23 2003/10/27 00:12:42 lukem Exp $ */
|
||||
/* $NetBSD: err.c,v 1.24 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@ -38,13 +38,11 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: err.c,v 1.23 2003/10/27 00:12:42 lukem Exp $");
|
||||
__RCSID("$NetBSD: err.c,v 1.24 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#ifndef __NO_NAMESPACE_H /* XXX */
|
||||
#include "namespace.h"
|
||||
#endif
|
||||
#include <err.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
@ -53,7 +51,7 @@ __weak_alias(err, _err)
|
||||
#endif
|
||||
|
||||
__dead void
|
||||
_err(int eval, const char *fmt, ...)
|
||||
err(int eval, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: errlist.c,v 1.14 2003/08/07 16:42:47 agc Exp $ */
|
||||
/* $NetBSD: errlist.c,v 1.15 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1985, 1993
|
||||
@ -34,18 +34,13 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)errlst.c 8.2 (Berkeley) 11/16/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: errlist.c,v 1.14 2003/08/07 16:42:47 agc Exp $");
|
||||
__RCSID("$NetBSD: errlist.c,v 1.15 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#ifdef __weak_alias
|
||||
__weak_alias(sys_errlist, _sys_errlist)
|
||||
__weak_alias(__sys_errlist, _sys_errlist)
|
||||
__weak_alias(sys_nerr, _sys_nerr)
|
||||
__weak_alias(__sys_nerr, _sys_nerr)
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
const char *const _sys_errlist[] = {
|
||||
static const char *const errlist[] = {
|
||||
"Undefined error: 0", /* 0 - ENOERROR */
|
||||
"Operation not permitted", /* 1 - EPERM */
|
||||
"No such file or directory", /* 2 - ENOENT */
|
||||
@ -145,5 +140,35 @@ const char *const _sys_errlist[] = {
|
||||
"Function not implemented", /* 78 - ENOSYS */
|
||||
|
||||
"Inappropriate file type or format", /* 79 - EFTYPE */
|
||||
"Authentication error", /* 80 - EAUTH */
|
||||
"Need authenticator", /* 81 - ENEEDAUTH */
|
||||
|
||||
/* SystemV IPC */
|
||||
"Identifier removed", /* 82 - EIDRM */
|
||||
"No message of desired type", /* 83 - ENOMSG */
|
||||
/* 84 - EOVERFLOW */
|
||||
"Value too large to be stored in data type",
|
||||
|
||||
/* Wide/multibyte-character handling, ISO/IEC 9899/AMD1:1995 */
|
||||
"Illegal byte sequence", /* 85 - EILSEQ */
|
||||
|
||||
/* Base, Realtime, Threads or Thread Priority Scheduling option errors */
|
||||
"Not supported", /* 86 - ENOTSUP */
|
||||
|
||||
/* Realtime option errors */
|
||||
"Operation Canceled", /* 87 - ECANCELED */
|
||||
|
||||
/* Realtime, XSI STREAMS option errors */
|
||||
"Bad or Corrupt message", /* 88 - EBADMSG */
|
||||
|
||||
/* XSI STREAMS option errors */
|
||||
"No message available", /* 89 - ENODATA */
|
||||
"No STREAM resources", /* 90 - ENOSR */
|
||||
"Not a STREAM", /* 91 - ENOSTR */
|
||||
"STREAM ioctl timeout", /* 92 - ETIME */
|
||||
"Attribute not found" /* 93 - ENOATTR */
|
||||
};
|
||||
const int _sys_nerr = { sizeof _sys_errlist/sizeof _sys_errlist[0] };
|
||||
|
||||
const int sys_nerr = sizeof(errlist) / sizeof(errlist[0]);
|
||||
|
||||
const char * const *sys_errlist = errlist;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: errx.c,v 1.11 2003/10/27 00:12:42 lukem Exp $ */
|
||||
/* $NetBSD: errx.c,v 1.12 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@ -38,13 +38,11 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: errx.c,v 1.11 2003/10/27 00:12:42 lukem Exp $");
|
||||
__RCSID("$NetBSD: errx.c,v 1.12 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#ifndef __NO_NAMESPACE_H /* XXX */
|
||||
#include "namespace.h"
|
||||
#endif
|
||||
#include <err.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
@ -53,7 +51,7 @@ __weak_alias(errx, _errx)
|
||||
#endif
|
||||
|
||||
__dead void
|
||||
_errx(int eval, const char *fmt, ...)
|
||||
errx(int eval, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
|
1212
lib/libc/gen/fts.c
1212
lib/libc/gen/fts.c
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: getmntinfo.c,v 1.15 2005/04/12 21:36:46 drochner Exp $ */
|
||||
/* $NetBSD: getmntinfo.c,v 1.16 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -34,12 +34,10 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)getmntinfo.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: getmntinfo.c,v 1.15 2005/04/12 21:36:46 drochner Exp $");
|
||||
__RCSID("$NetBSD: getmntinfo.c,v 1.16 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/ucred.h>
|
||||
@ -49,37 +47,33 @@ __RCSID("$NetBSD: getmntinfo.c,v 1.15 2005/04/12 21:36:46 drochner Exp $");
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __weak_alias
|
||||
__weak_alias(getmntinfo,_getmntinfo)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Return information about mounted filesystems.
|
||||
*/
|
||||
int
|
||||
getmntinfo(mntbufp, flags)
|
||||
struct statfs12 **mntbufp;
|
||||
struct statvfs **mntbufp;
|
||||
int flags;
|
||||
{
|
||||
static struct statfs12 *mntbuf;
|
||||
static struct statvfs *mntbuf;
|
||||
static int mntsize;
|
||||
static size_t bufsize;
|
||||
|
||||
_DIAGASSERT(mntbufp != NULL);
|
||||
|
||||
if (mntsize <= 0 &&
|
||||
(mntsize = getfsstat(NULL, 0L, MNT_NOWAIT)) == -1)
|
||||
(mntsize = getvfsstat(NULL, (size_t)0, MNT_NOWAIT)) == -1)
|
||||
return (0);
|
||||
if (bufsize > 0 &&
|
||||
(mntsize = getfsstat(mntbuf, (long)bufsize, flags)) == -1)
|
||||
(mntsize = getvfsstat(mntbuf, bufsize, flags)) == -1)
|
||||
return (0);
|
||||
while (bufsize <= mntsize * sizeof(struct statfs12)) {
|
||||
while (bufsize <= mntsize * sizeof(struct statvfs)) {
|
||||
if (mntbuf)
|
||||
free(mntbuf);
|
||||
bufsize = (mntsize + 1) * sizeof(struct statfs12);
|
||||
bufsize = (mntsize + 1) * sizeof(struct statvfs);
|
||||
if ((mntbuf = malloc(bufsize)) == NULL)
|
||||
return (0);
|
||||
if ((mntsize = getfsstat(mntbuf, (long)bufsize, flags)) == -1)
|
||||
if ((mntsize = getvfsstat(mntbuf, bufsize, flags)) == -1)
|
||||
return (0);
|
||||
}
|
||||
*mntbufp = mntbuf;
|
||||
|
1031
lib/libc/gen/glob.c
1031
lib/libc/gen/glob.c
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: humanize_number.c,v 1.9 2005/02/09 21:35:46 kleink Exp $ */
|
||||
/* $NetBSD: humanize_number.c,v 1.10 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997, 1998, 1999, 2002 The NetBSD Foundation, Inc.
|
||||
@ -38,11 +38,9 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef __lint
|
||||
__COPYRIGHT("@(#) Copyright (c) 2002\n\
|
||||
The NetBSD Foundation, inc. All rights reserved.\n");
|
||||
__RCSID("$NetBSD: humanize_number.c,v 1.9 2005/02/09 21:35:46 kleink Exp $");
|
||||
#endif /* !__lint */
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: humanize_number.c,v 1.10 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include "namespace.h"
|
||||
#include <assert.h>
|
||||
|
@ -1,9 +1,318 @@
|
||||
/* $NetBSD: opendir.c,v 1.27 2005/08/19 02:04:54 christos Exp $ */
|
||||
/* $NetBSD: opendir.c,v 1.28 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)opendir.c 8.7 (Berkeley) 12/10/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: opendir.c,v 1.28 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include "namespace.h"
|
||||
#include "reentrant.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/stat.h>
|
||||
#include <signal.h>
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
#include <assert.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "__opendir30.c"
|
||||
/*
|
||||
* Open a directory.
|
||||
*/
|
||||
DIR *
|
||||
opendir(name)
|
||||
const char *name;
|
||||
{
|
||||
|
||||
_DIAGASSERT(name != NULL);
|
||||
|
||||
return (__opendir2(name, DTF_HIDEW|DTF_NODUP));
|
||||
}
|
||||
|
||||
DIR *
|
||||
__opendir2(name, flags)
|
||||
const char *name;
|
||||
int flags;
|
||||
{
|
||||
DIR *dirp = NULL;
|
||||
int fd;
|
||||
int serrno;
|
||||
struct stat sb;
|
||||
int pagesz;
|
||||
int incr;
|
||||
int unionstack, nfsdir;
|
||||
struct statvfs sfb;
|
||||
|
||||
_DIAGASSERT(name != NULL);
|
||||
|
||||
if ((fd = open(name, O_RDONLY | O_NONBLOCK)) == -1 ||
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
|
||||
goto error;
|
||||
if (fstat(fd, &sb) || !S_ISDIR(sb.st_mode)) {
|
||||
errno = ENOTDIR;
|
||||
goto error;
|
||||
}
|
||||
if ((dirp = (DIR *)malloc(sizeof(DIR))) == NULL)
|
||||
goto error;
|
||||
dirp->dd_buf = NULL;
|
||||
|
||||
/*
|
||||
* If the machine's page size is an exact multiple of DIRBLKSIZ,
|
||||
* use a buffer that is cluster boundary aligned.
|
||||
* Hopefully this can be a big win someday by allowing page trades
|
||||
* to user space to be done by getdirentries()
|
||||
*/
|
||||
if (((pagesz = getpagesize()) % DIRBLKSIZ) == 0)
|
||||
incr = pagesz;
|
||||
else
|
||||
incr = DIRBLKSIZ;
|
||||
|
||||
/*
|
||||
* Determine whether this directory is the top of a union stack.
|
||||
*/
|
||||
|
||||
if (fstatvfs1(fd, &sfb, ST_NOWAIT) < 0)
|
||||
goto error;
|
||||
|
||||
if (flags & DTF_NODUP)
|
||||
unionstack = !(strncmp(sfb.f_fstypename, MOUNT_UNION,
|
||||
MFSNAMELEN)) || (sfb.f_flag & MNT_UNION);
|
||||
else
|
||||
unionstack = 0;
|
||||
|
||||
nfsdir = !(strncmp(sfb.f_fstypename, MOUNT_NFS, MFSNAMELEN));
|
||||
|
||||
if (unionstack || nfsdir) {
|
||||
size_t len;
|
||||
size_t space;
|
||||
char *buf, *nbuf;
|
||||
char *ddptr;
|
||||
char *ddeptr;
|
||||
int n;
|
||||
struct dirent **dpv;
|
||||
|
||||
/*
|
||||
* The strategy here for directories on top of a union stack
|
||||
* is to read all the directory entries into a buffer, sort
|
||||
* the buffer, and remove duplicate entries by setting the
|
||||
* inode number to zero.
|
||||
*
|
||||
* For directories on an NFS mounted filesystem, we try
|
||||
* to get a consistent snapshot by trying until we have
|
||||
* successfully read all of the directory without errors
|
||||
* (i.e. 'bad cookie' errors from the server because
|
||||
* the directory was modified). These errors should not
|
||||
* happen often, but need to be dealt with.
|
||||
*/
|
||||
retry:
|
||||
len = 0;
|
||||
space = 0;
|
||||
buf = 0;
|
||||
ddptr = 0;
|
||||
|
||||
do {
|
||||
/*
|
||||
* Always make at least DIRBLKSIZ bytes
|
||||
* available to getdirentries
|
||||
*/
|
||||
if (space < DIRBLKSIZ) {
|
||||
space += incr;
|
||||
len += incr;
|
||||
nbuf = realloc(buf, len);
|
||||
if (nbuf == NULL) {
|
||||
dirp->dd_buf = buf;
|
||||
goto error;
|
||||
}
|
||||
buf = nbuf;
|
||||
ddptr = buf + (len - space);
|
||||
}
|
||||
|
||||
dirp->dd_seek = lseek(fd, (off_t)0, SEEK_CUR);
|
||||
n = getdents(fd, ddptr, space);
|
||||
/*
|
||||
* For NFS: EINVAL means a bad cookie error
|
||||
* from the server. Keep trying to get a
|
||||
* consistent view, in this case this means
|
||||
* starting all over again.
|
||||
*/
|
||||
if (n == -1 && errno == EINVAL && nfsdir) {
|
||||
free(buf);
|
||||
lseek(fd, (off_t)0, SEEK_SET);
|
||||
goto retry;
|
||||
}
|
||||
if (n > 0) {
|
||||
ddptr += n;
|
||||
space -= n;
|
||||
}
|
||||
} while (n > 0);
|
||||
|
||||
ddeptr = ddptr;
|
||||
flags |= __DTF_READALL;
|
||||
|
||||
/*
|
||||
* Re-open the directory.
|
||||
* This has the effect of rewinding back to the
|
||||
* top of the union stack and is needed by
|
||||
* programs which plan to fchdir to a descriptor
|
||||
* which has also been read -- see fts.c.
|
||||
*/
|
||||
if (flags & DTF_REWIND) {
|
||||
(void) close(fd);
|
||||
if ((fd = open(name, O_RDONLY)) == -1 ||
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) {
|
||||
dirp->dd_buf = buf;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* There is now a buffer full of (possibly) duplicate
|
||||
* names.
|
||||
*/
|
||||
dirp->dd_buf = buf;
|
||||
|
||||
/*
|
||||
* Go round this loop twice...
|
||||
*
|
||||
* Scan through the buffer, counting entries.
|
||||
* On the second pass, save pointers to each one.
|
||||
* Then sort the pointers and remove duplicate names.
|
||||
*/
|
||||
if (!nfsdir) {
|
||||
for (dpv = 0;;) {
|
||||
for (n = 0, ddptr = buf; ddptr < ddeptr;) {
|
||||
struct dirent *dp;
|
||||
|
||||
dp = (struct dirent *)(void *)ddptr;
|
||||
if ((long)dp & _DIRENT_ALIGN(dp))
|
||||
break;
|
||||
/*
|
||||
* d_reclen is unsigned,
|
||||
* so no need to compare <= 0
|
||||
*/
|
||||
if (dp->d_reclen > (ddeptr + 1 - ddptr))
|
||||
break;
|
||||
ddptr += dp->d_reclen;
|
||||
if (dp->d_fileno) {
|
||||
if (dpv)
|
||||
dpv[n] = dp;
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
||||
if (dpv) {
|
||||
struct dirent *xp;
|
||||
|
||||
/*
|
||||
* This sort must be stable.
|
||||
*/
|
||||
mergesort(dpv, (size_t)n, sizeof(*dpv),
|
||||
alphasort);
|
||||
|
||||
dpv[n] = NULL;
|
||||
xp = NULL;
|
||||
|
||||
/*
|
||||
* Scan through the buffer in sort
|
||||
* order, zapping the inode number
|
||||
* of any duplicate names.
|
||||
*/
|
||||
for (n = 0; dpv[n]; n++) {
|
||||
struct dirent *dp = dpv[n];
|
||||
|
||||
if ((xp == NULL) ||
|
||||
strcmp(dp->d_name,
|
||||
xp->d_name))
|
||||
xp = dp;
|
||||
else
|
||||
dp->d_fileno = 0;
|
||||
if (dp->d_type == DT_WHT &&
|
||||
(flags & DTF_HIDEW))
|
||||
dp->d_fileno = 0;
|
||||
}
|
||||
|
||||
free(dpv);
|
||||
break;
|
||||
} else {
|
||||
dpv = malloc((n + 1) *
|
||||
sizeof(struct dirent *));
|
||||
if (dpv == NULL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dirp->dd_len = len;
|
||||
dirp->dd_size = ddptr - dirp->dd_buf;
|
||||
} else {
|
||||
dirp->dd_len = incr;
|
||||
dirp->dd_buf = malloc((size_t)dirp->dd_len);
|
||||
if (dirp->dd_buf == NULL)
|
||||
goto error;
|
||||
dirp->dd_seek = 0;
|
||||
flags &= ~DTF_REWIND;
|
||||
}
|
||||
|
||||
dirp->dd_loc = 0;
|
||||
dirp->dd_fd = fd;
|
||||
dirp->dd_flags = flags;
|
||||
|
||||
/*
|
||||
* Set up seek point for rewinddir.
|
||||
*/
|
||||
#ifdef _REENTRANT
|
||||
if (__isthreaded) {
|
||||
if ((dirp->dd_lock = malloc(sizeof(mutex_t))) == NULL)
|
||||
goto error;
|
||||
mutex_init((mutex_t *)dirp->dd_lock, NULL);
|
||||
}
|
||||
#endif
|
||||
dirp->dd_rewind = telldir(dirp);
|
||||
return (dirp);
|
||||
error:
|
||||
serrno = errno;
|
||||
if (dirp && dirp->dd_buf)
|
||||
free(dirp->dd_buf);
|
||||
if (dirp)
|
||||
free(dirp);
|
||||
if (fd != -1)
|
||||
(void)close(fd);
|
||||
errno = serrno;
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pthread_atfork.c,v 1.4 2005/06/01 05:30:54 lukem Exp $ */
|
||||
/* $NetBSD: pthread_atfork.c,v 1.5 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
@ -38,11 +38,9 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: pthread_atfork.c,v 1.4 2005/06/01 05:30:54 lukem Exp $");
|
||||
__RCSID("$NetBSD: pthread_atfork.c,v 1.5 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
|
||||
#include "namespace.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
@ -1,5 +1,141 @@
|
||||
/* $NetBSD: readdir.c,v 1.19 2005/08/19 02:04:54 christos Exp $ */
|
||||
/* $NetBSD: readdir.c,v 1.20 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
#define __LIBC12_SOURCE__
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "__readdir30.c"
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)readdir.c 8.3 (Berkeley) 9/29/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: readdir.c,v 1.20 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include "namespace.h"
|
||||
#include "reentrant.h"
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/*
|
||||
* get next entry in a directory.
|
||||
*/
|
||||
static struct dirent *
|
||||
_readdir_unlocked(DIR *dirp)
|
||||
{
|
||||
struct dirent *dp;
|
||||
|
||||
|
||||
for (;;) {
|
||||
if (dirp->dd_loc >= dirp->dd_size) {
|
||||
if (dirp->dd_flags & __DTF_READALL)
|
||||
return (NULL);
|
||||
dirp->dd_loc = 0;
|
||||
}
|
||||
if (dirp->dd_loc == 0 && !(dirp->dd_flags & __DTF_READALL)) {
|
||||
dirp->dd_seek = lseek(dirp->dd_fd, (off_t)0, SEEK_CUR);
|
||||
dirp->dd_size = getdents(dirp->dd_fd,
|
||||
dirp->dd_buf, (size_t)dirp->dd_len);
|
||||
if (dirp->dd_size <= 0)
|
||||
return (NULL);
|
||||
}
|
||||
dp = (struct dirent *)
|
||||
(void *)(dirp->dd_buf + (size_t)dirp->dd_loc);
|
||||
if ((intptr_t)dp & _DIRENT_ALIGN(dp))/* bogus pointer check */
|
||||
return (NULL);
|
||||
/* d_reclen is unsigned; no need to compare it <= 0 */
|
||||
if (dp->d_reclen > dirp->dd_len + 1 - dirp->dd_loc)
|
||||
return (NULL);
|
||||
dirp->dd_loc += dp->d_reclen;
|
||||
if (dp->d_ino == 0)
|
||||
continue;
|
||||
if (dp->d_type == DT_WHT && (dirp->dd_flags & DTF_HIDEW))
|
||||
continue;
|
||||
return (dp);
|
||||
}
|
||||
}
|
||||
|
||||
struct dirent *
|
||||
readdir(dirp)
|
||||
DIR *dirp;
|
||||
{
|
||||
struct dirent *dp;
|
||||
|
||||
#ifdef _REENTRANT
|
||||
if (__isthreaded) {
|
||||
mutex_lock((mutex_t *)dirp->dd_lock);
|
||||
dp = _readdir_unlocked(dirp);
|
||||
mutex_unlock((mutex_t *)dirp->dd_lock);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
dp = _readdir_unlocked(dirp);
|
||||
return (dp);
|
||||
}
|
||||
|
||||
int
|
||||
readdir_r(dirp, entry, result)
|
||||
DIR *dirp;
|
||||
struct dirent *entry;
|
||||
struct dirent **result;
|
||||
{
|
||||
struct dirent *dp;
|
||||
int saved_errno;
|
||||
|
||||
saved_errno = errno;
|
||||
errno = 0;
|
||||
#ifdef _REENTRANT
|
||||
if (__isthreaded) {
|
||||
mutex_lock((mutex_t *)dirp->dd_lock);
|
||||
if ((dp = _readdir_unlocked(dirp)) != NULL)
|
||||
memcpy(entry, dp, (size_t)_DIRENT_SIZE(dp));
|
||||
mutex_unlock((mutex_t *)dirp->dd_lock);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if ((dp = _readdir_unlocked(dirp)) != NULL)
|
||||
memcpy(entry, dp, (size_t)_DIRENT_SIZE(dp));
|
||||
|
||||
if (errno != 0) {
|
||||
if (dp == NULL)
|
||||
return (errno);
|
||||
} else
|
||||
errno = saved_errno;
|
||||
|
||||
if (dp != NULL)
|
||||
*result = entry;
|
||||
else
|
||||
*result = NULL;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -1,6 +1,133 @@
|
||||
/* $NetBSD: scandir.c,v 1.24 2005/08/19 02:04:54 christos Exp $ */
|
||||
/* $NetBSD: scandir.c,v 1.25 2005/09/13 01:44:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)scandir.c 8.3 (Berkeley) 1/2/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: scandir.c,v 1.25 2005/09/13 01:44:09 christos Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
/*
|
||||
* Scan the directory dirname calling selectfn to make a list of selected
|
||||
* directory entries then sort using qsort and compare routine dcomp.
|
||||
* Returns the number of entries and a pointer to a list of pointers to
|
||||
* struct dirent (through namelist). Returns -1 if there were any errors.
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#define __LIBC12_SOURCE__
|
||||
|
||||
#include "__scandir30.c"
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <dirent.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
scandir(dirname, namelist, selectfn, dcomp)
|
||||
const char *dirname;
|
||||
struct dirent ***namelist;
|
||||
int (*selectfn) __P((const struct dirent *));
|
||||
int (*dcomp) __P((const void *, const void *));
|
||||
{
|
||||
struct dirent *d, *p, **names, **newnames;
|
||||
size_t nitems, arraysz;
|
||||
struct stat stb;
|
||||
DIR *dirp;
|
||||
|
||||
_DIAGASSERT(dirname != NULL);
|
||||
_DIAGASSERT(namelist != NULL);
|
||||
|
||||
if ((dirp = opendir(dirname)) == NULL)
|
||||
return (-1);
|
||||
if (fstat(dirp->dd_fd, &stb) < 0)
|
||||
goto bad;
|
||||
|
||||
/*
|
||||
* estimate the array size by taking the size of the directory file
|
||||
* and dividing it by a multiple of the minimum size entry.
|
||||
*/
|
||||
arraysz = (size_t)(stb.st_size / 24);
|
||||
names = malloc(arraysz * sizeof(struct dirent *));
|
||||
if (names == NULL)
|
||||
goto bad;
|
||||
|
||||
nitems = 0;
|
||||
while ((d = readdir(dirp)) != NULL) {
|
||||
if (selectfn != NULL && !(*selectfn)(d))
|
||||
continue; /* just selected names */
|
||||
|
||||
/*
|
||||
* Check to make sure the array has space left and
|
||||
* realloc the maximum size.
|
||||
*/
|
||||
if (nitems >= arraysz) {
|
||||
if (fstat(dirp->dd_fd, &stb) < 0)
|
||||
goto bad2; /* just might have grown */
|
||||
arraysz = (size_t)(stb.st_size / 12);
|
||||
newnames = realloc(names,
|
||||
arraysz * sizeof(struct dirent *));
|
||||
if (newnames == NULL)
|
||||
goto bad2;
|
||||
names = newnames;
|
||||
}
|
||||
|
||||
/*
|
||||
* Make a minimum size copy of the data
|
||||
*/
|
||||
p = (struct dirent *)malloc((size_t)_DIRENT_SIZE(d));
|
||||
if (p == NULL)
|
||||
goto bad2;
|
||||
p->d_fileno = d->d_fileno;
|
||||
p->d_reclen = d->d_reclen;
|
||||
p->d_type = d->d_type;
|
||||
p->d_namlen = d->d_namlen;
|
||||
memmove(p->d_name, d->d_name, (size_t)(p->d_namlen + 1));
|
||||
names[nitems++] = p;
|
||||
}
|
||||
closedir(dirp);
|
||||
if (nitems && dcomp != NULL)
|
||||
qsort(names, nitems, sizeof(struct dirent *), dcomp);
|
||||
*namelist = names;
|
||||
return (nitems);
|
||||
|
||||
bad2:
|
||||
while (nitems-- > 0)
|
||||
free(names[nitems]);
|
||||
free(names);
|
||||
bad:
|
||||
closedir(dirp);
|
||||
return (-1);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user