summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorcvs2svn <cvs2svn@FreeBSD.org>2000-03-13 04:59:44 +0000
committercvs2svn <cvs2svn@FreeBSD.org>2000-03-13 04:59:44 +0000
commit842f30848780866cb822fe01c4d3d4576718ddb3 (patch)
tree212d1aae25966b1cb7769409e1ae97e626a32b95 /lib/libc
parentdd3552c8a7b2b6823668c2834f667466844698de (diff)
Notes
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/amd64/SYS.h98
-rw-r--r--lib/libc/amd64/gen/Makefile.inc5
-rw-r--r--lib/libc/amd64/gen/_setjmp.S89
-rw-r--r--lib/libc/amd64/gen/frexp.c67
-rw-r--r--lib/libc/amd64/gen/infinity.c9
-rw-r--r--lib/libc/amd64/gen/isinf.c68
-rw-r--r--lib/libc/amd64/gen/ldexp.c74
-rw-r--r--lib/libc/amd64/gen/setjmp.S116
-rw-r--r--lib/libc/amd64/gen/sigsetjmp.S127
-rw-r--r--lib/libc/amd64/net/Makefile.inc4
-rw-r--r--lib/libc/amd64/net/htonl.S53
-rw-r--r--lib/libc/amd64/net/htons.S51
-rw-r--r--lib/libc/amd64/net/ntohl.S53
-rw-r--r--lib/libc/amd64/net/ntohs.S51
-rw-r--r--lib/libc/amd64/sys/Makefile.inc28
-rw-r--r--lib/libc/amd64/sys/brk.S91
-rw-r--r--lib/libc/amd64/sys/cerror.S70
-rw-r--r--lib/libc/amd64/sys/exect.S56
-rw-r--r--lib/libc/amd64/sys/pipe.S51
-rw-r--r--lib/libc/amd64/sys/ptrace.S62
-rw-r--r--lib/libc/amd64/sys/reboot.S47
-rw-r--r--lib/libc/amd64/sys/sbrk.S95
-rw-r--r--lib/libc/amd64/sys/setlogin.S59
-rw-r--r--lib/libc/amd64/sys/sigreturn.S52
-rw-r--r--lib/libc/amd64/sys/vfork.S72
-rw-r--r--lib/libc/gen/__xuname.c125
-rw-r--r--lib/libc/gen/fts-compat.c1114
-rw-r--r--lib/libc/gen/fts-compat.h128
-rw-r--r--lib/libc/gen/pw_scan.c174
-rw-r--r--lib/libc/gen/pw_scan.h40
-rw-r--r--lib/libc/gen/sem_destroy.383
-rw-r--r--lib/libc/gen/sem_getvalue.377
-rw-r--r--lib/libc/gen/sem_init.3100
-rw-r--r--lib/libc/gen/sem_open.380
-rw-r--r--lib/libc/gen/sem_post.371
-rw-r--r--lib/libc/gen/sem_wait.392
-rw-r--r--lib/libc/gen/setflagsbyname.378
-rw-r--r--lib/libc/gen/setflagsbyname.c154
-rw-r--r--lib/libc/gen/setproctitle.3101
-rw-r--r--lib/libc/gen/setproctitle.c162
-rw-r--r--lib/libc/gen/strtofflags.378
-rw-r--r--lib/libc/gen/strtofflags.c154
-rw-r--r--lib/libc/locale/euc.5242
-rw-r--r--lib/libc/locale/utf2.588
-rw-r--r--lib/libc/posix1e/Makefile38
-rw-r--r--lib/libc/posix1e/acl.3180
-rw-r--r--lib/libc/posix1e/acl_delete.3124
-rw-r--r--lib/libc/posix1e/acl_delete.c57
-rw-r--r--lib/libc/posix1e/acl_dup.3105
-rw-r--r--lib/libc/posix1e/acl_free.389
-rw-r--r--lib/libc/posix1e/acl_free.c43
-rw-r--r--lib/libc/posix1e/acl_from_text.3125
-rw-r--r--lib/libc/posix1e/acl_from_text.c246
-rw-r--r--lib/libc/posix1e/acl_get.3138
-rw-r--r--lib/libc/posix1e/acl_get.c97
-rw-r--r--lib/libc/posix1e/acl_init.3104
-rw-r--r--lib/libc/posix1e/acl_init.c67
-rw-r--r--lib/libc/posix1e/acl_set.3131
-rw-r--r--lib/libc/posix1e/acl_set.c88
-rw-r--r--lib/libc/posix1e/acl_support.c409
-rw-r--r--lib/libc/posix1e/acl_support.h46
-rw-r--r--lib/libc/posix1e/acl_to_text.3130
-rw-r--r--lib/libc/posix1e/acl_to_text.c233
-rw-r--r--lib/libc/posix1e/acl_valid.3144
-rw-r--r--lib/libc/posix1e/acl_valid.c97
-rw-r--r--lib/libc/posix1e/posix1e.3101
-rw-r--r--lib/libc/stdlib/strtoll.c138
-rw-r--r--lib/libc/stdlib/strtoull.c116
68 files changed, 0 insertions, 7735 deletions
diff --git a/lib/libc/amd64/SYS.h b/lib/libc/amd64/SYS.h
deleted file mode 100644
index 155672f6bb82..000000000000
--- a/lib/libc/amd64/SYS.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*-
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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: @(#)SYS.h 5.5 (Berkeley) 5/7/91
- *
- * $FreeBSD$
- */
-
-#include <sys/syscall.h>
-#include "DEFS.h"
-
-#define SYSCALL(x) 2: PIC_PROLOGUE; jmp PIC_PLT(HIDENAME(cerror)); \
- ENTRY(__CONCAT(_,x)); \
- .weak CNAME(x); \
- .set CNAME(x),CNAME(__CONCAT(_,x)); \
- lea __CONCAT(SYS_,x),%eax; KERNCALL; jb 2b
-
-#define RSYSCALL(x) SYSCALL(x); ret
-
-#define PSEUDO(x,y) ENTRY(__CONCAT(_,x)); \
- .weak CNAME(x); \
- .set CNAME(x),CNAME(__CONCAT(_,x)); \
- lea __CONCAT(SYS_,y), %eax; KERNCALL; ret
-
-/* gas messes up offset -- although we don't currently need it, do for BCS */
-#define LCALL(x,y) .byte 0x9a ; .long y; .word x
-
-/*
- * Design note:
- *
- * The macros PSYSCALL() and PRSYSCALL() are intended for use where a
- * syscall needs to be renamed in the threaded library. When building
- * a normal library, they default to the traditional SYSCALL() and
- * RSYSCALL(). This avoids the need to #ifdef _THREAD_SAFE everywhere
- * that the renamed function needs to be called.
- */
-#ifdef _THREAD_SAFE
-/*
- * For the thread_safe versions, we prepend _thread_sys_ to the function
- * name so that the 'C' wrapper can go around the real name.
- */
-#define PSYSCALL(x) 2: PIC_PROLOGUE; jmp PIC_PLT(HIDENAME(cerror)); \
- ENTRY(__CONCAT(_thread_sys_,x)); \
- .weak CNAME(__CONCAT(_,x)); \
- .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(_thread_sys_,x));\
- .weak CNAME(x); \
- .set CNAME(x),CNAME(__CONCAT(_,x)); \
- lea __CONCAT(SYS_,x),%eax; KERNCALL; jb 2b
-#define PRSYSCALL(x) PSYSCALL(x); ret
-#define PPSEUDO(x,y) ENTRY(__CONCAT(_thread_sys_,x)); \
- lea __CONCAT(SYS_,y), %eax; KERNCALL; ret
-#else
-/*
- * The non-threaded library defaults to traditional syscalls where
- * the function name matches the syscall name.
- */
-#define PSYSCALL(x) SYSCALL(x)
-#define PRSYSCALL(x) RSYSCALL(x)
-#define PPSEUDO(x,y) PSEUDO(x,y)
-#endif
-
-#ifdef __ELF__
-#define KERNCALL int $0x80 /* Faster */
-#else
-#define KERNCALL LCALL(7,0) /* The old way */
-#endif
diff --git a/lib/libc/amd64/gen/Makefile.inc b/lib/libc/amd64/gen/Makefile.inc
deleted file mode 100644
index f2506fdc6ae4..000000000000
--- a/lib/libc/amd64/gen/Makefile.inc
+++ /dev/null
@@ -1,5 +0,0 @@
-# @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
-# $FreeBSD$
-
-SRCS+= _setjmp.S alloca.S fabs.S frexp.c infinity.c isinf.c ldexp.c modf.S \
- setjmp.S sigsetjmp.S
diff --git a/lib/libc/amd64/gen/_setjmp.S b/lib/libc/amd64/gen/_setjmp.S
deleted file mode 100644
index 9c66308dc502..000000000000
--- a/lib/libc/amd64/gen/_setjmp.S
+++ /dev/null
@@ -1,89 +0,0 @@
-/*-
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-#if defined(LIBC_RCS) && !defined(lint)
- .text
- .asciz "$FreeBSD$"
-#endif /* LIBC_RCS and not lint */
-
-/*
- * C library -- _setjmp, _longjmp
- *
- * _longjmp(a,v)
- * will generate a "return(v)" from the last call to
- * _setjmp(a)
- * by restoring registers from the environment 'a'.
- * The previous signal state is NOT restored.
- */
-
-#include "DEFS.h"
-
-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)
- fnstcw 24(%eax)
- xorl %eax,%eax
- ret
-
-#ifdef _THREAD_SAFE
-ENTRY(___longjmp)
-#else
-ALTENTRY(___longjmp)
-ENTRY(_longjmp)
-#endif
- 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
- fninit
- fldcw 24(%edx)
- testl %eax,%eax
- jnz 1f
- incl %eax
-1: movl %ecx,0(%esp)
- ret
diff --git a/lib/libc/amd64/gen/frexp.c b/lib/libc/amd64/gen/frexp.c
deleted file mode 100644
index 4834f1788095..000000000000
--- a/lib/libc/amd64/gen/frexp.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*-
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-#if defined(LIBC_RCS) && !defined(lint)
-static const char rcsid[] = "$FreeBSD$";
-#endif /* LIBC_RCS and not lint */
-
-#include <sys/types.h>
-#include <math.h>
-
-double
-frexp(value, eptr)
- double value;
- int *eptr;
-{
- union {
- double v;
- struct {
- u_int u_mant2 : 32;
- u_int u_mant1 : 20;
- u_int u_exp : 11;
- u_int u_sign : 1;
- } s;
- } u;
-
- if (value) {
- u.v = value;
- *eptr = u.s.u_exp - 1022;
- u.s.u_exp = 1022;
- return(u.v);
- } else {
- *eptr = 0;
- return((double)0);
- }
-}
diff --git a/lib/libc/amd64/gen/infinity.c b/lib/libc/amd64/gen/infinity.c
deleted file mode 100644
index ac92d46e7ea9..000000000000
--- a/lib/libc/amd64/gen/infinity.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
- * infinity.c
- * $FreeBSD$
- */
-
-#include <math.h>
-
-/* bytes for +Infinity on a 387 */
-char __infinity[] = { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f };
diff --git a/lib/libc/amd64/gen/isinf.c b/lib/libc/amd64/gen/isinf.c
deleted file mode 100644
index b2b63a8f7274..000000000000
--- a/lib/libc/amd64/gen/isinf.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*-
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-#if defined(LIBC_RCS) && !defined(lint)
-static const char rcsid[] = "$FreeBSD$";
-#endif /* LIBC_RCS and not lint */
-
-#include <sys/types.h>
-
-int
-isnan(d)
- double d;
-{
- register struct IEEEdp {
- u_int manl : 32;
- u_int manh : 20;
- u_int exp : 11;
- u_int sign : 1;
- } *p = (struct IEEEdp *)&d;
-
- return(p->exp == 2047 && (p->manh || p->manl));
-}
-
-int
-isinf(d)
- double d;
-{
- register struct IEEEdp {
- u_int manl : 32;
- u_int manh : 20;
- u_int exp : 11;
- u_int sign : 1;
- } *p = (struct IEEEdp *)&d;
-
- return(p->exp == 2047 && !p->manh && !p->manl);
-}
diff --git a/lib/libc/amd64/gen/ldexp.c b/lib/libc/amd64/gen/ldexp.c
deleted file mode 100644
index e7e58f05b2e0..000000000000
--- a/lib/libc/amd64/gen/ldexp.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Sean Eric Fagan.
- *
- * 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 University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-#if defined(LIBC_RCS) && !defined(lint)
-static const char rcsid[] = "$FreeBSD$";
-#endif /* LIBC_RCS and not lint */
-
-/*
- * ldexp(value, exp): return value * (2 ** exp).
- *
- * Written by Sean Eric Fagan (sef@kithrup.COM)
- * Sun Mar 11 20:27:09 PST 1990
- */
-
-/*
- * We do the conversion in C to let gcc optimize it away, if possible.
- * The "fxch ; fstp" stuff is because value is still on the stack
- * (stupid 8087!).
- */
-double
-ldexp (double value, int exp)
-{
- double temp, texp, temp2;
- texp = exp;
-#ifdef __GNUC__
-#if __GNUC__ >= 2
- asm ("fscale "
- : "=u" (temp2), "=t" (temp)
- : "0" (texp), "1" (value));
-#else
- asm ("fscale ; fxch %%st(1) ; fstp%L1 %1 "
- : "=f" (temp), "=0" (temp2)
- : "0" (texp), "f" (value));
-#endif
-#else
-error unknown asm
-#endif
- return (temp);
-}
diff --git a/lib/libc/amd64/gen/setjmp.S b/lib/libc/amd64/gen/setjmp.S
deleted file mode 100644
index 39e9c2165ec1..000000000000
--- a/lib/libc/amd64/gen/setjmp.S
+++ /dev/null
@@ -1,116 +0,0 @@
-/*-
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-#if defined(LIBC_RCS) && !defined(lint)
- .text
- .asciz "$FreeBSD$"
-#endif /* LIBC_RCS and not lint */
-
-/*
- * C library -- _setjmp, _longjmp
- *
- * longjmp(a,v)
- * will generate a "return(v)" from the last call to
- * setjmp(a)
- * by restoring registers from the environment 'a'.
- * The previous signal state is restored.
- */
-
-#include "DEFS.h"
-#include "SYS.h"
-
-ENTRY(setjmp)
- movl 4(%esp),%ecx
- PIC_PROLOGUE
- leal 28(%ecx), %eax
- pushl %eax /* (sigset_t*)oset */
- pushl $0 /* (sigset_t*)set */
- pushl $1 /* SIG_BLOCK */
-#ifdef _THREAD_SAFE
- call PIC_PLT(CNAME(_thread_sys_sigprocmask))
-#else
- call PIC_PLT(CNAME(sigprocmask))
-#endif
- addl $12,%esp
- PIC_EPILOGUE
- movl 4(%esp),%ecx
- 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)
- fnstcw 24(%ecx)
- xorl %eax,%eax
- ret
-
-#ifdef _THREAD_SAFE
-ENTRY(__longjmp)
-#else
-ALTENTRY(__longjmp)
-ENTRY(longjmp)
-#endif
- movl 4(%esp),%edx
- PIC_PROLOGUE
- pushl $0 /* (sigset_t*)oset */
- leal 28(%edx), %eax
- pushl %eax /* (sigset_t*)set */
- pushl $3 /* SIG_SETMASK */
-#ifdef _THREAD_SAFE
- call PIC_PLT(CNAME(_thread_sys_sigprocmask))
-#else
- call PIC_PLT(CNAME(sigprocmask))
-#endif
- addl $12,%esp
- PIC_EPILOGUE
- 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
- fninit
- fldcw 24(%edx)
- testl %eax,%eax
- jnz 1f
- incl %eax
-1: movl %ecx,0(%esp)
- ret
diff --git a/lib/libc/amd64/gen/sigsetjmp.S b/lib/libc/amd64/gen/sigsetjmp.S
deleted file mode 100644
index 13c0dc7246c1..000000000000
--- a/lib/libc/amd64/gen/sigsetjmp.S
+++ /dev/null
@@ -1,127 +0,0 @@
-/*-
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-#if defined(LIBC_RCS) && !defined(lint)
- .text
- .asciz "$FreeBSD$"
-#endif /* LIBC_RCS and not lint */
-
-#include "DEFS.h"
-#include "SYS.h"
-
-/*-
- * TODO:
- * Rename sigsetjmp to __sigsetjmp and siglongjmp to __siglongjmp,
- * remove the other *jmp functions and define everything in terms
- * of the renamed functions. This requires compiler support for
- * the renamed functions (introduced in gcc-2.5.3; previous versions
- * only supported *jmp with 0 or 1 leading underscores).
- *
- * Use sigprocmask() instead of sigblock() and sigsetmask(), and
- * check for and handle errors.
- *
- * Restore _all_ the registers and the signal mask atomically. Can
- * use sigreturn() if sigreturn() works.
- */
-
-ENTRY(sigsetjmp)
- movl 8(%esp),%eax
- movl 4(%esp),%ecx
- movl %eax,44(%ecx)
- testl %eax,%eax
- jz 2f
- PIC_PROLOGUE
- leal 28(%ecx), %eax
- pushl %eax /* (sigset_t*)oset */
- pushl $0 /* (sigset_t*)set */
- pushl $1 /* SIG_BLOCK */
-#ifdef _THREAD_SAFE
- call PIC_PLT(CNAME(_thread_sys_sigprocmask))
-#else
- call PIC_PLT(CNAME(sigprocmask))
-#endif
- addl $12,%esp
- PIC_EPILOGUE
- movl 4(%esp),%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)
- fnstcw 24(%ecx)
- xorl %eax,%eax
- ret
-
-#ifdef _THREAD_SAFE
-ENTRY(__siglongjmp)
-#else
-ALTENTRY(__siglongjmp)
-ENTRY(siglongjmp)
-#endif
- movl 4(%esp),%edx
- cmpl $0,44(%edx)
- jz 2f
- PIC_PROLOGUE
- pushl $0 /* (sigset_t*)oset */
- leal 28(%edx), %eax
- pushl %eax /* (sigset_t*)set */
- pushl $3 /* SIG_SETMASK */
-#ifdef _THREAD_SAFE
- call PIC_PLT(CNAME(_thread_sys_sigprocmask))
-#else
- call PIC_PLT(CNAME(sigprocmask))
-#endif
- addl $12,%esp
- PIC_EPILOGUE
- movl 4(%esp),%edx
-2: 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
- fninit
- fldcw 24(%edx)
- testl %eax,%eax
- jnz 1f
- incl %eax
-1: movl %ecx,0(%esp)
- ret
diff --git a/lib/libc/amd64/net/Makefile.inc b/lib/libc/amd64/net/Makefile.inc
deleted file mode 100644
index 96e559bf8027..000000000000
--- a/lib/libc/amd64/net/Makefile.inc
+++ /dev/null
@@ -1,4 +0,0 @@
-# @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
-# $FreeBSD$
-
-SRCS+= htonl.S htons.S ntohl.S ntohs.S
diff --git a/lib/libc/amd64/net/htonl.S b/lib/libc/amd64/net/htonl.S
deleted file mode 100644
index 48f1ca8adcf9..000000000000
--- a/lib/libc/amd64/net/htonl.S
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-#if defined(LIBC_RCS) && !defined(lint)
- .text
- .asciz "$FreeBSD$"
-#endif /* LIBC_RCS and not lint */
-
-/* netorder = htonl(hostorder) */
-
-#include "DEFS.h"
-
-ENTRY(htonl)
- movl 4(%esp),%eax
- xchgb %al,%ah
- roll $16,%eax
- xchgb %al,%ah
- ret
diff --git a/lib/libc/amd64/net/htons.S b/lib/libc/amd64/net/htons.S
deleted file mode 100644
index 68f2b5a0131e..000000000000
--- a/lib/libc/amd64/net/htons.S
+++ /dev/null
@@ -1,51 +0,0 @@
-/*-
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-#if defined(LIBC_RCS) && !defined(lint)
- .text
- .asciz "$FreeBSD$"
-#endif /* LIBC_RCS and not lint */
-
-/* netorder = htons(hostorder) */
-
-#include "DEFS.h"
-
-ENTRY(htons)
- movzwl 4(%esp),%eax
- xchgb %al,%ah
- ret
diff --git a/lib/libc/amd64/net/ntohl.S b/lib/libc/amd64/net/ntohl.S
deleted file mode 100644
index 7be9deebe26c..000000000000
--- a/lib/libc/amd64/net/ntohl.S
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-#if defined(LIBC_RCS) && !defined(lint)
- .text
- .asciz "$FreeBSD$"
-#endif /* LIBC_RCS and not lint */
-
-/* hostorder = ntohl(netorder) */
-
-#include "DEFS.h"
-
-ENTRY(ntohl)
- movl 4(%esp),%eax
- xchgb %al,%ah
- roll $16,%eax
- xchgb %al,%ah
- ret
diff --git a/lib/libc/amd64/net/ntohs.S b/lib/libc/amd64/net/ntohs.S
deleted file mode 100644
index 0f1d2280ce70..000000000000
--- a/lib/libc/amd64/net/ntohs.S
+++ /dev/null
@@ -1,51 +0,0 @@
-/*-
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-#if defined(LIBC_RCS) && !defined(lint)
- .text
- .asciz "$FreeBSD$"
-#endif /* LIBC_RCS and not lint */
-
-/* hostorder = ntohs(netorder) */
-
-#include "DEFS.h"
-
-ENTRY(ntohs)
- movzwl 4(%esp),%eax
- xchgb %al,%ah
- ret
diff --git a/lib/libc/amd64/sys/Makefile.inc b/lib/libc/amd64/sys/Makefile.inc
deleted file mode 100644
index c1c3d2d0e715..000000000000
--- a/lib/libc/amd64/sys/Makefile.inc
+++ /dev/null
@@ -1,28 +0,0 @@
-# from: Makefile.inc,v 1.1 1993/09/03 19:04:23 jtc Exp
-# $FreeBSD$
-
-SRCS+= i386_get_ioperm.c i386_get_ldt.c i386_set_ioperm.c i386_set_ldt.c \
- i386_vm86.c
-
-MDASM= Ovfork.S brk.S cerror.S exect.S fork.S pipe.S ptrace.S reboot.S \
- rfork.S sbrk.S setlogin.S sigreturn.S syscall.S
-
-# Don't generate default code for these syscalls:
-NOASM= __semctl.o break.o exit.o ftruncate.o getdomainname.o getlogin.o \
- lseek.o mlockall.o mmap.o msgctl.o msgget.o msgrcv.o msgsnd.o \
- munlockall.o openbsd_poll.o pread.o pwrite.o semconfig.o semget.o \
- semop.o setdomainname.o shmat.o shmctl.o shmdt.o shmget.o sstk.o \
- thr_sleep.o thr_wakeup.o truncate.o uname.o vfork.o yield.o
-
-PSEUDO= _getlogin.o
-
-# Pseudo syscalls that are renamed as _thread_sys_{pseudo} when
-# building libc_r.
-PSEUDOR= _exit.o
-
-.if ${LIB} == "c"
-MAN2+= i386_get_ioperm.2 i386_get_ldt.2 i386_vm86.2
-
-MLINKS+=i386_get_ioperm.2 i386_set_ioperm.2
-MLINKS+=i386_get_ldt.2 i386_set_ldt.2
-.endif
diff --git a/lib/libc/amd64/sys/brk.S b/lib/libc/amd64/sys/brk.S
deleted file mode 100644
index 57266750efd3..000000000000
--- a/lib/libc/amd64/sys/brk.S
+++ /dev/null
@@ -1,91 +0,0 @@
-/*-
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-#if defined(SYSLIBC_RCS) && !defined(lint)
- .text
- .asciz "$FreeBSD$"
-#endif /* SYSLIBC_RCS and not lint */
-
-#include "SYS.h"
-
- .globl HIDENAME(curbrk)
- .globl HIDENAME(minbrk)
-ENTRY(_brk)
- jmp ok
-
-ENTRY(brk)
-#ifdef PIC
- movl 4(%esp),%eax
- PIC_PROLOGUE
- movl PIC_GOT(HIDENAME(curbrk)),%edx # set up GOT addressing
- movl PIC_GOT(HIDENAME(minbrk)),%ecx #
- PIC_EPILOGUE
- cmpl %eax,(%ecx)
- jbe ok
- movl (%ecx),%eax
- movl %eax,4(%esp)
-ok:
- lea SYS_break,%eax
- KERNCALL
- jb err
- movl 4(%esp),%eax
- movl %eax,(%edx)
- movl $0,%eax
- ret
-err:
- PIC_PROLOGUE
- jmp PIC_PLT(HIDENAME(cerror))
-
-#else
-
- movl 4(%esp),%eax
- cmpl %eax,HIDENAME(minbrk)
- jbe ok
- movl HIDENAME(minbrk),%eax
- movl %eax,4(%esp)
-ok:
- lea SYS_break,%eax
- KERNCALL
- jb err
- movl 4(%esp),%eax
- movl %eax,HIDENAME(curbrk)
- movl $0,%eax
- ret
-err:
- jmp HIDENAME(cerror)
-#endif
diff --git a/lib/libc/amd64/sys/cerror.S b/lib/libc/amd64/sys/cerror.S
deleted file mode 100644
index 31c3622bd200..000000000000
--- a/lib/libc/amd64/sys/cerror.S
+++ /dev/null
@@ -1,70 +0,0 @@
-/*-
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-#if defined(SYSLIBC_RCS) && !defined(lint)
- .text
- .asciz "$FreeBSD$"
-#endif /* SYSLIBC_RCS and not lint */
-
-#include "SYS.h"
-
- .globl HIDENAME(cerror)
-
- /*
- * The __error() function is thread aware. For non-threaded
- * programs and the initial threaded in threaded programs,
- * it returns a pointer to the global errno variable.
- */
- .globl CNAME(__error)
- .type CNAME(__error),@function
-HIDENAME(cerror):
- pushl %eax
-#ifdef PIC
- /* The caller must execute the PIC prologue before jumping to cerror. */
- call PIC_PLT(CNAME(__error))
- popl %ecx
- PIC_EPILOGUE
-#else
- call CNAME(__error)
- popl %ecx
-#endif
- movl %ecx,(%eax)
- movl $-1,%eax
- movl $-1,%edx
- ret
-
diff --git a/lib/libc/amd64/sys/exect.S b/lib/libc/amd64/sys/exect.S
deleted file mode 100644
index 9f90060fe156..000000000000
--- a/lib/libc/amd64/sys/exect.S
+++ /dev/null
@@ -1,56 +0,0 @@
-/*-
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-#if defined(SYSLIBC_RCS) && !defined(lint)
- .text
- .asciz "$FreeBSD$"
-#endif /* SYSLIBC_RCS and not lint */
-
-#include "SYS.h"
-#include <machine/psl.h>
-
-ENTRY(exect)
- lea SYS_execve,%eax
- pushf
- popl %edx
- orl $ PSL_T,%edx
- pushl %edx
- popf
- KERNCALL
- PIC_PROLOGUE
- jmp PIC_PLT(HIDENAME(cerror)) /* exect(file, argv, env); */
diff --git a/lib/libc/amd64/sys/pipe.S b/lib/libc/amd64/sys/pipe.S
deleted file mode 100644
index 1684611f766f..000000000000
--- a/lib/libc/amd64/sys/pipe.S
+++ /dev/null
@@ -1,51 +0,0 @@
-/*-
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-#if defined(SYSLIBC_RCS) && !defined(lint)
- .text
- .asciz "$FreeBSD$"
-#endif /* SYSLIBC_RCS and not lint */
-
-#include "SYS.h"
-
-PSYSCALL(pipe)
- movl 4(%esp),%ecx
- movl %eax,(%ecx)
- movl %edx,4(%ecx)
- movl $0,%eax
- ret
diff --git a/lib/libc/amd64/sys/ptrace.S b/lib/libc/amd64/sys/ptrace.S
deleted file mode 100644
index 7f5e149d33e7..000000000000
--- a/lib/libc/amd64/sys/ptrace.S
+++ /dev/null
@@ -1,62 +0,0 @@
-/*-
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-#if defined(SYSLIBC_RCS) && !defined(lint)
- .text
- .asciz "$FreeBSD$"
-#endif /* SYSLIBC_RCS and not lint */
-
-#include "SYS.h"
-
-ENTRY(ptrace)
- xorl %eax,%eax
-#ifdef PIC
- PIC_PROLOGUE
- movl PIC_GOT(CNAME(errno)),%edx
- movl %eax,(%edx)
- PIC_EPILOGUE
-#else
- movl %eax,CNAME(errno)
-#endif
- lea SYS_ptrace,%eax
- KERNCALL
- jb err
- ret
-err:
- PIC_PROLOGUE
- jmp PIC_PLT(HIDENAME(cerror))
diff --git a/lib/libc/amd64/sys/reboot.S b/lib/libc/amd64/sys/reboot.S
deleted file mode 100644
index 4e39068fdff4..000000000000
--- a/lib/libc/amd64/sys/reboot.S
+++ /dev/null
@@ -1,47 +0,0 @@
-/*-
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-#if defined(SYSLIBC_RCS) && !defined(lint)
- .text
- .asciz "$FreeBSD$"
-#endif /* SYSLIBC_RCS and not lint */
-
-#include "SYS.h"
-
-SYSCALL(reboot)
- iret
diff --git a/lib/libc/amd64/sys/sbrk.S b/lib/libc/amd64/sys/sbrk.S
deleted file mode 100644
index f7aae351b00b..000000000000
--- a/lib/libc/amd64/sys/sbrk.S
+++ /dev/null
@@ -1,95 +0,0 @@
-/*-
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-#if defined(SYSLIBC_RCS) && !defined(lint)
- .text
- .asciz "$FreeBSD$"
-#endif /* SYSLIBC_RCS and not lint */
-
-#include "SYS.h"
-
- .globl CNAME(end)
- .globl HIDENAME(minbrk)
- .globl HIDENAME(curbrk)
-
- .data
-HIDENAME(minbrk): .long CNAME(end)
-HIDENAME(curbrk): .long CNAME(end)
- .text
-
-ENTRY(sbrk)
-#ifdef PIC
- movl 4(%esp),%ecx
- PIC_PROLOGUE
- movl PIC_GOT(HIDENAME(curbrk)),%edx
- movl (%edx),%eax
- PIC_EPILOGUE
- testl %ecx,%ecx
- jz back
- addl %eax,4(%esp)
- lea SYS_break,%eax
- KERNCALL
- jb err
- PIC_PROLOGUE
- movl PIC_GOT(HIDENAME(curbrk)),%edx
- movl (%edx),%eax
- addl %ecx,(%edx)
- PIC_EPILOGUE
-back:
- ret
-err:
- PIC_PROLOGUE
- jmp PIC_PLT(HIDENAME(cerror))
-
-#else /* !PIC */
-
- movl 4(%esp),%ecx
- movl HIDENAME(curbrk),%eax
- testl %ecx,%ecx
- jz back
- addl %eax,4(%esp)
- lea SYS_break,%eax
- KERNCALL
- jb err
- movl HIDENAME(curbrk),%eax
- addl %ecx,HIDENAME(curbrk)
-back:
- ret
-err:
- jmp HIDENAME(cerror)
-#endif /* PIC */
diff --git a/lib/libc/amd64/sys/setlogin.S b/lib/libc/amd64/sys/setlogin.S
deleted file mode 100644
index a4d74b0d10cf..000000000000
--- a/lib/libc/amd64/sys/setlogin.S
+++ /dev/null
@@ -1,59 +0,0 @@
-/*-
- * Copyright (c) 1991 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-#if defined(LIBC_RCS) && !defined(lint)
- .text
- .asciz "$FreeBSD$"
-#endif /* LIBC_RCS and not lint */
-
-#include "SYS.h"
-
-.globl CNAME(_logname_valid) /* in getlogin() */
-
-SYSCALL(setlogin)
-#ifdef PIC
- PIC_PROLOGUE
- pushl %eax
- movl PIC_GOT(CNAME(_logname_valid)),%eax
- movl $0,(%eax)
- popl %eax
- PIC_EPILOGUE
-#else
- movl $0,CNAME(_logname_valid)
-#endif
- ret /* setlogin(name) */
diff --git a/lib/libc/amd64/sys/sigreturn.S b/lib/libc/amd64/sys/sigreturn.S
deleted file mode 100644
index 7405c340030e..000000000000
--- a/lib/libc/amd64/sys/sigreturn.S
+++ /dev/null
@@ -1,52 +0,0 @@
-/*-
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-#if defined(SYSLIBC_RCS) && !defined(lint)
- .text
- .asciz "$FreeBSD$"
-#endif /* SYSLIBC_RCS and not lint */
-
-#include "SYS.h"
-
-/*
- * NOTE: If the profiling ENTRY() code ever changes any registers, they
- * must be saved. On FreeBSD, this is not the case.
- */
-
-PSYSCALL(sigreturn)
- ret
diff --git a/lib/libc/amd64/sys/vfork.S b/lib/libc/amd64/sys/vfork.S
deleted file mode 100644
index 30d7fd1932b7..000000000000
--- a/lib/libc/amd64/sys/vfork.S
+++ /dev/null
@@ -1,72 +0,0 @@
-/*-
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-#if defined(SYSLIBC_RCS) && !defined(lint)
- .text
- .asciz "$FreeBSD$"
-#endif /* SYSLIBC_RCS and not lint */
-
-#include "DEFS.h"
-#include "SYS.h"
-
-/*
- * pid = vfork();
- *
- * %edx == 0 in parent process, %edx == 1 in child process.
- * %eax == pid of child in parent, %eax == pid of parent in child.
- *
- */
-
-#ifdef _THREAD_SAFE
-ENTRY(_thread_sys_vfork)
-#else
-ENTRY(vfork)
-#endif
- popl %ecx /* my rta into ecx */
- lea SYS_vfork,%eax
- KERNCALL
- jb 2f
- cmpl $0,%edx /* parent process? */
- je 1f /* yes */
- movl $0,%eax
-1:
- jmp %ecx
-2:
- pushl %ecx
- PIC_PROLOGUE
- jmp PIC_PLT(HIDENAME(cerror))
diff --git a/lib/libc/gen/__xuname.c b/lib/libc/gen/__xuname.c
deleted file mode 100644
index 944c2dc3b2ff..000000000000
--- a/lib/libc/gen/__xuname.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/*-
- * Copyright (c) 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-/*static char sccsid[] = "From: @(#)uname.c 8.1 (Berkeley) 1/4/94";*/
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/param.h>
-#include <sys/sysctl.h>
-#include <sys/utsname.h>
-#include <errno.h>
-
-int
-uname(name)
- struct utsname *name;
-{
- int mib[2], rval;
- size_t len;
- char *p;
- int oerrno;
-
- rval = 0;
-
- mib[0] = CTL_KERN;
- mib[1] = KERN_OSTYPE;
- len = sizeof(name->sysname);
- oerrno = errno;
- if (sysctl(mib, 2, &name->sysname, &len, NULL, 0) == -1) {
- if(errno == ENOMEM)
- errno = oerrno;
- else
- rval = -1;
- }
- name->sysname[sizeof(name->sysname) - 1] = '\0';
-
- mib[0] = CTL_KERN;
- mib[1] = KERN_HOSTNAME;
- len = sizeof(name->nodename);
- oerrno = errno;
- if (sysctl(mib, 2, &name->nodename, &len, NULL, 0) == -1) {
- if(errno == ENOMEM)
- errno = oerrno;
- else
- rval = -1;
- }
- name->nodename[sizeof(name->nodename) - 1] = '\0';
-
- mib[0] = CTL_KERN;
- mib[1] = KERN_OSRELEASE;
- len = sizeof(name->release);
- oerrno = errno;
- if (sysctl(mib, 2, &name->release, &len, NULL, 0) == -1) {
- if(errno == ENOMEM)
- errno = oerrno;
- else
- rval = -1;
- }
- name->release[sizeof(name->release) - 1] = '\0';
-
- /* The version may have newlines in it, turn them into spaces. */
- mib[0] = CTL_KERN;
- mib[1] = KERN_VERSION;
- len = sizeof(name->version);
- oerrno = errno;
- if (sysctl(mib, 2, &name->version, &len, NULL, 0) == -1) {
- if (errno == ENOMEM)
- errno = oerrno;
- else
- rval = -1;
- }
- name->version[sizeof(name->version) - 1] = '\0';
- for (p = name->version; len--; ++p) {
- if (*p == '\n' || *p == '\t') {
- if (len > 1)
- *p = ' ';
- else
- *p = '\0';
- }
- }
-
- mib[0] = CTL_HW;
- mib[1] = HW_MACHINE;
- len = sizeof(name->machine);
- oerrno = errno;
- if (sysctl(mib, 2, &name->machine, &len, NULL, 0) == -1) {
- if (errno == ENOMEM)
- errno = oerrno;
- else
- rval = -1;
- }
- name->machine[sizeof(name->machine) - 1] = '\0';
- return (rval);
-}
diff --git a/lib/libc/gen/fts-compat.c b/lib/libc/gen/fts-compat.c
deleted file mode 100644
index 6b92a120676a..000000000000
--- a/lib/libc/gen/fts-compat.c
+++ /dev/null
@@ -1,1114 +0,0 @@
-/*-
- * Copyright (c) 1990, 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- *
- * $OpenBSD: fts.c,v 1.22 1999/10/03 19:22:22 millert Exp $
- *
- * $FreeBSD$
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94";
-#else
-static char rcsid[] = "$FreeBSD$";
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/param.h>
-#include <sys/stat.h>
-
-#include <dirent.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <fts.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-static FTSENT *fts_alloc __P((FTS *, char *, int));
-static FTSENT *fts_build __P((FTS *, int));
-static void fts_lfree __P((FTSENT *));
-static void fts_load __P((FTS *, FTSENT *));
-static size_t fts_maxarglen __P((char * const *));
-static void fts_padjust __P((FTS *, FTSENT *));
-static int fts_palloc __P((FTS *, size_t));
-static FTSENT *fts_sort __P((FTS *, FTSENT *, int));
-static u_short fts_stat __P((FTS *, FTSENT *, int));
-static int fts_safe_changedir __P((FTS *, FTSENT *, int));
-
-#define ISDOT(a) (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2])))
-
-#define CLR(opt) (sp->fts_options &= ~(opt))
-#define ISSET(opt) (sp->fts_options & (opt))
-#define SET(opt) (sp->fts_options |= (opt))
-
-#define CHDIR(sp, path) (!ISSET(FTS_NOCHDIR) && chdir(path))
-#define FCHDIR(sp, fd) (!ISSET(FTS_NOCHDIR) && fchdir(fd))
-
-/* fts_build flags */
-#define BCHILD 1 /* fts_children */
-#define BNAMES 2 /* fts_children, names only */
-#define BREAD 3 /* fts_read */
-
-FTS *
-fts_open(argv, options, compar)
- char * const *argv;
- register int options;
- int (*compar) __P((const FTSENT **, const FTSENT **));
-{
- register FTS *sp;
- register FTSENT *p, *root;
- register int nitems;
- FTSENT *parent, *tmp;
- int len;
-
- /* Options check. */
- if (options & ~FTS_OPTIONMASK) {
- errno = EINVAL;
- return (NULL);
- }
-
- /* Allocate/initialize the stream */
- if ((sp = malloc((u_int)sizeof(FTS))) == NULL)
- return (NULL);
- memset(sp, 0, sizeof(FTS));
- sp->fts_compar = compar;
- sp->fts_options = options;
-
- /* Shush, GCC. */
- tmp = NULL;
-
- /* Logical walks turn on NOCHDIR; symbolic links are too hard. */
- if (ISSET(FTS_LOGICAL))
- SET(FTS_NOCHDIR);
-
- /*
- * Start out with 1K of path space, and enough, in any case,
- * to hold the user's paths.
- */
- if (fts_palloc(sp, MAX(fts_maxarglen(argv), MAXPATHLEN)))
- goto mem1;
-
- /* Allocate/initialize root's parent. */
- if ((parent = fts_alloc(sp, "", 0)) == NULL)
- goto mem2;
- parent->fts_level = FTS_ROOTPARENTLEVEL;
-
- /* Allocate/initialize root(s). */
- for (root = NULL, nitems = 0; *argv; ++argv, ++nitems) {
- /* Don't allow zero-length paths. */
- if ((len = strlen(*argv)) == 0) {
- errno = ENOENT;
- goto mem3;
- }
-
- p = fts_alloc(sp, *argv, len);
- p->fts_level = FTS_ROOTLEVEL;
- p->fts_parent = parent;
- p->fts_accpath = p->fts_name;
- p->fts_info = fts_stat(sp, p, ISSET(FTS_COMFOLLOW));
-
- /* Command-line "." and ".." are real directories. */
- if (p->fts_info == FTS_DOT)
- p->fts_info = FTS_D;
-
- /*
- * If comparison routine supplied, traverse in sorted
- * order; otherwise traverse in the order specified.
- */
- if (compar) {
- p->fts_link = root;
- root = p;
- } else {
- p->fts_link = NULL;
- if (root == NULL)
- tmp = root = p;
- else {
- tmp->fts_link = p;
- tmp = p;
- }
- }
- }
- if (compar && nitems > 1)
- root = fts_sort(sp, root, nitems);
-
- /*
- * Allocate a dummy pointer and make fts_read think that we've just
- * finished the node before the root(s); set p->fts_info to FTS_INIT
- * so that everything about the "current" node is ignored.
- */
- if ((sp->fts_cur = fts_alloc(sp, "", 0)) == NULL)
- goto mem3;
- sp->fts_cur->fts_link = root;
- sp->fts_cur->fts_info = FTS_INIT;
-
- /*
- * If using chdir(2), grab a file descriptor pointing to dot to ensure
- * that we can get back here; this could be avoided for some paths,
- * but almost certainly not worth the effort. Slashes, symbolic links,
- * and ".." are all fairly nasty problems. Note, if we can't get the
- * descriptor we run anyway, just more slowly.
- */
- if (!ISSET(FTS_NOCHDIR) && (sp->fts_rfd = _open(".", O_RDONLY, 0)) < 0)
- SET(FTS_NOCHDIR);
-
- return (sp);
-
-mem3: fts_lfree(root);
- free(parent);
-mem2: free(sp->fts_path);
-mem1: free(sp);
- return (NULL);
-}
-
-static void
-fts_load(sp, p)
- FTS *sp;
- register FTSENT *p;
-{
- register int len;
- register char *cp;
-
- /*
- * Load the stream structure for the next traversal. Since we don't
- * actually enter the directory until after the preorder visit, set
- * the fts_accpath field specially so the chdir gets done to the right
- * place and the user can access the first node. From fts_open it's
- * known that the path will fit.
- */
- len = p->fts_pathlen = p->fts_namelen;
- memmove(sp->fts_path, p->fts_name, len + 1);
- if ((cp = strrchr(p->fts_name, '/')) && (cp != p->fts_name || cp[1])) {
- len = strlen(++cp);
- memmove(p->fts_name, cp, len + 1);
- p->fts_namelen = len;
- }
- p->fts_accpath = p->fts_path = sp->fts_path;
- sp->fts_dev = p->fts_dev;
-}
-
-int
-fts_close(sp)
- FTS *sp;
-{
- register FTSENT *freep, *p;
- int saved_errno;
-
- /*
- * This still works if we haven't read anything -- the dummy structure
- * points to the root list, so we step through to the end of the root
- * list which has a valid parent pointer.
- */
- if (sp->fts_cur) {
- for (p = sp->fts_cur; p->fts_level >= FTS_ROOTLEVEL;) {
- freep = p;
- p = p->fts_link ? p->fts_link : p->fts_parent;
- free(freep);
- }
- free(p);
- }
-
- /* Free up child linked list, sort array, path buffer. */
- if (sp->fts_child)
- fts_lfree(sp->fts_child);
- if (sp->fts_array)
- free(sp->fts_array);
- free(sp->fts_path);
-
- /* Return to original directory, save errno if necessary. */
- if (!ISSET(FTS_NOCHDIR)) {
- saved_errno = fchdir(sp->fts_rfd) ? errno : 0;
- (void)_close(sp->fts_rfd);
-
- /* Set errno and return. */
- if (saved_errno != 0) {
- /* Free up the stream pointer. */
- free(sp);
- errno = saved_errno;
- return (-1);
- }
- }
-
- /* Free up the stream pointer. */
- free(sp);
- return (0);
-}
-
-/*
- * Special case of "/" at the end of the path so that slashes aren't
- * appended which would cause paths to be written as "....//foo".
- */
-#define NAPPEND(p) \
- (p->fts_path[p->fts_pathlen - 1] == '/' \
- ? p->fts_pathlen - 1 : p->fts_pathlen)
-
-FTSENT *
-fts_read(sp)
- register FTS *sp;
-{
- register FTSENT *p, *tmp;
- register int instr;
- register char *t;
- int saved_errno;
-
- /* If finished or unrecoverable error, return NULL. */
- if (sp->fts_cur == NULL || ISSET(FTS_STOP))
- return (NULL);
-
- /* Set current node pointer. */
- p = sp->fts_cur;
-
- /* Save and zero out user instructions. */
- instr = p->fts_instr;
- p->fts_instr = FTS_NOINSTR;
-
- /* Any type of file may be re-visited; re-stat and re-turn. */
- if (instr == FTS_AGAIN) {
- p->fts_info = fts_stat(sp, p, 0);
- return (p);
- }
-
- /*
- * Following a symlink -- SLNONE test allows application to see
- * SLNONE and recover. If indirecting through a symlink, have
- * keep a pointer to current location. If unable to get that
- * pointer, follow fails.
- */
- if (instr == FTS_FOLLOW &&
- (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) {
- p->fts_info = fts_stat(sp, p, 1);
- if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
- if ((p->fts_symfd = _open(".", O_RDONLY, 0)) < 0) {
- p->fts_errno = errno;
- p->fts_info = FTS_ERR;
- } else
- p->fts_flags |= FTS_SYMFOLLOW;
- }
- return (p);
- }
-
- /* Directory in pre-order. */
- if (p->fts_info == FTS_D) {
- /* If skipped or crossed mount point, do post-order visit. */
- if (instr == FTS_SKIP ||
- (ISSET(FTS_XDEV) && p->fts_dev != sp->fts_dev)) {
- if (p->fts_flags & FTS_SYMFOLLOW)
- (void)_close(p->fts_symfd);
- if (sp->fts_child) {
- fts_lfree(sp->fts_child);
- sp->fts_child = NULL;
- }
- p->fts_info = FTS_DP;
- return (p);
- }
-
- /* Rebuild if only read the names and now traversing. */
- if (sp->fts_child && ISSET(FTS_NAMEONLY)) {
- CLR(FTS_NAMEONLY);
- fts_lfree(sp->fts_child);
- sp->fts_child = NULL;
- }
-
- /*
- * Cd to the subdirectory.
- *
- * If have already read and now fail to chdir, whack the list
- * to make the names come out right, and set the parent errno
- * so the application will eventually get an error condition.
- * Set the FTS_DONTCHDIR flag so that when we logically change
- * directories back to the parent we don't do a chdir.
- *
- * If haven't read do so. If the read fails, fts_build sets
- * FTS_STOP or the fts_info field of the node.
- */
- if (sp->fts_child) {
- if (fts_safe_changedir(sp, p, -1)) {
- p->fts_errno = errno;
- p->fts_flags |= FTS_DONTCHDIR;
- for (p = sp->fts_child; p; p = p->fts_link)
- p->fts_accpath =
- p->fts_parent->fts_accpath;
- }
- } else if ((sp->fts_child = fts_build(sp, BREAD)) == NULL) {
- if (ISSET(FTS_STOP))
- return (NULL);
- return (p);
- }
- p = sp->fts_child;
- sp->fts_child = NULL;
- goto name;
- }
-
- /* Move to the next node on this level. */
-next: tmp = p;
- if ((p = p->fts_link)) {
- free(tmp);
-
- /*
- * If reached the top, return to the original directory (or
- * the root of the tree), and load the paths for the next root.
- */
- if (p->fts_level == FTS_ROOTLEVEL) {
- if (FCHDIR(sp, sp->fts_rfd)) {
- SET(FTS_STOP);
- return (NULL);
- }
- fts_load(sp, p);
- return (sp->fts_cur = p);
- }
-
- /*
- * User may have called fts_set on the node. If skipped,
- * ignore. If followed, get a file descriptor so we can
- * get back if necessary.
- */
- if (p->fts_instr == FTS_SKIP)
- goto next;
- if (p->fts_instr == FTS_FOLLOW) {
- p->fts_info = fts_stat(sp, p, 1);
- if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
- if ((p->fts_symfd =
- _open(".", O_RDONLY, 0)) < 0) {
- p->fts_errno = errno;
- p->fts_info = FTS_ERR;
- } else
- p->fts_flags |= FTS_SYMFOLLOW;
- }
- p->fts_instr = FTS_NOINSTR;
- }
-
-name: t = sp->fts_path + NAPPEND(p->fts_parent);
- *t++ = '/';
- memmove(t, p->fts_name, p->fts_namelen + 1);
- return (sp->fts_cur = p);
- }
-
- /* Move up to the parent node. */
- p = tmp->fts_parent;
- free(tmp);
-
- if (p->fts_level == FTS_ROOTPARENTLEVEL) {
- /*
- * Done; free everything up and set errno to 0 so the user
- * can distinguish between error and EOF.
- */
- free(p);
- errno = 0;
- return (sp->fts_cur = NULL);
- }
-
- /* NUL terminate the pathname. */
- sp->fts_path[p->fts_pathlen] = '\0';
-
- /*
- * Return to the parent directory. If at a root node or came through
- * a symlink, go back through the file descriptor. Otherwise, cd up
- * one directory.
- */
- if (p->fts_level == FTS_ROOTLEVEL) {
- if (FCHDIR(sp, sp->fts_rfd)) {
- SET(FTS_STOP);
- return (NULL);
- }
- } else if (p->fts_flags & FTS_SYMFOLLOW) {
- if (FCHDIR(sp, p->fts_symfd)) {
- saved_errno = errno;
- (void)_close(p->fts_symfd);
- errno = saved_errno;
- SET(FTS_STOP);
- return (NULL);
- }
- (void)_close(p->fts_symfd);
- } else if (!(p->fts_flags & FTS_DONTCHDIR)) {
- if (CHDIR(sp, "..")) {
- SET(FTS_STOP);
- return (NULL);
- }
- }
- p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP;
- return (sp->fts_cur = p);
-}
-
-/*
- * Fts_set takes the stream as an argument although it's not used in this
- * implementation; it would be necessary if anyone wanted to add global
- * semantics to fts using fts_set. An error return is allowed for similar
- * reasons.
- */
-/* ARGSUSED */
-int
-fts_set(sp, p, instr)
- FTS *sp;
- FTSENT *p;
- int instr;
-{
- if (instr && instr != FTS_AGAIN && instr != FTS_FOLLOW &&
- instr != FTS_NOINSTR && instr != FTS_SKIP) {
- errno = EINVAL;
- return (1);
- }
- p->fts_instr = instr;
- return (0);
-}
-
-FTSENT *
-fts_children(sp, instr)
- register FTS *sp;
- int instr;
-{
- register FTSENT *p;
- int fd;
-
- if (instr && instr != FTS_NAMEONLY) {
- errno = EINVAL;
- return (NULL);
- }
-
- /* Set current node pointer. */
- p = sp->fts_cur;
-
- /*
- * Errno set to 0 so user can distinguish empty directory from
- * an error.
- */
- errno = 0;
-
- /* Fatal errors stop here. */
- if (ISSET(FTS_STOP))
- return (NULL);
-
- /* Return logical hierarchy of user's arguments. */
- if (p->fts_info == FTS_INIT)
- return (p->fts_link);
-
- /*
- * If not a directory being visited in pre-order, stop here. Could
- * allow FTS_DNR, assuming the user has fixed the problem, but the
- * same effect is available with FTS_AGAIN.
- */
- if (p->fts_info != FTS_D /* && p->fts_info != FTS_DNR */)
- return (NULL);
-
- /* Free up any previous child list. */
- if (sp->fts_child)
- fts_lfree(sp->fts_child);
-
- if (instr == FTS_NAMEONLY) {
- SET(FTS_NAMEONLY);
- instr = BNAMES;
- } else
- instr = BCHILD;
-
- /*
- * If using chdir on a relative path and called BEFORE fts_read does
- * its chdir to the root of a traversal, we can lose -- we need to
- * chdir into the subdirectory, and we don't know where the current
- * directory is, so we can't get back so that the upcoming chdir by
- * fts_read will work.
- */
- if (p->fts_level != FTS_ROOTLEVEL || p->fts_accpath[0] == '/' ||
- ISSET(FTS_NOCHDIR))
- return (sp->fts_child = fts_build(sp, instr));
-
- if ((fd = _open(".", O_RDONLY, 0)) < 0)
- return (NULL);
- sp->fts_child = fts_build(sp, instr);
- if (fchdir(fd))
- return (NULL);
- (void)_close(fd);
- return (sp->fts_child);
-}
-
-/*
- * This is the tricky part -- do not casually change *anything* in here. The
- * idea is to build the linked list of entries that are used by fts_children
- * and fts_read. There are lots of special cases.
- *
- * The real slowdown in walking the tree is the stat calls. If FTS_NOSTAT is
- * set and it's a physical walk (so that symbolic links can't be directories),
- * we can do things quickly. First, if it's a 4.4BSD file system, the type
- * of the file is in the directory entry. Otherwise, we assume that the number
- * of subdirectories in a node is equal to the number of links to the parent.
- * The former skips all stat calls. The latter skips stat calls in any leaf
- * directories and for any files after the subdirectories in the directory have
- * been found, cutting the stat calls by about 2/3.
- */
-static FTSENT *
-fts_build(sp, type)
- register FTS *sp;
- int type;
-{
- register struct dirent *dp;
- register FTSENT *p, *head;
- register int nitems;
- FTSENT *cur, *tail;
- DIR *dirp;
- void *oldaddr;
- int cderrno, descend, len, level, maxlen, nlinks, oflag, saved_errno,
- nostat, doadjust;
- char *cp;
-
- /* Set current node pointer. */
- cur = sp->fts_cur;
-
- /*
- * Open the directory for reading. If this fails, we're done.
- * If being called from fts_read, set the fts_info field.
- */
-#ifdef FTS_WHITEOUT
- if (ISSET(FTS_WHITEOUT))
- oflag = DTF_NODUP|DTF_REWIND;
- else
- oflag = DTF_HIDEW|DTF_NODUP|DTF_REWIND;
-#else
-#define __opendir2(path, flag) opendir(path)
-#endif
- if ((dirp = __opendir2(cur->fts_accpath, oflag)) == NULL) {
- if (type == BREAD) {
- cur->fts_info = FTS_DNR;
- cur->fts_errno = errno;
- }
- return (NULL);
- }
-
- /*
- * Nlinks is the number of possible entries of type directory in the
- * directory if we're cheating on stat calls, 0 if we're not doing
- * any stat calls at all, -1 if we're doing stats on everything.
- */
- if (type == BNAMES) {
- nlinks = 0;
- /* Be quiet about nostat, GCC. */
- nostat = 0;
- } else if (ISSET(FTS_NOSTAT) && ISSET(FTS_PHYSICAL)) {
- nlinks = cur->fts_nlink - (ISSET(FTS_SEEDOT) ? 0 : 2);
- nostat = 1;
- } else {
- nlinks = -1;
- nostat = 0;
- }
-
-#ifdef notdef
- (void)printf("nlinks == %d (cur: %d)\n", nlinks, cur->fts_nlink);
- (void)printf("NOSTAT %d PHYSICAL %d SEEDOT %d\n",
- ISSET(FTS_NOSTAT), ISSET(FTS_PHYSICAL), ISSET(FTS_SEEDOT));
-#endif
- /*
- * If we're going to need to stat anything or we want to descend
- * and stay in the directory, chdir. If this fails we keep going,
- * but set a flag so we don't chdir after the post-order visit.
- * We won't be able to stat anything, but we can still return the
- * names themselves. Note, that since fts_read won't be able to
- * chdir into the directory, it will have to return different path
- * names than before, i.e. "a/b" instead of "b". Since the node
- * has already been visited in pre-order, have to wait until the
- * post-order visit to return the error. There is a special case
- * here, if there was nothing to stat then it's not an error to
- * not be able to stat. This is all fairly nasty. If a program
- * needed sorted entries or stat information, they had better be
- * checking FTS_NS on the returned nodes.
- */
- cderrno = 0;
- if (nlinks || type == BREAD) {
- if (fts_safe_changedir(sp, cur, dirfd(dirp))) {
- if (nlinks && type == BREAD)
- cur->fts_errno = errno;
- cur->fts_flags |= FTS_DONTCHDIR;
- descend = 0;
- cderrno = errno;
- (void)closedir(dirp);
- dirp = NULL;
- } else
- descend = 1;
- } else
- descend = 0;
-
- /*
- * Figure out the max file name length that can be stored in the
- * current path -- the inner loop allocates more path as necessary.
- * We really wouldn't have to do the maxlen calculations here, we
- * could do them in fts_read before returning the path, but it's a
- * lot easier here since the length is part of the dirent structure.
- *
- * If not changing directories set a pointer so that can just append
- * each new name into the path.
- */
- len = NAPPEND(cur);
- if (ISSET(FTS_NOCHDIR)) {
- cp = sp->fts_path + len;
- *cp++ = '/';
- } else {
- /* GCC, you're too verbose. */
- cp = NULL;
- }
- len++;
- maxlen = sp->fts_pathlen - len;
-
- level = cur->fts_level + 1;
-
- /* Read the directory, attaching each entry to the `link' pointer. */
- doadjust = 0;
- for (head = tail = NULL, nitems = 0; dirp && (dp = readdir(dirp));) {
- if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
- continue;
-
- if ((p = fts_alloc(sp, dp->d_name, (int)dp->d_namlen)) == NULL)
- goto mem1;
- if (dp->d_namlen >= maxlen) { /* include space for NUL */
- oldaddr = sp->fts_path;
- if (fts_palloc(sp, dp->d_namlen +len + 1)) {
- /*
- * No more memory for path or structures. Save
- * errno, free up the current structure and the
- * structures already allocated.
- */
-mem1: saved_errno = errno;
- if (p)
- free(p);
- fts_lfree(head);
- (void)closedir(dirp);
- cur->fts_info = FTS_ERR;
- SET(FTS_STOP);
- errno = saved_errno;
- return (NULL);
- }
- /* Did realloc() change the pointer? */
- if (oldaddr != sp->fts_path) {
- doadjust = 1;
- if (ISSET(FTS_NOCHDIR))
- cp = sp->fts_path + len;
- }
- maxlen = sp->fts_pathlen - len;
- }
-
- if (len + dp->d_namlen >= USHRT_MAX) {
- /*
- * In an FTSENT, fts_pathlen is a u_short so it is
- * possible to wraparound here. If we do, free up
- * the current structure and the structures already
- * allocated, then error out with ENAMETOOLONG.
- */
- free(p);
- fts_lfree(head);
- (void)closedir(dirp);
- cur->fts_info = FTS_ERR;
- SET(FTS_STOP);
- errno = ENAMETOOLONG;
- return (NULL);
- }
- p->fts_level = level;
- p->fts_parent = sp->fts_cur;
- p->fts_pathlen = len + dp->d_namlen;
-
-#ifdef FTS_WHITEOUT
- if (dp->d_type == DT_WHT)
- p->fts_flags |= FTS_ISW;
-#endif
-
- if (cderrno) {
- if (nlinks) {
- p->fts_info = FTS_NS;
- p->fts_errno = cderrno;
- } else
- p->fts_info = FTS_NSOK;
- p->fts_accpath = cur->fts_accpath;
- } else if (nlinks == 0
-#ifdef DT_DIR
- || (nostat &&
- dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN)
-#endif
- ) {
- p->fts_accpath =
- ISSET(FTS_NOCHDIR) ? p->fts_path : p->fts_name;
- p->fts_info = FTS_NSOK;
- } else {
- /* Build a file name for fts_stat to stat. */
- if (ISSET(FTS_NOCHDIR)) {
- p->fts_accpath = p->fts_path;
- memmove(cp, p->fts_name, p->fts_namelen + 1);
- } else
- p->fts_accpath = p->fts_name;
- /* Stat it. */
- p->fts_info = fts_stat(sp, p, 0);
-
- /* Decrement link count if applicable. */
- if (nlinks > 0 && (p->fts_info == FTS_D ||
- p->fts_info == FTS_DC || p->fts_info == FTS_DOT))
- --nlinks;
- }
-
- /* We walk in directory order so "ls -f" doesn't get upset. */
- p->fts_link = NULL;
- if (head == NULL)
- head = tail = p;
- else {
- tail->fts_link = p;
- tail = p;
- }
- ++nitems;
- }
- if (dirp)
- (void)closedir(dirp);
-
- /*
- * If realloc() changed the address of the path, adjust the
- * addresses for the rest of the tree and the dir list.
- */
- if (doadjust)
- fts_padjust(sp, head);
-
- /*
- * If not changing directories, reset the path back to original
- * state.
- */
- if (ISSET(FTS_NOCHDIR)) {
- if (len == sp->fts_pathlen || nitems == 0)
- --cp;
- *cp = '\0';
- }
-
- /*
- * If descended after called from fts_children or after called from
- * fts_read and nothing found, get back. At the root level we use
- * the saved fd; if one of fts_open()'s arguments is a relative path
- * to an empty directory, we wind up here with no other way back. If
- * can't get back, we're done.
- */
- if (descend && (type == BCHILD || !nitems) &&
- (cur->fts_level == FTS_ROOTLEVEL ?
- FCHDIR(sp, sp->fts_rfd) : CHDIR(sp, ".."))) {
- cur->fts_info = FTS_ERR;
- SET(FTS_STOP);
- return (NULL);
- }
-
- /* If didn't find anything, return NULL. */
- if (!nitems) {
- if (type == BREAD)
- cur->fts_info = FTS_DP;
- return (NULL);
- }
-
- /* Sort the entries. */
- if (sp->fts_compar && nitems > 1)
- head = fts_sort(sp, head, nitems);
- return (head);
-}
-
-static u_short
-fts_stat(sp, p, follow)
- FTS *sp;
- register FTSENT *p;
- int follow;
-{
- register FTSENT *t;
- register dev_t dev;
- register ino_t ino;
- struct stat *sbp, sb;
- int saved_errno;
-
- /* If user needs stat info, stat buffer already allocated. */
- sbp = ISSET(FTS_NOSTAT) ? &sb : p->fts_statp;
-
-#ifdef FTS_WHITEOUT
- /* check for whiteout */
- if (p->fts_flags & FTS_ISW) {
- if (sbp != &sb) {
- memset(sbp, '\0', sizeof (*sbp));
- sbp->st_mode = S_IFWHT;
- }
- return (FTS_W);
- }
-#endif
-
- /*
- * If doing a logical walk, or application requested FTS_FOLLOW, do
- * a stat(2). If that fails, check for a non-existent symlink. If
- * fail, set the errno from the stat call.
- */
- if (ISSET(FTS_LOGICAL) || follow) {
- if (stat(p->fts_accpath, sbp)) {
- saved_errno = errno;
- if (!lstat(p->fts_accpath, sbp)) {
- errno = 0;
- return (FTS_SLNONE);
- }
- p->fts_errno = saved_errno;
- goto err;
- }
- } else if (lstat(p->fts_accpath, sbp)) {
- p->fts_errno = errno;
-err: memset(sbp, 0, sizeof(struct stat));
- return (FTS_NS);
- }
-
- if (S_ISDIR(sbp->st_mode)) {
- /*
- * Set the device/inode. Used to find cycles and check for
- * crossing mount points. Also remember the link count, used
- * in fts_build to limit the number of stat calls. It is
- * understood that these fields are only referenced if fts_info
- * is set to FTS_D.
- */
- dev = p->fts_dev = sbp->st_dev;
- ino = p->fts_ino = sbp->st_ino;
- p->fts_nlink = sbp->st_nlink;
-
- if (ISDOT(p->fts_name))
- return (FTS_DOT);
-
- /*
- * Cycle detection is done by brute force when the directory
- * is first encountered. If the tree gets deep enough or the
- * number of symbolic links to directories is high enough,
- * something faster might be worthwhile.
- */
- for (t = p->fts_parent;
- t->fts_level >= FTS_ROOTLEVEL; t = t->fts_parent)
- if (ino == t->fts_ino && dev == t->fts_dev) {
- p->fts_cycle = t;
- return (FTS_DC);
- }
- return (FTS_D);
- }
- if (S_ISLNK(sbp->st_mode))
- return (FTS_SL);
- if (S_ISREG(sbp->st_mode))
- return (FTS_F);
- return (FTS_DEFAULT);
-}
-
-static FTSENT *
-fts_sort(sp, head, nitems)
- FTS *sp;
- FTSENT *head;
- register int nitems;
-{
- register FTSENT **ap, *p;
-
- /*
- * Construct an array of pointers to the structures and call qsort(3).
- * Reassemble the array in the order returned by qsort. If unable to
- * sort for memory reasons, return the directory entries in their
- * current order. Allocate enough space for the current needs plus
- * 40 so don't realloc one entry at a time.
- */
- if (nitems > sp->fts_nitems) {
- struct _ftsent **a;
-
- sp->fts_nitems = nitems + 40;
- if ((a = realloc(sp->fts_array,
- sp->fts_nitems * sizeof(FTSENT *))) == NULL) {
- if (sp->fts_array)
- free(sp->fts_array);
- sp->fts_array = NULL;
- sp->fts_nitems = 0;
- return (head);
- }
- sp->fts_array = a;
- }
- for (ap = sp->fts_array, p = head; p; p = p->fts_link)
- *ap++ = p;
- qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *), sp->fts_compar);
- for (head = *(ap = sp->fts_array); --nitems; ++ap)
- ap[0]->fts_link = ap[1];
- ap[0]->fts_link = NULL;
- return (head);
-}
-
-static FTSENT *
-fts_alloc(sp, name, namelen)
- FTS *sp;
- char *name;
- register int namelen;
-{
- register FTSENT *p;
- size_t len;
-
- /*
- * The file name is a variable length array and no stat structure is
- * necessary if the user has set the nostat bit. Allocate the FTSENT
- * structure, the file name and the stat structure in one chunk, but
- * be careful that the stat structure is reasonably aligned. Since the
- * fts_name field is declared to be of size 1, the fts_name pointer is
- * namelen + 2 before the first possible address of the stat structure.
- */
- len = sizeof(FTSENT) + namelen;
- if (!ISSET(FTS_NOSTAT))
- len += sizeof(struct stat) + ALIGNBYTES;
- if ((p = malloc(len)) == NULL)
- return (NULL);
-
- /* Copy the name and guarantee NUL termination. */
- memmove(p->fts_name, name, namelen);
- p->fts_name[namelen] = '\0';
-
- if (!ISSET(FTS_NOSTAT))
- p->fts_statp = (struct stat *)ALIGN(p->fts_name + namelen + 2);
- p->fts_namelen = namelen;
- p->fts_path = sp->fts_path;
- p->fts_errno = 0;
- p->fts_flags = 0;
- p->fts_instr = FTS_NOINSTR;
- p->fts_number = 0;
- p->fts_pointer = NULL;
- return (p);
-}
-
-static void
-fts_lfree(head)
- register FTSENT *head;
-{
- register FTSENT *p;
-
- /* Free a linked list of structures. */
- while ((p = head)) {
- head = head->fts_link;
- free(p);
- }
-}
-
-/*
- * Allow essentially unlimited paths; find, rm, ls should all work on any tree.
- * Most systems will allow creation of paths much longer than MAXPATHLEN, even
- * though the kernel won't resolve them. Add the size (not just what's needed)
- * plus 256 bytes so don't realloc the path 2 bytes at a time.
- */
-static int
-fts_palloc(sp, more)
- FTS *sp;
- size_t more;
-{
- char *p;
-
- sp->fts_pathlen += more + 256;
- /*
- * Check for possible wraparound. In an FTS, fts_pathlen is
- * a signed int but in an FTSENT it is an unsigned short.
- * We limit fts_pathlen to USHRT_MAX to be safe in both cases.
- */
- if (sp->fts_pathlen < 0 || sp->fts_pathlen >= USHRT_MAX) {
- if (sp->fts_path)
- free(sp->fts_path);
- sp->fts_path = NULL;
- errno = ENAMETOOLONG;
- return (1);
- }
- p = realloc(sp->fts_path, sp->fts_pathlen);
- if (p == NULL) {
- if (sp->fts_path)
- free(sp->fts_path);
- sp->fts_path = NULL;
- return (1);
- }
- sp->fts_path = p;
- return (0);
-}
-
-/*
- * When the path is realloc'd, have to fix all of the pointers in structures
- * already returned.
- */
-static void
-fts_padjust(sp, head)
- FTS *sp;
- FTSENT *head;
-{
- FTSENT *p;
- char *addr = sp->fts_path;
-
-#define ADJUST(p) { \
- if ((p)->fts_accpath != (p)->fts_name) { \
- (p)->fts_accpath = \
- (char *)addr + ((p)->fts_accpath - (p)->fts_path); \
- } \
- (p)->fts_path = addr; \
-}
- /* Adjust the current set of children. */
- for (p = sp->fts_child; p; p = p->fts_link)
- ADJUST(p);
-
- /* Adjust the rest of the tree, including the current level. */
- for (p = head; p->fts_level >= FTS_ROOTLEVEL;) {
- ADJUST(p);
- p = p->fts_link ? p->fts_link : p->fts_parent;
- }
-}
-
-static size_t
-fts_maxarglen(argv)
- char * const *argv;
-{
- size_t len, max;
-
- for (max = 0; *argv; ++argv)
- if ((len = strlen(*argv)) > max)
- max = len;
- return (max + 1);
-}
-
-/*
- * Change to dir specified by fd or p->fts_accpath without getting
- * tricked by someone changing the world out from underneath us.
- * Assumes p->fts_dev and p->fts_ino are filled in.
- */
-static int
-fts_safe_changedir(sp, p, fd)
- FTS *sp;
- FTSENT *p;
- int fd;
-{
- int ret, oerrno, newfd;
- struct stat sb;
-
- newfd = fd;
- if (ISSET(FTS_NOCHDIR))
- return (0);
- if (fd < 0 && (newfd = _open(p->fts_accpath, O_RDONLY, 0)) < 0)
- return (-1);
- if (fstat(newfd, &sb)) {
- ret = -1;
- goto bail;
- }
- if (p->fts_dev != sb.st_dev || p->fts_ino != sb.st_ino) {
- errno = ENOENT; /* disinformation */
- ret = -1;
- goto bail;
- }
- ret = fchdir(newfd);
-bail:
- oerrno = errno;
- if (fd < 0)
- (void)_close(newfd);
- errno = oerrno;
- return (ret);
-}
diff --git a/lib/libc/gen/fts-compat.h b/lib/libc/gen/fts-compat.h
deleted file mode 100644
index 4fa4a3aa0ded..000000000000
--- a/lib/libc/gen/fts-compat.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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 _FTS_H_
-#define _FTS_H_
-
-typedef struct {
- struct _ftsent *fts_cur; /* current node */
- struct _ftsent *fts_child; /* linked list of children */
- struct _ftsent **fts_array; /* sort array */
- dev_t fts_dev; /* starting device # */
- char *fts_path; /* path for this descent */
- int fts_rfd; /* fd for root */
- int fts_pathlen; /* sizeof(path) */
- int fts_nitems; /* elements in the sort array */
- int (*fts_compar)(); /* compare function */
-
-#define FTS_COMFOLLOW 0x001 /* follow command line symlinks */
-#define FTS_LOGICAL 0x002 /* logical walk */
-#define FTS_NOCHDIR 0x004 /* don't change directories */
-#define FTS_NOSTAT 0x008 /* don't get stat info */
-#define FTS_PHYSICAL 0x010 /* physical walk */
-#define FTS_SEEDOT 0x020 /* return dot and dot-dot */
-#define FTS_XDEV 0x040 /* don't cross devices */
-#define FTS_WHITEOUT 0x080 /* return whiteout information */
-#define FTS_OPTIONMASK 0x0ff /* valid user option mask */
-
-#define FTS_NAMEONLY 0x100 /* (private) child names only */
-#define FTS_STOP 0x200 /* (private) unrecoverable error */
- int fts_options; /* fts_open options, global flags */
-} FTS;
-
-typedef struct _ftsent {
- struct _ftsent *fts_cycle; /* cycle node */
- struct _ftsent *fts_parent; /* parent directory */
- struct _ftsent *fts_link; /* next file in directory */
- long fts_number; /* local numeric value */
- void *fts_pointer; /* local address value */
- char *fts_accpath; /* access path */
- char *fts_path; /* root path */
- int fts_errno; /* errno for this node */
- int fts_symfd; /* fd for symlink */
- u_short fts_pathlen; /* strlen(fts_path) */
- u_short fts_namelen; /* strlen(fts_name) */
-
- ino_t fts_ino; /* inode */
- dev_t fts_dev; /* device */
- nlink_t fts_nlink; /* link count */
-
-#define FTS_ROOTPARENTLEVEL -1
-#define FTS_ROOTLEVEL 0
- short fts_level; /* depth (-1 to N) */
-
-#define FTS_D 1 /* preorder directory */
-#define FTS_DC 2 /* directory that causes cycles */
-#define FTS_DEFAULT 3 /* none of the above */
-#define FTS_DNR 4 /* unreadable directory */
-#define FTS_DOT 5 /* dot or dot-dot */
-#define FTS_DP 6 /* postorder directory */
-#define FTS_ERR 7 /* error; errno is set */
-#define FTS_F 8 /* regular file */
-#define FTS_INIT 9 /* initialized only */
-#define FTS_NS 10 /* stat(2) failed */
-#define FTS_NSOK 11 /* no stat(2) requested */
-#define FTS_SL 12 /* symbolic link */
-#define FTS_SLNONE 13 /* symbolic link without target */
-#define FTS_W 14 /* whiteout object */
- u_short fts_info; /* user flags for FTSENT structure */
-
-#define FTS_DONTCHDIR 0x01 /* don't chdir .. to the parent */
-#define FTS_SYMFOLLOW 0x02 /* followed a symlink to get here */
-#define FTS_ISW 0x04 /* this is a whiteout object */
- u_short fts_flags; /* private flags for FTSENT structure */
-
-#define FTS_AGAIN 1 /* read node again */
-#define FTS_FOLLOW 2 /* follow symbolic link */
-#define FTS_NOINSTR 3 /* no instructions */
-#define FTS_SKIP 4 /* discard node */
- u_short fts_instr; /* fts_set() instructions */
-
- struct stat *fts_statp; /* stat(2) information */
- char fts_name[1]; /* file name */
-} FTSENT;
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-FTSENT *fts_children __P((FTS *, int));
-int fts_close __P((FTS *));
-FTS *fts_open __P((char * const *, int,
- int (*)(const FTSENT **, const FTSENT **)));
-FTSENT *fts_read __P((FTS *));
-int fts_set __P((FTS *, FTSENT *, int));
-__END_DECLS
-
-#endif /* !_FTS_H_ */
diff --git a/lib/libc/gen/pw_scan.c b/lib/libc/gen/pw_scan.c
deleted file mode 100644
index d0fb5f17d035..000000000000
--- a/lib/libc/gen/pw_scan.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/*-
- * Copyright (c) 1990, 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)pw_scan.c 8.3 (Berkeley) 4/2/94";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * This module is used to "verify" password entries by chpass(1) and
- * pwd_mkdb(8).
- */
-
-#include <sys/param.h>
-
-#include <err.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <pwd.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "pw_scan.h"
-
-/*
- * Some software assumes that IDs are short. We should emit warnings
- * for id's which can not be stored in a short, but we are more liberal
- * by default, warning for IDs greater than USHRT_MAX.
- *
- * If pw_big_ids_warning is anything other than -1 on entry to pw_scan()
- * it will be set based on the existance of PW_SCAN_BIG_IDS in the
- * environment.
- */
-int pw_big_ids_warning = -1;
-
-int
-pw_scan(bp, pw)
- char *bp;
- struct passwd *pw;
-{
- uid_t id;
- int root;
- char *p, *sh;
-
- if (pw_big_ids_warning == -1)
- pw_big_ids_warning = getenv("PW_SCAN_BIG_IDS") == NULL ? 1 : 0;
-
- pw->pw_fields = 0;
- if (!(pw->pw_name = strsep(&bp, ":"))) /* login */
- goto fmt;
- root = !strcmp(pw->pw_name, "root");
- if(pw->pw_name[0] && (pw->pw_name[0] != '+' || pw->pw_name[1] == '\0'))
- pw->pw_fields |= _PWF_NAME;
-
- if (!(pw->pw_passwd = strsep(&bp, ":"))) /* passwd */
- goto fmt;
- if(pw->pw_passwd[0]) pw->pw_fields |= _PWF_PASSWD;
-
- if (!(p = strsep(&bp, ":"))) /* uid */
- goto fmt;
- if (p[0])
- pw->pw_fields |= _PWF_UID;
- else {
- if (pw->pw_name[0] != '+' && pw->pw_name[0] != '-') {
- warnx("no uid for user %s", pw->pw_name);
- return (0);
- }
- }
- id = strtoul(p, (char **)NULL, 10);
- if (errno == ERANGE) {
- warnx("%s > max uid value (%u)", p, ULONG_MAX);
- return (0);
- }
- if (root && id) {
- warnx("root uid should be 0");
- return (0);
- }
- if (pw_big_ids_warning && id > USHRT_MAX) {
- warnx("%s > recommended max uid value (%u)", p, USHRT_MAX);
- /*return (0);*/ /* THIS SHOULD NOT BE FATAL! */
- }
- pw->pw_uid = id;
-
- if (!(p = strsep(&bp, ":"))) /* gid */
- goto fmt;
- if(p[0]) pw->pw_fields |= _PWF_GID;
- id = strtoul(p, (char **)NULL, 10);
- if (errno == ERANGE) {
- warnx("%s > max gid value (%u)", p, ULONG_MAX);
- return (0);
- }
- if (pw_big_ids_warning && id > USHRT_MAX) {
- warnx("%s > recommended max gid value (%u)", p, USHRT_MAX);
- /* return (0); This should not be fatal! */
- }
- pw->pw_gid = id;
-
- pw->pw_class = strsep(&bp, ":"); /* class */
- if(pw->pw_class[0]) pw->pw_fields |= _PWF_CLASS;
-
- if (!(p = strsep(&bp, ":"))) /* change */
- goto fmt;
- if(p[0]) pw->pw_fields |= _PWF_CHANGE;
- pw->pw_change = atol(p);
-
- if (!(p = strsep(&bp, ":"))) /* expire */
- goto fmt;
- if(p[0]) pw->pw_fields |= _PWF_EXPIRE;
- pw->pw_expire = atol(p);
-
- if (!(pw->pw_gecos = strsep(&bp, ":"))) /* gecos */
- goto fmt;
- if(pw->pw_gecos[0]) pw->pw_fields |= _PWF_GECOS;
-
- if (!(pw->pw_dir = strsep(&bp, ":"))) /* directory */
- goto fmt;
- if(pw->pw_dir[0]) pw->pw_fields |= _PWF_DIR;
-
- if (!(pw->pw_shell = strsep(&bp, ":"))) /* shell */
- goto fmt;
-
- p = pw->pw_shell;
- if (root && *p) /* empty == /bin/sh */
- for (setusershell();;) {
- if (!(sh = getusershell())) {
- warnx("warning, unknown root shell");
- break;
- }
- if (!strcmp(p, sh))
- break;
- }
- if(p[0]) pw->pw_fields |= _PWF_SHELL;
-
- if ((p = strsep(&bp, ":"))) { /* too many */
-fmt: warnx("corrupted entry");
- return (0);
- }
- return (1);
-}
diff --git a/lib/libc/gen/pw_scan.h b/lib/libc/gen/pw_scan.h
deleted file mode 100644
index 2519bd45db01..000000000000
--- a/lib/libc/gen/pw_scan.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*-
- * Copyright (c) 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- *
- * @(#)pw_scan.h 8.1 (Berkeley) 4/1/94
- *
- * $FreeBSD$
- */
-
-extern int pw_big_ids_warning;
-
-extern int pw_scan __P((char *, struct passwd *));
diff --git a/lib/libc/gen/sem_destroy.3 b/lib/libc/gen/sem_destroy.3
deleted file mode 100644
index 770349dee281..000000000000
--- a/lib/libc/gen/sem_destroy.3
+++ /dev/null
@@ -1,83 +0,0 @@
-.\" Copyright (C) 2000 Jason Evans <jasone@canonware.com>.
-.\" 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(s), this list of conditions and the following disclaimer as
-.\" the first lines of this file unmodified other than the possible
-.\" addition of one or more copyright notices.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice(s), this list of conditions and the following disclaimer in
-.\" the documentation and/or other materials provided with the
-.\" distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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.
-.\"
-.\" $FreeBSD$
-.Dd February 15, 2000
-.Dt SEM_DESTROY 3
-.Os
-.Sh NAME
-.Nm sem_destroy
-.Nd destroy an unnamed semaphore
-.Sh SYNOPSIS
-.Fd #include <semaphore.h>
-.Ft int
-.Fn sem_destroy "sem_t *sem"
-.Sh DESCRIPTION
-The
-.Fn sem_destroy
-function destroys the unnamed semaphore pointed to by
-.Fa sem .
-After a successful call to
-.Fn sem_destroy ,
-.Fa sem
-is unuseable until re-initialized by another call to
-.Fn sem_init .
-.Sh RETURN VALUES
-If successful,
-.Fn sem_destroy
-returns 0. Otherwise, -1 is returned and
-.Va errno
-is set to indicate the type of
-error.
-.Sh ERRORS
-.Fn sem_destroy
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-.Fa sem
-points to an invalid semaphore.
-.It Bq Er EBUSY
-There are currently threads blocked on the semaphore that
-.Fa sem
-points to.
-.El
-.Sh SEE ALSO
-.Xr sem_init 3
-.Sh STANDARDS
-.Fn sem_destroy
-conforms to ISO/IEC 9945-1 ANSI/IEEE
-.Pq Dq Tn POSIX
-Std 1003.1 1996 Edition.
-.Pp
-POSIX does not define the behavior of
-.Fn sem_destroy
-if called while there are threads blocked on
-.Fa sem ,
-but this implementation is guaranteed to return -1 and set
-.Va errno
-to EBUSY if there are threads blocked on
-.Fa sem .
diff --git a/lib/libc/gen/sem_getvalue.3 b/lib/libc/gen/sem_getvalue.3
deleted file mode 100644
index be0cbae8ca7b..000000000000
--- a/lib/libc/gen/sem_getvalue.3
+++ /dev/null
@@ -1,77 +0,0 @@
-.\" Copyright (C) 2000 Jason Evans <jasone@canonware.com>.
-.\" 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(s), this list of conditions and the following disclaimer as
-.\" the first lines of this file unmodified other than the possible
-.\" addition of one or more copyright notices.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice(s), this list of conditions and the following disclaimer in
-.\" the documentation and/or other materials provided with the
-.\" distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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.
-.\"
-.\" $FreeBSD$
-.Dd February 15, 2000
-.Dt SEM_GETVALUE 3
-.Os
-.Sh NAME
-.Nm sem_getvalue
-.Nd get the value of a semaphore
-.Sh SYNOPSIS
-.Fd #include <semaphore.h>
-.Ft int
-.Fn sem_getvalue "sem_t *sem" "int *sval"
-.Sh DESCRIPTION
-The
-.Fn sem_getvalue
-function sets the variable pointed to by
-.Fa sval
-to the current value of the semaphore pointed to by
-.Fa sem ,
-as of the time that the call to
-.Fn sem_getvalue
-is actually run.
-.Sh RETURN VALUES
-If successful,
-.Fn sem_getvalue
-returns 0. Otherwise, -1 is returned and
-.Va errno
-is set to indicate the type of
-error.
-.Sh ERRORS
-.Fn sem_getvalue
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-.Fa sem
-points to an invalid semaphore.
-.El
-.Sh SEE ALSO
-.Xr sem_post 3 ,
-.Xr sem_wait 3 ,
-.Xr sem_trywait 3
-.Sh STANDARDS
-.Fn sem_getvalue
-conforms to ISO/IEC 9945-1 ANSI/IEEE
-.Pq Dq Tn POSIX
-Std 1003.1 1996 Edition.
-.Pp
-The value of the semaphore is never negative, even if there are threads blocked
-on the semaphore. POSIX is somewhat ambiguous in its wording with regard to
-what the value of the semaphore should be if there are blocked waiting threads,
-but this behavior is conformant, given the wording of the specification.
diff --git a/lib/libc/gen/sem_init.3 b/lib/libc/gen/sem_init.3
deleted file mode 100644
index 059a9c6aeba5..000000000000
--- a/lib/libc/gen/sem_init.3
+++ /dev/null
@@ -1,100 +0,0 @@
-.\" Copyright (C) 2000 Jason Evans <jasone@canonware.com>.
-.\" 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(s), this list of conditions and the following disclaimer as
-.\" the first lines of this file unmodified other than the possible
-.\" addition of one or more copyright notices.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice(s), this list of conditions and the following disclaimer in
-.\" the documentation and/or other materials provided with the
-.\" distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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.
-.\"
-.\" $FreeBSD$
-.Dd February 15, 2000
-.Dt SEM_INIT 3
-.Os
-.Sh NAME
-.Nm sem_init
-.Nd initialize an unnamed semaphore
-.Sh SYNOPSIS
-.Fd #include <semaphore.h>
-.Ft int
-.Fn sem_init "sem_t *sem" "int pshared" "unsigned int value"
-.Sh DESCRIPTION
-The
-.Fn sem_init
-function initializes the unnamed semaphore pointed to by
-.Fa sem
-to have the value
-.Fa value .
-A non-zero value for
-.Fa pshared
-specifies a shared semaphore that can be used by multiple processes, which this
-implementation is not capable of.
-.Pp
-Following a successful call to
-.Fn sem_init ,
-.Fa sem
-can be used as an argument in subsequent calls to
-.Fa sem_wait ,
-.Fa sem_trywait ,
-.Fa sem_post ,
-and
-.Fa sem_destroy .
-.Fa sem
-is no longer valid after a successful call to
-.Fa sem_destroy .
-.Sh RETURN VALUES
-If successful,
-.Fn sem_init
-returns 0. Otherwise, -1 is returned and
-.Va errno
-is set to indicate the type of
-error.
-.Sh ERRORS
-.Fn sem_init
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-.Fa value
-exceeds SEM_VALUE_MAX.
-.It Bq Er ENOSPC
-Memory allocation error.
-.It Bq Er EPERM
-Unable to initialize a shared semaphore.
-.El
-.Sh SEE ALSO
-.Xr sem_wait 3 ,
-.Xr sem_trywait 3 ,
-.Xr sem_post 3 ,
-.Xr sem_destroy
-.Sh STANDARDS
-.Fn sem_init
-conforms to ISO/IEC 9945-1 ANSI/IEEE
-.Pq Dq Tn POSIX
-Std 1003.1 1996 Edition.
-.Pp
-This implementation does not support shared semaphores, and reports this fact
-by setting
-.Va errno
-to EPERM. This is perhaps a stretch of the intention of POSIX, but is
-compliant, with the caveat that
-.Fn sem_init
-always reports a permissions error when an attempt to create a shared semaphore
-is made.
diff --git a/lib/libc/gen/sem_open.3 b/lib/libc/gen/sem_open.3
deleted file mode 100644
index a4729f97961b..000000000000
--- a/lib/libc/gen/sem_open.3
+++ /dev/null
@@ -1,80 +0,0 @@
-.\" Copyright (C) 2000 Jason Evans <jasone@canonware.com>.
-.\" 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(s), this list of conditions and the following disclaimer as
-.\" the first lines of this file unmodified other than the possible
-.\" addition of one or more copyright notices.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice(s), this list of conditions and the following disclaimer in
-.\" the documentation and/or other materials provided with the
-.\" distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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.
-.\"
-.\" $FreeBSD$
-.Dd February 15, 2000
-.Dt SEM_OPEN 3
-.Os
-.Sh NAME
-.Nm sem_open ,
-.Nm sem_close ,
-.Nm sem_unlink
-.Nd named semaphore operations
-.Sh SYNOPSIS
-.Fd #include <semaphore.h>
-.Ft sem_t *
-.Fn sem_open "const char *name" "int oflag" "..."
-.Ft int
-.Fn sem_close "sem_t *sem"
-.Ft int
-.Fn sem_unlink "const char *name"
-.Sh DESCRIPTION
-The
-.Fn sem_open ,
-.Fn sem_close ,
-and
-.Fn sem_unlink
-functions are not supported by this implementation.
-.Sh RETURN VALUES
-.Fn sem_open
-returns SEM_FAILED and sets
-.Va errno
-to indicate an error.
-.Fn sem_close
-and
-.Fn sem_unlink
-return -1 and set
-.Va errno
-to indicate an error.
-.Sh ERRORS
-.Fn sem_open ,
-.Fn sem_close ,
-and
-.Fn sem_unlink
-will fail:
-.Bl -tag -width Er
-.It Bq Er ENOSYS
-Function not supported by this implementation.
-.El
-.Sh STANDARDS
-.Fn sem_open ,
-.Fn sem_close ,
-and
-.Fn sem_unlink
-conform to ISO/IEC 9945-1 ANSI/IEEE
-.Pq Dq Tn POSIX
-Std 1003.1 1996 Edition.
diff --git a/lib/libc/gen/sem_post.3 b/lib/libc/gen/sem_post.3
deleted file mode 100644
index c578e6d04e84..000000000000
--- a/lib/libc/gen/sem_post.3
+++ /dev/null
@@ -1,71 +0,0 @@
-.\" Copyright (C) 2000 Jason Evans <jasone@canonware.com>.
-.\" 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(s), this list of conditions and the following disclaimer as
-.\" the first lines of this file unmodified other than the possible
-.\" addition of one or more copyright notices.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice(s), this list of conditions and the following disclaimer in
-.\" the documentation and/or other materials provided with the
-.\" distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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.
-.\"
-.\" $FreeBSD$
-.Dd February 15, 2000
-.Dt SEM_POST 3
-.Os
-.Sh NAME
-.Nm sem_post
-.Nd increment (unlock) a semaphore
-.Sh SYNOPSIS
-.Fd #include <semaphore.h>
-.Ft int
-.Fn sem_post "sem_t *sem"
-.Sh DESCRIPTION
-The
-.Fn sem_post
-function increments (unlocks) the semaphore pointed to by
-.Fa sem .
-If there are threads blocked on the semaphore when
-.Fn sem_post
-is called, then the highest priority thread that has been blocked the longest on
-the semaphore will be allowed to return from
-.Fn sem_wait .
-.Sh RETURN VALUES
-If successful,
-.Fn sem_post
-returns 0. Otherwise, -1 is returned and
-.Va errno
-is set to indicate the type of
-error.
-.Sh ERRORS
-.Fn sem_post
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-.Fa sem
-points to an invalid semaphore.
-.El
-.Sh SEE ALSO
-.Xr sem_wait 3 ,
-.Xr sem_trywait 3
-.Sh STANDARDS
-.Fn sem_post
-conforms to ISO/IEC 9945-1 ANSI/IEEE
-.Pq Dq Tn POSIX
-Std 1003.1 1996 Edition.
diff --git a/lib/libc/gen/sem_wait.3 b/lib/libc/gen/sem_wait.3
deleted file mode 100644
index c60c8ee6cc67..000000000000
--- a/lib/libc/gen/sem_wait.3
+++ /dev/null
@@ -1,92 +0,0 @@
-.\" Copyright (C) 2000 Jason Evans <jasone@canonware.com>.
-.\" 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(s), this list of conditions and the following disclaimer as
-.\" the first lines of this file unmodified other than the possible
-.\" addition of one or more copyright notices.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice(s), this list of conditions and the following disclaimer in
-.\" the documentation and/or other materials provided with the
-.\" distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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.
-.\"
-.\" $FreeBSD$
-.Dd February 15, 2000
-.Dt SEM_WAIT 3
-.Os
-.Sh NAME
-.Nm sem_wait ,
-.Nm sem_trywait
-.Nd decrement (lock) a semaphore
-.Sh SYNOPSIS
-.Fd #include <semaphore.h>
-.Ft int
-.Fn sem_wait "sem_t *sem"
-.Ft int
-.Fn sem_trywait "sem_t *sem"
-.Sh DESCRIPTION
-The
-.Fn sem_wait
-function decrements (locks) the semaphore pointed to by
-.Fa sem ,
-but blocks if the value of
-.Fa sem
-is zero, until the value is non-zero and the value can be decremented.
-.Pp
-The
-.Fn sem_trywait
-function decrements (locks) the semaphore pointed to by
-.Fa sem
-only if the value is non-zero. Otherwise, the semaphore is not decremented and
-an error is returned.
-.Sh RETURN VALUES
-If successful,
-.Fn sem_wait
-and
-.Fn sem_trywait
-return 0. Otherwise, -1 is returned and
-.Va errno
-is set to indicate the type of
-error.
-.Sh ERRORS
-.Fn sem_wait
-and
-.Fn sem_trywait
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-.Fa sem
-points to an invalid semaphore.
-.El
-.Pp
-Additionally,
-.Fn sem_trywait
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EAGAIN
-The semaphore value was zero, and thus could not be decremented.
-.El
-.Sh SEE ALSO
-.Xr sem_post 3
-.Sh STANDARDS
-.Fn sem_wait
-and
-.Fn sem_trywait
-conform to ISO/IEC 9945-1 ANSI/IEEE
-.Pq Dq Tn POSIX
-Std 1003.1 1996 Edition.
diff --git a/lib/libc/gen/setflagsbyname.3 b/lib/libc/gen/setflagsbyname.3
deleted file mode 100644
index 09c6208c3b08..000000000000
--- a/lib/libc/gen/setflagsbyname.3
+++ /dev/null
@@ -1,78 +0,0 @@
-.\" Copyright (c) 1989, 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. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" 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.
-.\"
-.\" @(#)setmode.3 8.2 (Berkeley) 4/28/95
-.\" $FreeBSD$
-.\"
-.Dd January 1, 2000
-.Dt SETFLAGS 3
-.Os
-.Sh NAME
-.Nm getflags ,
-.Nm setflags
-.Nd modify file flag bits
-.Sh SYNOPSIS
-.Fd #include <unistd.h>
-.Ft char *
-.Fn getflags "u_long flags" "char *def"
-.Ft int
-.Fn setflags "char **stringp" "u_long *setp" "u_long *clrp"
-.Sh DESCRIPTION
-The
-.Fn getflags
-function returns a comma separated string of the file flags represented by
-.Fa flags .
-If no flags are set the string
-.Fa def
-is returned instead.
-.Pp
-The
-.Fn setflags
-function takes a string of file flags, as described in
-.Xr chflags 1 ,
-parses it, and returns the 'set' flags and 'clear' flags
-such as would be given as arguments to
-.Xr chflags 2 .
-On success
-.Fn setflags
-returns 0, otherwise it returns non-zero and
-.Fa stringp
-is left pointing to the offending token.
-.Sh SEE ALSO
-.Xr chflags 1 ,
-.Xr chflags 2 ,
-.Sh HISTORY
-The
-.Fn getflags
-and
-.Fn setflags
-functions first appeared in
-.Fx 4.0 .
diff --git a/lib/libc/gen/setflagsbyname.c b/lib/libc/gen/setflagsbyname.c
deleted file mode 100644
index c1fe6c56adeb..000000000000
--- a/lib/libc/gen/setflagsbyname.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/*-
- * Copyright (c) 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)stat_flags.c 8.1 (Berkeley) 5/31/93";
-#else
-static const char rcsid[] =
- "$FreeBSD$";
-#endif
-#endif /* not lint */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <stddef.h>
-#include <string.h>
-
-static struct {
- char *name;
- u_long flag;
- int invert;
-} mapping[] = {
- /* shorter names per flag first, all prefixed by "no" */
- { "nosappnd", SF_APPEND, 0 },
- { "nosappend", SF_APPEND, 0 },
- { "noarch", SF_ARCHIVED, 0 },
- { "noarchived", SF_ARCHIVED, 0 },
- { "noschg", SF_IMMUTABLE, 0 },
- { "noschange", SF_IMMUTABLE, 0 },
- { "nosimmutable", SF_IMMUTABLE, 0 },
- { "nosunlnk", SF_NOUNLINK, 0 },
- { "nosunlink", SF_NOUNLINK, 0 },
- { "nouappnd", UF_APPEND, 0 },
- { "nouappend", UF_APPEND, 0 },
- { "nouchg", UF_IMMUTABLE, 0 },
- { "nouchange", UF_IMMUTABLE, 0 },
- { "nouimmutable", UF_IMMUTABLE, 0 },
- { "nodump", UF_NODUMP, 1 },
- { "noopaque", UF_OPAQUE, 0 },
- { "nouunlnk", UF_NOUNLINK, 0 },
- { "nouunlink", UF_NOUNLINK, 0 }
-};
-#define nmappings (sizeof(mapping) / sizeof(mapping[0]))
-
-/*
- * getflags --
- * Convert stat flags to a comma-separated string. If no flags
- * are set, return the default string.
- */
-char *
-getflags(flags, def)
- u_long flags;
- char *def;
-{
- static char string[128];
- char *sp, *dp;
- u_long setflags;
- int i;
-
- setflags = flags;
- dp = string;
- for (i = 0; i < nmappings; i++) {
- if (setflags & mapping[i].flag) {
- if (dp > string)
- *dp++ = ',';
- for (sp = mapping[i].invert ? mapping[i].name :
- mapping[i].name + 2; *sp; *dp++ = *sp++) ;
- setflags &= ~mapping[i].flag;
- }
- }
- *dp = '\0';
- return (dp == string && def != NULL ? def : string);
-}
-
-/*
- * setflags --
- * Take string of arguments and return stat flags. Return 0 on
- * success, 1 on failure. On failure, stringp is set to point
- * to the offending token.
- */
-int
-setflags(stringp, setp, clrp)
- char **stringp;
- u_long *setp, *clrp;
-{
- char *string, *p;
- int i;
-
- if (setp)
- *setp = 0;
- if (clrp)
- *clrp = 0;
- string = *stringp;
- while ((p = strsep(&string, "\t ,")) != NULL) {
- *stringp = p;
- if (*p == '\0')
- continue;
- for (i = 0; i < nmappings; i++) {
- if (strcmp(p, mapping[i].name + 2) == 0) {
- if (mapping[i].invert) {
- if (clrp)
- *clrp |= mapping[i].flag;
- } else {
- if (setp)
- *setp |= mapping[i].flag;
- }
- break;
- } else if (strcmp(p, mapping[i].name) == 0) {
- if (mapping[i].invert) {
- if (setp)
- *setp |= mapping[i].flag;
- } else {
- if (clrp)
- *clrp |= mapping[i].flag;
- }
- break;
- }
- }
- if (i == nmappings)
- return 1;
- }
- return 0;
-}
diff --git a/lib/libc/gen/setproctitle.3 b/lib/libc/gen/setproctitle.3
deleted file mode 100644
index 10eae654736a..000000000000
--- a/lib/libc/gen/setproctitle.3
+++ /dev/null
@@ -1,101 +0,0 @@
-.\" Copyright (c) 1995 Peter Wemm <peter@freebsd.org>
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, is permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice immediately at the beginning of the file, without modification,
-.\" 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. This work was done expressly for inclusion into FreeBSD. Other use
-.\" is permitted provided this notation is included.
-.\" 4. Absolutely no warranty of function or purpose is made by the author
-.\" Peter Wemm.
-.\" 5. Modifications may be freely made to this file providing the above
-.\" conditions are met.
-.\"
-.\" $FreeBSD$
-.\"
-.\" The following requests are required for all man pages.
-.Dd December 16, 1995
-.Os FreeBSD
-.Dt SETPROCTITLE 3
-.Sh NAME
-.Nm setproctitle
-.Nd set the process title for
-.Xr ps 1
-.Sh SYNOPSIS
-.Fd #include <sys/types.h>
-.Fd #include <libutil.h>
-.Ft void
-.Fn setproctitle "const char *fmt" "..."
-.Pp
-Link with
-.Va -lutil
-on the
-.Xr cc 1
-command line.
-.Sh DESCRIPTION
-The
-.Fn setproctitle
-library routine sets the process title that appears on the
-.Xr ps 1
-command.
-.Pp
-The title is set from the executable's name, followed by the
-result of a
-.Xr printf 3
-style expansion of the arguments as specified by the
-.Va fmt
-argument.
-.Pp
-If
-.Va fmt
-is NULL, the process title is restored.
-.Sh EXAMPLES
-To set the title on a daemon to indicate its activity:
-.Bd -literal -offset indent
-setproctitle("talking to %s", inet_ntoa(addr));
-.Ed
-.Sh SEE ALSO
-.Xr ps 1 ,
-.Xr w 1 ,
-.Xr kvm 3 ,
-.Xr kvm_getargv 3 ,
-.Xr printf 3
-.Sh STANDARDS
-.Fn setproctitle
-is implicitly non-standard. Other methods of causing the
-.Xr ps 1
-command line to change, including copying over the argv[0] string are
-also implicitly non-portable. It is preferable to use an operating system
-supplied
-.Fn setproctitle
-if present.
-.Pp
-Unfortunately, it is possible that there are other calling conventions
-to other versions of
-.Fn setproctitle ,
-although none have been found by the author as yet. This is believed to be
-the predominant convention.
-.Pp
-It is thought that the implementation is compatible with other systems,
-including
-.Nx
-and
-.Tn BSD/OS .
-.Sh HISTORY
-.Fn setproctitle
-first appeared in
-.Fx 2.2 .
-Other operating systems have
-similar functions.
-.Sh AUTHORS
-.An Peter Wemm Aq peter@FreeBSD.org
-stole the idea from the
-.Sy "Sendmail 8.7.3"
-source code by
-.An Eric Allman Aq eric@sendmail.org .
diff --git a/lib/libc/gen/setproctitle.c b/lib/libc/gen/setproctitle.c
deleted file mode 100644
index 37b9fab52b3a..000000000000
--- a/lib/libc/gen/setproctitle.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright (c) 1995 Peter Wemm <peter@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, is permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice immediately at the beginning of the file, without modification,
- * 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. Absolutely no warranty of function or purpose is made by the author
- * Peter Wemm.
- *
- * $FreeBSD$
- */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/exec.h>
-#include <sys/sysctl.h>
-
-#include <vm/vm.h>
-#include <vm/vm_param.h>
-#include <vm/pmap.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-/*
- * Older FreeBSD 2.0, 2.1 and 2.2 had different ps_strings structures and
- * in different locations.
- * 1: old_ps_strings at the very top of the stack.
- * 2: old_ps_strings at SPARE_USRSPACE below the top of the stack.
- * 3: ps_strings at the very top of the stack.
- * This attempts to support a kernel built in the #2 and #3 era.
- */
-
-struct old_ps_strings {
- char *old_ps_argvstr;
- int old_ps_nargvstr;
- char *old_ps_envstr;
- int old_ps_nenvstr;
-};
-#define OLD_PS_STRINGS ((struct old_ps_strings *) \
- (USRSTACK - SPARE_USRSPACE - sizeof(struct old_ps_strings)))
-
-#if defined(__STDC__) /* from other parts of sendmail */
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-
-#define SPT_BUFSIZE 2048 /* from other parts of sendmail */
-extern char * __progname; /* is this defined in a .h anywhere? */
-
-void
-#if defined(__STDC__)
-setproctitle(const char *fmt, ...)
-#else
-setproctitle(fmt, va_alist)
- const char *fmt;
- va_dcl
-#endif
-{
- static struct ps_strings *ps_strings;
- static char buf[SPT_BUFSIZE];
- static char obuf[SPT_BUFSIZE];
- static char **oargv, *kbuf;
- static int oargc = -1;
- static char *nargv[2] = { buf, NULL };
- char **nargvp;
- int nargc;
- va_list ap;
- size_t len;
- unsigned long ul_ps_strings;
- int oid[4];
-
-#if defined(__STDC__)
- va_start(ap, fmt);
-#else
- va_start(ap);
-#endif
-
- if (fmt) {
- buf[sizeof(buf) - 1] = '\0';
-
- /* print program name heading for grep */
- (void) snprintf(buf, sizeof(buf), "%s: ", __progname);
-
- /*
- * can't use return from sprintf, as that is the count of how
- * much it wanted to write, not how much it actually did.
- */
-
- len = strlen(buf);
-
- /* print the argument string */
- (void) vsnprintf(buf + len, sizeof(buf) - len, fmt, ap);
-
- nargvp = nargv;
- nargc = 1;
- kbuf = buf;
- } else if (*obuf != '\0') {
- /* Idea from NetBSD - reset the title on fmt == NULL */
- nargvp = oargv;
- nargc = oargc;
- kbuf = obuf;
- } else
- /* Nothing to restore */
- return;
-
- va_end(ap);
-
- /* Set the title into the kernel cached command line */
- oid[0] = CTL_KERN;
- oid[1] = KERN_PROC;
- oid[2] = KERN_PROC_ARGS;
- oid[3] = getpid();
- sysctl(oid, 4, 0, 0, kbuf, strlen(kbuf) + 1);
-
- if (ps_strings == NULL) {
- len = sizeof(ul_ps_strings);
- if (sysctlbyname("kern.ps_strings", &ul_ps_strings, &len, NULL,
- 0) == -1)
- ul_ps_strings = PS_STRINGS;
- ps_strings = (struct ps_strings *)ul_ps_strings;
- }
-
- /* PS_STRINGS points to zeroed memory on a style #2 kernel */
- if (ps_strings->ps_argvstr) {
- /* style #3 */
- if (oargc == -1) {
- /* Record our original args */
- oargc = ps_strings->ps_nargvstr;
- oargv = ps_strings->ps_argvstr;
- for (nargc = len = 0; nargc < oargc; nargc++) {
- snprintf(obuf + len, sizeof(obuf) - len, "%s%s",
- len ? " " : "", oargv[nargc]);
- if (len)
- len++;
- len += strlen(oargv[nargc]);
- if (len >= sizeof(obuf))
- break;
- }
- }
- ps_strings->ps_nargvstr = nargc;
- ps_strings->ps_argvstr = nargvp;
- } else {
- /* style #2 - we can only restore our first arg :-( */
- if (*obuf == '\0')
- strncpy(obuf, OLD_PS_STRINGS->old_ps_argvstr,
- sizeof(obuf) - 1);
- OLD_PS_STRINGS->old_ps_nargvstr = 1;
- OLD_PS_STRINGS->old_ps_argvstr = nargvp[0];
- }
-}
diff --git a/lib/libc/gen/strtofflags.3 b/lib/libc/gen/strtofflags.3
deleted file mode 100644
index 09c6208c3b08..000000000000
--- a/lib/libc/gen/strtofflags.3
+++ /dev/null
@@ -1,78 +0,0 @@
-.\" Copyright (c) 1989, 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. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" 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.
-.\"
-.\" @(#)setmode.3 8.2 (Berkeley) 4/28/95
-.\" $FreeBSD$
-.\"
-.Dd January 1, 2000
-.Dt SETFLAGS 3
-.Os
-.Sh NAME
-.Nm getflags ,
-.Nm setflags
-.Nd modify file flag bits
-.Sh SYNOPSIS
-.Fd #include <unistd.h>
-.Ft char *
-.Fn getflags "u_long flags" "char *def"
-.Ft int
-.Fn setflags "char **stringp" "u_long *setp" "u_long *clrp"
-.Sh DESCRIPTION
-The
-.Fn getflags
-function returns a comma separated string of the file flags represented by
-.Fa flags .
-If no flags are set the string
-.Fa def
-is returned instead.
-.Pp
-The
-.Fn setflags
-function takes a string of file flags, as described in
-.Xr chflags 1 ,
-parses it, and returns the 'set' flags and 'clear' flags
-such as would be given as arguments to
-.Xr chflags 2 .
-On success
-.Fn setflags
-returns 0, otherwise it returns non-zero and
-.Fa stringp
-is left pointing to the offending token.
-.Sh SEE ALSO
-.Xr chflags 1 ,
-.Xr chflags 2 ,
-.Sh HISTORY
-The
-.Fn getflags
-and
-.Fn setflags
-functions first appeared in
-.Fx 4.0 .
diff --git a/lib/libc/gen/strtofflags.c b/lib/libc/gen/strtofflags.c
deleted file mode 100644
index c1fe6c56adeb..000000000000
--- a/lib/libc/gen/strtofflags.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/*-
- * Copyright (c) 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)stat_flags.c 8.1 (Berkeley) 5/31/93";
-#else
-static const char rcsid[] =
- "$FreeBSD$";
-#endif
-#endif /* not lint */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <stddef.h>
-#include <string.h>
-
-static struct {
- char *name;
- u_long flag;
- int invert;
-} mapping[] = {
- /* shorter names per flag first, all prefixed by "no" */
- { "nosappnd", SF_APPEND, 0 },
- { "nosappend", SF_APPEND, 0 },
- { "noarch", SF_ARCHIVED, 0 },
- { "noarchived", SF_ARCHIVED, 0 },
- { "noschg", SF_IMMUTABLE, 0 },
- { "noschange", SF_IMMUTABLE, 0 },
- { "nosimmutable", SF_IMMUTABLE, 0 },
- { "nosunlnk", SF_NOUNLINK, 0 },
- { "nosunlink", SF_NOUNLINK, 0 },
- { "nouappnd", UF_APPEND, 0 },
- { "nouappend", UF_APPEND, 0 },
- { "nouchg", UF_IMMUTABLE, 0 },
- { "nouchange", UF_IMMUTABLE, 0 },
- { "nouimmutable", UF_IMMUTABLE, 0 },
- { "nodump", UF_NODUMP, 1 },
- { "noopaque", UF_OPAQUE, 0 },
- { "nouunlnk", UF_NOUNLINK, 0 },
- { "nouunlink", UF_NOUNLINK, 0 }
-};
-#define nmappings (sizeof(mapping) / sizeof(mapping[0]))
-
-/*
- * getflags --
- * Convert stat flags to a comma-separated string. If no flags
- * are set, return the default string.
- */
-char *
-getflags(flags, def)
- u_long flags;
- char *def;
-{
- static char string[128];
- char *sp, *dp;
- u_long setflags;
- int i;
-
- setflags = flags;
- dp = string;
- for (i = 0; i < nmappings; i++) {
- if (setflags & mapping[i].flag) {
- if (dp > string)
- *dp++ = ',';
- for (sp = mapping[i].invert ? mapping[i].name :
- mapping[i].name + 2; *sp; *dp++ = *sp++) ;
- setflags &= ~mapping[i].flag;
- }
- }
- *dp = '\0';
- return (dp == string && def != NULL ? def : string);
-}
-
-/*
- * setflags --
- * Take string of arguments and return stat flags. Return 0 on
- * success, 1 on failure. On failure, stringp is set to point
- * to the offending token.
- */
-int
-setflags(stringp, setp, clrp)
- char **stringp;
- u_long *setp, *clrp;
-{
- char *string, *p;
- int i;
-
- if (setp)
- *setp = 0;
- if (clrp)
- *clrp = 0;
- string = *stringp;
- while ((p = strsep(&string, "\t ,")) != NULL) {
- *stringp = p;
- if (*p == '\0')
- continue;
- for (i = 0; i < nmappings; i++) {
- if (strcmp(p, mapping[i].name + 2) == 0) {
- if (mapping[i].invert) {
- if (clrp)
- *clrp |= mapping[i].flag;
- } else {
- if (setp)
- *setp |= mapping[i].flag;
- }
- break;
- } else if (strcmp(p, mapping[i].name) == 0) {
- if (mapping[i].invert) {
- if (setp)
- *setp |= mapping[i].flag;
- } else {
- if (clrp)
- *clrp |= mapping[i].flag;
- }
- break;
- }
- }
- if (i == nmappings)
- return 1;
- }
- return 0;
-}
diff --git a/lib/libc/locale/euc.5 b/lib/libc/locale/euc.5
deleted file mode 100644
index ce319ba37ff4..000000000000
--- a/lib/libc/locale/euc.5
+++ /dev/null
@@ -1,242 +0,0 @@
-.\" Copyright (c) 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Paul Borman at Krystal Technologies.
-.\"
-.\" 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 University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" 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.
-.\"
-.\" @(#)euc.4 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd June 4, 1993
-.Dt EUC 4
-.Os
-.Sh NAME
-.Nm euc
-.Nd EUC encoding of runes
-.Sh SYNOPSIS
-.Nm ENCODING
-.Qq EUC
-.Pp
-.Nm VARIABLE
-.Ar len1
-.Ar mask1
-.Ar len2
-.Ar mask2
-.Ar len3
-.Ar mask3
-.Ar len4
-.Ar mask4
-.Ar mask
-.Sh DESCRIPTION
-The
-.Nm EUC
-encoding is provided for compatibility with
-.Ux
-based systems.
-See
-.Xr mklocale 1
-for a complete description of the
-.Ev LC_CTYPE
-source file format.
-.Pp
-.Nm EUC
-implements a system of 4 multibyte codesets.
-A multibyte character in the first codeset consists of
-.Ar len1
-bytes starting with a byte in the range of 0x00 to 0x7f.
-To allow use of ASCII,
-.Ar len1
-is always 1.
-A multibyte character in the second codeset consists of
-.Ar len2
-bytes starting with a byte in the range of 0x80-0xff excluding 0x8e and 0x8f.
-A multibyte character in the third codeset consists of
-.Ar len3
-bytes starting with the byte 0x8e.
-A multibyte character in the fourth codeset consists of
-.Ar len4
-bytes starting with the byte 0x8f.
-.Pp
-The
-.Ev rune_t
-encoding of
-.Nm EUC
-multibyte characters is dependent on the
-.Ar len
-and
-.Ar mask
-arguments.
-First, the bytes are moved into a
-.Ev rune_t
-as follows:
-.Bd -literal
-byte0 << ((\fIlen\fPN-1) * 8) | byte1 << ((\fIlen\fPN-2) * 8) | ... | byte\fIlen\fPN-1
-.Ed
-.Pp
-The result is then ANDed with
-.Ar ~mask
-and ORed with
-.Ar maskN .
-Codesets 2 and 3 are special in that the leading byte (0x8e or 0x8f) is
-first removed and the
-.Ar lenN
-argument is reduced by 1.
-.Pp
-For example, the Japanese locale has the following
-.Ev VARIABLE
-line:
-.Bd -literal
-VARIABLE 1 0x0000 2 0x8080 2 0x0080 3 0x8000 0x8080
-.Ed
-.Pp
-Codeset 1 consists of the values 0x0000 - 0x007f.
-.Pp
-Codeset 2 consists of the values who have the bits 0x8080 set.
-.Pp
-Codeset 3 consists of the values 0x0080 - 0x00ff.
-.Pp
-Codeset 4 consists of the values 0x8000 - 0xff7f excluding the values
-which have the 0x0080 bit set.
-.Pp
-Notice that the global
-.Ar mask
-is set to 0x8080, this implies that from those 2 bits the codeset can
-be determined.
-.Sh "EXAMPLE - Japanese Locale"
-This is a complete example of an
-.Ev LC_CTYPE
-source file for the Japanese locale
-.Bd -literal
-/*
- * Japanese LOCALE_CTYPE definitions using EUC of JIS character sets
- */
-
-ENCODING "EUC"
-
-/* JIS JIS JIS */
-/* X201 X208 X201 */
-/* 00-7f 84-fe */
-
-VARIABLE 1 0x0000 2 0x8080 2 0x0080 3 0x8000 0x8080
-
-/*
- * Code Set 1
- */
-ALPHA 'A' - 'Z' 'a' - 'z'
-CONTROL 0x00 - 0x1f 0x7f
-DIGIT '0' - '9'
-GRAPH 0x21 - 0x7e
-LOWER 'a' - 'z'
-PUNCT 0x21 - 0x2f 0x3a - 0x40 0x5b - 0x60 0x7b - 0x7e
-SPACE 0x09 - 0x0d 0x20
-UPPER 'A' - 'Z'
-XDIGIT 'a' - 'f' 'A' - 'F'
-BLANK ' ' '\t'
-PRINT 0x20 - 0x7e
-
-MAPLOWER < 'A' - 'Z' : 'a' > < 'a' - 'z' : 'a' >
-MAPUPPER < 'A' - 'Z' : 'A' > < 'a' - 'z' : 'A' >
-TODIGIT < '0' - '9' : 0 >
-TODIGIT < 'A' - 'F' : 10 > < 'a' - 'f' : 10 >
-
-/*
- * Code Set 2
- */
-
-SPACE 0xa1a1
-PHONOGRAM 0xa1bc
-SPECIAL 0xa1a2 - 0xa1fe
-PUNCT 0xa1a2 - 0xa1f8 /* A few too many in here... */
-
-SPECIAL 0xa2a1 - 0xa2ae 0xa2ba - 0xa2c1 0xa2ca - 0xa2d0 0xa2dc - 0xa2ea
-SPECIAL 0xa2f2 - 0xa2f9 0xa2fe
-
-DIGIT 0xa3b0 - 0xa3b9
-UPPER 0xa3c1 - 0xa3da /* Romaji */
-LOWER 0xa3e1 - 0xa3fa /* Romaji */
-MAPLOWER < 0xa3c1 - 0xa3da : 0xa3e1 > /* English */
-MAPLOWER < 0xa3e1 - 0xa3fa : 0xa3e1 > /* English */
-MAPUPPER < 0xa3c1 - 0xa3da : 0xa3c1 >
-MAPUPPER < 0xa3e1 - 0xa3fa : 0xa3c1 >
-
-XDIGIT 0xa3c1 - 0xa3c6 0xa3e1 - 0xa3e6
-
-TODIGIT < 0xa3b0 - 0xa3b9 : 0 >
-TODIGIT < 0xa3c1 - 0xa3c6 : 10 > < 0xa3e1 - 0xa3e6 : 10 >
-
-PHONOGRAM 0xa4a1 - 0xa4f3
-PHONOGRAM 0xa5a1 - 0xa5f6
-
-UPPER 0xa6a1 - 0xa6b8 /* Greek */
-LOWER 0xa6c1 - 0xa6d8 /* Greek */
-MAPLOWER < 0xa6a1 - 0xa6b8 : 0xa6c1 > < 0xa6c1 - 0xa6d8 : 0xa6c1 >
-MAPUPPER < 0xa6a1 - 0xa6b8 : 0xa6a1 > < 0xa6c1 - 0xa6d8 : 0xa6a1 >
-
-UPPER 0xa7a1 - 0xa7c1 /* Cyrillic */
-LOWER 0xa7d1 - 0xa7f1 /* Cyrillic */
-MAPLOWER < 0xa7a1 - 0xa7c1 : 0xa7d1 > < 0xa7d1 - 0xa7f1 : 0xa7d1 >
-MAPUPPER < 0xa7a1 - 0xa7c1 : 0xa7a1 > < 0xa7d1 - 0xa7f1 : 0xa7a1 >
-
-SPECIAL 0xa8a1 - 0xa8c0
-
-IDEOGRAM 0xb0a1 - 0xb0fe 0xb1a1 - 0xb1fe 0xb2a1 - 0xb2fe
-IDEOGRAM 0xb3a1 - 0xb3fe 0xb4a1 - 0xb4fe 0xb5a1 - 0xb5fe
-IDEOGRAM 0xb6a1 - 0xb6fe 0xb7a1 - 0xb7fe 0xb8a1 - 0xb8fe
-IDEOGRAM 0xb9a1 - 0xb9fe 0xbaa1 - 0xbafe 0xbba1 - 0xbbfe
-IDEOGRAM 0xbca1 - 0xbcfe 0xbda1 - 0xbdfe 0xbea1 - 0xbefe
-IDEOGRAM 0xbfa1 - 0xbffe 0xc0a1 - 0xc0fe 0xc1a1 - 0xc1fe
-IDEOGRAM 0xc2a1 - 0xc2fe 0xc3a1 - 0xc3fe 0xc4a1 - 0xc4fe
-IDEOGRAM 0xc5a1 - 0xc5fe 0xc6a1 - 0xc6fe 0xc7a1 - 0xc7fe
-IDEOGRAM 0xc8a1 - 0xc8fe 0xc9a1 - 0xc9fe 0xcaa1 - 0xcafe
-IDEOGRAM 0xcba1 - 0xcbfe 0xcca1 - 0xccfe 0xcda1 - 0xcdfe
-IDEOGRAM 0xcea1 - 0xcefe 0xcfa1 - 0xcfd3 0xd0a1 - 0xd0fe
-IDEOGRAM 0xd1a1 - 0xd1fe 0xd2a1 - 0xd2fe 0xd3a1 - 0xd3fe
-IDEOGRAM 0xd4a1 - 0xd4fe 0xd5a1 - 0xd5fe 0xd6a1 - 0xd6fe
-IDEOGRAM 0xd7a1 - 0xd7fe 0xd8a1 - 0xd8fe 0xd9a1 - 0xd9fe
-IDEOGRAM 0xdaa1 - 0xdafe 0xdba1 - 0xdbfe 0xdca1 - 0xdcfe
-IDEOGRAM 0xdda1 - 0xddfe 0xdea1 - 0xdefe 0xdfa1 - 0xdffe
-IDEOGRAM 0xe0a1 - 0xe0fe 0xe1a1 - 0xe1fe 0xe2a1 - 0xe2fe
-IDEOGRAM 0xe3a1 - 0xe3fe 0xe4a1 - 0xe4fe 0xe5a1 - 0xe5fe
-IDEOGRAM 0xe6a1 - 0xe6fe 0xe7a1 - 0xe7fe 0xe8a1 - 0xe8fe
-IDEOGRAM 0xe9a1 - 0xe9fe 0xeaa1 - 0xeafe 0xeba1 - 0xebfe
-IDEOGRAM 0xeca1 - 0xecfe 0xeda1 - 0xedfe 0xeea1 - 0xeefe
-IDEOGRAM 0xefa1 - 0xeffe 0xf0a1 - 0xf0fe 0xf1a1 - 0xf1fe
-IDEOGRAM 0xf2a1 - 0xf2fe 0xf3a1 - 0xf3fe 0xf4a1 - 0xf4a4
-/*
- * This is for Code Set 3, half-width kana
- */
-SPECIAL 0xa1 - 0xdf
-PHONOGRAM 0xa1 - 0xdf
-CONTROL 0x84 - 0x97 0x9b - 0x9f 0xe0 - 0xfe
-.Ed
-.Sh "SEE ALSO"
-.Xr mklocale 1 ,
-.Xr setlocale 3
diff --git a/lib/libc/locale/utf2.5 b/lib/libc/locale/utf2.5
deleted file mode 100644
index 3734dbab1669..000000000000
--- a/lib/libc/locale/utf2.5
+++ /dev/null
@@ -1,88 +0,0 @@
-.\" Copyright (c) 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Paul Borman at Krystal Technologies.
-.\"
-.\" 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 University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" 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.
-.\"
-.\" @(#)utf2.4 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd June 4, 1993
-.Dt UTF2 4
-.Os
-.Sh NAME
-.Nm utf2
-.Nd "Universal character set Transformation Format encoding of runes
-.Sh SYNOPSIS
-.Nm ENCODING
-.Qq UTF2
-.Sh DESCRIPTION
-The
-.Nm UTF2
-encoding is based on a proposed X-Open multibyte
-\s-1FSS-UCS-TF\s+1 (File System Safe Universal Character Set Transformation Format) encoding as used in
-.Nm Plan 9 from Bell Labs.
-Although it is capable of representing more than 16 bits,
-the current implementation is limited to 16 bits as defined by the
-Unicode Standard.
-.Pp
-.Nm UTF2
-representation is backwards compatible with ASCII, so 0x00-0x7f refer to the
-ASCII character set. The multibyte encoding of runes between 0x0080 and 0xffff
-consist entirely of bytes whose high order bit is set. The actual
-encoding is represented by the following table:
-.Bd -literal
-[0x0000 - 0x007f] [00000000.0bbbbbbb] -> 0bbbbbbb
-[0x0080 - 0x07ff] [00000bbb.bbbbbbbb] -> 110bbbbb, 10bbbbbb
-[0x0800 - 0xffff] [bbbbbbbb.bbbbbbbb] -> 1110bbbb, 10bbbbbb, 10bbbbbb
-.Ed
-.Pp
-If more than a single representation of a value exists (for example,
-0x00; 0xC0 0x80; 0xE0 0x80 0x80) the shortest representation is always
-used (but the longer ones will be correctly decoded).
-.Pp
-The final three encodings provided by X-Open:
-.Bd -literal
-[00000000.000bbbbb.bbbbbbbb.bbbbbbbb] ->
- 11110bbb, 10bbbbbb, 10bbbbbb, 10bbbbbb
-
-[000000bb.bbbbbbbb.bbbbbbbb.bbbbbbbb] ->
- 111110bb, 10bbbbbb, 10bbbbbb, 10bbbbbb, 10bbbbbb
-
-[0bbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb] ->
- 1111110b, 10bbbbbb, 10bbbbbb, 10bbbbbb, 10bbbbbb, 10bbbbbb
-.Ed
-.Pp
-which provides for the entire proposed ISO-10646 31 bit standard are currently
-not implemented.
-.Sh "SEE ALSO"
-.Xr mklocale 1 ,
-.Xr setlocale 3
diff --git a/lib/libc/posix1e/Makefile b/lib/libc/posix1e/Makefile
deleted file mode 100644
index 43a8a35b503f..000000000000
--- a/lib/libc/posix1e/Makefile
+++ /dev/null
@@ -1,38 +0,0 @@
-# $FreeBSD$
-
-LIB= posix1e
-SRCS+= acl_delete.c \
- acl_free.c \
- acl_from_text.c \
- acl_get.c \
- acl_init.c \
- acl_set.c \
- acl_support.c \
- acl_to_text.c \
- acl_valid.c
-
-MAN3= acl.3 \
- acl_delete.3 \
- acl_dup.3 \
- acl_free.3 \
- acl_from_text.3 \
- acl_get.3 \
- acl_init.3 \
- acl_set.3 \
- acl_to_text.3 \
- acl_valid.3 \
- posix1e.3
-
-MLINKS+=acl_delete.3 acl_delete_def_file.3 \
- acl_delete.3 acl_delete_file_np.3 \
- acl_delete.3 acl_delete_fd_np.3 \
- acl_get.3 acl_get_file.3 \
- acl_get.3 acl_get_fd.3 \
- acl_get.3 acl_get_fd_np.3 \
- acl_set.3 acl_set_file.3 \
- acl_set.3 acl_set_fd.3 \
- acl_set.3 acl_set_fd_np.3 \
- acl_valid.3 acl_valid_file_np.3 \
- acl_valid.3 acl_valid_fd_np.3
-
-.include <bsd.lib.mk>
diff --git a/lib/libc/posix1e/acl.3 b/lib/libc/posix1e/acl.3
deleted file mode 100644
index 20208fabeb15..000000000000
--- a/lib/libc/posix1e/acl.3
+++ /dev/null
@@ -1,180 +0,0 @@
-.\"-
-.\" Copyright (c) 2000 Robert N. M. Watson
-.\" 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.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd January 28, 2000
-.Dt ACL 3
-.Os FreeBSD 4.0
-.Sh NAME
-.Nm acl
-.Nd introduction to the POSIX.1e ACL security API
-.Sh SYNOPSIS
-.Fd #include <sys/types.h>
-.Fd #include <sys/acl.h>
-.Sh DESCRIPTION
-As shipped,
-.Fx 4.0
-permits file systems to export
-Access Control Lists via the VFS, and provides a library for userland
-access to and manipulation of these ACLs, but support for ACLs is not
-provided by any file systems shipped in the base operating system.
-The library calls shipped with 4.0 include routines to allocate,
-duplicate, retrieve, set, and validate ACLs associated with file objects.
-As well as the POSIX.1e routines, there are a number of non-portable
-extensions defined that allow for alternative ACL semantics than the
-POSIX.1e semantics, such as AFS, NTFS, Coda, and NWFS semantics. Where
-routines are non-standard, they are suffixed with _np to indicate that
-they are not portable.
-
-POSIX.1e describes a set of ACL manipulation routines to manage the
-contents of ACLs, as well as their relationships with files. This
-manipulation library is not currently implemented in FreeBSD, although
-a third party library was under development at the time this document
-was written. There is a general consensus that the POSIX.1e manipulation
-routines are ambiguously defined in the specification, and don't meet the
-needs of most applications. For the time being, applications may
-directly manipulate the ACL structures, defined in acl.h, although the
-recommended usage is to only ever handle text-form ACLs in applications,
-generated and maintained using
-.Fn acl_from_text
-and
-.Fn acl_to_text ,
-passed directly to and from the management routines. In this manner,
-an application can remain safely unaware of the contents of ACLs.
-
-Available functions, sorted by behavior, include:
-
-.Fn acl_delete_def_file ,
-.Fn acl_delete_file_np ,
-.Fn acl_delete_fd_np
-
-These functions are described in
-.Xr acl_delete 3 ,
-and may be used to delete ACLs from file system objects.
-
-.Fn acl_free
-
-This function is described in
-.Xr acl_free 3 ,
-and may be used to free userland working ACL storage.
-
-.Fn acl_from_text
-
-This function is described in
-.Xr acl_from_text 3 ,
-and may be used to convert a text-form ACL into working ACL state, if
-the ACL has POSIX.1e semantics.
-
-.Fn acl_get_file ,
-.Fn acl_get_fd ,
-.Fn acl_get_fd_np
-
-These functions are described in
-.Xr acl_get 3 ,
-and may be used to retrieve ACLs from file system objects.
-
-.Fn acl_init
-
-This function is described in
-.Xr acl_init 3 ,
-and may be used to allocate a fresh (empty) ACL structure.
-
-.Fn acl_dup
-
-This function is described in
-.Xr acl_dup 3 ,
-and may be used to duplicate an ACL structure.
-
-.Fn acl_set_file ,
-.Fn acl_set_fd ,
-.Fn acl_set_fd_np
-
-These functions are described in
-.Xr acl_set 3 ,
-and may be used to assign an ACL to a file system object.
-
-.Fn acl_to_text
-
-This function is described in
-.Xr acl_to_text 3 ,
-and may be used to generate a text-form of a POSIX.1e semantics ACL.
-
-.Fn acl_valid ,
-.Fn acl_valid_file_np ,
-.Fn acl_valid_fd_np
-
-Thee functions are described in
-.Xr acl_valid 3 ,
-and may be used to validate an ACL as correct POSIX.1e-semantics, or
-as appropriate for a particular file system object regardless of semantics.
-
-Documentation of the internal kernel interfaces backing these calls may
-be found in
-.Xr acl 9 .
-The syscalls between the internal interfaces and the public library
-routines may change over time, and as such are not documented. They are
-not intended to be called directly without going through the library.
-.Sh IMPLEMENTATION NOTES
-FreeBSD's support for POSIX.1e interfaces and features is still under
-development at this time.
-.Sh ENVIRONMENT
-POSIX.1e assigns security labels to all objects, extending the security
-functionality described in POSIX.1. These additional labels provide
-fine-grained discretionary access control, fine-grained capabilities,
-and labels necessary for mandatory access control. POSIX.2c describes
-a set of userland utilities for manipulating these labels. These userland
-utilities are not bundled with
-.Fx 4.0
-so as to discourage their
-use in the short term.
-.\" .Sh FILES
-.Sh SEE ALSO
-.Xr acl 3 ,
-.Xr acl_dup 3 ,
-.Xr acl_free 3 ,
-.Xr acl_from_text 3 ,
-.Xr acl_get 3 ,
-.Xr acl_set 3 ,
-.Xr acl_to_text 3 ,
-.Xr acl_valid 3 ,
-.Xr acl 9
-.Sh STANDARDS
-POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion
-of the draft continues on the cross-platform POSIX.1e implementation
-mailing list. To join this list, see the
-.Fx
-POSIX.1e implementation
-page for more information.
-.Sh HISTORY
-POSIX.1e support was introduced in
-.Fx 4.0 ,
-and development continues.
-.Sh AUTHORS
-.An Robert N M Watson
-.Sh BUGS
-These features are not yet fully implemented. In particular, the shipped
-version of UFS/FFS does not support storage of additional security labels,
-and so is unable to (easily) provide support for most of these features.
diff --git a/lib/libc/posix1e/acl_delete.3 b/lib/libc/posix1e/acl_delete.3
deleted file mode 100644
index ef559d5f7533..000000000000
--- a/lib/libc/posix1e/acl_delete.3
+++ /dev/null
@@ -1,124 +0,0 @@
-.\"-
-.\" Copyright (c) 2000 Robert N. M. Watson
-.\" 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.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd January 28, 2000
-.Dt ACL_DELETE 3
-.Os FreeBSD 4.0
-.Sh NAME
-.Nm acl_delete_def_file ,
-.Nm acl_delete_file_np ,
-.Nm acl_delete_fd_np
-.Nd Delete an ACL from a file
-.Sh SYNOPSIS
-.Fd #include <sys/types.h>
-.Fd #include <sys/acl.h>
-.Ft int
-.Fn acl_delete_def_file "const char *path_p"
-.Ft int
-.Fn acl_delete_file_np "const char *path_p" "acl_type_t type"
-.Ft int
-.Fn acl_delete_fd_np "int filedes" "acl_type_t type"
-.Sh DESCRIPTION
-The
-.Fn acl_delete_def_file ,
-.Fn acl_delete_file_np ,
-and
-.Fn acl_delete_fd_np
-each allow the deletion of an ACL from a file.
-.Fn acl_delete_def_file
-is a POSIX.1e call that deletes the default ACL from a file (normally a
-directory) by name; the other two calls are non-portable extensions that
-allow deleting of arbitrary ACL types from a file/directory by either path
-name, or by file descriptor.
-.Sh IMPLEMENTATION NOTES
-FreeBSD's support for POSIX.1e interfaces and features is still under
-development at this time.
-.Sh RETURN VALUES
-In the event of success, 0 is returned. In the event of failure, -1 is
-returned, and
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-If any of the following conditions occur, these functions shall return -1
-and set
-.Va errno
-to the corresponding value:
-.Bl -tag -width Er
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix, or the
-object exists and the process does not have appropriate access rights.
-.It Bq Er EBADF
-The
-.Va fd
-argument is not a valid file descriptor.
-.It Bq Er EINVAL
-The ACL type passed is invalid for this file object.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters, or an
-entire path name exceeded 1023 characters.
-.It Bq Er ENOENT
-The named object does not exist, or the
-.Va path_p
-argument points to an empty string.
-.It Bq Er ENOMEM
-Insufficient memory available to fulfill request.
-.It Bq Er ENOTDIR
-A component of the path prefix is not a directory.
-
-Argument
-.Va path_p
-must be a directory, and is not.
-.It Bq Er EOPNOTSUPP
-The file system does not support ACL deletion.
-.It Bq Er EPERM
-The process does not have appropriate privilege to perform the operation
-to delete an ACL.
-.It Bq Er EROFS
-The file system is read-only.
-.El
-.Sh SEE ALSO
-.Xr acl 3 ,
-.Xr acl_get 3 ,
-.Xr acl_set 3 ,
-.Xr posix1e 3
-.Sh STANDARDS
-POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion
-of the draft continues on the cross-platform POSIX.1e implementation
-mailing list. To join this list, see the
-.Fx
-POSIX.1e implementation
-page for more information.
-.Sh HISTORY
-POSIX.1e support was introduced in
-.Fx 4.0 ,
-and development continues.
-.Sh AUTHORS
-.An Robert N M Watson
-.Sh BUGS
-These features are not yet fully implemented. In particular, the shipped
-version of UFS/FFS does not support storage of additional security labels,
-and so is unable to (easily) provide support for most of these features.
diff --git a/lib/libc/posix1e/acl_delete.c b/lib/libc/posix1e/acl_delete.c
deleted file mode 100644
index 8998400a0585..000000000000
--- a/lib/libc/posix1e/acl_delete.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*-
- * Copyright (c) 1999 Robert N. M. Watson
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- */
-/*
- * acl_delete_def_file -- remove a default acl from a file
- */
-
-#include <sys/types.h>
-#include <sys/acl.h>
-#include <sys/errno.h>
-
-int
-acl_delete_def_file(const char *path_p)
-{
-
- return (__acl_delete_file(path_p, ACL_TYPE_DEFAULT));
-}
-
-
-int
-acl_delete_file_np(const char *path_p, acl_type_t type)
-{
-
- return (__acl_delete_file(path_p, type));
-}
-
-
-int
-acl_delete_fd_np(int filedes, acl_type_t type)
-{
-
- return (__acl_delete_fd(filedes, type));
-}
diff --git a/lib/libc/posix1e/acl_dup.3 b/lib/libc/posix1e/acl_dup.3
deleted file mode 100644
index aaceb54f7764..000000000000
--- a/lib/libc/posix1e/acl_dup.3
+++ /dev/null
@@ -1,105 +0,0 @@
-.\"-
-.\" Copyright (c) 2000 Robert N. M. Watson
-.\" 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.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd January 28, 2000
-.Dt ACL_DUP 3
-.Os FreeBSD 4.0
-.Sh NAME
-.Nm acl_dup
-.Nd Duplicate an ACL
-.Sh SYNOPSIS
-.Fd #include <sys/types.h>
-.Fd #include <sys/acl.h>
-.Ft acl_t
-.Fn acl_dup "acl_t acl"
-.Sh DESCRIPTION
-The
-.Fn acl_dup
-function returns a pointer to a copy of the ACL pointed to by the argument
-.Va acl .
-
-This function may cause memory to be allocated. The caller should free any
-releasable memory, when the new ACL is no longer required, by calling
-.Xr acl_free 3
-with the
-.Va (void*)acl_t
-as an argument.
-
-Any existing ACL pointers that refer to the ACL referred to by
-.Va acl
-shall continue to refer to the ACL.
-.Sh IMPLEMENTATION NOTES
-FreeBSD's support for POSIX.1e interfaces and features is still under
-development at this time.
-.Sh RETURN VALUES
-Upon successful completion, this function shall return a pointer to the
-duplicate ACL. Otherwise, a value of
-.Va (acl_t)NULL
-shall be returned, and
-.Va errno
-shall be set to indicate the error.
-.Sh ERRORS
-If any of the following conditions occur, the
-.Fn acl_init
-function shall return a value of
-.Va (acl_t)NULL
-and set
-.Va errno
-to the corresponding value:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-Argument
-.Va acl
-does not point to a valid ACL.
-.It Bq Er ENOMEM
-The
-.Va acl_t
-to be returned requires more memory than is allowed by the hardware or
-system-imposed memory management constraints.
-.El
-.Sh SEE ALSO
-.Xr acl 3 ,
-.Xr acl_free 3 ,
-.Xr acl_get 3 ,
-.Xr posix1e 3
-.Sh STANDARDS
-POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion
-of the draft continues on the cross-platform POSIX.1e implementation
-mailing list. To join this list, see the
-.Fx
-POSIX.1e implementation
-page for more information.
-.Sh HISTORY
-POSIX.1e support was introduced in
-.Fx 4.0 ,
-and development continues.
-.Sh AUTHORS
-.An Robert N M Watson
-.Sh BUGS
-These features are not yet fully implemented. In particular, the shipped
-version of UFS/FFS does not support storage of additional security labels,
-and so is unable to (easily) provide support for most of these features.
diff --git a/lib/libc/posix1e/acl_free.3 b/lib/libc/posix1e/acl_free.3
deleted file mode 100644
index e02569b264a6..000000000000
--- a/lib/libc/posix1e/acl_free.3
+++ /dev/null
@@ -1,89 +0,0 @@
-.\"-
-.\" Copyright (c) 2000 Robert N. M. Watson
-.\" 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.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd January 28, 2000
-.Dt ACL_FREE 3
-.Os FreeBSD 4.0
-.Sh NAME
-.Nm acl_free
-.Nd Free ACL working state
-.Sh SYNOPSIS
-.Fd #include <sys/types.h>
-.Fd #include <sys/acl.h>
-.Ft int
-.Fn acl_free "void *obj_p"
-.Sh DESCRIPTION
-The
-.Fn acl_free
-call allows the freeing of ACL working space, such as is allocated by
-.Xr acl_dup 3 ,
-or
-.Xr acl_from_text 3 .
-.Sh IMPLEMENTATION NOTES
-FreeBSD's support for POSIX.1e interfaces and features is still under
-development at this time.
-.Sh RETURN VALUES
-In the event of success, 0 is returned. In the event of failure, -1 is
-returned, and
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-If any of the following conditions occur, the
-.Fn acl_free
-function shall return -1 and set
-.Va errno
-to the corresponding value:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The value of the
-.Va obj_p
-argument is invalid.
-.El
-.Sh SEE ALSO
-.Xr acl 3 ,
-.Xr acl_dup 3 ,
-.Xr acl_from_text 3 ,
-.Xr acl_get 3 ,
-.Xr acl_init 3 ,
-.Xr posix1e 3
-.Sh STANDARDS
-POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion
-of the draft continues on the cross-platform POSIX.1e implementation
-mailing list. To join this list, see the
-.Fx
-POSIX.1e implementation
-page for more information.
-.Sh HISTORY
-POSIX.1e support was introduced in
-.Fx 4.0 ,
-and development continues.
-.Sh AUTHORS
-.An Robert N M Watson
-.Sh BUGS
-These features are not yet fully implemented. In particular, the shipped
-version of UFS/FFS does not support storage of additional security labels,
-and so is unable to (easily) provide support for most of these features.
diff --git a/lib/libc/posix1e/acl_free.c b/lib/libc/posix1e/acl_free.c
deleted file mode 100644
index 74b7238be966..000000000000
--- a/lib/libc/posix1e/acl_free.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*-
- * Copyright (c) 1999 Robert N. M. Watson
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- */
-/*
- * acl_free -- free ACL objects from user memory
- */
-
-#include <sys/types.h>
-#include <sys/acl.h>
-#include <sys/errno.h>
-#include <stdlib.h>
-
-int
-acl_free(void *obj_p)
-{
-
- free(obj_p);
- return (0);
-}
diff --git a/lib/libc/posix1e/acl_from_text.3 b/lib/libc/posix1e/acl_from_text.3
deleted file mode 100644
index 776376163284..000000000000
--- a/lib/libc/posix1e/acl_from_text.3
+++ /dev/null
@@ -1,125 +0,0 @@
-.\"-
-.\" Copyright (c) 2000 Robert N. M. Watson
-.\" 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.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd January 28, 2000
-.Dt ACL_FROM_TEXT 3
-.Os FreeBSD 4.0
-.Sh NAME
-.Nm acl_from_text
-.Nd Create an ACL from text
-.Sh SYNOPSIS
-.Fd #include <sys/types.h>
-.Fd #include <sys/acl.h>
-.Ft acl_t
-.Fn acl_from_text "const char *buf_p"
-.Sh DESCRIPTION
-The
-.Fn acl_from_text
-function converts the text form of an ACL referred to by
-.Va buf_p
-into the internal working structure for ACLs, appropriate for applying to
-files or manipulating.
-
-This function may cause memory to be allocated. The caller should free any
-releasable memory, when the new ACL is no longer required, by calling
-.Xr acl_free 3
-with the
-.Va (void *)acl_t
-as an argument.
-.Sh IMPLEMENTATION NOTES
-FreeBSD's support for POSIX.1e interfaces and features is still under
-development at this time.
-.Sh RETURN VALUES
-Upon successful completion, the function shall return a pointer to the
-internal representation of the ACL in working storage. Otherwise, a value
-of
-.Va (acl_t)NULL
-shall be returned, and
-.Va errno
-shall be set to indicate the error.
-.Sh ERRORS
-If any of the following conditions occur, the
-.Fn acl_from_text
-function shall return a value of
-.Va (acl_t)NULL
-and set
-.Va errno
-to the corresponding value:
-.Bl -tag -width Er
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix, or the
-object exists and the process does not have appropriate access rights.
-.It Bq Er EINVAL
-Argument
-.Va buf_p
-cannot be translated into an ACL.
-.It Bq Er ENOMEM
-The ACL working storage requires more memory than is allowed by the
-hardware or system-imposed memory management constraints.
-.El
-.Sh SEE ALSO
-.Xr acl 3 ,
-.Xr acl_free 3 ,
-.Xr acl_get 3 ,
-.Xr acl_to_text 3 ,
-.Xr posix1e 3
-.Sh STANDARDS
-POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion
-of the draft continues on the cross-platform POSIX.1e implementation
-mailing list. To join this list, see the
-.Fx
-POSIX.1e implementation
-page for more information.
-.Sh HISTORY
-POSIX.1e support was introduced in
-.Fx 4.0 ,
-and development continues.
-.Sh AUTHORS
-.An Robert N M Watson
-.Sh BUGS
-These features are not yet fully implemented. In particular, the shipped
-version of UFS/FFS does not support storage of additional security labels,
-and so is unable to (easily) provide support for most of these features.
-
-.Fn acl_from_text
-and
-.Fn acl_to_text
-rely on the
-.Xr getpwent 3
-library calls to manage username and uid mapping, as well as the
-.Xr getgrent 3
-library calls to manage groupname and gid mapping. These calls are not
-thread safe, and so transitively, neither are
-.Fn acl_from_text
-and
-.Fn acl_to_text .
-These functions may also interfere with stateful
-calls associated with the
-.Fn getpwent
-and
-.Fn getgrent
-calls.
diff --git a/lib/libc/posix1e/acl_from_text.c b/lib/libc/posix1e/acl_from_text.c
deleted file mode 100644
index a71bbcae57ed..000000000000
--- a/lib/libc/posix1e/acl_from_text.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/*-
- * Copyright (c) 1999 Robert N. M. Watson
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- */
-/*
- * acl_from_text: convert a text-form ACL from a string to an acl_t
- */
-
-#include <sys/types.h>
-#include <sys/acl.h>
-#include <sys/errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "acl_support.h"
-
-enum PARSE_MODE {
- PM_BASE, /* initial, begin line, or after , */
- PM_QUALIFIER, /* in qualifier field */
- PM_PERM, /* in permission field */
- PM_COMMENT, /* in comment */
-};
-
-static char *
-string_skip_whitespace(char *string)
-{
-
- while (*string && ((*string == ' ') || (*string == '\t'))) {
- string++;
- }
- return (string);
-}
-
-static void
-string_trim_trailing_whitespace(char *string)
-{
- char *end;
-
- if (*string == '\0')
- return;
-
- end = string + strlen(string) - 1;
-
- while (end != string) {
- if ((*end == ' ') || (*end == '\t')) {
- *end = '\0';
- end--;
- } else {
- return;
- }
- }
-
- return;
-}
-
-acl_tag_t
-acl_string_to_tag(char *tag, char *qualifier)
-{
-
- if (*qualifier == '\0') {
- if ((!strcmp(tag, "user")) || (!strcmp(tag, "u"))) {
- return (ACL_USER_OBJ);
- } else
- if ((!strcmp(tag, "group")) || (!strcmp(tag, "g"))) {
- return (ACL_GROUP_OBJ);
- } else
- if ((!strcmp(tag, "mask")) || (!strcmp(tag, "m"))) {
- return (ACL_MASK);
- } else
- if ((!strcmp(tag, "other")) || (!strcmp(tag, "o"))) {
- return (ACL_OTHER);
- } else
- return(-1);
- } else {
- if ((!strcmp(tag, "user")) || (!strcmp(tag, "u"))) {
- return(ACL_USER);
- } else
- if ((!strcmp(tag, "group")) || (!strcmp(tag, "g"))) {
- return(ACL_GROUP);
- } else
- return(-1);
- }
-}
-
-/*
- * acl_from_text -- convert a string into an ACL
- * postpone most validity checking until the end and cal acl_valid to do
- * that.
- */
-acl_t
-acl_from_text(const char *buf_p)
-{
- acl_tag_t t;
- acl_perm_t p;
- acl_t acl;
- uid_t id;
- char *mybuf_p, *line, *cur, *notcomment, *comment, *entry;
- char *tag, *qualifier, *permission;
- int error;
-
- /* local copy we can mess up */
- mybuf_p = strdup(buf_p);
- if (!mybuf_p) {
- errno = ENOMEM;
- return(0);
- }
-
- acl = acl_init(3);
- if (!acl) {
- free(mybuf_p);
- errno = ENOMEM;
- return(0);
- }
-
- /* outer loop: delimit at \n boundaries */
- cur = mybuf_p;
- while ((line = strsep(&cur, "\n"))) {
- /* now split the line on the first # to strip out comments */
- comment = line;
- notcomment = strsep(&comment, "#");
-
- /* inner loop: delimit at , boundaries */
- while ((entry = strsep(&notcomment, ","))) {
- /* now split into three :-delimited fields */
- tag = strsep(&entry, ":");
- if (!tag) {
- /* printf("no tag\n"); */
- errno = EINVAL;
- goto error_label;
- }
- tag = string_skip_whitespace(tag);
- if ((*tag == '\0') && (!entry)) {
- /*
- * is an entirely comment line, skip to next
- * comma
- */
- continue;
- }
- string_trim_trailing_whitespace(tag);
-
- qualifier = strsep(&entry, ":");
- if (!qualifier) {
- /* printf("no qualifier\n"); */
- errno = EINVAL;
- goto error_label;
- }
- qualifier = string_skip_whitespace(qualifier);
- string_trim_trailing_whitespace(qualifier);
-
- permission = strsep(&entry, ":");
- if ((!permission) || (entry)) {
- /* printf("no permission, or more stuff\n"); */
- errno = EINVAL;
- goto error_label;
- }
- permission = string_skip_whitespace(permission);
- string_trim_trailing_whitespace(permission);
-
- /* printf("[%s/%s/%s]\n", tag, qualifier,
- permission); */
-
- t = acl_string_to_tag(tag, qualifier);
- if (t == -1) {
- errno = EINVAL;
- goto error_label;
- }
-
- error = acl_string_to_perm(permission, &p);
- if (error == -1) {
- errno = EINVAL;
- goto error_label;
- }
-
- switch(t) {
- case ACL_USER_OBJ:
- case ACL_GROUP_OBJ:
- case ACL_MASK:
- case ACL_OTHER:
- if (*qualifier != '\0') {
- errno = EINVAL;
- goto error_label;
- }
- id = 0;
- break;
-
- case ACL_USER:
- case ACL_GROUP:
- error = acl_name_to_id(t, qualifier, &id);
- if (error == -1)
- goto error_label;
- break;
-
- default:
- errno = EINVAL;
- goto error_label;
- }
-
- error = acl_add_entry(acl, t, id, p);
- if (error == -1)
- goto error_label;
- }
- }
-
-#if 0
- /* XXX should we only return ACLs valid according to acl_valid? */
- /* verify validity of the ACL we read in */
- if (acl_valid(acl) == -1) {
- errno = EINVAL;
- goto error_label;
- }
-#endif
-
- return(acl);
-
-error_label:
- acl_free(acl);
- free(mybuf_p);
- return(0);
-}
-
-
-
diff --git a/lib/libc/posix1e/acl_get.3 b/lib/libc/posix1e/acl_get.3
deleted file mode 100644
index 7781e40c5c11..000000000000
--- a/lib/libc/posix1e/acl_get.3
+++ /dev/null
@@ -1,138 +0,0 @@
-.\"-
-.\" Copyright (c) 2000 Robert N. M. Watson
-.\" 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.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd January 28, 2000
-.Dt ACL_GET 3
-.Os FreeBSD 4.0
-.Sh NAME
-.Nm acl_get_file ,
-.Nm acl_get_fd ,
-.Nm acl_get_fd_np
-.Nd Get an ACL for a file
-.Sh SYNOPSIS
-.Fd #include <sys/types.h>
-.Fd #include <sys/acl.h>
-.Ft acl_t
-.Fn acl_get_file "const char *path_p" "acl_type_t type"
-.Ft acl_t
-.Fn acl_get_fd "int fd"
-.Ft acl_t
-.Fn acl_get_fd_np "int fd" "acl_type_t type"
-.Sh DESCRIPTION
-The
-.Fn acl_get_file ,
-.Fn acl_get_fd ,
-and
-.Fn acl_get_fd_np
-each allow the retrieval of an ACL from a file.
-.Fn acl_get_file
-is a POSIX.1e call that allows the retrieval of a
-specified type of ACL from a file by name;
-.Fn acl_get_fd
-is a POSIX.1e call that allows the retrieval of an ACL of type
-ACL_TYPE_ACCESS
-from a file descriptor.
-.Fn acl_get_fd_np
-is a non-portable form of
-.Fn acl_get_fd
-that allows the retrieval of any type of ACL from a file descriptor.
-
-This function may cause memory to be allocated. The caller should free
-any releasable memory, when the new ACL is no longer required, by calling
-.Xr acl_free 3
-with the
-.Va (void *)acl_t
-as an argument.
-
-The ACL in the working storage is an independent copy of the ACL associated
-with the object referred to by
-.Va fd .
-The ACL in the working storage shall not participate in any access control
-decisions.
-.Sh IMPLEMENTATION NOTES
-FreeBSD's support for POSIX.1e interfaces and features is still under
-development at this time.
-.Sh RETURN VALUES
-Upon successful completion, the function shall return a pointer to the ACL
-that was retrieved. Otherwise, a value of
-.Va (acl_t)NULL
-shall be returned, and
-.Va errno
-shall be set to indicate the error.
-.Sh ERRORS
-If any of the following conditions occur, the
-.Fn acl_get_fd
-function shall return a value of
-.Va (acl_t)NULL
-and set
-.Va errno
-to the corresponding value:
-.Bl -tag -width Er
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix, or the
-object exists and the process does not have appropriate access rights.
-.It Bq Er EBADF
-The
-.Va fd
-argument is not a valid file descriptor.
-.It Bq Er EINVAL
-The ACL type passed is invalid for this file object.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters, or an
-entire path name exceeded 1023 characters.
-.It Bq Er ENOENT
-The named object does not exist, or the
-.Va path_p
-argument points to an empty string.
-.It Bq Er ENOMEM
-Insufficient memory available to fulfill request.
-.It Bq Er EOPNOTSUPP
-The file system does not support ACL retrieval.
-.El
-.Sh SEE ALSO
-.Xr acl 3 ,
-.Xr acl_free 3 ,
-.Xr acl_get 3 ,
-.Xr acl_set 3 ,
-.Xr posix1e 3
-.Sh STANDARDS
-POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion
-of the draft continues on the cross-platform POSIX.1e implementation
-mailing list. To join this list, see the
-.Fx
-POSIX.1e implementation
-page for more information.
-.Sh HISTORY
-POSIX.1e support was introduced in
-.Fx 4.0 ,
-and development continues.
-.Sh AUTHORS
-.An Robert N M Watson
-.Sh BUGS
-These features are not yet fully implemented. In particular, the shipped
-version of UFS/FFS does not support storage of additional security labels,
-and so is unable to (easily) provide support for most of these features.
diff --git a/lib/libc/posix1e/acl_get.c b/lib/libc/posix1e/acl_get.c
deleted file mode 100644
index 494eed7723ab..000000000000
--- a/lib/libc/posix1e/acl_get.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*-
- * Copyright (c) 1999 Robert N. M. Watson
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- */
-/*
- * acl_get_file - syscall wrapper for retrieving ACL by filename
- * acl_get_fd - syscall wrapper for retrieving access ACL by fd
- * acl_get_fd_np - syscall wrapper for retrieving ACL by fd (non-POSIX)
- */
-
-#include <sys/types.h>
-#include <sys/acl.h>
-#include <sys/errno.h>
-#include <stdlib.h>
-
-acl_t
-acl_get_file(const char *path_p, acl_type_t type)
-{
- struct acl *aclp;
- int error;
-
- aclp = acl_init(ACL_MAX_ENTRIES);
- if (!aclp) {
- return (0);
- }
-
- error = __acl_get_file(path_p, type, aclp);
- if (error) {
- acl_free(aclp);
- return (0);
- }
-
- return (aclp);
-}
-
-acl_t
-acl_get_fd(int fd)
-{
- struct acl *aclp;
- int error;
-
- aclp = acl_init(ACL_MAX_ENTRIES);
- if (!aclp) {
- return (0);
- }
-
- error = __acl_get_fd(fd, ACL_TYPE_ACCESS, aclp);
- if (error) {
- acl_free(aclp);
- return (0);
- }
-
- return (aclp);
-}
-
-acl_t
-acl_get_fd_np(int fd, acl_type_t type)
-{
- struct acl *aclp;
- int error;
-
- aclp = acl_init(ACL_MAX_ENTRIES);
- if (!aclp) {
- return (0);
- }
-
- error = __acl_get_fd(fd, type, aclp);
- if (error) {
- acl_free(aclp);
- return (0);
- }
-
- return (aclp);
-}
diff --git a/lib/libc/posix1e/acl_init.3 b/lib/libc/posix1e/acl_init.3
deleted file mode 100644
index 51b7c2a8f93f..000000000000
--- a/lib/libc/posix1e/acl_init.3
+++ /dev/null
@@ -1,104 +0,0 @@
-.\"-
-.\" Copyright (c) 2000 Robert N. M. Watson
-.\" 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.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd January 28, 2000
-.Dt ACL_INIT 3
-.Os FreeBSD 4.0
-.Sh NAME
-.Nm acl_init
-.Nd Initialize ACL working storage
-.Sh SYNOPSIS
-.Fd #include <sys/types.h>
-.Fd #include <sys/acl.h>
-.Ft acl_t
-.Fn acl_init "int count"
-.Sh DESCRIPTION
-The
-.Fn acl_init
-function allocates and initializes the working storage for an ACL of at
-least
-.Va count
-ACL entries. A pointer to the working storage is returned. The working
-storage allocated to contain the ACL is freed by a call to
-.Xr acl_free 3 .
-When the area is first allocated, it shall contain an an ACL that contains
-no ACL entries.
-
-This function may cause memory to be allocated. The caller should free any
-releasable memory, when the new ACL is no longer required, by calling
-.Xr acl_free 3
-with the
-.Va (void*)acl_t
-as an argument.
-.Sh IMPLEMENTATION NOTES
-FreeBSD's support for POSIX.1e interfaces and features is still under
-development at this time.
-.Sh RETURN VALUES
-Upon successful completion, this function shall return a pointer to the
-working storage. Otherwise, a value of
-.Va (acl_t)NULL
-shall be returned, and
-.Va errno
-shall be set to indicate the error.
-.Sh ERRORS
-If any of the following conditions occur, the
-.Fn acl_init
-function shall return a value of
-.Va (acl_t)NULL
-and set
-.Va errno
-to the corresponding value:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The value of count is less than zero.
-.It Bq Er ENOMEM
-The
-.Va acl_t
-to be returned requires more memory than is allowed by the hardware or
-system-imposed memory management constraints.
-.El
-.Sh SEE ALSO
-.Xr acl 3 ,
-.Xr acl_free 3 ,
-.Xr posix1e 3
-.Sh STANDARDS
-POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion
-of the draft continues on the cross-platform POSIX.1e implementation
-mailing list. To join this list, see the
-.Fx
-POSIX.1e implementation
-page for more information.
-.Sh HISTORY
-POSIX.1e support was introduced in
-.Fx 4.0 ,
-and development continues.
-.Sh AUTHORS
-.An Robert N M Watson
-.Sh BUGS
-These features are not yet fully implemented. In particular, the shipped
-version of UFS/FFS does not support storage of additional security labels,
-and so is unable to (easily) provide support for most of these features.
diff --git a/lib/libc/posix1e/acl_init.c b/lib/libc/posix1e/acl_init.c
deleted file mode 100644
index c2fa43b8ab3b..000000000000
--- a/lib/libc/posix1e/acl_init.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*-
- * Copyright (c) 1999 Robert N. M. Watson
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- */
-/*
- * acl_init -- return a fresh acl structure
- * acl_dup -- duplicate an acl and return the new copy
- */
-
-#include <sys/types.h>
-#include <sys/acl.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-
-acl_t
-acl_init(int count)
-{
- struct acl *acl;
-
- if (count > ACL_MAX_ENTRIES) {
- errno = ENOMEM;
- return (0);
- }
-
- acl = (struct acl *) malloc(sizeof(struct acl));
- bzero(acl, sizeof(struct acl));
-
- return (acl);
-}
-
-acl_t
-acl_dup(acl_t acl)
-{
- struct acl *acl_new;
-
- acl_new = acl_init(ACL_MAX_ENTRIES);
- if (!acl_new)
- return(NULL);
-
- *acl_new = *acl;
-
- return(acl_new);
-}
diff --git a/lib/libc/posix1e/acl_set.3 b/lib/libc/posix1e/acl_set.3
deleted file mode 100644
index 916292c9d1eb..000000000000
--- a/lib/libc/posix1e/acl_set.3
+++ /dev/null
@@ -1,131 +0,0 @@
-.\"-
-.\" Copyright (c) 2000 Robert N. M. Watson
-.\" 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.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd January 28, 2000
-.Dt ACL_SET 3
-.Os FreeBSD 4.0
-.Sh NAME
-.Nm acl_set_file ,
-.Nm acl_set_fd ,
-.Nm acl_set_fd_np
-.Nd Get an ACL for a file
-.Sh SYNOPSIS
-.Fd #include <sys/types.h>
-.Fd #include <sys/acl.h>
-.Ft int
-.Fn acl_set_file "const char *path_p" "acl_type_t type" "acl_t acl"
-.Ft int
-.Fn acl_set_fd "int fd" "acl_t acl"
-.Ft int
-.Fn acl_set_fd_np "int fd" "acl_t acl" "acl_type_t type"
-.Sh DESCRIPTION
-The
-.Fn acl_set_file ,
-.Fn acl_set_fd ,
-and
-.Fn acl_set_fd_np
-each associate an ACL with an object referred to by
-.Va fd
-or
-.Va path_p .
-All except
-.Fn acl_set_fd_np
-are POSIX.1e calls--
-.Fn acl_set_fd
-allows only the setting of ACLs of type ACL_TYPE_ACCESS
-where as
-.Fn acl_set_fd_np
-allows the setting of ACLs of any type.
-.Sh IMPLEMENTATION NOTES
-FreeBSD's support for POSIX.1e interfaces and features is still under
-development at this time.
-.Sh RETURN VALUES
-Upon successful completion, the function shall return a value of zero.
-Otherwise, a value of -1 shall be returned and
-.Va errno
-shall be set to indicate the error.
-.Sh ERRORS
-If any of the following conditions occur, these functions shall return
--1 and set
-.Va errno
-to the corresponding value:
-.Bl -tag -width Er
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix, or the
-object exists and the process does not have appropriate access rights.
-.It Bq Er EBADF
-The
-.Va fd
-argument is not a valid file descriptor.
-.It Bq Er EINVAL
-Argument
-.Va acl
-does not point to a valid ACL for this object, or the ACL type
-specified in
-.Va type
-is invalid for this object, or both.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters, or an
-entire path name exceeded 1023 characters.
-.It Bq Er ENOENT
-The named object does not exist, or the
-.Va path_p
-argument points to an empty string.
-.It Bq Er ENOMEM
-Insufficient memory available to fulfill request.
-.It Bq Er ENOSPC
-The directory or file system that would contain the new ACL cannot be
-extended, or the file system is out of file allocation resources.
-.It Bq Er EOPNOTSUPP
-The file system does not support ACL retrieval.
-.It Bq Er EROFS
-This function requires modification of a file system which is currently
-read-only.
-.El
-.Sh SEE ALSO
-.Xr acl 3 ,
-.Xr acl_delete 3 ,
-.Xr acl_get 3 ,
-.Xr acl_valid 3 ,
-.Xr posix1e 3
-.Sh STANDARDS
-POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion
-of the draft continues on the cross-platform POSIX.1e implementation
-mailing list. To join this list, see the
-.Fx
-POSIX.1e implementation
-page for more information.
-.Sh HISTORY
-POSIX.1e support was introduced in
-.Fx 4.0 ,
-and development continues.
-.Sh AUTHORS
-.An Robert N M Watson
-.Sh BUGS
-These features are not yet fully implemented. In particular, the shipped
-version of UFS/FFS does not support storage of additional security labels,
-and so is unable to (easily) provide support for most of these features.
diff --git a/lib/libc/posix1e/acl_set.c b/lib/libc/posix1e/acl_set.c
deleted file mode 100644
index 070e2b16e5c1..000000000000
--- a/lib/libc/posix1e/acl_set.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*-
- * Copyright (c) 1999 Robert N. M. Watson
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- */
-/*
- * acl_set_file -- set a file/directory ACL by name
- */
-
-#include <sys/types.h>
-#include <sys/acl.h>
-#include <errno.h>
-
-#include "acl_support.h"
-
-/*
- * For POSIX.1e-semantic ACLs, do a presort so the kernel doesn't have to
- * (the POSIX.1e semantic code will reject unsorted ACL submission). If it's
- * not a semantic that the library knows about, just submit it flat and
- * assume the caller knows what they're up to.
- */
-int
-acl_set_file(const char *path_p, acl_type_t type, acl_t acl)
-{
- int error;
-
- if (acl_posix1e(acl, type)) {
- error = acl_sort(acl);
- if (error) {
- errno = error;
- return (-1);
- }
- }
-
- return (__acl_set_file(path_p, type, acl));
-}
-
-int
-acl_set_fd(int fd, acl_t acl)
-{
- int error;
-
- error = acl_sort(acl);
- if (error) {
- errno = error;
- return(-1);
- }
-
- return (__acl_set_fd(fd, ACL_TYPE_ACCESS, acl));
-}
-
-int
-acl_set_fd_np(int fd, acl_t acl, acl_type_t type)
-{
- int error;
-
- if (acl_posix1e(acl, type)) {
- error = acl_sort(acl);
- if (error) {
- errno = error;
- return (-1);
- }
- }
-
- return (__acl_set_fd(fd, type, acl));
-}
diff --git a/lib/libc/posix1e/acl_support.c b/lib/libc/posix1e/acl_support.c
deleted file mode 100644
index a136407b287a..000000000000
--- a/lib/libc/posix1e/acl_support.c
+++ /dev/null
@@ -1,409 +0,0 @@
-/*-
- * Copyright (c) 1999 Robert N. M. Watson
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- */
-/*
- * Support functionality for the POSIX.1e ACL interface
- * These calls are intended only to be called within the library.
- */
-
-#include <sys/types.h>
-#include <sys/acl.h>
-#include <errno.h>
-#include <grp.h>
-#include <pwd.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "acl_support.h"
-
-#define ACL_STRING_PERM_WRITE 'w'
-#define ACL_STRING_PERM_READ 'r'
-#define ACL_STRING_PERM_EXEC 'x'
-#define ACL_STRING_PERM_NONE '-'
-
-/*
- * acl_entry_compare -- compare two acl_entry structures to determine the
- * order they should appear in. Used by acl_sort to sort ACL entries into
- * the kernel-desired order -- i.e., the order useful for evaluation and
- * O(n) validity checking. Beter to have an O(nlogn) sort in userland and
- * an O(n) in kernel than to have both in kernel.
- */
-typedef int (*compare)(const void *, const void *);
-static int
-acl_entry_compare(struct acl_entry *a, struct acl_entry *b)
-{
- /*
- * First, sort between tags -- conveniently defined in the correct
- * order for verification.
- */
- if (a->ae_tag < b->ae_tag)
- return (-1);
- if (a->ae_tag > b->ae_tag)
- return (1);
-
- /*
- * Next compare uids/gids on appropriate types.
- */
-
- if (a->ae_tag == ACL_USER || a->ae_tag == ACL_GROUP) {
- if (a->ae_id < b->ae_id)
- return (-1);
- if (a->ae_id > b->ae_id)
- return (1);
-
- /* shouldn't be equal, fall through to the invalid case */
- }
-
- /*
- * Don't know how to sort multiple entries of the rest--either it's
- * a bad entry, or there shouldn't be more than one. Ignore and the
- * validity checker can get it later.
- */
- return (0);
-}
-
-/*
- * acl_sort -- sort ACL entries.
- * Give the opportunity to fail, althouh we don't currently have a way
- * to fail.
- */
-int
-acl_sort(acl_t acl)
-{
-
- qsort(&acl->acl_entry[0], acl->acl_cnt, sizeof(struct acl_entry),
- (compare) acl_entry_compare);
-
- return (0);
-}
-
-/*
- * acl_posix1e -- in what situations should we acl_sort before submission?
- * We apply posix1e ACL semantics for any ACL of type ACL_TYPE_ACCESS or
- * ACL_TYPE_DEFAULT
- */
-int
-acl_posix1e(acl_t acl, acl_type_t type)
-{
-
- return ((type == ACL_TYPE_ACCESS) || (type == ACL_TYPE_DEFAULT));
-}
-
-/*
- * acl_check -- given an ACL, check its validity. This is mirrored from
- * code in sys/kern/kern_acl.c, and if changes are made in one, they should
- * be made in the other also. This copy of acl_check is made available
- * in userland for the benefit of processes wanting to check ACLs for
- * validity before submitting them to the kernel, or for performing
- * in userland file system checking. Needless to say, the kernel makes
- * the real checks on calls to get/setacl.
- *
- * See the comments in kernel for explanation -- just briefly, it assumes
- * an already sorted ACL, and checks based on that assumption. The
- * POSIX.1e interface, acl_valid(), will perform the sort before calling
- * this. Returns 0 on success, EINVAL on failure.
- */
-int
-acl_check(struct acl *acl)
-{
- struct acl_entry *entry; /* current entry */
- uid_t obj_uid=-1, obj_gid=-1, highest_uid=0, highest_gid=0;
- int stage = ACL_USER_OBJ;
- int i = 0;
- int count_user_obj=0, count_user=0, count_group_obj=0,
- count_group=0, count_mask=0, count_other=0;
-
- /* printf("acl_check: checking acl with %d entries\n", acl->acl_cnt); */
- while (i < acl->acl_cnt) {
-
- entry = &acl->acl_entry[i];
-
- if ((entry->ae_perm | ACL_PERM_BITS) != ACL_PERM_BITS)
- return (EINVAL);
-
- switch(entry->ae_tag) {
- case ACL_USER_OBJ:
- /* printf("acl_check: %d: ACL_USER_OBJ\n", i); */
- if (stage > ACL_USER_OBJ)
- return (EINVAL);
- stage = ACL_USER;
- count_user_obj++;
- obj_uid = entry->ae_id;
- break;
-
- case ACL_USER:
- /* printf("acl_check: %d: ACL_USER\n", i); */
- if (stage > ACL_USER)
- return (EINVAL);
- stage = ACL_USER;
- if (entry->ae_id == obj_uid)
- return (EINVAL);
- if (count_user && (entry->ae_id <= highest_uid))
- return (EINVAL);
- highest_uid = entry->ae_id;
- count_user++;
- break;
-
- case ACL_GROUP_OBJ:
- /* printf("acl_check: %d: ACL_GROUP_OBJ\n", i); */
- if (stage > ACL_GROUP_OBJ)
- return (EINVAL);
- stage = ACL_GROUP;
- count_group_obj++;
- obj_gid = entry->ae_id;
- break;
-
- case ACL_GROUP:
- /* printf("acl_check: %d: ACL_GROUP\n", i); */
- if (stage > ACL_GROUP)
- return (EINVAL);
- stage = ACL_GROUP;
- if (entry->ae_id == obj_gid)
- return (EINVAL);
- if (count_group && (entry->ae_id <= highest_gid))
- return (EINVAL);
- highest_gid = entry->ae_id;
- count_group++;
- break;
-
- case ACL_MASK:
- /* printf("acl_check: %d: ACL_MASK\n", i); */
- if (stage > ACL_MASK)
- return (EINVAL);
- stage = ACL_MASK;
- count_mask++;
- break;
-
- case ACL_OTHER:
- /* printf("acl_check: %d: ACL_OTHER\n", i); */
- if (stage > ACL_OTHER)
- return (EINVAL);
- stage = ACL_OTHER;
- count_other++;
- break;
-
- default:
- /* printf("acl_check: %d: INVALID\n", i); */
- return (EINVAL);
- }
- i++;
- }
-
- if (count_user_obj != 1)
- return (EINVAL);
-
- if (count_group_obj != 1)
- return (EINVAL);
-
- if (count_mask != 0 && count_mask != 1)
- return (EINVAL);
-
- if (count_other != 1)
- return (EINVAL);
-
- return (0);
-}
-
-
-/*
- * Given a uid/gid, return a username/groupname for the text form of an ACL
- * XXX NOT THREAD SAFE, RELIES ON GETPWUID, GETGRGID
- * XXX USES *PW* AND *GR* WHICH ARE STATEFUL AND THEREFORE THIS ROUTINE
- * MAY HAVE SIDE-EFFECTS
- */
-int
-acl_id_to_name(acl_tag_t tag, uid_t id, ssize_t buf_len, char *buf)
-{
- struct group *g;
- struct passwd *p;
- int i;
-
- switch(tag) {
- case ACL_USER:
- p = getpwuid(id);
- if (!p)
- i = snprintf(buf, buf_len, "%d", id);
- else
- i = snprintf(buf, buf_len, "%s", p->pw_name);
-
- if (i >= buf_len) {
- errno = ENOMEM;
- return (-1);
- }
- return (0);
-
- case ACL_GROUP:
- g = getgrgid(id);
- if (!g)
- i = snprintf(buf, buf_len, "%d", id);
- else
- i = snprintf(buf, buf_len, "%s", g->gr_name);
-
- if (i >= buf_len) {
- errno = ENOMEM;
- return (-1);
- }
- return (0);
-
- default:
- return (EINVAL);
- }
-}
-
-
-/*
- * Given a username/groupname from a text form of an ACL, return the uid/gid
- * XXX NOT THREAD SAFE, RELIES ON GETPWNAM, GETGRNAM
- * XXX USES *PW* AND *GR* WHICH ARE STATEFUL AND THEREFORE THIS ROUTINE
- * MAY HAVE SIDE-EFFECTS
- *
- * XXX currently doesn't deal correctly with a numeric uid being passed
- * instead of a username. What is correct behavior here? Check chown.
- */
-int
-acl_name_to_id(acl_tag_t tag, char *name, uid_t *id)
-{
- struct group *g;
- struct passwd *p;
-
- switch(tag) {
- case ACL_USER:
- p = getpwnam(name);
- if (!p) {
- errno = EINVAL;
- return (-1);
- }
- *id = p->pw_uid;
- return (0);
-
- case ACL_GROUP:
- g = getgrnam(name);
- if (g) {
- errno = EINVAL;
- return (-1);
- }
- *id = g->gr_gid;
- return (0);
-
- default:
- return (EINVAL);
- }
-}
-
-
-/*
- * Given a right-shifted permission (i.e., direct ACL_PERM_* mask), fill
- * in a string describing the permissions.
- */
-int
-acl_perm_to_string(acl_perm_t perm, ssize_t buf_len, char *buf)
-{
-
- if (buf_len < ACL_STRING_PERM_MAXSIZE + 1) {
- errno = ENOMEM;
- return (-1);
- }
-
- if ((perm | ACL_PERM_BITS) != ACL_PERM_BITS) {
- errno = EINVAL;
- return (-1);
- }
-
- buf[3] = 0; /* null terminate */
-
- if (perm & ACL_PERM_READ)
- buf[0] = ACL_STRING_PERM_READ;
- else
- buf[0] = ACL_STRING_PERM_NONE;
-
- if (perm & ACL_PERM_WRITE)
- buf[1] = ACL_STRING_PERM_WRITE;
- else
- buf[1] = ACL_STRING_PERM_NONE;
-
- if (perm & ACL_PERM_EXEC)
- buf[2] = ACL_STRING_PERM_EXEC;
- else
- buf[2] = ACL_STRING_PERM_NONE;
-
- return (0);
-}
-
-/*
- * given a string, return a permission describing it
- */
-int
-acl_string_to_perm(char *string, acl_perm_t *perm)
-{
- acl_perm_t myperm = ACL_PERM_NONE;
- char *ch;
-
- ch = string;
- while (*ch) {
- switch(*ch) {
- case ACL_STRING_PERM_READ:
- myperm |= ACL_PERM_READ;
- break;
- case ACL_STRING_PERM_WRITE:
- myperm |= ACL_PERM_WRITE;
- break;
- case ACL_STRING_PERM_EXEC:
- myperm |= ACL_PERM_EXEC;
- break;
- case ACL_STRING_PERM_NONE:
- break;
- default:
- return (EINVAL);
- }
- ch++;
- }
-
- *perm = myperm;
- return (0);
-}
-
-/*
- * Add an ACL entry without doing much checking, et al
- */
-int
-acl_add_entry(acl_t acl, acl_tag_t tag, uid_t id, acl_perm_t perm)
-{
- struct acl_entry *e;
-
- if (acl->acl_cnt >= ACL_MAX_ENTRIES) {
- errno = ENOMEM;
- return (-1);
- }
-
- e = &(acl->acl_entry[acl->acl_cnt]);
- e->ae_perm = perm;
- e->ae_tag = tag;
- e->ae_id = id;
- acl->acl_cnt++;
-
- return (0);
-}
diff --git a/lib/libc/posix1e/acl_support.h b/lib/libc/posix1e/acl_support.h
deleted file mode 100644
index e34aca5e5646..000000000000
--- a/lib/libc/posix1e/acl_support.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*-
- * Copyright (c) 1999 Robert N. M. Watson
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- */
-/*
- * Support functionality for the POSIX.1e ACL interface
- * These calls are intended only to be called within the library.
- */
-#ifndef _ACL_SUPPORT_H
-#define _ACL_SUPPORT_H
-
-#define ACL_STRING_PERM_MAXSIZE 3 /* read, write, exec */
-
-int acl_check(struct acl *acl);
-int acl_sort(acl_t acl);
-int acl_posix1e(acl_t acl, acl_type_t type);
-int acl_id_to_name(acl_tag_t tag, uid_t id, ssize_t buf_len, char *buf);
-int acl_name_to_id(acl_tag_t tag, char *name, uid_t *id);
-int acl_perm_to_string(acl_perm_t perm, ssize_t buf_len, char *buf);
-int acl_string_to_perm(char *string, acl_perm_t *perm);
-int acl_add_entry(acl_t acl, acl_tag_t tag, uid_t id, acl_perm_t perm);
-
-#endif
diff --git a/lib/libc/posix1e/acl_to_text.3 b/lib/libc/posix1e/acl_to_text.3
deleted file mode 100644
index 483dea7324ee..000000000000
--- a/lib/libc/posix1e/acl_to_text.3
+++ /dev/null
@@ -1,130 +0,0 @@
-.\"-
-.\" Copyright (c) 2000 Robert N. M. Watson
-.\" 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.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd January 28, 2000
-.Dt ACL_TO_TEXT 3
-.Os FreeBSD 4.0
-.Sh NAME
-.Nm acl_to_text
-.Nd Convert an ACL to Text
-.Sh SYNOPSIS
-.Fd #include <sys/types.h>
-.Fd #include <sys/acl.h>
-.Ft char *
-.Fn acl_to_text "acl_t acl" "ssize_t *len_p"
-.Sh DESCRIPTION
-The
-.Fn acl_to_text
-function translates the ACL pointed to by argument
-.Va acl
-into a NULL terminated character string. If the pointer
-.Va len_p
-is not NULL, then the function shall return the length of the string (not
-including the NULL terminator) in the location pointed to by
-.Va len_p .
-The format of the text string returned by
-.Fn acl_to_text
-shall be the POSIX.1e long ACL form.
-
-This function allocates any memory necessary to contain the string and
-returns a pointer to the string. The caller should free any releasable
-memory, when the new string is no longer required, by calling
-.Xr acl_free 3
-with the
-.Va (void*)char
-as an argument.
-.Sh IMPLEMENTATION NOTES
-FreeBSD's support for POSIX.1e interfaces and features is still under
-development at this time.
-.Sh RETURN VALUES
-Upon successful completion, the function shall return a pointer to the
-long text form of an ACL. Otherwise, a value of
-.Va (char*)NULL
-shall be returned and
-.Va errno
-shall be set to indicate the error.
-.Sh ERRORS
-If any of the following conditions occur, the
-.Fn acl_to_text
-function shall return a value of
-.Va (acl_t)NULL
-and set
-.Va errno
-to the corresponding value:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-Argument
-.Va acl
-does not point to a valid ACL.
-
-The ACL denoted by
-.Va acl
-contains one or more improperly formed ACL entries, or for some other
-reason cannot be translated into a text form of an ACL.
-.It Bq Er ENOMEM
-The character string to be returned requires more memory than is allowed
-by the hardware or software-imposed memory management constraints.
-.El
-.Sh SEE ALSO
-.Xr acl 3 ,
-.Xr acl_free 3 ,
-.Xr acl_from_text 3 ,
-.Xr posix1e 3
-.Sh STANDARDS
-POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion
-of the draft continues on the cross-platform POSIX.1e implementation
-mailing list. To join this list, see the FreeBSD POSIX.1e implementation
-page for more information.
-.Sh HISTORY
-POSIX.1e support was introduced in
-.Fx 4.0 ,
-and development continues.
-.Sh AUTHORS
-.An Robert N M Watson
-.Sh BUGS
-These features are not yet fully implemented. In particular, the shipped
-version of UFS/FFS does not support storage of additional security labels,
-and so is unable to (easily) provide support for most of these features.
-
-.Fn acl_from_text
-and
-.Fn acl_to_text
-rely on the
-.Xr getpwent 3
-library calls to manage username and uid mapping, as well as the
-.Xr getgrent 3
-library calls to manage groupname and gid mapping. These calls are not
-thread safe, and so transitively, neither are
-.Fn acl_from_text
-and
-.Fn acl_to_text .
-These functions may also interfere with stateful
-calls associated with the
-.Fn getpwent
-and
-.Fn getgrent
-calls.
diff --git a/lib/libc/posix1e/acl_to_text.c b/lib/libc/posix1e/acl_to_text.c
deleted file mode 100644
index 0dc3058fbff0..000000000000
--- a/lib/libc/posix1e/acl_to_text.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/*-
- * Copyright (c) 1999 Robert N. M. Watson
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- */
-/*
- * acl_to_text - return a text string with a text representation of the acl
- * in it.
- */
-
-#include <sys/types.h>
-#include <sys/acl.h>
-#include <sys/errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <utmp.h>
-
-#include "acl_support.h"
-
-/*
- * acl_to_text - generate a text form of an acl
- * spec says nothing about output ordering, so leave in acl order
- *
- * This function will not produce nice results if it is called with
- * a non-POSIX.1e semantics ACL.
- */
-char *
-acl_to_text(acl_t acl, ssize_t *len_p)
-{
- char *buf, *tmpbuf;
- char name_buf[UT_NAMESIZE+1];
- char perm_buf[ACL_STRING_PERM_MAXSIZE+1],
- effective_perm_buf[ACL_STRING_PERM_MAXSIZE+1];
- int i, error, len;
- uid_t ae_id;
- acl_tag_t ae_tag;
- acl_perm_t ae_perm, effective_perm, mask_perm;
-
- buf = strdup("");
-
- mask_perm = ACL_PERM_BITS; /* effective is regular if no mask */
- for (i = 0; i < acl->acl_cnt; i++)
- if (acl->acl_entry[i].ae_tag == ACL_MASK)
- mask_perm = acl->acl_entry[i].ae_perm;
-
- for (i = 0; i < acl->acl_cnt; i++) {
- ae_tag = acl->acl_entry[i].ae_tag;
- ae_id = acl->acl_entry[i].ae_id;
- ae_perm = acl->acl_entry[i].ae_perm;
-
- switch(ae_tag) {
- case ACL_USER_OBJ:
- error = acl_perm_to_string(ae_perm,
- ACL_STRING_PERM_MAXSIZE+1, perm_buf);
- if (error)
- goto error_label;
- len = asprintf(&tmpbuf, "%suser::%s\n", buf,
- perm_buf);
- if (len == -1) {
- errno = ENOMEM;
- goto error_label;
- }
- free(buf);
- buf = tmpbuf;
- break;
-
- case ACL_USER:
- error = acl_perm_to_string(ae_perm,
- ACL_STRING_PERM_MAXSIZE+1, perm_buf);
- if (error)
- goto error_label;
-
- error = acl_id_to_name(ae_tag, ae_id, UT_NAMESIZE+1,
- name_buf);
- if (error)
- goto error_label;
-
- effective_perm = ae_perm & mask_perm;
- if (effective_perm != ae_perm) {
- error = acl_perm_to_string(effective_perm,
- ACL_STRING_PERM_MAXSIZE+1,
- effective_perm_buf);
- if (error)
- goto error_label;
- len = asprintf(&tmpbuf, "%suser:%s:%s\t\t# "
- "effective: %s\n",
- buf, name_buf, perm_buf,
- effective_perm_buf);
- } else {
- len = asprintf(&tmpbuf, "%suser:%s:%s\n", buf,
- name_buf, perm_buf);
- }
- if (len == -1) {
- errno = ENOMEM;
- goto error_label;
- }
- free(buf);
- buf = tmpbuf;
- break;
-
- case ACL_GROUP_OBJ:
- error = acl_perm_to_string(ae_perm,
- ACL_STRING_PERM_MAXSIZE+1, perm_buf);
- if (error)
- goto error_label;
-
- effective_perm = ae_perm & mask_perm;
- if (effective_perm != ae_perm) {
- error = acl_perm_to_string(effective_perm,
- ACL_STRING_PERM_MAXSIZE+1,
- effective_perm_buf);
- if (error)
- goto error_label;
- len = asprintf(&tmpbuf, "%sgroup::%s\t\t# "
- "effective: %s\n",
- buf, perm_buf, effective_perm_buf);
- } else {
- len = asprintf(&tmpbuf, "%sgroup::%s\n", buf,
- perm_buf);
- }
- if (len == -1) {
- errno = ENOMEM;
- goto error_label;
- }
- free(buf);
- buf = tmpbuf;
- break;
-
- case ACL_GROUP:
- error = acl_perm_to_string(ae_perm,
- ACL_STRING_PERM_MAXSIZE+1, perm_buf);
- if (error)
- goto error_label;
-
- error = acl_id_to_name(ae_tag, ae_id, UT_NAMESIZE+1,
- name_buf);
- if (error)
- goto error_label;
-
- effective_perm = ae_perm & mask_perm;
- if (effective_perm != ae_perm) {
- error = acl_perm_to_string(effective_perm,
- ACL_STRING_PERM_MAXSIZE+1,
- effective_perm_buf);
- if (error)
- goto error_label;
- len = asprintf(&tmpbuf, "%sgroup::%s\t\t# "
- "effective: %s\n",
- buf, perm_buf, effective_perm_buf);
- } else {
- len = asprintf(&tmpbuf, "%sgroup:%s:%s\n", buf,
- name_buf, perm_buf);
- }
- if (len == -1) {
- errno = ENOMEM;
- goto error_label;
- }
- free(buf);
- buf = tmpbuf;
- break;
-
- case ACL_MASK:
- error = acl_perm_to_string(ae_perm,
- ACL_STRING_PERM_MAXSIZE+1, perm_buf);
- if (error)
- goto error_label;
-
- len = asprintf(&tmpbuf, "%smask::%s\n", buf,
- perm_buf);
- if (len == -1) {
- errno = ENOMEM;
- goto error_label;
- }
- free(buf);
- buf = tmpbuf;
- break;
-
- case ACL_OTHER:
- error = acl_perm_to_string(ae_perm,
- ACL_STRING_PERM_MAXSIZE+1, perm_buf);
- if (error)
- goto error_label;
-
- len = asprintf(&tmpbuf, "%sother::%s\n", buf,
- perm_buf);
- if (len == -1) {
- errno = ENOMEM;
- goto error_label;
- }
- free(buf);
- buf = tmpbuf;
- break;
-
- default:
- free(buf);
- errno = EINVAL;
- return (0);
- }
- }
-
- if (len_p) {
- *len_p = strlen(buf);
- }
- return (buf);
-
-error_label:
- /* jump to here sets errno already, we just clean up */
- if (buf) free(buf);
- return (0);
-}
diff --git a/lib/libc/posix1e/acl_valid.3 b/lib/libc/posix1e/acl_valid.3
deleted file mode 100644
index 53ee879d20df..000000000000
--- a/lib/libc/posix1e/acl_valid.3
+++ /dev/null
@@ -1,144 +0,0 @@
-.\"-
-.\" Copyright (c) 2000 Robert N. M. Watson
-.\" 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.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd January 28, 2000
-.Dt ACL_VALID 3
-.Os FreeBSD 4.0
-.Sh NAME
-.Nm acl_valid ,
-.Nm acl_valid_fd_np ,
-.Nm acl_valid_file_np
-.Nd Validate an ACL
-.Sh SYNOPSIS
-.Fd #include <sys/types.h>
-.Fd #include <sys/acl.h>
-.Ft int
-.Fn acl_valid "acl_t acl"
-.Ft int
-.Fn acl_valid_fd_np "int fd" "acl_type_t type" "acl_t acl"
-.Ft int
-.Fn acl_valid_file_np "const char *path_p" "acl_type_t type" "acl_t acl"
-.Sh DESCRIPTION
-These functions check that the ACL referred to by the argument
-.Va acl
-is valid. The POSIX.1e routine,
-.Fn acl_valid ,
-checks this validity only with POSIX.1e ACL semantics, and irrespective
-of the context in which the ACL is to be used. The non-portable forms,
-.Fn acl_valid_fd_np
-and
-.Fn acl_valid_file_np ,
-allow an ACL to be checked in the context of a specific acl type,
-.Va type ,
-and file system object. In environments where additional ACL types are
-supported than just POSIX.1e, this makes more sense.
-
-For POSIX.1e semantics, the checks include:
-.Bd -literal -offset indent
-The three required entries (ACL_USER_OBJ, ACL_GROUP_OBJ,
-and ACL_OTHER) shall exist exactly once in the ACL. If
-the ACL contains any ACL_USER, ACL_GROUP, or any other
-implementation-defined entries in the file group class
-then one ACL_MASK entry shall also be required. The ACL
-shall contain at most on ACL_MASK entry.
-
-The qualifier field shall be unique among all entries of
-the same POSIX.1e ACL facility defined tag type. The
-tag type field shall contain valid values including any
-implementation-defined values. Validation of the values
-of the qualifier field is implementation-defined.
-.Ed
-
-The POSIX.1e
-.Fn acl_valid
-function may reorder the ACL for the purposes of verification; the
-non-portable validation functions will not.
-.Sh IMPLEMENTATION NOTES
-FreeBSD's support for POSIX.1e interfaces and features is still under
-development at this time.
-.Sh RETURN VALUES
-Upon successful completion, the function shall return a value of zero.
-Otherwise, a value of -1 shall be returned and
-.Va errno
-shall be set to indicate the error.
-.Sh ERRORS
-If any of the following conditions occur, these functions shall return
--1 and set
-.Va errno
-to the corresponding value:
-.Bl -tag -width Er
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix, or the
-object exists and the process does not have appropriate access rights.
-.It Bq Er EBADF
-The
-.Va fd
-argument is not a valid file descriptor.
-.It Bq Er EINVAL
-Argument
-.Va acl
-does not point to a valid ACL.
-
-One or more of the required ACL entries is not present in
-.Va acl .
-
-The ACL contains entries that are not unique.
-
-The file system rejects the ACL based on fs-specific semantics issues.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters, or an
-entire path name exceeded 1023 characters.
-.It Bq Er ENOENT
-The named object does not exist, or the
-.Va path_p
-argument points to an empty string.
-.It Bq Er ENOMEM
-Insufficient memory available to fulfill request.
-.It Bq Er EOPNOTSUPP
-The file system does not support ACL retrieval.
-.El
-.Sh SEE ALSO
-.Xr acl 3 ,
-.Xr acl_get 3 ,
-.Xr acl_init 3 ,
-.Xr acl_set 3 ,
-.Xr posix1e 3
-.Sh STANDARDS
-POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion
-of the draft continues on the cross-platform POSIX.1e implementation
-mailing list. To join this list, see the FreeBSD POSIX.1e implementation
-page for more information.
-.Sh HISTORY
-POSIX.1e support was introduced in
-.Fx 4.0 ,
-and development continues.
-.Sh AUTHORS
-.An Robert N M Watson
-.Sh BUGS
-These features are not yet fully implemented. In particular, the shipped
-version of UFS/FFS does not support storage of additional security labels,
-and so is unable to (easily) provide support for most of these features.
diff --git a/lib/libc/posix1e/acl_valid.c b/lib/libc/posix1e/acl_valid.c
deleted file mode 100644
index efb91ed73e42..000000000000
--- a/lib/libc/posix1e/acl_valid.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*-
- * Copyright (c) 1999 Robert N. M. Watson
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- */
-/*
- * acl_valid -- POSIX.1e ACL check routine
- */
-
-#include <sys/types.h>
-#include <sys/acl.h>
-#include <sys/errno.h>
-
-#include "acl_support.h"
-
-/*
- * acl_valid: accepts an ACL, returns 0 on valid ACL, -1 for invalid,
- * and errno set to EINVAL.
- *
- * Implemented by calling the acl_check routine in acl_support, which
- * requires ordering. We call acl_support's acl_sort to make this
- * true. POSIX.1e allows acl_valid() to reorder the ACL as it sees fit.
- *
- * This call is deprecated, as it doesn't ask whether the ACL is valid
- * for a particular target. However, this call is standardized, unlike
- * the other two forms.
- */
-int
-acl_valid(acl_t acl)
-{
- int error;
-
- acl_sort(acl);
- error = acl_check(acl);
- if (error) {
- errno = error;
- return (-1);
- } else {
- return (0);
- }
-}
-
-
-int
-acl_valid_file_np(const char *pathp, acl_type_t type, acl_t acl)
-{
- int error;
-
- if (acl_posix1e(acl, type)) {
- error = acl_sort(acl);
- if (error) {
- errno = error;
- return (-1);
- }
- }
-
- return (__acl_aclcheck_file(pathp, type, acl));
-}
-
-
-int
-acl_valid_fd_np(int fd, acl_type_t type, acl_t acl)
-{
- int error;
-
- if (acl_posix1e(acl, type)) {
- error = acl_sort(acl);
- if (error) {
- errno = error;
- return (-1);
- }
- }
-
- return (__acl_aclcheck_fd(fd, type, acl));
-}
diff --git a/lib/libc/posix1e/posix1e.3 b/lib/libc/posix1e/posix1e.3
deleted file mode 100644
index 3d433826ca5f..000000000000
--- a/lib/libc/posix1e/posix1e.3
+++ /dev/null
@@ -1,101 +0,0 @@
-.\"-
-.\" Copyright (c) 2000 Robert N. M. Watson
-.\" 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.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd January 17, 2000
-.Dt POSIX1E 3
-.Os FreeBSD 4.0
-.Sh NAME
-.Nm posix1e
-.Nd introduction to the POSIX.1e security API
-.Sh SYNOPSIS
-.Fd #include <sys/acl.h>
-.Fd #include <sys/audit.h>
-.Fd #include <sys/capability.h>
-.Fd #include <sys/mac.h>
-.Sh DESCRIPTION
-The IEEE POSIX.1e specification never left draft form, but the interfaces
-it describes are now widely used despite inherent limitations. Currently,
-only a few of the interfaces and features are implemented in FreeBSD,
-although efforts are underway to complete the integration at this time.
-
-POSIX.1e describes five security extensions to the base POSIX.1 API:
-Access Control Lists (ACLs), Auditing, Capabilities, Mandatory Access
-Control, and Information Flow Labels. Of these, the ACL interfaces are
-currently included with FreeBSD, Auditing, Capabilities, and Mandatory
-Access Control are in the wings, and Information Flow Labels are not on
-the calendar.
-
-POSIX.1e defines both syntax and semantics for these features, but fairly
-substantial changes are required to implement these features in the
-operating system. As shipped, FreeBSD 4.0 permits file systems to export
-Access Control Lists via the VFS, and provides a library for userland
-access to and manipulation of these ACLs, but support for ACLs is not
-provided by any file systems shipped in the base operating system.
-Available API calls relating to ACLs are described in detail in
-.Xr acl 3 .
-
-The patches supporting other POSIX.1e features are not available in the
-base operating system at this time--however, more information on them
-may be found on the FreeBSD POSIX.1e implementation web page:
-
-http://www.watson.org/fbsd-hardening/posix1e/
-.Sh IMPLEMENTATION NOTES
-FreeBSD's support for POSIX.1e interfaces and features is still under
-development at this time.
-.Sh ENVIRONMENT
-POSIX.1e assigns security labels to all objects, extending the security
-functionality described in POSIX.1. These additional labels provide
-fine-grained discretionary access control, fine-grained capabilities,
-and labels necessary for mandatory access control. POSIX.2c describes
-a set of userland utilities for manipulating these labels. These userland
-utilities are not bundled with
-.Fx 4.0
-so as to discourage their
-use in the short term.
-.Sh FILES
-.Sh SEE ALSO
-.Xr acl 3 ,
-.Xr acl 9 ,
-.Xr extattr 9
-.Sh STANDARDS
-POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion
-of the draft continues on the cross-platform POSIX.1e implementation
-mailing list. To join this list, see the
-.Fx
-POSIX.1e implementation
-page for more information.
-.Sh HISTORY
-POSIX.1e support was introduced in
-.Fx 4.0 ,
-and development continues.
-.Sh AUTHORS
-.An Robert N M Watson ,
-.An Ilmar S Habibulin
-.Sh BUGS
-These features are not yet fully implemented. In particular, the shipped
-version of UFS/FFS does not support storage of additional security labels,
-and so is unable to (easily) provide support for most of these features.
diff --git a/lib/libc/stdlib/strtoll.c b/lib/libc/stdlib/strtoll.c
deleted file mode 100644
index f84e030531bb..000000000000
--- a/lib/libc/stdlib/strtoll.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*-
- * Copyright (c) 1992, 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strtoq.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-
-#include <limits.h>
-#include <errno.h>
-#include <ctype.h>
-#include <stdlib.h>
-
-/*
- * Convert a string to a quad integer.
- *
- * Ignores `locale' stuff. Assumes that the upper and lower case
- * alphabets and digits are each contiguous.
- */
-quad_t
-strtoq(nptr, endptr, base)
- const char *nptr;
- char **endptr;
- register int base;
-{
- register const char *s;
- register u_quad_t acc;
- register unsigned char c;
- register u_quad_t qbase, cutoff;
- register int neg, any, cutlim;
-
- /*
- * Skip white space and pick up leading +/- sign if any.
- * If base is 0, allow 0x for hex and 0 for octal, else
- * assume decimal; if base is already 16, allow 0x.
- */
- s = nptr;
- do {
- c = *s++;
- } while (isspace(c));
- if (c == '-') {
- neg = 1;
- c = *s++;
- } else {
- neg = 0;
- if (c == '+')
- c = *s++;
- }
- if ((base == 0 || base == 16) &&
- c == '0' && (*s == 'x' || *s == 'X')) {
- c = s[1];
- s += 2;
- base = 16;
- }
- if (base == 0)
- base = c == '0' ? 8 : 10;
-
- /*
- * Compute the cutoff value between legal numbers and illegal
- * numbers. That is the largest legal value, divided by the
- * base. An input number that is greater than this value, if
- * followed by a legal input character, is too big. One that
- * is equal to this value may be valid or not; the limit
- * between valid and invalid numbers is then based on the last
- * digit. For instance, if the range for quads is
- * [-9223372036854775808..9223372036854775807] and the input base
- * is 10, cutoff will be set to 922337203685477580 and cutlim to
- * either 7 (neg==0) or 8 (neg==1), meaning that if we have
- * accumulated a value > 922337203685477580, or equal but the
- * next digit is > 7 (or 8), the number is too big, and we will
- * return a range error.
- *
- * Set any if any `digits' consumed; make it negative to indicate
- * overflow.
- */
- qbase = (unsigned)base;
- cutoff = neg ? (u_quad_t)-(QUAD_MIN + QUAD_MAX) + QUAD_MAX : QUAD_MAX;
- cutlim = cutoff % qbase;
- cutoff /= qbase;
- for (acc = 0, any = 0;; c = *s++) {
- if (!isascii(c))
- break;
- if (isdigit(c))
- c -= '0';
- else if (isalpha(c))
- c -= isupper(c) ? 'A' - 10 : 'a' - 10;
- else
- break;
- if (c >= base)
- break;
- if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
- any = -1;
- else {
- any = 1;
- acc *= qbase;
- acc += c;
- }
- }
- if (any < 0) {
- acc = neg ? QUAD_MIN : QUAD_MAX;
- errno = ERANGE;
- } else if (neg)
- acc = -acc;
- if (endptr != 0)
- *endptr = (char *)(any ? s - 1 : nptr);
- return (acc);
-}
diff --git a/lib/libc/stdlib/strtoull.c b/lib/libc/stdlib/strtoull.c
deleted file mode 100644
index 7656a3c53b14..000000000000
--- a/lib/libc/stdlib/strtoull.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/*-
- * Copyright (c) 1992, 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strtouq.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-
-#include <limits.h>
-#include <errno.h>
-#include <ctype.h>
-#include <stdlib.h>
-
-/*
- * Convert a string to an unsigned quad integer.
- *
- * Ignores `locale' stuff. Assumes that the upper and lower case
- * alphabets and digits are each contiguous.
- */
-u_quad_t
-strtouq(nptr, endptr, base)
- const char *nptr;
- char **endptr;
- register int base;
-{
- register const char *s = nptr;
- register u_quad_t acc;
- register unsigned char c;
- register u_quad_t qbase, cutoff;
- register int neg, any, cutlim;
-
- /*
- * See strtoq for comments as to the logic used.
- */
- s = nptr;
- do {
- c = *s++;
- } while (isspace(c));
- if (c == '-') {
- neg = 1;
- c = *s++;
- } else {
- neg = 0;
- if (c == '+')
- c = *s++;
- }
- if ((base == 0 || base == 16) &&
- c == '0' && (*s == 'x' || *s == 'X')) {
- c = s[1];
- s += 2;
- base = 16;
- }
- if (base == 0)
- base = c == '0' ? 8 : 10;
- qbase = (unsigned)base;
- cutoff = (u_quad_t)UQUAD_MAX / qbase;
- cutlim = (u_quad_t)UQUAD_MAX % qbase;
- for (acc = 0, any = 0;; c = *s++) {
- if (!isascii(c))
- break;
- if (isdigit(c))
- c -= '0';
- else if (isalpha(c))
- c -= isupper(c) ? 'A' - 10 : 'a' - 10;
- else
- break;
- if (c >= base)
- break;
- if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
- any = -1;
- else {
- any = 1;
- acc *= qbase;
- acc += c;
- }
- }
- if (any < 0) {
- acc = UQUAD_MAX;
- errno = ERANGE;
- } else if (neg)
- acc = -acc;
- if (endptr != 0)
- *endptr = (char *)(any ? s - 1 : nptr);
- return (acc);
-}