aboutsummaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2014-08-19 06:50:54 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2014-08-19 06:50:54 +0000
commitee7b0571c2c18bdec848ed2044223cc88db29bd8 (patch)
treeb04f4bd7cd887f50e7d98af35f46b9834ff86c80 /lib/libc
parentffda191e301f128a62c152fde92b692548367fca (diff)
parent15fc2873832ea5b9b639e701bbbf2e73af8b6a88 (diff)
downloadsrc-ee7b0571c2c18bdec848ed2044223cc88db29bd8.tar.gz
src-ee7b0571c2c18bdec848ed2044223cc88db29bd8.zip
Notes
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/Makefile1
-rw-r--r--lib/libc/Makefile.depend1
-rw-r--r--lib/libc/amd64/gen/sigsetjmp.S1
-rw-r--r--lib/libc/arm/Symbol.map5
-rw-r--r--lib/libc/arm/aeabi/Makefile.inc3
-rw-r--r--lib/libc/arm/aeabi/aeabi_unwind_exidx.c104
-rw-r--r--lib/libc/capability/cap_rights_init.32
-rw-r--r--lib/libc/gen/arc4random.c19
-rw-r--r--lib/libc/gen/cap_rights_get.32
-rw-r--r--lib/libc/gen/cap_sandboxed.32
-rw-r--r--lib/libc/gen/check_utility_compat.32
-rw-r--r--lib/libc/gen/clock_getcpuclockid.32
-rw-r--r--lib/libc/gen/directory.313
-rw-r--r--lib/libc/gen/dlinfo.39
-rw-r--r--lib/libc/gen/ftok.32
-rw-r--r--lib/libc/gen/gen-private.h1
-rw-r--r--lib/libc/gen/getpagesizes.32
-rw-r--r--lib/libc/gen/getutxent.32
-rw-r--r--lib/libc/gen/opendir.c365
-rw-r--r--lib/libc/gen/posix_spawn.32
-rw-r--r--lib/libc/gen/posix_spawn_file_actions_addopen.32
-rw-r--r--lib/libc/gen/posix_spawn_file_actions_init.32
-rw-r--r--lib/libc/gen/posix_spawnattr_getflags.32
-rw-r--r--lib/libc/gen/posix_spawnattr_getpgroup.32
-rw-r--r--lib/libc/gen/posix_spawnattr_getschedparam.32
-rw-r--r--lib/libc/gen/posix_spawnattr_getschedpolicy.32
-rw-r--r--lib/libc/gen/posix_spawnattr_getsigdefault.32
-rw-r--r--lib/libc/gen/posix_spawnattr_getsigmask.32
-rw-r--r--lib/libc/gen/posix_spawnattr_init.32
-rw-r--r--lib/libc/gen/readdir.c4
-rw-r--r--lib/libc/gen/readpassphrase.c8
-rw-r--r--lib/libc/gen/rewinddir.c19
-rw-r--r--lib/libc/gen/sem_new.c69
-rw-r--r--lib/libc/gen/sem_wait.31
-rw-r--r--lib/libc/gen/setproctitle.34
-rw-r--r--lib/libc/gen/statvfs.32
-rw-r--r--lib/libc/gen/sysconf.c12
-rw-r--r--lib/libc/gen/telldir.c41
-rw-r--r--lib/libc/gen/telldir.h2
-rw-r--r--lib/libc/gen/tls.c5
-rw-r--r--lib/libc/gen/ttyname.326
-rw-r--r--lib/libc/i386/gen/sigsetjmp.S1
-rw-r--r--lib/libc/ia64/Makefile.inc9
-rw-r--r--lib/libc/ia64/SYS.h63
-rw-r--r--lib/libc/ia64/Symbol.map71
-rw-r--r--lib/libc/ia64/_fpmath.h82
-rw-r--r--lib/libc/ia64/arith.h37
-rw-r--r--lib/libc/ia64/gd_qnan.h21
-rw-r--r--lib/libc/ia64/gen/Makefile.inc11
-rw-r--r--lib/libc/ia64/gen/__divdf3.S142
-rw-r--r--lib/libc/ia64/gen/__divdi3.S143
-rw-r--r--lib/libc/ia64/gen/__divsf3.S116
-rw-r--r--lib/libc/ia64/gen/__divsi3.S125
-rw-r--r--lib/libc/ia64/gen/__moddi3.S160
-rw-r--r--lib/libc/ia64/gen/__modsi3.S132
-rw-r--r--lib/libc/ia64/gen/__udivdi3.S144
-rw-r--r--lib/libc/ia64/gen/__udivsi3.S125
-rw-r--r--lib/libc/ia64/gen/__umoddi3.S156
-rw-r--r--lib/libc/ia64/gen/__umodsi3.S132
-rw-r--r--lib/libc/ia64/gen/_mcount.S75
-rw-r--r--lib/libc/ia64/gen/_set_tp.c34
-rw-r--r--lib/libc/ia64/gen/_setjmp.S310
-rw-r--r--lib/libc/ia64/gen/fabs.S33
-rw-r--r--lib/libc/ia64/gen/flt_rounds.c25
-rw-r--r--lib/libc/ia64/gen/fpgetmask.c40
-rw-r--r--lib/libc/ia64/gen/fpgetround.c39
-rw-r--r--lib/libc/ia64/gen/fpsetmask.c44
-rw-r--r--lib/libc/ia64/gen/fpsetround.c43
-rw-r--r--lib/libc/ia64/gen/getcontextx.c76
-rw-r--r--lib/libc/ia64/gen/infinity.c48
-rw-r--r--lib/libc/ia64/gen/makecontext.c123
-rw-r--r--lib/libc/ia64/gen/setjmp.S82
-rw-r--r--lib/libc/ia64/gen/signalcontext.c123
-rw-r--r--lib/libc/ia64/gen/sigsetjmp.S66
-rw-r--r--lib/libc/ia64/gen/unwind.c129
-rw-r--r--lib/libc/ia64/string/Makefile.inc3
-rw-r--r--lib/libc/ia64/string/bcopy.S95
-rw-r--r--lib/libc/ia64/string/bzero.S81
-rw-r--r--lib/libc/ia64/string/ffs.S99
-rw-r--r--lib/libc/ia64/string/memcpy.S36
-rw-r--r--lib/libc/ia64/string/memmove.S36
-rw-r--r--lib/libc/ia64/sys/Makefile.inc14
-rw-r--r--lib/libc/ia64/sys/Ovfork.S37
-rw-r--r--lib/libc/ia64/sys/__vdso_gettc.c48
-rw-r--r--lib/libc/ia64/sys/brk.S57
-rw-r--r--lib/libc/ia64/sys/cerror.S46
-rw-r--r--lib/libc/ia64/sys/exect.S38
-rw-r--r--lib/libc/ia64/sys/fork.S37
-rw-r--r--lib/libc/ia64/sys/getcontext.S39
-rw-r--r--lib/libc/ia64/sys/pipe.S47
-rw-r--r--lib/libc/ia64/sys/ptrace.S41
-rw-r--r--lib/libc/ia64/sys/sbrk.S63
-rw-r--r--lib/libc/ia64/sys/setlogin.S42
-rw-r--r--lib/libc/ia64/sys/sigreturn.S41
-rw-r--r--lib/libc/ia64/sys/swapcontext.S39
-rw-r--r--lib/libc/iconv/__iconv_get_list.32
-rw-r--r--lib/libc/iconv/bsd_iconv.c5
-rw-r--r--lib/libc/iconv/citrus_db_factory.c4
-rw-r--r--lib/libc/iconv/citrus_iconv.c3
-rw-r--r--lib/libc/iconv/iconv_canonicalize.32
-rw-r--r--lib/libc/iconv/iconvctl.32
-rw-r--r--lib/libc/iconv/iconvlist.32
-rw-r--r--lib/libc/locale/utf8.c29
-rw-r--r--lib/libc/mips/arith.h3
-rw-r--r--lib/libc/net/Makefile.inc8
-rw-r--r--lib/libc/net/getaddrinfo.c112
-rw-r--r--lib/libc/net/nsdispatch.33
-rw-r--r--lib/libc/net/sourcefilter.33
-rw-r--r--lib/libc/net/sourcefilter.c3
-rw-r--r--lib/libc/posix1e/acl_add_flag_np.32
-rw-r--r--lib/libc/posix1e/acl_add_perm.32
-rw-r--r--lib/libc/posix1e/acl_calc_mask.32
-rw-r--r--lib/libc/posix1e/acl_clear_flags_np.32
-rw-r--r--lib/libc/posix1e/acl_clear_perms.32
-rw-r--r--lib/libc/posix1e/acl_copy_entry.32
-rw-r--r--lib/libc/posix1e/acl_create_entry.32
-rw-r--r--lib/libc/posix1e/acl_delete_entry.32
-rw-r--r--lib/libc/posix1e/acl_delete_flag_np.32
-rw-r--r--lib/libc/posix1e/acl_delete_perm.32
-rw-r--r--lib/libc/posix1e/acl_get_brand_np.32
-rw-r--r--lib/libc/posix1e/acl_get_entry.32
-rw-r--r--lib/libc/posix1e/acl_get_entry_type_np.32
-rw-r--r--lib/libc/posix1e/acl_get_flag_np.32
-rw-r--r--lib/libc/posix1e/acl_get_flagset_np.32
-rw-r--r--lib/libc/posix1e/acl_get_perm_np.32
-rw-r--r--lib/libc/posix1e/acl_get_permset.32
-rw-r--r--lib/libc/posix1e/acl_get_qualifier.32
-rw-r--r--lib/libc/posix1e/acl_get_tag_type.32
-rw-r--r--lib/libc/posix1e/acl_is_trivial_np.32
-rw-r--r--lib/libc/posix1e/acl_set_entry_type_np.32
-rw-r--r--lib/libc/posix1e/acl_set_flagset_np.32
-rw-r--r--lib/libc/posix1e/acl_set_permset.32
-rw-r--r--lib/libc/posix1e/acl_set_qualifier.32
-rw-r--r--lib/libc/posix1e/acl_set_tag_type.32
-rw-r--r--lib/libc/posix1e/acl_strip_np.32
-rw-r--r--lib/libc/regex/re_format.79
-rw-r--r--lib/libc/regex/regcomp.c18
-rw-r--r--lib/libc/stdio/fflush.c25
-rw-r--r--lib/libc/stdio/fmemopen.c17
-rw-r--r--lib/libc/stdio/fopen.39
-rw-r--r--lib/libc/stdio/fputs.c2
-rw-r--r--lib/libc/stdio/fputws.c2
-rw-r--r--lib/libc/stdio/freopen.c10
-rw-r--r--lib/libc/stdio/ftell.c18
-rw-r--r--lib/libc/stdio/gets.c2
-rw-r--r--lib/libc/stdio/printf.34
-rw-r--r--lib/libc/stdio/puts.c4
-rw-r--r--lib/libc/stdio/putw.c2
-rw-r--r--lib/libc/stdio/rewind.c5
-rw-r--r--lib/libc/stdio/vfprintf.c4
-rw-r--r--lib/libc/stdio/vfwprintf.c4
-rw-r--r--lib/libc/stdio/wbuf.c5
-rw-r--r--lib/libc/stdlib/Makefile.inc1
-rw-r--r--lib/libc/stdlib/Symbol.map3
-rw-r--r--lib/libc/stdlib/a64l.32
-rw-r--r--lib/libc/stdlib/getopt.315
-rw-r--r--lib/libc/stdlib/getopt.c13
-rw-r--r--lib/libc/stdlib/getopt_long.c30
-rw-r--r--lib/libc/stdlib/hcreate.393
-rw-r--r--lib/libc/stdlib/hcreate.c105
-rw-r--r--lib/libc/stdlib/strfmon.34
-rw-r--r--lib/libc/stdlib/strfmon.c8
-rw-r--r--lib/libc/stdlib/tsearch.c13
-rw-r--r--lib/libc/stdlib/twalk.c17
-rw-r--r--lib/libc/stdtime/strftime.32
-rw-r--r--lib/libc/stdtime/strftime.c340
-rw-r--r--lib/libc/stdtime/strptime.c196
-rw-r--r--lib/libc/stdtime/timelocal.c2
-rw-r--r--lib/libc/string/Makefile.inc3
-rw-r--r--lib/libc/string/memmem.32
-rw-r--r--lib/libc/string/strcasecmp.34
-rw-r--r--lib/libc/string/strcspn.388
-rw-r--r--lib/libc/string/strerror.32
-rw-r--r--lib/libc/string/strspn.345
-rw-r--r--lib/libc/string/strtok.35
-rw-r--r--lib/libc/sys/abort2.24
-rw-r--r--lib/libc/sys/aio_cancel.24
-rw-r--r--lib/libc/sys/aio_error.22
-rw-r--r--lib/libc/sys/aio_mlock.22
-rw-r--r--lib/libc/sys/aio_read.22
-rw-r--r--lib/libc/sys/aio_return.22
-rw-r--r--lib/libc/sys/aio_suspend.22
-rw-r--r--lib/libc/sys/aio_waitcomplete.22
-rw-r--r--lib/libc/sys/aio_write.22
-rw-r--r--lib/libc/sys/bind.26
-rw-r--r--lib/libc/sys/bindat.22
-rw-r--r--lib/libc/sys/cap_fcntls_limit.22
-rw-r--r--lib/libc/sys/cap_ioctls_limit.22
-rw-r--r--lib/libc/sys/cap_rights_limit.22
-rw-r--r--lib/libc/sys/connect.26
-rw-r--r--lib/libc/sys/connectat.22
-rw-r--r--lib/libc/sys/cpuset.24
-rw-r--r--lib/libc/sys/cpuset_getaffinity.24
-rw-r--r--lib/libc/sys/ffclock.24
-rw-r--r--lib/libc/sys/intro.22
-rw-r--r--lib/libc/sys/kenv.24
-rw-r--r--lib/libc/sys/kqueue.225
-rw-r--r--lib/libc/sys/kse.210
-rw-r--r--lib/libc/sys/listen.25
-rw-r--r--lib/libc/sys/mlock.221
-rw-r--r--lib/libc/sys/mmap.233
-rw-r--r--lib/libc/sys/mmap.c17
-rw-r--r--lib/libc/sys/pdfork.24
-rw-r--r--lib/libc/sys/posix_fallocate.22
-rw-r--r--lib/libc/sys/posix_openpt.22
-rw-r--r--lib/libc/sys/procctl.22
-rw-r--r--lib/libc/sys/pselect.22
-rw-r--r--lib/libc/sys/rtprio.22
-rw-r--r--lib/libc/sys/sendfile.22
-rw-r--r--lib/libc/sys/shm_open.24
-rw-r--r--lib/libc/sys/shutdown.22
-rw-r--r--lib/libc/sys/socket.263
-rw-r--r--lib/libc/sys/utimes.266
-rw-r--r--lib/libc/xdr/xdr_float.c2
214 files changed, 1402 insertions, 4940 deletions
diff --git a/lib/libc/Makefile b/lib/libc/Makefile
index e9bc33bd9277..9951857dbf4d 100644
--- a/lib/libc/Makefile
+++ b/lib/libc/Makefile
@@ -80,7 +80,6 @@ NOASM=
.include "${LIBC_SRCTOP}/nls/Makefile.inc"
.include "${LIBC_SRCTOP}/posix1e/Makefile.inc"
.if ${LIBC_ARCH} != "amd64" && \
- ${LIBC_ARCH} != "ia64" && \
${LIBC_ARCH} != "powerpc64" && \
${LIBC_ARCH} != "sparc64" && \
${MACHINE_ARCH:Mmipsn32*} == "" && \
diff --git a/lib/libc/Makefile.depend b/lib/libc/Makefile.depend
index 616f3ba77615..d23769e11570 100644
--- a/lib/libc/Makefile.depend
+++ b/lib/libc/Makefile.depend
@@ -3,6 +3,7 @@
DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,}
DIRDEPS = \
+ bin/cat.host \
gnu/lib/csu \
include \
include/rpc \
diff --git a/lib/libc/amd64/gen/sigsetjmp.S b/lib/libc/amd64/gen/sigsetjmp.S
index 02b154ce5fa2..9a205567c3b7 100644
--- a/lib/libc/amd64/gen/sigsetjmp.S
+++ b/lib/libc/amd64/gen/sigsetjmp.S
@@ -105,7 +105,6 @@ ENTRY(__siglongjmp)
movq 40(%rdx),%r13
movq 48(%rdx),%r14
movq 56(%rdx),%r15
- fninit
fldcw 64(%rdx)
testq %rax,%rax
jnz 1f
diff --git a/lib/libc/arm/Symbol.map b/lib/libc/arm/Symbol.map
index 746db23cb382..cf65492c3050 100644
--- a/lib/libc/arm/Symbol.map
+++ b/lib/libc/arm/Symbol.map
@@ -37,8 +37,9 @@ FBSD_1.3 {
__flt_rounds;
};
-FBSD_1.3 {
- __flt_rounds;
+FBSD_1.4 {
+ __gnu_Unwind_Find_exidx;
+ dl_unwind_find_exidx;
};
FBSDprivate_1.0 {
diff --git a/lib/libc/arm/aeabi/Makefile.inc b/lib/libc/arm/aeabi/Makefile.inc
index 8f9e19ec2df9..0957c922e2d1 100644
--- a/lib/libc/arm/aeabi/Makefile.inc
+++ b/lib/libc/arm/aeabi/Makefile.inc
@@ -3,7 +3,8 @@
.PATH: ${LIBC_SRCTOP}/arm/aeabi
SRCS+= aeabi_atexit.c \
- aeabi_unwind_cpp.c
+ aeabi_unwind_cpp.c \
+ aeabi_unwind_exidx.c
.if ${MACHINE_ARCH} != "armv6hf"
SRCS+= aeabi_double.c \
aeabi_float.c
diff --git a/lib/libc/arm/aeabi/aeabi_unwind_exidx.c b/lib/libc/arm/aeabi/aeabi_unwind_exidx.c
new file mode 100644
index 000000000000..d5af8b3fc6e0
--- /dev/null
+++ b/lib/libc/arm/aeabi/aeabi_unwind_exidx.c
@@ -0,0 +1,104 @@
+/*-
+ * Copyright (c) 2014 Ian Lepore <ian@freebsd.org>
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <machine/elf.h>
+#include <link.h>
+#include <stddef.h>
+
+/*
+ * ARM EABI unwind helper.
+ *
+ * This finds the exidx section address and size associated with a given code
+ * address. There are separate implementations for static and dynamic code.
+ *
+ * GCC expects this function to exist as __gnu_Unwind_Find_exidx(), clang and
+ * BSD tools expect it to be dl_unwind_find_exidx(). Both have the same API, so
+ * we set up an alias for GCC.
+ */
+__strong_reference(dl_unwind_find_exidx, __gnu_Unwind_Find_exidx);
+
+/*
+ * Each entry in the exidx section is a pair of 32-bit words. We don't
+ * interpret the contents of the entries here; this typedef is just a local
+ * convenience for using sizeof() and doing pointer math.
+ */
+typedef struct exidx_entry {
+ uint32_t data[2];
+} exidx_entry;
+
+#ifdef __PIC__
+
+/*
+ * Unwind helper for dynamically linked code.
+ *
+ * This finds the shared object that contains the given address, and returns the
+ * address of the exidx section in that shared object along with the number of
+ * entries in that section, or NULL if it wasn't found.
+ */
+void *
+dl_unwind_find_exidx(const void *pc, int *pcount)
+{
+ const Elf_Phdr *hdr;
+ struct dl_phdr_info info;
+ int i;
+
+ if (_rtld_addr_phdr(pc, &info)) {
+ hdr = info.dlpi_phdr;
+ for (i = 0; i < info.dlpi_phnum; i++, hdr++) {
+ if (hdr->p_type == PT_ARM_EXIDX) {
+ *pcount = hdr->p_memsz / sizeof(exidx_entry);
+ return ((void *)(info.dlpi_addr + hdr->p_vaddr));
+ }
+ }
+ }
+ return (NULL);
+}
+
+#else /* !__PIC__ */
+
+/*
+ * Unwind helper for statically linked code.
+ *
+ * In a statically linked program, the linker populates a pair of symbols with
+ * the addresses of the start and end of the exidx table, so returning the
+ * address and count of elements is pretty straighforward.
+ */
+void *
+dl_unwind_find_exidx(const void *pc, int *pcount)
+{
+ extern struct exidx_entry __exidx_start;
+ extern struct exidx_entry __exidx_end;
+
+ *pcount = (int)(&__exidx_end - &__exidx_start);
+ return (&__exidx_start);
+}
+
+#endif /* __PIC__ */
+
diff --git a/lib/libc/capability/cap_rights_init.3 b/lib/libc/capability/cap_rights_init.3
index 464184eaea60..5615de1a6804 100644
--- a/lib/libc/capability/cap_rights_init.3
+++ b/lib/libc/capability/cap_rights_init.3
@@ -237,5 +237,5 @@ Support for capabilities and capabilities mode was developed as part of the
Project.
.Sh AUTHORS
This family of functions was created by
-.An Pawel Jakub Dawidek Aq pawel@dawidek.net
+.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net
under sponsorship from the FreeBSD Foundation.
diff --git a/lib/libc/gen/arc4random.c b/lib/libc/gen/arc4random.c
index 59e410bc4386..59c4f7fd1dc7 100644
--- a/lib/libc/gen/arc4random.c
+++ b/lib/libc/gen/arc4random.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arc4random.c,v 1.22 2010/12/22 08:23:42 otto Exp $ */
+/* $OpenBSD: arc4random.c,v 1.24 2013/06/11 16:59:50 deraadt Exp $ */
/*
* Copyright (c) 1996, David Mazieres <dm@uun.org>
@@ -182,8 +182,7 @@ arc4_stir_if_needed(void)
{
pid_t pid = getpid();
- if (arc4_count <= 0 || !rs_initialized || arc4_stir_pid != pid)
- {
+ if (arc4_count <= 0 || !rs_initialized || arc4_stir_pid != pid) {
arc4_stir_pid = pid;
arc4_stir();
}
@@ -276,18 +275,8 @@ arc4random_uniform(u_int32_t upper_bound)
if (upper_bound < 2)
return 0;
-#if (ULONG_MAX > 0xffffffffUL)
- min = 0x100000000UL % upper_bound;
-#else
- /* Calculate (2**32 % upper_bound) avoiding 64-bit math */
- if (upper_bound > 0x80000000)
- min = 1 + ~upper_bound; /* 2**32 - upper_bound */
- else {
- /* (2**32 - (x * 2)) % x == 2**32 % x when x <= 2**31 */
- min = ((0xffffffff - (upper_bound * 2)) + 1) % upper_bound;
- }
-#endif
-
+ /* 2**32 % x == (2**32 - x) % x */
+ min = -upper_bound % upper_bound;
/*
* This could theoretically loop forever but each retry has
* p > 0.5 (worst case, usually far better) of selecting a
diff --git a/lib/libc/gen/cap_rights_get.3 b/lib/libc/gen/cap_rights_get.3
index bc6fb248ec23..f74d1f7aeda5 100644
--- a/lib/libc/gen/cap_rights_get.3
+++ b/lib/libc/gen/cap_rights_get.3
@@ -115,5 +115,5 @@ Support for capabilities and capabilities mode was developed as part of the
Project.
.Sh AUTHORS
This function was created by
-.An Pawel Jakub Dawidek Aq pawel@dawidek.net
+.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net
under sponsorship of the FreeBSD Foundation.
diff --git a/lib/libc/gen/cap_sandboxed.3 b/lib/libc/gen/cap_sandboxed.3
index 7019bfb9a3f2..5882ff002789 100644
--- a/lib/libc/gen/cap_sandboxed.3
+++ b/lib/libc/gen/cap_sandboxed.3
@@ -67,5 +67,5 @@ or
.Xr capsicum 4
.Sh AUTHORS
This function was implemented and manual page was written by
-.An Pawel Jakub Dawidek Aq pawel@dawidek.net
+.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net
under sponsorship of the FreeBSD Foundation.
diff --git a/lib/libc/gen/check_utility_compat.3 b/lib/libc/gen/check_utility_compat.3
index 57638e50ead0..89449a4064bb 100644
--- a/lib/libc/gen/check_utility_compat.3
+++ b/lib/libc/gen/check_utility_compat.3
@@ -86,4 +86,4 @@ function first appeared in
.Fx 5.0 .
.Sh AUTHORS
This manual page was written by
-.An Garrett Wollman Aq wollman@FreeBSD.org .
+.An Garrett Wollman Aq Mt wollman@FreeBSD.org .
diff --git a/lib/libc/gen/clock_getcpuclockid.3 b/lib/libc/gen/clock_getcpuclockid.3
index 3d31993ccc2c..ebaa3dc0cc43 100644
--- a/lib/libc/gen/clock_getcpuclockid.3
+++ b/lib/libc/gen/clock_getcpuclockid.3
@@ -92,4 +92,4 @@ The
function first appeared in
.Fx 10.0 .
.Sh AUTHORS
-.An David Xu Aq davidxu@FreeBSD.org
+.An David Xu Aq Mt davidxu@FreeBSD.org
diff --git a/lib/libc/gen/directory.3 b/lib/libc/gen/directory.3
index 4573d4513fe2..1e864f8dcbc5 100644
--- a/lib/libc/gen/directory.3
+++ b/lib/libc/gen/directory.3
@@ -28,7 +28,7 @@
.\" @(#)directory.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd August 18, 2013
+.Dd July 28, 2014
.Dt DIRECTORY 3
.Os
.Sh NAME
@@ -169,6 +169,10 @@ If the directory is closed and then
reopened, prior values returned by
.Fn telldir
will no longer be valid.
+Values returned by
+.Fn telldir
+are also invalidated by a call to
+.Fn rewinddir .
.Pp
The
.Fn seekdir
@@ -182,13 +186,6 @@ The new position reverts to the one associated with the
when the
.Fn telldir
operation was performed.
-State associated with the token returned by
-.Fn telldir is freed when it is passed to
-.Fn seekdir .
-If you wish return to the same location again,
-then you must create a new token with another
-.Fn telldir
-call.
.Pp
The
.Fn rewinddir
diff --git a/lib/libc/gen/dlinfo.3 b/lib/libc/gen/dlinfo.3
index d00f07467af5..3fc568e0fcc6 100644
--- a/lib/libc/gen/dlinfo.3
+++ b/lib/libc/gen/dlinfo.3
@@ -271,12 +271,9 @@ The
implementation of the
.Fn dlinfo
function was originally written by
-.An Alexey Zelkin
-.Aq phantom@FreeBSD.org
+.An Alexey Zelkin Aq Mt phantom@FreeBSD.org
and later extended and improved by
-.An Alexander Kabaev
-.Aq kan@FreeBSD.org .
+.An Alexander Kabaev Aq Mt kan@FreeBSD.org .
.Pp
The manual page for this function was written by
-.An Alexey Zelkin
-.Aq phantom@FreeBSD.org .
+.An Alexey Zelkin Aq Mt phantom@FreeBSD.org .
diff --git a/lib/libc/gen/ftok.3 b/lib/libc/gen/ftok.3
index 996b2da41c7b..98f8bad878f8 100644
--- a/lib/libc/gen/ftok.3
+++ b/lib/libc/gen/ftok.3
@@ -73,7 +73,7 @@ The
function originates with System V and is typically used by programs
that use the System V IPC routines.
.Sh AUTHORS
-.An Thorsten Lockert Aq tholo@sigmasoft.com
+.An Thorsten Lockert Aq Mt tholo@sigmasoft.com
.Sh BUGS
The returned key is computed based on the device minor number and inode of the
specified
diff --git a/lib/libc/gen/gen-private.h b/lib/libc/gen/gen-private.h
index e8854ad2d856..d1fab5f31462 100644
--- a/lib/libc/gen/gen-private.h
+++ b/lib/libc/gen/gen-private.h
@@ -48,7 +48,6 @@ struct _dirdesc {
char *dd_buf; /* data buffer */
int dd_len; /* size of data buffer */
long dd_seek; /* magic cookie returned by getdirentries */
- long dd_rewind; /* magic cookie for rewinding */
int dd_flags; /* flags for readdir */
struct pthread_mutex *dd_lock; /* lock */
struct _telldir *dd_td; /* telldir position recording */
diff --git a/lib/libc/gen/getpagesizes.3 b/lib/libc/gen/getpagesizes.3
index 854e2f7858fe..52fa866821f2 100644
--- a/lib/libc/gen/getpagesizes.3
+++ b/lib/libc/gen/getpagesizes.3
@@ -96,4 +96,4 @@ implementation that was first released in
.Fx 7.3 .
.Sh AUTHORS
This manual page was written by
-.An Alan L. Cox Aq alc@cs.rice.edu .
+.An Alan L. Cox Aq Mt alc@cs.rice.edu .
diff --git a/lib/libc/gen/getutxent.3 b/lib/libc/gen/getutxent.3
index 2ea09712d8d4..120f4a08b8e1 100644
--- a/lib/libc/gen/getutxent.3
+++ b/lib/libc/gen/getutxent.3
@@ -475,4 +475,4 @@ They replaced the
.In utmp.h
interface.
.Sh AUTHORS
-.An Ed Schouten Aq ed@FreeBSD.org
+.An Ed Schouten Aq Mt ed@FreeBSD.org
diff --git a/lib/libc/gen/opendir.c b/lib/libc/gen/opendir.c
index a9eb0af1ba4b..54928e73d60c 100644
--- a/lib/libc/gen/opendir.c
+++ b/lib/libc/gen/opendir.c
@@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$");
#include "gen-private.h"
#include "telldir.h"
-static DIR * __opendir_common(int, int);
+static DIR * __opendir_common(int, int, bool);
/*
* Open a directory.
@@ -67,18 +67,10 @@ opendir(const char *name)
DIR *
fdopendir(int fd)
{
- struct stat statb;
- /* Check that fd is associated with a directory. */
- if (_fstat(fd, &statb) != 0)
- return (NULL);
- if (!S_ISDIR(statb.st_mode)) {
- errno = ENOTDIR;
- return (NULL);
- }
if (_fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
return (NULL);
- return (__opendir_common(fd, DTF_HIDEW|DTF_NODUP));
+ return (__opendir_common(fd, DTF_HIDEW|DTF_NODUP, true));
}
DIR *
@@ -88,11 +80,13 @@ __opendir2(const char *name, int flags)
DIR *dir;
int saved_errno;
+ if ((flags & (__DTF_READALL | __DTF_SKIPREAD)) != 0)
+ return (NULL);
if ((fd = _open(name,
O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC)) == -1)
return (NULL);
- dir = __opendir_common(fd, flags);
+ dir = __opendir_common(fd, flags, false);
if (dir == NULL) {
saved_errno = errno;
_close(fd);
@@ -110,22 +104,195 @@ opendir_compar(const void *p1, const void *p2)
}
/*
+ * For a directory at the top of a unionfs stack, the entire directory's
+ * contents are read and cached locally until the next call to rewinddir().
+ * For the fdopendir() case, the initial seek position must be preserved.
+ * For rewinddir(), the full directory should always be re-read from the
+ * beginning.
+ *
+ * If an error occurs, the existing buffer and state of 'dirp' is left
+ * unchanged.
+ */
+bool
+_filldir(DIR *dirp, bool use_current_pos)
+{
+ struct dirent **dpv;
+ char *buf, *ddptr, *ddeptr;
+ off_t pos;
+ int fd2, incr, len, n, saved_errno, space;
+
+ len = 0;
+ space = 0;
+ buf = NULL;
+ ddptr = NULL;
+
+ /*
+ * Use the system page size if that is a multiple of DIRBLKSIZ.
+ * Hopefully this can be a big win someday by allowing page
+ * trades to user space to be done by _getdirentries().
+ */
+ incr = getpagesize();
+ if ((incr % DIRBLKSIZ) != 0)
+ incr = DIRBLKSIZ;
+
+ /*
+ * The strategy here is to read all the directory
+ * entries into a buffer, sort the buffer, and
+ * remove duplicate entries by setting the inode
+ * number to zero.
+ *
+ * We reopen the directory because _getdirentries()
+ * on a MNT_UNION mount modifies the open directory,
+ * making it refer to the lower directory after the
+ * upper directory's entries are exhausted.
+ * This would otherwise break software that uses
+ * the directory descriptor for fchdir or *at
+ * functions, such as fts.c.
+ */
+ if ((fd2 = _openat(dirp->dd_fd, ".", O_RDONLY | O_CLOEXEC)) == -1)
+ return (false);
+
+ if (use_current_pos) {
+ pos = lseek(dirp->dd_fd, 0, SEEK_CUR);
+ if (pos == -1 || lseek(fd2, pos, SEEK_SET) == -1) {
+ saved_errno = errno;
+ _close(fd2);
+ errno = saved_errno;
+ return (false);
+ }
+ }
+
+ do {
+ /*
+ * Always make at least DIRBLKSIZ bytes
+ * available to _getdirentries
+ */
+ if (space < DIRBLKSIZ) {
+ space += incr;
+ len += incr;
+ buf = reallocf(buf, len);
+ if (buf == NULL) {
+ saved_errno = errno;
+ _close(fd2);
+ errno = saved_errno;
+ return (false);
+ }
+ ddptr = buf + (len - space);
+ }
+
+ n = _getdirentries(fd2, ddptr, space, &dirp->dd_seek);
+ if (n > 0) {
+ ddptr += n;
+ space -= n;
+ }
+ if (n < 0) {
+ saved_errno = errno;
+ _close(fd2);
+ errno = saved_errno;
+ return (false);
+ }
+ } while (n > 0);
+ _close(fd2);
+
+ ddeptr = ddptr;
+
+ /*
+ * There is now a buffer full of (possibly) duplicate
+ * names.
+ */
+ dirp->dd_buf = buf;
+
+ /*
+ * Go round this loop twice...
+ *
+ * Scan through the buffer, counting entries.
+ * On the second pass, save pointers to each one.
+ * Then sort the pointers and remove duplicate names.
+ */
+ for (dpv = 0;;) {
+ n = 0;
+ ddptr = buf;
+ while (ddptr < ddeptr) {
+ struct dirent *dp;
+
+ dp = (struct dirent *) ddptr;
+ if ((long)dp & 03L)
+ break;
+ if ((dp->d_reclen <= 0) ||
+ (dp->d_reclen > (ddeptr + 1 - ddptr)))
+ break;
+ ddptr += dp->d_reclen;
+ if (dp->d_fileno) {
+ if (dpv)
+ dpv[n] = dp;
+ n++;
+ }
+ }
+
+ if (dpv) {
+ struct dirent *xp;
+
+ /*
+ * This sort must be stable.
+ */
+ mergesort(dpv, n, sizeof(*dpv), opendir_compar);
+
+ dpv[n] = NULL;
+ xp = NULL;
+
+ /*
+ * Scan through the buffer in sort order,
+ * zapping the inode number of any
+ * duplicate names.
+ */
+ for (n = 0; dpv[n]; n++) {
+ struct dirent *dp = dpv[n];
+
+ if ((xp == NULL) ||
+ strcmp(dp->d_name, xp->d_name)) {
+ xp = dp;
+ } else {
+ dp->d_fileno = 0;
+ }
+ if (dp->d_type == DT_WHT &&
+ (dirp->dd_flags & DTF_HIDEW))
+ dp->d_fileno = 0;
+ }
+
+ free(dpv);
+ break;
+ } else {
+ dpv = malloc((n+1) * sizeof(struct dirent *));
+ if (dpv == NULL)
+ break;
+ }
+ }
+
+ dirp->dd_len = len;
+ dirp->dd_size = ddptr - dirp->dd_buf;
+ return (true);
+}
+
+
+/*
* Common routine for opendir(3), __opendir2(3) and fdopendir(3).
*/
static DIR *
-__opendir_common(int fd, int flags)
+__opendir_common(int fd, int flags, bool use_current_pos)
{
DIR *dirp;
int incr;
int saved_errno;
int unionstack;
- int fd2;
-
- fd2 = -1;
if ((dirp = malloc(sizeof(DIR) + sizeof(struct _telldir))) == NULL)
return (NULL);
+ dirp->dd_buf = NULL;
+ dirp->dd_fd = fd;
+ dirp->dd_flags = flags;
+ dirp->dd_loc = 0;
+ dirp->dd_lock = NULL;
dirp->dd_td = (struct _telldir *)((char *)dirp + sizeof(DIR));
LIST_INIT(&dirp->dd_td->td_locq);
dirp->dd_td->td_loccnt = 0;
@@ -154,163 +321,39 @@ __opendir_common(int fd, int flags)
}
if (unionstack) {
- int len = 0;
- int space = 0;
- char *buf = 0;
- char *ddptr = 0;
- char *ddeptr;
- int n;
- struct dirent **dpv;
-
- /*
- * The strategy here is to read all the directory
- * entries into a buffer, sort the buffer, and
- * remove duplicate entries by setting the inode
- * number to zero.
- *
- * We reopen the directory because _getdirentries()
- * on a MNT_UNION mount modifies the open directory,
- * making it refer to the lower directory after the
- * upper directory's entries are exhausted.
- * This would otherwise break software that uses
- * the directory descriptor for fchdir or *at
- * functions, such as fts.c.
- */
- if ((fd2 = _openat(fd, ".", O_RDONLY | O_CLOEXEC)) == -1) {
- saved_errno = errno;
- free(buf);
- free(dirp);
- errno = saved_errno;
- return (NULL);
- }
-
- do {
- /*
- * Always make at least DIRBLKSIZ bytes
- * available to _getdirentries
- */
- if (space < DIRBLKSIZ) {
- space += incr;
- len += incr;
- buf = reallocf(buf, len);
- if (buf == NULL)
- goto fail;
- ddptr = buf + (len - space);
- }
-
- n = _getdirentries(fd2, ddptr, space, &dirp->dd_seek);
- if (n > 0) {
- ddptr += n;
- space -= n;
- }
- } while (n > 0);
-
- ddeptr = ddptr;
- flags |= __DTF_READALL;
-
- _close(fd2);
- fd2 = -1;
-
- /*
- * There is now a buffer full of (possibly) duplicate
- * names.
- */
- dirp->dd_buf = buf;
-
- /*
- * Go round this loop twice...
- *
- * Scan through the buffer, counting entries.
- * On the second pass, save pointers to each one.
- * Then sort the pointers and remove duplicate names.
- */
- for (dpv = 0;;) {
- n = 0;
- ddptr = buf;
- while (ddptr < ddeptr) {
- struct dirent *dp;
-
- dp = (struct dirent *) ddptr;
- if ((long)dp & 03L)
- break;
- if ((dp->d_reclen <= 0) ||
- (dp->d_reclen > (ddeptr + 1 - ddptr)))
- break;
- ddptr += dp->d_reclen;
- if (dp->d_fileno) {
- if (dpv)
- dpv[n] = dp;
- n++;
- }
- }
-
- if (dpv) {
- struct dirent *xp;
-
- /*
- * This sort must be stable.
- */
- mergesort(dpv, n, sizeof(*dpv),
- opendir_compar);
-
- dpv[n] = NULL;
- xp = NULL;
-
- /*
- * Scan through the buffer in sort order,
- * zapping the inode number of any
- * duplicate names.
- */
- for (n = 0; dpv[n]; n++) {
- struct dirent *dp = dpv[n];
-
- if ((xp == NULL) ||
- strcmp(dp->d_name, xp->d_name)) {
- xp = dp;
- } else {
- dp->d_fileno = 0;
- }
- if (dp->d_type == DT_WHT &&
- (flags & DTF_HIDEW))
- dp->d_fileno = 0;
- }
-
- free(dpv);
- break;
- } else {
- dpv = malloc((n+1) * sizeof(struct dirent *));
- if (dpv == NULL)
- break;
- }
- }
-
- dirp->dd_len = len;
- dirp->dd_size = ddptr - dirp->dd_buf;
+ if (!_filldir(dirp, use_current_pos))
+ goto fail;
+ dirp->dd_flags |= __DTF_READALL;
} else {
dirp->dd_len = incr;
- dirp->dd_size = 0;
dirp->dd_buf = malloc(dirp->dd_len);
if (dirp->dd_buf == NULL)
goto fail;
- dirp->dd_seek = 0;
+ if (use_current_pos) {
+ /*
+ * Read the first batch of directory entries
+ * to prime dd_seek. This also checks if the
+ * fd passed to fdopendir() is a directory.
+ */
+ dirp->dd_size = _getdirentries(dirp->dd_fd,
+ dirp->dd_buf, dirp->dd_len, &dirp->dd_seek);
+ if (dirp->dd_size < 0) {
+ if (errno == EINVAL)
+ errno = ENOTDIR;
+ goto fail;
+ }
+ dirp->dd_flags |= __DTF_SKIPREAD;
+ } else {
+ dirp->dd_size = 0;
+ dirp->dd_seek = 0;
+ }
}
- dirp->dd_loc = 0;
- dirp->dd_fd = fd;
- dirp->dd_flags = flags;
- dirp->dd_lock = NULL;
-
- /*
- * Set up seek point for rewinddir.
- */
- dirp->dd_rewind = telldir(dirp);
-
return (dirp);
fail:
saved_errno = errno;
- if (fd2 != -1)
- _close(fd2);
+ free(dirp->dd_buf);
free(dirp);
errno = saved_errno;
return (NULL);
diff --git a/lib/libc/gen/posix_spawn.3 b/lib/libc/gen/posix_spawn.3
index 73359b44b168..dd5bd2b5ed88 100644
--- a/lib/libc/gen/posix_spawn.3
+++ b/lib/libc/gen/posix_spawn.3
@@ -457,4 +457,4 @@ and
functions first appeared in
.Fx 8.0 .
.Sh AUTHORS
-.An Ed Schouten Aq ed@FreeBSD.org
+.An Ed Schouten Aq Mt ed@FreeBSD.org
diff --git a/lib/libc/gen/posix_spawn_file_actions_addopen.3 b/lib/libc/gen/posix_spawn_file_actions_addopen.3
index 9cd47efb02da..b28f3960ef6b 100644
--- a/lib/libc/gen/posix_spawn_file_actions_addopen.3
+++ b/lib/libc/gen/posix_spawn_file_actions_addopen.3
@@ -200,4 +200,4 @@ and
functions first appeared in
.Fx 8.0 .
.Sh AUTHORS
-.An Ed Schouten Aq ed@FreeBSD.org
+.An Ed Schouten Aq Mt ed@FreeBSD.org
diff --git a/lib/libc/gen/posix_spawn_file_actions_init.3 b/lib/libc/gen/posix_spawn_file_actions_init.3
index d826b8bf4458..eda2a1daa1e9 100644
--- a/lib/libc/gen/posix_spawn_file_actions_init.3
+++ b/lib/libc/gen/posix_spawn_file_actions_init.3
@@ -101,4 +101,4 @@ and
functions first appeared in
.Fx 8.0 .
.Sh AUTHORS
-.An Ed Schouten Aq ed@FreeBSD.org
+.An Ed Schouten Aq Mt ed@FreeBSD.org
diff --git a/lib/libc/gen/posix_spawnattr_getflags.3 b/lib/libc/gen/posix_spawnattr_getflags.3
index 4064011f1d0e..b5995cea4a82 100644
--- a/lib/libc/gen/posix_spawnattr_getflags.3
+++ b/lib/libc/gen/posix_spawnattr_getflags.3
@@ -108,4 +108,4 @@ and
functions first appeared in
.Fx 8.0 .
.Sh AUTHORS
-.An Ed Schouten Aq ed@FreeBSD.org
+.An Ed Schouten Aq Mt ed@FreeBSD.org
diff --git a/lib/libc/gen/posix_spawnattr_getpgroup.3 b/lib/libc/gen/posix_spawnattr_getpgroup.3
index 5cd51d687ab7..91b3e5cd3d18 100644
--- a/lib/libc/gen/posix_spawnattr_getpgroup.3
+++ b/lib/libc/gen/posix_spawnattr_getpgroup.3
@@ -93,4 +93,4 @@ and
functions first appeared in
.Fx 8.0 .
.Sh AUTHORS
-.An Ed Schouten Aq ed@FreeBSD.org
+.An Ed Schouten Aq Mt ed@FreeBSD.org
diff --git a/lib/libc/gen/posix_spawnattr_getschedparam.3 b/lib/libc/gen/posix_spawnattr_getschedparam.3
index 70009b9b4090..a137200bd6ae 100644
--- a/lib/libc/gen/posix_spawnattr_getschedparam.3
+++ b/lib/libc/gen/posix_spawnattr_getschedparam.3
@@ -97,4 +97,4 @@ and
functions first appeared in
.Fx 8.0 .
.Sh AUTHORS
-.An Ed Schouten Aq ed@FreeBSD.org
+.An Ed Schouten Aq Mt ed@FreeBSD.org
diff --git a/lib/libc/gen/posix_spawnattr_getschedpolicy.3 b/lib/libc/gen/posix_spawnattr_getschedpolicy.3
index 45c1965408b6..3e79d4b79582 100644
--- a/lib/libc/gen/posix_spawnattr_getschedpolicy.3
+++ b/lib/libc/gen/posix_spawnattr_getschedpolicy.3
@@ -95,4 +95,4 @@ and
functions first appeared in
.Fx 8.0 .
.Sh AUTHORS
-.An Ed Schouten Aq ed@FreeBSD.org
+.An Ed Schouten Aq Mt ed@FreeBSD.org
diff --git a/lib/libc/gen/posix_spawnattr_getsigdefault.3 b/lib/libc/gen/posix_spawnattr_getsigdefault.3
index 9e13c3742cf7..88783322ff97 100644
--- a/lib/libc/gen/posix_spawnattr_getsigdefault.3
+++ b/lib/libc/gen/posix_spawnattr_getsigdefault.3
@@ -95,4 +95,4 @@ and
functions first appeared in
.Fx 8.0 .
.Sh AUTHORS
-.An Ed Schouten Aq ed@FreeBSD.org
+.An Ed Schouten Aq Mt ed@FreeBSD.org
diff --git a/lib/libc/gen/posix_spawnattr_getsigmask.3 b/lib/libc/gen/posix_spawnattr_getsigmask.3
index 5cee7ec6853e..4f9c014853af 100644
--- a/lib/libc/gen/posix_spawnattr_getsigmask.3
+++ b/lib/libc/gen/posix_spawnattr_getsigmask.3
@@ -95,4 +95,4 @@ and
functions first appeared in
.Fx 8.0 .
.Sh AUTHORS
-.An Ed Schouten Aq ed@FreeBSD.org
+.An Ed Schouten Aq Mt ed@FreeBSD.org
diff --git a/lib/libc/gen/posix_spawnattr_init.3 b/lib/libc/gen/posix_spawnattr_init.3
index 66c99cd5afa8..19d29a6f99cb 100644
--- a/lib/libc/gen/posix_spawnattr_init.3
+++ b/lib/libc/gen/posix_spawnattr_init.3
@@ -120,4 +120,4 @@ and
functions first appeared in
.Fx 8.0 .
.Sh AUTHORS
-.An Ed Schouten Aq ed@FreeBSD.org
+.An Ed Schouten Aq Mt ed@FreeBSD.org
diff --git a/lib/libc/gen/readdir.c b/lib/libc/gen/readdir.c
index 324870b39ad1..69f59d16087a 100644
--- a/lib/libc/gen/readdir.c
+++ b/lib/libc/gen/readdir.c
@@ -61,12 +61,14 @@ _readdir_unlocked(dirp, skip)
return (NULL);
dirp->dd_loc = 0;
}
- if (dirp->dd_loc == 0 && !(dirp->dd_flags & __DTF_READALL)) {
+ if (dirp->dd_loc == 0 &&
+ !(dirp->dd_flags & (__DTF_READALL | __DTF_SKIPREAD))) {
dirp->dd_size = _getdirentries(dirp->dd_fd,
dirp->dd_buf, dirp->dd_len, &dirp->dd_seek);
if (dirp->dd_size <= 0)
return (NULL);
}
+ dirp->dd_flags &= ~__DTF_SKIPREAD;
dp = (struct dirent *)(dirp->dd_buf + dirp->dd_loc);
if ((long)dp & 03L) /* bogus pointer check */
return (NULL);
diff --git a/lib/libc/gen/readpassphrase.c b/lib/libc/gen/readpassphrase.c
index 86c7811d9fb1..95ae725e040c 100644
--- a/lib/libc/gen/readpassphrase.c
+++ b/lib/libc/gen/readpassphrase.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: readpassphrase.c,v 1.23 2010/05/14 13:30:34 millert Exp $ */
+/* $OpenBSD: readpassphrase.c,v 1.24 2013/11/24 23:51:29 deraadt Exp $ */
/*
* Copyright (c) 2000-2002, 2007, 2010
@@ -122,11 +122,11 @@ restart:
if (p < end) {
if ((flags & RPP_SEVENBIT))
ch &= 0x7f;
- if (isalpha(ch)) {
+ if (isalpha((unsigned char)ch)) {
if ((flags & RPP_FORCELOWER))
- ch = (char)tolower(ch);
+ ch = (char)tolower((unsigned char)ch);
if ((flags & RPP_FORCEUPPER))
- ch = (char)toupper(ch);
+ ch = (char)toupper((unsigned char)ch);
}
*p++ = ch;
}
diff --git a/lib/libc/gen/rewinddir.c b/lib/libc/gen/rewinddir.c
index 0eb091a08246..89e717cbfc10 100644
--- a/lib/libc/gen/rewinddir.c
+++ b/lib/libc/gen/rewinddir.c
@@ -33,9 +33,14 @@ static char sccsid[] = "@(#)rewinddir.c 8.1 (Berkeley) 6/8/93";
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include "namespace.h"
#include <sys/types.h>
#include <dirent.h>
+#include <pthread.h>
+#include <unistd.h>
+#include "un-namespace.h"
+#include "libc_private.h"
#include "gen-private.h"
#include "telldir.h"
@@ -44,6 +49,16 @@ rewinddir(dirp)
DIR *dirp;
{
- _seekdir(dirp, dirp->dd_rewind);
- dirp->dd_rewind = telldir(dirp);
+ if (__isthreaded)
+ _pthread_mutex_lock(&dirp->dd_lock);
+ if (dirp->dd_flags & __DTF_READALL)
+ _filldir(dirp, false);
+ else if (dirp->dd_seek != 0) {
+ (void) lseek(dirp->dd_fd, 0, SEEK_SET);
+ dirp->dd_seek = 0;
+ }
+ dirp->dd_loc = 0;
+ _reclaim_telldir(dirp);
+ if (__isthreaded)
+ _pthread_mutex_unlock(&dirp->dd_lock);
}
diff --git a/lib/libc/gen/sem_new.c b/lib/libc/gen/sem_new.c
index 9a2ab2716dfc..ec1a2fde8537 100644
--- a/lib/libc/gen/sem_new.c
+++ b/lib/libc/gen/sem_new.c
@@ -66,6 +66,8 @@ __weak_reference(_sem_wait, sem_wait);
struct sem_nameinfo {
int open_count;
char *name;
+ dev_t dev;
+ ino_t ino;
sem_t *sem;
LIST_ENTRY(sem_nameinfo) next;
};
@@ -151,37 +153,46 @@ _sem_open(const char *name, int flags, ...)
return (SEM_FAILED);
}
name++;
-
+ strcpy(path, SEM_PREFIX);
+ if (strlcat(path, name, sizeof(path)) >= sizeof(path)) {
+ errno = ENAMETOOLONG;
+ return (SEM_FAILED);
+ }
if (flags & ~(O_CREAT|O_EXCL)) {
errno = EINVAL;
return (SEM_FAILED);
}
-
+ if ((flags & O_CREAT) != 0) {
+ va_start(ap, flags);
+ mode = va_arg(ap, int);
+ value = va_arg(ap, int);
+ va_end(ap);
+ }
+ fd = -1;
_pthread_once(&once, sem_module_init);
_pthread_mutex_lock(&sem_llock);
LIST_FOREACH(ni, &sem_list, next) {
- if (strcmp(name, ni->name) == 0) {
- if ((flags & (O_CREAT|O_EXCL)) == (O_CREAT|O_EXCL)) {
- _pthread_mutex_unlock(&sem_llock);
- errno = EEXIST;
- return (SEM_FAILED);
- } else {
- ni->open_count++;
- sem = ni->sem;
- _pthread_mutex_unlock(&sem_llock);
- return (sem);
+ if (ni->name != NULL && strcmp(name, ni->name) == 0) {
+ fd = _open(path, flags | O_RDWR | O_CLOEXEC |
+ O_EXLOCK, mode);
+ if (fd == -1 || _fstat(fd, &sb) == -1)
+ goto error;
+ if ((flags & (O_CREAT | O_EXCL)) == (O_CREAT |
+ O_EXCL) || ni->dev != sb.st_dev ||
+ ni->ino != sb.st_ino) {
+ ni->name = NULL;
+ ni = NULL;
+ break;
}
+ ni->open_count++;
+ sem = ni->sem;
+ _pthread_mutex_unlock(&sem_llock);
+ _close(fd);
+ return (sem);
}
}
- if (flags & O_CREAT) {
- va_start(ap, flags);
- mode = va_arg(ap, int);
- value = va_arg(ap, int);
- va_end(ap);
- }
-
len = sizeof(*ni) + strlen(name) + 1;
ni = (struct sem_nameinfo *)malloc(len);
if (ni == NULL) {
@@ -192,17 +203,11 @@ _sem_open(const char *name, int flags, ...)
ni->name = (char *)(ni+1);
strcpy(ni->name, name);
- strcpy(path, SEM_PREFIX);
- if (strlcat(path, name, sizeof(path)) >= sizeof(path)) {
- errno = ENAMETOOLONG;
- goto error;
+ if (fd == -1) {
+ fd = _open(path, flags | O_RDWR | O_CLOEXEC | O_EXLOCK, mode);
+ if (fd == -1 || _fstat(fd, &sb) == -1)
+ goto error;
}
-
- fd = _open(path, flags|O_RDWR|O_CLOEXEC|O_EXLOCK, mode);
- if (fd == -1)
- goto error;
- if (_fstat(fd, &sb))
- goto error;
if (sb.st_size < sizeof(sem_t)) {
sem_t tmp;
@@ -228,6 +233,8 @@ _sem_open(const char *name, int flags, ...)
}
ni->open_count = 1;
ni->sem = sem;
+ ni->dev = sb.st_dev;
+ ni->ino = sb.st_ino;
LIST_INSERT_HEAD(&sem_list, ni, next);
_close(fd);
_pthread_mutex_unlock(&sem_llock);
@@ -294,13 +301,13 @@ _sem_unlink(const char *name)
return -1;
}
name++;
-
strcpy(path, SEM_PREFIX);
if (strlcat(path, name, sizeof(path)) >= sizeof(path)) {
errno = ENAMETOOLONG;
return (-1);
}
- return unlink(path);
+
+ return (unlink(path));
}
int
diff --git a/lib/libc/gen/sem_wait.3 b/lib/libc/gen/sem_wait.3
index 993ac4a15a29..9de8ba8a0e79 100644
--- a/lib/libc/gen/sem_wait.3
+++ b/lib/libc/gen/sem_wait.3
@@ -81,6 +81,7 @@ will fail if:
.It Bq Er EINTR
A signal interrupted this function.
.El
+.Pp
Additionally,
.Fn sem_trywait
will fail if:
diff --git a/lib/libc/gen/setproctitle.3 b/lib/libc/gen/setproctitle.3
index 0fefddf3b315..955556e5b205 100644
--- a/lib/libc/gen/setproctitle.3
+++ b/lib/libc/gen/setproctitle.3
@@ -100,11 +100,11 @@ Other operating systems have
similar functions.
.Sh AUTHORS
.An -nosplit
-.An Peter Wemm Aq peter@FreeBSD.org
+.An Peter Wemm Aq Mt peter@FreeBSD.org
stole the idea from the
.Sy "Sendmail 8.7.3"
source code by
-.An Eric Allman Aq eric@sendmail.org .
+.An Eric Allman Aq Mt eric@sendmail.org .
.Sh BUGS
Never pass a string with user-supplied data as a format without using
.Ql %s .
diff --git a/lib/libc/gen/statvfs.3 b/lib/libc/gen/statvfs.3
index f9c7430f6e99..73109bd98342 100644
--- a/lib/libc/gen/statvfs.3
+++ b/lib/libc/gen/statvfs.3
@@ -184,4 +184,4 @@ The
and
.Fn fstatvfs
functions and this manual page were written by
-.An Garrett Wollman Aq wollman@FreeBSD.org .
+.An Garrett Wollman Aq Mt wollman@FreeBSD.org .
diff --git a/lib/libc/gen/sysconf.c b/lib/libc/gen/sysconf.c
index b7952b107c38..2b3acfb5db74 100644
--- a/lib/libc/gen/sysconf.c
+++ b/lib/libc/gen/sysconf.c
@@ -367,11 +367,17 @@ yesno:
* _POSIX_FILE_LOCKING, so we can't answer this one.
*/
#endif
-#if _POSIX_THREAD_SAFE_FUNCTIONS > -1
+
+ /*
+ * SUSv4tc1 says the following about _SC_GETGR_R_SIZE_MAX and
+ * _SC_GETPW_R_SIZE_MAX:
+ * Note that sysconf(_SC_GETGR_R_SIZE_MAX) may return -1 if
+ * there is no hard limit on the size of the buffer needed to
+ * store all the groups returned.
+ */
case _SC_GETGR_R_SIZE_MAX:
case _SC_GETPW_R_SIZE_MAX:
-#error "somebody needs to implement this"
-#endif
+ return (-1);
case _SC_HOST_NAME_MAX:
return (MAXHOSTNAMELEN - 1); /* does not include \0 */
case _SC_LOGIN_NAME_MAX:
diff --git a/lib/libc/gen/telldir.c b/lib/libc/gen/telldir.c
index 4954b973a915..d72b500b051c 100644
--- a/lib/libc/gen/telldir.c
+++ b/lib/libc/gen/telldir.c
@@ -47,13 +47,6 @@ __FBSDID("$FreeBSD$");
#include "telldir.h"
/*
- * The option SINGLEUSE may be defined to say that a telldir
- * cookie may be used only once before it is freed. This option
- * is used to avoid having memory usage grow without bound.
- */
-#define SINGLEUSE
-
-/*
* return a pointer into a directory
*/
long
@@ -61,18 +54,31 @@ telldir(dirp)
DIR *dirp;
{
struct ddloc *lp;
+ long idx;
- if ((lp = (struct ddloc *)malloc(sizeof(struct ddloc))) == NULL)
- return (-1);
if (__isthreaded)
_pthread_mutex_lock(&dirp->dd_lock);
- lp->loc_index = dirp->dd_td->td_loccnt++;
- lp->loc_seek = dirp->dd_seek;
- lp->loc_loc = dirp->dd_loc;
- LIST_INSERT_HEAD(&dirp->dd_td->td_locq, lp, loc_lqe);
+ LIST_FOREACH(lp, &dirp->dd_td->td_locq, loc_lqe) {
+ if (lp->loc_seek == dirp->dd_seek &&
+ lp->loc_loc == dirp->dd_loc)
+ break;
+ }
+ if (lp == NULL) {
+ lp = malloc(sizeof(struct ddloc));
+ if (lp == NULL) {
+ if (__isthreaded)
+ _pthread_mutex_unlock(&dirp->dd_lock);
+ return (-1);
+ }
+ lp->loc_index = dirp->dd_td->td_loccnt++;
+ lp->loc_seek = dirp->dd_seek;
+ lp->loc_loc = dirp->dd_loc;
+ LIST_INSERT_HEAD(&dirp->dd_td->td_locq, lp, loc_lqe);
+ }
+ idx = lp->loc_index;
if (__isthreaded)
_pthread_mutex_unlock(&dirp->dd_lock);
- return (lp->loc_index);
+ return (idx);
}
/*
@@ -94,7 +100,7 @@ _seekdir(dirp, loc)
if (lp == NULL)
return;
if (lp->loc_loc == dirp->dd_loc && lp->loc_seek == dirp->dd_seek)
- goto found;
+ return;
(void) lseek(dirp->dd_fd, (off_t)lp->loc_seek, SEEK_SET);
dirp->dd_seek = lp->loc_seek;
dirp->dd_loc = 0;
@@ -103,11 +109,6 @@ _seekdir(dirp, loc)
if (dp == NULL)
break;
}
-found:
-#ifdef SINGLEUSE
- LIST_REMOVE(lp, loc_lqe);
- free((caddr_t)lp);
-#endif
}
/*
diff --git a/lib/libc/gen/telldir.h b/lib/libc/gen/telldir.h
index ef930d2b80b7..04989bb7b536 100644
--- a/lib/libc/gen/telldir.h
+++ b/lib/libc/gen/telldir.h
@@ -36,6 +36,7 @@
#define _TELLDIR_H_
#include <sys/queue.h>
+#include <stdbool.h>
/*
* One of these structures is malloced to describe the current directory
@@ -59,6 +60,7 @@ struct _telldir {
long td_loccnt; /* index of entry for sequential readdir's */
};
+bool _filldir(DIR *, bool);
struct dirent *_readdir_unlocked(DIR *, int);
void _reclaim_telldir(DIR *);
void _seekdir(DIR *, long);
diff --git a/lib/libc/gen/tls.c b/lib/libc/gen/tls.c
index 4b083da2ae82..5219418fdc32 100644
--- a/lib/libc/gen/tls.c
+++ b/lib/libc/gen/tls.c
@@ -62,7 +62,7 @@ void _rtld_free_tls(void *tls, size_t tcbsize, size_t tcbalign);
void *__libc_allocate_tls(void *oldtls, size_t tcbsize, size_t tcbalign);
void __libc_free_tls(void *tls, size_t tcbsize, size_t tcbalign);
-#if defined(__ia64__) || defined(__amd64__)
+#if defined(__amd64__)
#define TLS_TCB_ALIGN 16
#elif defined(__powerpc__) || defined(__i386__) || defined(__arm__) || \
defined(__sparc64__) || defined(__mips__)
@@ -71,8 +71,7 @@ void __libc_free_tls(void *tls, size_t tcbsize, size_t tcbalign);
#error TLS_TCB_ALIGN undefined for target architecture
#endif
-#if defined(__arm__) || defined(__ia64__) || defined(__mips__) || \
- defined(__powerpc__)
+#if defined(__arm__) || defined(__mips__) || defined(__powerpc__)
#define TLS_VARIANT_I
#endif
#if defined(__i386__) || defined(__amd64__) || defined(__sparc64__)
diff --git a/lib/libc/gen/ttyname.3 b/lib/libc/gen/ttyname.3
index 9420bbe8f9e4..9e8a4f099598 100644
--- a/lib/libc/gen/ttyname.3
+++ b/lib/libc/gen/ttyname.3
@@ -28,7 +28,7 @@
.\" @(#)ttyname.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd May 14, 2005
+.Dd July 18, 2014
.Dt TTYNAME 3
.Os
.Sh NAME
@@ -76,6 +76,14 @@ function
takes a buffer and length as arguments to avoid this problem.
.Sh RETURN VALUES
The
+.Fn isatty
+function returns 1 if
+.Fa fd
+refers to a terminal type device;
+otherwise, it returns 0 and may set
+.Va errno
+to indicate the error.
+The
.Fn ttyname
function
returns the null terminated name if the device is found and
@@ -89,15 +97,23 @@ The
function returns 0 if successful.
Otherwise an error number is returned.
.Sh ERRORS
-The
-.Fn ttyname_r
-may fail and return the following error codes:
+These functions may fail if:
.Bl -tag -width Er
-.It Bq Er ENOTTY
+.It Bq Er EBADF
The
.Fa fd
argument
is not a valid file descriptor.
+.It Bq Er ENOTTY
+The file associated with
+.Fa fd
+is not a terminal.
+.El
+.Pp
+Additionally,
+.Fn ttyname_r
+may fail if:
+.Bl -tag -width Er
.It Bq Er ERANGE
The
.Fa bufsize
diff --git a/lib/libc/i386/gen/sigsetjmp.S b/lib/libc/i386/gen/sigsetjmp.S
index 0920b6da9956..1c636493c507 100644
--- a/lib/libc/i386/gen/sigsetjmp.S
+++ b/lib/libc/i386/gen/sigsetjmp.S
@@ -115,7 +115,6 @@ ENTRY(__siglongjmp)
movl 12(%edx),%ebp
movl 16(%edx),%esi
movl 20(%edx),%edi
- fninit
fldcw 24(%edx)
testl %eax,%eax
jnz 1f
diff --git a/lib/libc/ia64/Makefile.inc b/lib/libc/ia64/Makefile.inc
deleted file mode 100644
index 16565c610291..000000000000
--- a/lib/libc/ia64/Makefile.inc
+++ /dev/null
@@ -1,9 +0,0 @@
-# $FreeBSD$
-#
-# Machine dependent definitions for the ia64 architecture.
-#
-
-# Long double is 80 bits
-GDTOASRCS+=strtorx.c
-MDSRCS+=machdep_ldisx.c
-SYM_MAPS+=${LIBC_SRCTOP}/ia64/Symbol.map
diff --git a/lib/libc/ia64/SYS.h b/lib/libc/ia64/SYS.h
deleted file mode 100644
index eb019a26bc3b..000000000000
--- a/lib/libc/ia64/SYS.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* $NetBSD: SYS.h,v 1.5 1997/05/02 18:15:15 kleink Exp $ */
-
-/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Author: Chris G. Demetriou
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- *
- * $FreeBSD$
- */
-
-#include <machine/asm.h>
-#include <sys/syscall.h>
-
-#define CALLSYS_ERROR(name) \
- CALLSYS_NOERROR(name); \
- cmp.ne p6,p0=r0,r10; \
-(p6) br.cond.sptk.few .cerror
-
-
-#define SYSCALL(name) \
-ENTRY(__sys_ ## name,0); /* XXX # of args? */ \
- WEAK_ALIAS(name, __sys_ ## name); \
- WEAK_ALIAS(_ ## name, __sys_ ## name); \
- CALLSYS_ERROR(name)
-
-#define SYSCALL_NOERROR(name) \
-ENTRY(__sys_ ## name,0); /* XXX # of args? */ \
- WEAK_ALIAS(name, __sys_ ## name); \
- WEAK_ALIAS(_ ## name, __sys_ ## name); \
- CALLSYS_NOERROR(name)
-
-#define RSYSCALL(name) \
- SYSCALL(name); \
- br.ret.sptk.few rp; \
-END(__sys_ ## name)
-
-#define PSEUDO(name) \
-ENTRY(__sys_ ## name,0); /* XXX # of args? */ \
- WEAK_ALIAS(_ ## name, __sys_ ## name); \
- CALLSYS_ERROR(name); \
- br.ret.sptk.few rp; \
-END(__sys_ ## name);
diff --git a/lib/libc/ia64/Symbol.map b/lib/libc/ia64/Symbol.map
deleted file mode 100644
index 7a31a512f5ca..000000000000
--- a/lib/libc/ia64/Symbol.map
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * $FreeBSD$
- */
-
-/*
- * This only needs to contain symbols that are not listed in
- * symbol maps from other parts of libc (i.e., not found in
- * stdlib/Symbol.map, string/Symbol.map, sys/Symbol.map, ...).
- */
-FBSD_1.0 {
- /* PSEUDO syscalls */
- _exit;
-
- mcount;
- _setjmp;
- _longjmp;
- fabs;
- __flt_rounds;
- fpgetmask;
- fpgetround;
- fpsetmask;
- fpsetround;
- __infinity;
- __nan;
- makecontext;
- setjmp;
- longjmp;
- sigsetjmp;
- siglongjmp;
- htonl;
- htons;
- ntohl;
- ntohs;
- vfork;
- brk;
- exect;
- sbrk;
-};
-
-FBSDprivate_1.0 {
- /* PSEUDO syscalls */
- __sys_getlogin;
- _getlogin;
- __sys_exit;
-
- _set_tp;
- __divdf3;
- __divdi3;
- __divsf3;
- __divsi3;
- __moddi3;
- __modsi3;
- __udivdi3;
- __udivsi3;
- __umoddi3;
- __umodsi3;
- _mcount;
- ___longjmp;
- __makecontext;
- __longjmp;
- signalcontext;
- __signalcontext;
- __siglongjmp;
- _Unwind_FindTableEntry;
- __sys_vfork;
- _vfork;
- _end;
- minbrk;
- .cerror;
- curbrk;
-};
diff --git a/lib/libc/ia64/_fpmath.h b/lib/libc/ia64/_fpmath.h
deleted file mode 100644
index 936ce23b6ef3..000000000000
--- a/lib/libc/ia64/_fpmath.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*-
- * Copyright (c) 2003 Mike Barcroft <mike@FreeBSD.org>
- * Copyright (c) 2002, 2003 David Schultz <das@FreeBSD.ORG>
- * 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$
- */
-
-#include <sys/endian.h>
-
-union IEEEl2bits {
- long double e;
- struct {
-#if _BYTE_ORDER == _LITTLE_ENDIAN
- unsigned int manl :32;
- unsigned int manh :32;
- unsigned int exp :15;
- unsigned int sign :1;
- unsigned long junk :48;
-#else /* _BIG_ENDIAN */
- unsigned long junk :48;
- unsigned int sign :1;
- unsigned int exp :15;
- unsigned int manh :32;
- unsigned int manl :32;
-#endif
- } bits;
- struct {
-#if _BYTE_ORDER == _LITTLE_ENDIAN
- unsigned long man :64;
- unsigned int expsign :16;
- unsigned long junk :48;
-#else /* _BIG_ENDIAN */
- unsigned long junk :48;
- unsigned int expsign :16;
- unsigned long man :64;
-#endif
- } xbits;
-};
-
-#if _BYTE_ORDER == _LITTLE_ENDIAN
-#define LDBL_NBIT 0x80000000
-#define mask_nbit_l(u) ((u).bits.manh &= ~LDBL_NBIT)
-#else /* _BIG_ENDIAN */
-/*
- * XXX This doesn't look right. Very few machines have a different
- * endianness for integers and floating-point, and in nextafterl()
- * we assume that none do. If you have an environment for testing
- * this, please let me know. --das
- */
-#define LDBL_NBIT 0x80
-#define mask_nbit_l(u) ((u).bits.manh &= ~LDBL_NBIT)
-#endif
-
-#define LDBL_MANH_SIZE 32
-#define LDBL_MANL_SIZE 32
-
-#define LDBL_TO_ARRAY32(u, a) do { \
- (a)[0] = (uint32_t)(u).bits.manl; \
- (a)[1] = (uint32_t)(u).bits.manh; \
-} while (0)
diff --git a/lib/libc/ia64/arith.h b/lib/libc/ia64/arith.h
deleted file mode 100644
index 67265284dbf0..000000000000
--- a/lib/libc/ia64/arith.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * MD header for contrib/gdtoa
- *
- * $FreeBSD$
- */
-
-/*
- * NOTE: The definitions in this file must be correct or strtod(3) and
- * floating point formats in printf(3) will break! The file can be
- * generated by running contrib/gdtoa/arithchk.c on the target
- * architecture. See contrib/gdtoa/gdtoaimp.h for details.
- */
-
-#include <machine/endian.h>
-
-#if _BYTE_ORDER == _LITTLE_ENDIAN
-
-#define IEEE_8087
-#define Arith_Kind_ASL 1
-#define Long int
-#define Intcast (int)(long)
-#define Double_Align
-#define X64_bit_pointers
-
-#else /* _BYTE_ORDER == _LITTLE_ENDIAN */
-
-#define IEEE_MC68k
-#define Arith_Kind_ASL 2
-#define Long int
-#define Intcast (int)(long)
-#define Double_Align
-#define X64_bit_pointers
-#ifdef gcc_bug /* XXX Why does arithchk report sudden underflow here? */
-#define Sudden_Underflow
-#endif
-
-#endif
diff --git a/lib/libc/ia64/gd_qnan.h b/lib/libc/ia64/gd_qnan.h
deleted file mode 100644
index 39923860db07..000000000000
--- a/lib/libc/ia64/gd_qnan.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * MD header for contrib/gdtoa
- *
- * This file can be generated by compiling and running contrib/gdtoa/qnan.c
- * on the target architecture after arith.h has been generated.
- *
- * $FreeBSD$
- */
-
-#define f_QNAN 0x7fc00000
-#define d_QNAN0 0x0
-#define d_QNAN1 0x7ff80000
-#define ld_QNAN0 0x0
-#define ld_QNAN1 0xc0000000
-#define ld_QNAN2 0x7fff
-#define ld_QNAN3 0x0
-#define ldus_QNAN0 0x0
-#define ldus_QNAN1 0x0
-#define ldus_QNAN2 0x0
-#define ldus_QNAN3 0xc000
-#define ldus_QNAN4 0x7fff
diff --git a/lib/libc/ia64/gen/Makefile.inc b/lib/libc/ia64/gen/Makefile.inc
deleted file mode 100644
index 1e3373a6d650..000000000000
--- a/lib/libc/ia64/gen/Makefile.inc
+++ /dev/null
@@ -1,11 +0,0 @@
-# $FreeBSD$
-
-SRCS+= __divdf3.S __divdi3.S __divsf3.S __divsi3.S __moddi3.S __modsi3.S \
- __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S _mcount.S _set_tp.c \
- _setjmp.S fabs.S flt_rounds.c fpgetmask.c fpgetround.c fpsetmask.c \
- fpsetround.c getcontextx.c infinity.c ldexp.c makecontext.c setjmp.S \
- signalcontext.c sigsetjmp.S
-
-# The following may go away if function _Unwind_FindTableEntry()
-# will be part of GCC.
-SRCS+= unwind.c
diff --git a/lib/libc/ia64/gen/__divdf3.S b/lib/libc/ia64/gen/__divdf3.S
deleted file mode 100644
index 58425d92dbaa..000000000000
--- a/lib/libc/ia64/gen/__divdf3.S
+++ /dev/null
@@ -1,142 +0,0 @@
-//
-// Copyright (c) 2000, Intel Corporation
-// All rights reserved.
-//
-// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache,
-// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab,
-// Intel Corporation.
-//
-// WARRANTY DISCLAIMER
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 INTEL OR ITS
-// 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.
-//
-// Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
-//
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
- .section .text
-
-ENTRY(__divdf3, 0)
-{ .mfi
- // a is in f8
- // b is in f9
-
- // predicate registers used: p6
- // floating-point registers used: f6, f7, f8, f9, f10, f11
-
- // load a, the first argument, in f6
- nop.m 0
- mov f6=f8
- nop.i 0
-} { .mfi
- // load b, the second argument, in f7
- nop.m 0
- mov f7=f9
- nop.i 0;;
-} { .mfi
-
- // BEGIN DOUBLE PRECISION LATENCY-OPTIMIZED DIVIDE ALGORITHM
-
- nop.m 0
- // Step (1)
- // y0 = 1 / b in f8
- frcpa.s0 f8,p6=f6,f7
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (2)
- // q0 = a * y0 in f9
- (p6) fma.s1 f9=f6,f8,f0
- nop.i 0
-} { .mfi
- nop.m 0
- // Step (3)
- // e0 = 1 - b * y0 in f10
- (p6) fnma.s1 f10=f7,f8,f1
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (4)
- // q1 = q0 + e0 * q0 in f9
- (p6) fma.s1 f9=f10,f9,f9
- nop.i 0
-} { .mfi
- nop.m 0
- // Step (5)
- // e1 = e0 * e0 in f11
- (p6) fma.s1 f11=f10,f10,f0
- nop.i 0
-} { .mfi
- nop.m 0
- // Step (6)
- // y1 = y0 + e0 * y0 in f8
- (p6) fma.s1 f8=f10,f8,f8
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (7)
- // q2 = q1 + e1 * q1 in f9
- (p6) fma.s1 f9=f11,f9,f9
- nop.i 0
-} { .mfi
- nop.m 0
- // Step (8)
- // e2 = e1 * e1 in f10
- (p6) fma.s1 f10=f11,f11,f0
- nop.i 0
-} { .mfi
- nop.m 0
- // Step (9)
- // y2 = y1 + e1 * y1 in f8
- (p6) fma.s1 f8=f11,f8,f8
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (10)
- // q3 = q2 + e2 * q2 in f9
- (p6) fma.d.s1 f9=f10,f9,f9
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (11)
- // y3 = y2 + e2 * y2 in f8
- (p6) fma.s1 f8=f10,f8,f8
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (12)
- // r0 = a - b * q3 in f6
- (p6) fnma.d.s1 f6=f7,f9,f6
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (13)
- // q4 = q3 + r0 * y3 in f8
- (p6) fma.d.s0 f8=f6,f8,f9
- nop.i 0;;
-
- // END DOUBLE PRECISION LATENCY-OPTIMIZED DIVIDE ALGORITHM
-
-} { .mib
- nop.m 0
- nop.i 0
- // return
- br.ret.sptk b0;;
-}
-
-END(__divdf3)
-
diff --git a/lib/libc/ia64/gen/__divdi3.S b/lib/libc/ia64/gen/__divdi3.S
deleted file mode 100644
index 92e29116f6e2..000000000000
--- a/lib/libc/ia64/gen/__divdi3.S
+++ /dev/null
@@ -1,143 +0,0 @@
-.file "__divdi3.s"
-
-//
-// Copyright (c) 2000, Intel Corporation
-// All rights reserved.
-//
-// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache,
-// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab,
-// Intel Corporation.
-//
-// WARRANTY DISCLAIMER
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 INTEL OR ITS
-// 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.
-//
-// Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
-//
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-.section .text
-.proc __divdi3#
-.align 32
-.global __divdi3#
-.align 32
-
-// 64-bit signed integer divide
-
-__divdi3:
-
-{ .mii
- alloc r31=ar.pfs,2,0,0,0
- nop.i 0
- nop.i 0;;
-} { .mmi
-
- // 64-BIT SIGNED INTEGER DIVIDE BEGINS HERE
-
- setf.sig f8=r32
- setf.sig f9=r33
- nop.i 0;;
-} { .mfb
- nop.m 0
- fcvt.xf f6=f8
- nop.b 0
-} { .mfb
- nop.m 0
- fcvt.xf f7=f9
- nop.b 0;;
-} { .mfi
- nop.m 0
- // Step (1)
- // y0 = 1 / b in f8
- frcpa.s1 f8,p6=f6,f7
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (2)
- // e0 = 1 - b * y0 in f9
- (p6) fnma.s1 f9=f7,f8,f1
- nop.i 0
-} { .mfi
- nop.m 0
- // Step (3)
- // q0 = a * y0 in f10
- (p6) fma.s1 f10=f6,f8,f0
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (4)
- // e1 = e0 * e0 in f11
- (p6) fma.s1 f11=f9,f9,f0
- nop.i 0
-} { .mfi
- nop.m 0
- // Step (5)
- // q1 = q0 + e0 * q0 in f10
- (p6) fma.s1 f10=f9,f10,f10
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (6)
- // y1 = y0 + e0 * y0 in f8
- (p6) fma.s1 f8=f9,f8,f8
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (7)
- // q2 = q1 + e1 * q1 in f9
- (p6) fma.s1 f9=f11,f10,f10
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (8)
- // y2 = y1 + e1 * y1 in f8
- (p6) fma.s1 f8=f11,f8,f8
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (9)
- // r2 = a - b * q2 in f10
- (p6) fnma.s1 f10=f7,f9,f6
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (10)
- // q3 = q2 + r2 * y2 in f8
- (p6) fma.s1 f8=f10,f8,f9
- nop.i 0;;
-} { .mfb
- nop.m 0
- // Step (11)
- // q = trunc (q3)
- fcvt.fx.trunc.s1 f8=f8
- nop.b 0;;
-} { .mmi
- // quotient will be in r8 (if b != 0)
- getf.sig r8=f8
- nop.m 0
- nop.i 0;;
-}
-
- // 64-BIT SIGNED INTEGER DIVIDE ENDS HERE
-
-{ .mmb
- nop.m 0
- nop.m 0
- br.ret.sptk b0;;
-}
-
-.endp __divdi3
diff --git a/lib/libc/ia64/gen/__divsf3.S b/lib/libc/ia64/gen/__divsf3.S
deleted file mode 100644
index fe7bcb4d68ee..000000000000
--- a/lib/libc/ia64/gen/__divsf3.S
+++ /dev/null
@@ -1,116 +0,0 @@
-//
-// Copyright (c) 2000, Intel Corporation
-// All rights reserved.
-//
-// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache,
-// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab,
-// Intel Corporation.
-//
-// WARRANTY DISCLAIMER
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 INTEL OR ITS
-// 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.
-//
-// Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
-//
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-ENTRY(__divsf3, 0)
-{ .mfi
- // a is in f8
- // b is in f9
-
- // general registers used: r31, r32, r33, r34
- // predicate registers used: p6
- // floating-point registers used: f6, f7, f8
-
- nop.m 0
- // load a, the first argument, in f6
- mov f6=f8
- nop.i 0;;
-} { .mfi
- nop.m 0
- // load b, the second argument, in f7
- mov f7=f9
- nop.i 0;;
-} { .mfi
-
- // BEGIN SINGLE PRECISION LATENCY-OPTIMIZED DIVIDE ALGORITHM
-
- nop.m 0
- // Step (1)
- // y0 = 1 / b in f8
- frcpa.s0 f8,p6=f6,f7
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (2)
- // q0 = a * y0 in f6
- (p6) fma.s1 f6=f6,f8,f0
- nop.i 0
-} { .mfi
- nop.m 0
- // Step (3)
- // e0 = 1 - b * y0 in f7
- (p6) fnma.s1 f7=f7,f8,f1
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (4)
- // q1 = q0 + e0 * q0 in f6
- (p6) fma.s1 f6=f7,f6,f6
- nop.i 0
-} { .mfi
- nop.m 0
- // Step (5)
- // e1 = e0 * e0 in f7
- (p6) fma.s1 f7=f7,f7,f0
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (6)
- // q2 = q1 + e1 * q1 in f6
- (p6) fma.s1 f6=f7,f6,f6
- nop.i 0
-} { .mfi
- nop.m 0
- // Step (7)
- // e2 = e1 * e1 in f7
- (p6) fma.s1 f7=f7,f7,f0
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (8)
- // q3 = q2 + e2 * q2 in f6
- (p6) fma.d.s1 f6=f7,f6,f6
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (9)
- // q3' = q3 in f8
- (p6) fma.s.s0 f8=f6,f1,f0
- nop.i 0;;
-
- // END SINGLE PRECISION LATENCY-OPTIMIZED DIVIDE ALGORITHM
-
-} { .mmb
- nop.m 0
- nop.m 0
- // return
- br.ret.sptk b0;;
-}
-
-END(__divsf3)
diff --git a/lib/libc/ia64/gen/__divsi3.S b/lib/libc/ia64/gen/__divsi3.S
deleted file mode 100644
index 4c82e32ddcf1..000000000000
--- a/lib/libc/ia64/gen/__divsi3.S
+++ /dev/null
@@ -1,125 +0,0 @@
-.file "__divsi3.s"
-
-//
-// Copyright (c) 2000, Intel Corporation
-// All rights reserved.
-//
-// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache,
-// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab,
-// Intel Corporation.
-//
-// WARRANTY DISCLAIMER
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 INTEL OR ITS
-// 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.
-//
-// Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
-//
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-.section .text
-
-// 32-bit signed integer divide
-
-.proc __divsi3#
-.align 32
-.global __divsi3#
-.align 32
-
-__divsi3:
-
-{ .mii
- alloc r31=ar.pfs,2,0,0,0
- nop.i 0
- nop.i 0;;
-} { .mii
- nop.m 0
-
- // 32-BIT SIGNED INTEGER DIVIDE BEGINS HERE
-
- // general register used:
- // r32 - 32-bit signed integer dividend
- // r33 - 32-bit signed integer divisor
- // r8 - 32-bit signed integer result
- // r2 - scratch register
- // floating-point registers used: f6, f7, f8, f9
- // predicate registers used: p6
-
- sxt4 r32=r32
- sxt4 r33=r33;;
-} { .mmb
- setf.sig f6=r32
- setf.sig f7=r33
- nop.b 0;;
-} { .mfi
- nop.m 0
- fcvt.xf f6=f6
- nop.i 0
-} { .mfi
- nop.m 0
- fcvt.xf f7=f7
- mov r2 = 0x0ffdd;;
-} { .mfi
- setf.exp f9 = r2
- // (1) y0
- frcpa.s1 f8,p6=f6,f7
- nop.i 0;;
-} { .mfi
- nop.m 0
- // (2) q0 = a * y0
- (p6) fma.s1 f6=f6,f8,f0
- nop.i 0
-} { .mfi
- nop.m 0
- // (3) e0 = 1 - b * y0
- (p6) fnma.s1 f7=f7,f8,f1
- nop.i 0;;
-} { .mfi
- nop.m 0
- // (4) q1 = q0 + e0 * q0
- (p6) fma.s1 f6=f7,f6,f6
- nop.i 0
-} { .mfi
- nop.m 0
- // (5) e1 = e0 * e0 + 2^-34
- (p6) fma.s1 f7=f7,f7,f9
- nop.i 0;;
-} { .mfi
- nop.m 0
- // (6) q2 = q1 + e1 * q1
- (p6) fma.s1 f8=f7,f6,f6
- nop.i 0;;
-} { .mfi
- nop.m 0
- // (7) q = trunc(q2)
- fcvt.fx.trunc.s1 f8=f8
- nop.i 0;;
-} { .mmi
- // quotient will be in the least significant 32 bits of r8 (if b != 0)
- getf.sig r8=f8
- nop.m 0
- nop.i 0;;
-}
-
- // 32-BIT SIGNED INTEGER DIVIDE ENDS HERE
-
-{ .mmb
- nop.m 0
- nop.m 0
- br.ret.sptk b0;;
-}
-
-.endp __divsi3
diff --git a/lib/libc/ia64/gen/__moddi3.S b/lib/libc/ia64/gen/__moddi3.S
deleted file mode 100644
index e15f964c6ff9..000000000000
--- a/lib/libc/ia64/gen/__moddi3.S
+++ /dev/null
@@ -1,160 +0,0 @@
-.file "__moddi3.s"
-
-//
-// Copyright (c) 2000, Intel Corporation
-// All rights reserved.
-//
-// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache,
-// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab,
-// Intel Corporation.
-//
-// WARRANTY DISCLAIMER
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 INTEL OR ITS
-// 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.
-//
-// Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
-//
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-.section .text
-
-// 64-bit signed integer remainder
-
-.proc __moddi3#
-.align 32
-.global __moddi3#
-.align 32
-
-__moddi3:
-
-{ .mii
- alloc r31=ar.pfs,3,0,0,0
- nop.i 0
- nop.i 0
-} { .mmb
-
- // 64-BIT SIGNED INTEGER REMAINDER BEGINS HERE
-
- // general register used:
- // r32 - 64-bit signed integer dividend
- // r33 - 64-bit signed integer divisor
- // r8 - 64-bit signed integer result
- // r2 - scratch register
- // floating-point registers used: f6, f7, f8, f9, f10, f11, f12
- // predicate registers used: p6
-
- setf.sig f12=r32 // holds an in integer form
- setf.sig f7=r33
- nop.b 0
-} { .mlx
- nop.m 0
- //movl r2=0x8000000000000000;;
- movl r2=0xffffffffffffffff;;
-} { .mfi
- // get the 2's complement of b
- sub r33=r0,r33
- fcvt.xf f6=f12
- nop.i 0
-} { .mfi
- nop.m 0
- fcvt.xf f7=f7
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (1)
- // y0 = 1 / b in f8
- frcpa.s1 f8,p6=f6,f7
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (2)
- // q0 = a * y0 in f10
- (p6) fma.s1 f10=f6,f8,f0
- nop.i 0
-} { .mfi
- nop.m 0
- // Step (3)
- // e0 = 1 - b * y0 in f9
- (p6) fnma.s1 f9=f7,f8,f1
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (4)
- // q1 = q0 + e0 * q0 in f10
- (p6) fma.s1 f10=f9,f10,f10
- nop.i 0
-} { .mfi
- nop.m 0
- // Step (5)
- // e1 = e0 * e0 in f11
- (p6) fma.s1 f11=f9,f9,f0
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (6)
- // y1 = y0 + e0 * y0 in f8
- (p6) fma.s1 f8=f9,f8,f8
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (7)
- // q2 = q1 + e1 * q1 in f9
- (p6) fma.s1 f9=f11,f10,f10
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (8)
- // y2 = y1 + e1 * y1 in f8
- (p6) fma.s1 f8=f11,f8,f8
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (9)
- // r2 = a - b * q2 in f10
- (p6) fnma.s1 f10=f7,f9,f6
- nop.i 0;;
-} { .mfi
- setf.sig f7=r33
- // Step (10)
- // q3 = q2 + r2 * y2 in f8
- (p6) fma.s1 f8=f10,f8,f9
- nop.i 0;;
-} { .mfi
- nop.m 0
- // (11) q = trunc(q3)
- fcvt.fx.trunc.s1 f8=f8
- nop.i 0;;
-} { .mfi
- nop.m 0
- // (12) r = a + (-b) * q
- xma.l f8=f8,f7,f12
- nop.i 0;;
-} { .mib
- getf.sig r8=f8
- nop.i 0
- nop.b 0
-}
-
- // 64-BIT SIGNED INTEGER REMAINDER ENDS HERE
-
-{ .mib
- nop.m 0
- nop.i 0
- br.ret.sptk b0;;
-}
-
-.endp __moddi3
diff --git a/lib/libc/ia64/gen/__modsi3.S b/lib/libc/ia64/gen/__modsi3.S
deleted file mode 100644
index 1939493eff38..000000000000
--- a/lib/libc/ia64/gen/__modsi3.S
+++ /dev/null
@@ -1,132 +0,0 @@
-.file "__modsi3.s"
-
-//
-// Copyright (c) 2000, Intel Corporation
-// All rights reserved.
-//
-// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache,
-// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab,
-// Intel Corporation.
-//
-// WARRANTY DISCLAIMER
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 INTEL OR ITS
-// 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.
-//
-// Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
-//
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-.section .text
-
-// 32-bit signed integer remainder
-
-.proc __modsi3#
-.align 32
-.global __modsi3#
-.align 32
-
-__modsi3:
-
-{ .mii
- alloc r31=ar.pfs,2,0,0,0
- nop.i 0
- nop.i 0;;
-} { .mii
- nop.m 0
-
- // 32-BIT SIGNED INTEGER REMAINDER BEGINS HERE
-
- // general register used:
- // r32 - 32-bit signed integer dividend
- // r33 - 32-bit signed integer divisor
- // r8 - 32-bit signed integer result
- // r2 - scratch register
- // floating-point registers used: f6, f7, f8, f9, f10, f11
- // predicate registers used: p6
-
- sxt4 r32=r32
- sxt4 r33=r33;;
-} { .mmb
- setf.sig f11=r32
- setf.sig f7=r33
- nop.b 0;;
-} { .mfi
- // get 2's complement of b
- sub r33=r0,r33
- fcvt.xf f6=f11
- nop.i 0
-} { .mfi
- nop.m 0
- fcvt.xf f7=f7
- mov r2 = 0x0ffdd;;
-} { .mfi
- setf.exp f9 = r2
- // (1) y0
- frcpa.s1 f8,p6=f6,f7
- nop.i 0;;
-} { .mfi
- nop.m 0
- // (2) q0 = a * y0
- (p6) fma.s1 f10=f6,f8,f0
- nop.i 0
-} { .mfi
- nop.m 0
- // (3) e0 = 1 - b * y0
- (p6) fnma.s1 f8=f7,f8,f1
- nop.i 0;;
-} { .mfi
- // 2's complement of b
- setf.sig f7=r33
- // (4) q1 = q0 + e0 * q0
- (p6) fma.s1 f10=f8,f10,f10
- nop.i 0
-} { .mfi
- nop.m 0
- // (5) e1 = e0 * e0 + 2^-34
- (p6) fma.s1 f8=f8,f8,f9
- nop.i 0;;
-} { .mfi
- nop.m 0
- // (6) q2 = q1 + e1 * q1
- (p6) fma.s1 f8=f8,f10,f10
- nop.i 0;;
-} { .mfi
- nop.m 0
- // (7) q = trunc(q2)
- fcvt.fx.trunc.s1 f8=f8
- nop.i 0;;
-} { .mfi
- nop.m 0
- // (8) r = a + (-b) * q
- xma.l f8=f8,f7,f11
- nop.i 0;;
-} { .mmi
- // remainder will be in the least significant 32 bits of r8 (if b != 0)
- getf.sig r8=f8
- nop.m 0
- nop.i 0;;
-}
-
- // 32-BIT SIGNED INTEGER REMAINDER ENDS HERE
-
-{ .mmb
- nop.m 0
- nop.m 0
- br.ret.sptk b0;;
-}
-
-.endp __modsi3
diff --git a/lib/libc/ia64/gen/__udivdi3.S b/lib/libc/ia64/gen/__udivdi3.S
deleted file mode 100644
index 1233e8aa4105..000000000000
--- a/lib/libc/ia64/gen/__udivdi3.S
+++ /dev/null
@@ -1,144 +0,0 @@
-.file "__udivdi3.s"
-
-//
-// Copyright (c) 2000, Intel Corporation
-// All rights reserved.
-//
-// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache,
-// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab,
-// Intel Corporation.
-//
-// WARRANTY DISCLAIMER
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 INTEL OR ITS
-// 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.
-//
-// Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
-//
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-.section .text
-.proc __udivdi3#
-.align 32
-.global __udivdi3#
-.align 32
-
-// 64-bit unsigned integer divide
-
-__udivdi3:
-
-{ .mii
- alloc r31=ar.pfs,2,0,0,0
- nop.i 0
- nop.i 0;;
-}
-
-{ .mmi
-
- // 64-BIT UNSIGNED INTEGER DIVIDE BEGINS HERE
-
- setf.sig f8=r32
- setf.sig f9=r33
- nop.i 0;;
-} { .mfb
- nop.m 0
- fma.s1 f6=f8,f1,f0
- nop.b 0
-} { .mfb
- nop.m 0
- fma.s1 f7=f9,f1,f0
- nop.b 0;;
-} { .mfi
- nop.m 0
- // Step (1)
- // y0 = 1 / b in f8
- frcpa.s1 f8,p6=f6,f7
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (2)
- // e0 = 1 - b * y0 in f9
- (p6) fnma.s1 f9=f7,f8,f1
- nop.i 0
-} { .mfi
- nop.m 0
- // Step (3)
- // q0 = a * y0 in f10
- (p6) fma.s1 f10=f6,f8,f0
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (4)
- // e1 = e0 * e0 in f11
- (p6) fma.s1 f11=f9,f9,f0
- nop.i 0
-} { .mfi
- nop.m 0
- // Step (5)
- // q1 = q0 + e0 * q0 in f10
- (p6) fma.s1 f10=f9,f10,f10
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (6)
- // y1 = y0 + e0 * y0 in f8
- (p6) fma.s1 f8=f9,f8,f8
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (7)
- // q2 = q1 + e1 * q1 in f9
- (p6) fma.s1 f9=f11,f10,f10
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (8)
- // y2 = y1 + e1 * y1 in f8
- (p6) fma.s1 f8=f11,f8,f8
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (9)
- // r2 = a - b * q2 in f10
- (p6) fnma.s1 f10=f7,f9,f6
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (10)
- // q3 = q2 + r2 * y2 in f8
- (p6) fma.s1 f8=f10,f8,f9
- nop.i 0;;
-} { .mfb
- nop.m 0
- // (11) q = trunc(q3)
- fcvt.fxu.trunc.s1 f8=f8
- nop.b 0;;
-} { .mmi
- // quotient will be in r8 (if b != 0)
- getf.sig r8=f8
- nop.m 0
- nop.i 0;;
-}
-
- // 64-BIT UNSIGNED INTEGER DIVIDE ENDS HERE
-
-{ .mmb
- nop.m 0
- nop.m 0
- br.ret.sptk b0;;
-}
-
-.endp __udivdi3
diff --git a/lib/libc/ia64/gen/__udivsi3.S b/lib/libc/ia64/gen/__udivsi3.S
deleted file mode 100644
index 25959b88a922..000000000000
--- a/lib/libc/ia64/gen/__udivsi3.S
+++ /dev/null
@@ -1,125 +0,0 @@
-.file "__udivsi3.s"
-
-//
-// Copyright (c) 2000, Intel Corporation
-// All rights reserved.
-//
-// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache,
-// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab,
-// Intel Corporation.
-//
-// WARRANTY DISCLAIMER
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 INTEL OR ITS
-// 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.
-//
-// Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
-//
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-.section .text
-
-// 32-bit unsigned integer divide
-
-.proc __udivsi3#
-.align 32
-.global __udivsi3#
-.align 32
-
-__udivsi3:
-
-{ .mii
- alloc r31=ar.pfs,2,0,0,0
- nop.i 0
- nop.i 0;;
-} { .mii
- nop.m 0
-
- // 32-BIT UNSIGNED INTEGER DIVIDE BEGINS HERE
-
- // general register used:
- // r32 - 32-bit unsigned integer dividend
- // r33 - 32-bit unsigned integer divisor
- // r8 - 32-bit unsigned integer result
- // r2 - scratch register
- // floating-point registers used: f6, f7, f8, f9
- // predicate registers used: p6
-
- zxt4 r32=r32
- zxt4 r33=r33;;
-} { .mmb
- setf.sig f6=r32
- setf.sig f7=r33
- nop.b 0;;
-} { .mfi
- nop.m 0
- fcvt.xf f6=f6
- nop.i 0
-} { .mfi
- nop.m 0
- fcvt.xf f7=f7
- mov r2 = 0x0ffdd;;
-} { .mfi
- setf.exp f9 = r2
- // (1) y0
- frcpa.s1 f8,p6=f6,f7
- nop.i 0;;
-} { .mfi
- nop.m 0
- // (2) q0 = a * y0
- (p6) fma.s1 f6=f6,f8,f0
- nop.i 0
-} { .mfi
- nop.m 0
- // (3) e0 = 1 - b * y0
- (p6) fnma.s1 f7=f7,f8,f1
- nop.i 0;;
-} { .mfi
- nop.m 0
- // (4) q1 = q0 + e0 * q0
- (p6) fma.s1 f6=f7,f6,f6
- nop.i 0
-} { .mfi
- nop.m 0
- // (5) e1 = e0 * e0 + 2^-34
- (p6) fma.s1 f7=f7,f7,f9
- nop.i 0;;
-} { .mfi
- nop.m 0
- // (6) q2 = q1 + e1 * q1
- (p6) fma.s1 f8=f7,f6,f6
- nop.i 0;;
-} { .mfi
- nop.m 0
- // (7) q = trunc(q2)
- fcvt.fxu.trunc.s1 f8=f8
- nop.i 0;;
-} { .mmi
- // quotient will be in the least significant 32 bits of r8 (if b != 0)
- getf.sig r8=f8
- nop.m 0
- nop.i 0;;
-}
-
- // 32-BIT UNSIGNED INTEGER DIVIDE ENDS HERE
-
-{ .mmb
- nop.m 0
- nop.m 0
- br.ret.sptk b0;;
-}
-
-.endp __udivsi3
diff --git a/lib/libc/ia64/gen/__umoddi3.S b/lib/libc/ia64/gen/__umoddi3.S
deleted file mode 100644
index 509c62bb687e..000000000000
--- a/lib/libc/ia64/gen/__umoddi3.S
+++ /dev/null
@@ -1,156 +0,0 @@
-.file "__umoddi3.s"
-
-//
-// Copyright (c) 2000, Intel Corporation
-// All rights reserved.
-//
-// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache,
-// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab,
-// Intel Corporation.
-//
-// WARRANTY DISCLAIMER
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 INTEL OR ITS
-// 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.
-//
-// Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
-//
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-.section .text
-
- // 64-bit unsigned integer remainder
-
-.proc __umoddi3#
-.align 32
-.global __umoddi3#
-.align 32
-
-__umoddi3:
-
-{ .mii
- alloc r31=ar.pfs,3,0,0,0
- nop.i 0
- nop.i 0
-} { .mmb
-
- // 64-BIT UNSIGNED INTEGER REMAINDER BEGINS HERE
-
- // general register used:
- // r32 - 64-bit unsigned integer dividend
- // r33 - 64-bit unsigned integer divisor
- // r8 - 64-bit unsigned integer result
- // floating-point registers used: f6, f7, f8, f9, f10, f11, f12
- // predicate registers used: p6
-
- setf.sig f12=r32 // holds an in integer form
- setf.sig f7=r33
- nop.b 0;;
-} { .mfi
- // get 2's complement of b
- sub r33=r0,r33
- fcvt.xuf.s1 f6=f12
- nop.i 0
-} { .mfi
- nop.m 0
- fcvt.xuf.s1 f7=f7
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (1)
- // y0 = 1 / b in f8
- frcpa.s1 f8,p6=f6,f7
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (2)
- // q0 = a * y0 in f10
- (p6) fma.s1 f10=f6,f8,f0
- nop.i 0
-} { .mfi
- nop.m 0
- // Step (3)
- // e0 = 1 - b * y0 in f9
- (p6) fnma.s1 f9=f7,f8,f1
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (4)
- // q1 = q0 + e0 * q0 in f10
- (p6) fma.s1 f10=f9,f10,f10
- nop.i 0
-} { .mfi
- nop.m 0
- // Step (5)
- // e1 = e0 * e0 in f11
- (p6) fma.s1 f11=f9,f9,f0
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (6)
- // y1 = y0 + e0 * y0 in f8
- (p6) fma.s1 f8=f9,f8,f8
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (7)
- // q2 = q1 + e1 * q1 in f9
- (p6) fma.s1 f9=f11,f10,f10
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (8)
- // y2 = y1 + e1 * y1 in f8
- (p6) fma.s1 f8=f11,f8,f8
- nop.i 0;;
-} { .mfi
- nop.m 0
- // Step (9)
- // r2 = a - b * q2 in f10
- (p6) fnma.s1 f10=f7,f9,f6
- nop.i 0;;
-} { .mfi
- // f7=-b
- setf.sig f7=r33
- // Step (10)
- // q3 = q2 + r2 * y2 in f8
- (p6) fma.s1 f8=f10,f8,f9
- nop.i 0;;
-} { .mfi
- nop.m 0
- // (11) q = trunc(q3)
- fcvt.fxu.trunc.s1 f8=f8
- nop.i 0;;
-} { .mfi
- nop.m 0
- // (12) r = a + (-b) * q
- xma.l f8=f8,f7,f12
- nop.i 0;;
-} { .mib
- getf.sig r8=f8
- nop.i 0
- nop.b 0
-}
-
- // 64-BIT UNSIGNED INTEGER REMAINDER ENDS HERE
-
-{ .mib
- nop.m 0
- nop.i 0
- br.ret.sptk b0;;
-}
-
-.endp __umoddi3
diff --git a/lib/libc/ia64/gen/__umodsi3.S b/lib/libc/ia64/gen/__umodsi3.S
deleted file mode 100644
index 697db2e5d8c9..000000000000
--- a/lib/libc/ia64/gen/__umodsi3.S
+++ /dev/null
@@ -1,132 +0,0 @@
-.file "__umodsi3.s"
-
-//
-// Copyright (c) 2000, Intel Corporation
-// All rights reserved.
-//
-// Contributed 2/15/2000 by Marius Cornea, John Harrison, Cristina Iordache,
-// Ted Kubaska, Bob Norin, and Shane Story of the Computational Software Lab,
-// Intel Corporation.
-//
-// WARRANTY DISCLAIMER
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 INTEL OR ITS
-// 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.
-//
-// Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
-//
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-.section .text
-
-// 32-bit unsigned integer remainder
-
-.proc __umodsi3#
-.align 32
-.global __umodsi3#
-.align 32
-
-__umodsi3:
-
-{ .mii
- alloc r31=ar.pfs,2,0,0,0
- nop.i 0
- nop.i 0;;
-} { .mii
- nop.m 0
-
- // 32-BIT UNSIGNED INTEGER REMAINDER BEGINS HERE
-
- // general register used:
- // r32 - 32-bit unsigned integer dividend
- // r33 - 32-bit unsigned integer divisor
- // r8 - 32-bit unsigned integer result
- // r2 - scratch register
- // floating-point registers used: f6, f7, f8, f9, f10, f11
- // predicate registers used: p6
-
- zxt4 r32=r32
- zxt4 r33=r33;;
-} { .mmb
- setf.sig f11=r32
- setf.sig f7=r33
- nop.b 0;;
-} { .mfi
- nop.m 0
- fcvt.xf f6=f11
- nop.i 0
-} { .mfi
- // get 2's complement of b
- sub r33=r0,r33
- fcvt.xf f7=f7
- mov r2 = 0x0ffdd;;
-} { .mfi
- setf.exp f9 = r2
- // (1) y0
- frcpa.s1 f8,p6=f6,f7
- nop.i 0;;
-} { .mfi
- nop.m 0
- // (2) q0 = a * y0
- (p6) fma.s1 f10=f6,f8,f0
- nop.i 0
-} { .mfi
- nop.m 0
- // (3) e0 = 1 - b * y0
- (p6) fnma.s1 f8=f7,f8,f1
- nop.i 0;;
-} { .mfi
- nop.m 0
- // (4) q1 = q0 + e0 * q0
- (p6) fma.s1 f10=f8,f10,f10
- nop.i 0
-} { .mfi
- // get 2's complement of b
- setf.sig f7=r33
- // (5) e1 = e0 * e0 + 2^-34
- (p6) fma.s1 f8=f8,f8,f9
- nop.i 0;;
-} { .mfi
- nop.m 0
- // (6) q2 = q1 + e1 * q1
- (p6) fma.s1 f8=f8,f10,f10
- nop.i 0;;
-} { .mfi
- nop.m 0
- // (7) q = trunc(q2)
- fcvt.fxu.trunc.s1 f8=f8
- nop.i 0;;
-} { .mfi
- nop.m 0
- // (8) r = a + (-b) * q
- xma.l f8=f8,f7,f11
- nop.i 0;;
-} { .mmi
- // remainder will be in the least significant 32 bits of r8 (if b != 0)
- getf.sig r8=f8
- nop.m 0
- nop.i 0;;
-}
-
- // 32-BIT UNSIGNED INTEGER REMAINDER ENDS HERE
-
-{ .mmb
- nop.m 0
- nop.m 0
- br.ret.sptk b0;;
-}
-
-.endp __umodsi3
diff --git a/lib/libc/ia64/gen/_mcount.S b/lib/libc/ia64/gen/_mcount.S
deleted file mode 100644
index d9e9b76845d8..000000000000
--- a/lib/libc/ia64/gen/_mcount.S
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2004 Marcel Moolenaar
- * 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
- .text
-
-/*
- * Important registers:
- * r8 structure return address
- * r15 static link (nested routines)
- * rp our return address
- * in0 caller's ar.pfs
- * in1 caller's gp
- * in2 caller's rp
- * in3 GOT entry
- * ar.pfs our pfs
- */
-ENTRY_NOPROFILE(_mcount, 4)
- alloc loc0 = ar.pfs, 4, 4, 2, 0
- mov loc1 = r8
- mov loc2 = rp
- mov loc3 = r15
- ;;
- mov out0 = in2
- mov out1 = rp
- br.call.sptk rp = __mcount
- ;;
-1:
- mov gp = in1
- mov r14 = ip
- mov b7 = loc2
- ;;
- add r14 = 2f - 1b, r14
- mov ar.pfs = loc0
- mov rp = in2
- ;;
- mov r15 = loc3
- mov b7 = r14
- mov b6 = loc2
- mov r8 = loc1
- mov r14 = in0
- br.ret.sptk b7
- ;;
-2:
- mov ar.pfs = r14
- br.sptk b6
- ;;
-END(_mcount)
-
-WEAK_ALIAS(mcount, _mcount)
diff --git a/lib/libc/ia64/gen/_set_tp.c b/lib/libc/ia64/gen/_set_tp.c
deleted file mode 100644
index 901e90166918..000000000000
--- a/lib/libc/ia64/gen/_set_tp.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/*-
- * Copyright (c) 2004 Doug Rabson
- * 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$
- */
-
-void
-_set_tp(void *tpval)
-{
-
- __asm __volatile("mov r13 = %0" :: "r"(tpval));
-}
diff --git a/lib/libc/ia64/gen/_setjmp.S b/lib/libc/ia64/gen/_setjmp.S
deleted file mode 100644
index 3966e836475f..000000000000
--- a/lib/libc/ia64/gen/_setjmp.S
+++ /dev/null
@@ -1,310 +0,0 @@
-//
-// Copyright (c) 1999, 2000
-// Intel Corporation.
-// 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 Intel Corporation and
-// its contributors.
-//
-// 4. Neither the name of Intel Corporation or its contributors may be
-// used to endorse or promote products derived from this software
-// without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION 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 INTEL CORPORATION 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.
-//
-//
-
-//
-// Module Name:
-//
-// setjmp.s
-//
-// Abstract:
-//
-// Contains an implementation of setjmp and longjmp for the
-// IA-64 architecture.
-
- .file "setjmp.s"
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#define LOCORE
-#include <machine/setjmp.h>
-
-// int _setjmp(struct jmp_buffer *)
-//
-// Setup a non-local goto.
-//
-// Description:
-//
-// SetJump stores the current register set in the area pointed to
-// by "save". It returns zero. Subsequent calls to "LongJump" will
-// restore the registers and return non-zero to the same location.
-//
-// On entry, r32 contains the pointer to the jmp_buffer
-//
-
-ENTRY(_setjmp, 1)
- add r10 = J_PREDS, r32 // skip Unats & pfs save area
- add r11 = J_BSP, r32
- //
- // save immediate context
- //
- mov r2 = ar.bsp // save backing store pointer
- mov r3 = pr // save predicates
- flushrs
- ;;
- //
- // save user Unat register
- //
- mov r16 = ar.lc // save loop count register
- mov r14 = ar.unat // save user Unat register
-
- st8 [r10] = r3, J_LC-J_PREDS
- st8 [r11] = r2, J_R4-J_BSP
- ;;
- st8 [r10] = r16, J_R5-J_LC
- st8 [r32] = r14, J_NATS // Note: Unat at the
- // beginning of the save area
- mov r15 = ar.pfs
- ;;
- //
- // save preserved general registers & NaT's
- //
- .mem.offset 0,0
- st8.spill [r11] = r4, J_R6-J_R4
- .mem.offset 8,0
- st8.spill [r10] = r5, J_R7-J_R5
- ;;
- .mem.offset 16,0
- st8.spill [r11] = r6, J_SP-J_R6
- .mem.offset 24,0
- st8.spill [r10] = r7, J_F3-J_R7
- ;;
- st8.spill [r11] = sp, J_F2-J_SP
- mov r16 = ar.rsc
- ;;
- //
- // save spilled Unat and pfs registers
- //
- mov r2 = ar.unat // save Unat register after spill
- mov ar.rsc = r0
- ;;
- st8 [r32] = r2, J_PFS-J_NATS // save unat for spilled regs
- mov r17 = ar.rnat
- ;;
- st8 [r32] = r15, J_RNAT-J_PFS // save pfs
- mov ar.rsc = r16
- //
- // save floating registers
- //
- stf.spill [r11] = f2, J_F4-J_F2
- stf.spill [r10] = f3, J_F5-J_F3
- ;;
- stf.spill [r11] = f4, J_F16-J_F4
- stf.spill [r10] = f5, J_F17-J_F5
- ;;
- stf.spill [r11] = f16, J_F18-J_F16
- stf.spill [r10] = f17, J_F19-J_F17
- ;;
- stf.spill [r11] = f18, J_F20-J_F18
- stf.spill [r10] = f19, J_F21-J_F19
- ;;
- stf.spill [r11] = f20, J_F22-J_F20
- stf.spill [r10] = f21, J_F23-J_F21
- ;;
- stf.spill [r11] = f22, J_F24-J_F22
- stf.spill [r10] = f23, J_F25-J_F23
- ;;
- stf.spill [r11] = f24, J_F26-J_F24
- stf.spill [r10] = f25, J_F27-J_F25
- ;;
- stf.spill [r11] = f26, J_F28-J_F26
- stf.spill [r10] = f27, J_F29-J_F27
- ;;
- stf.spill [r11] = f28, J_F30-J_F28
- stf.spill [r10] = f29, J_F31-J_F29
- ;;
- stf.spill [r11] = f30, J_FPSR-J_F30
- stf.spill [r10] = f31, J_B0-J_F31 // size of f31 + fpsr
- ;;
- st8 [r32] = r17
- //
- // save FPSR register & branch registers
- //
- mov r2 = ar.fpsr // save fpsr register
- mov r3 = b0
- ;;
- st8 [r11] = r2, J_B1-J_FPSR
- st8 [r10] = r3, J_B2-J_B0
- mov r2 = b1
- mov r3 = b2
- ;;
- st8 [r11] = r2, J_B3-J_B1
- st8 [r10] = r3, J_B4-J_B2
- mov r2 = b3
- mov r3 = b4
- ;;
- st8 [r11] = r2, J_B5-J_B3
- st8 [r10] = r3
- mov r2 = b5
- ;;
- st8 [r11] = r2
- ;;
- //
- // return
- //
- mov r8 = r0 // return 0 from setjmp
- mov ar.unat = r14 // restore unat
- br.ret.sptk b0
-
-END(_setjmp)
-
-
-//
-// void _longjmp(struct jmp_buffer *, int val)
-//
-// Perform a non-local goto.
-//
-// Description:
-//
-// LongJump initializes the register set to the values saved by a
-// previous 'SetJump' and jumps to the return location saved by that
-// 'SetJump'. This has the effect of unwinding the stack and returning
-// for a second time to the 'SetJump'.
-//
-
- WEAK_ALIAS(_longjmp,___longjmp)
-ENTRY(___longjmp, 2)
- mov r14 = ar.rsc // get user RSC conf
- mov r8 = r33 // return value
- add r10 = J_PFS, r32 // get address of pfs
- ;;
- mov ar.rsc = r0
- add r11 = J_NATS, r32
- add r17 = J_RNAT, r32
- ;;
- ld8 r15 = [r10], J_BSP-J_PFS // get pfs
- ld8 r2 = [r11], J_LC-J_NATS // get unat for spilled regs
- mov r31 = r32
- ;;
- loadrs
- mov ar.unat = r2
- cmp.eq p6,p0=0,r8 // Return value 0?
- ;;
- ld8 r16 = [r10], J_PREDS-J_BSP // get backing store pointer
- ld8 r17 = [r17] // ar.rnat
- mov ar.pfs = r15
- ;;
- mov ar.bspstore = r16
-(p6) add r8 = 1, r0
- ;;
- mov ar.rnat = r17
- mov ar.rsc = r14 // restore RSC conf
-
- ld8 r3 = [r11], J_R4-J_LC // get lc register
- ld8 r2 = [r10], J_R5-J_PREDS // get predicates
- ;;
- mov pr = r2, -1
- mov ar.lc = r3
- //
- // restore preserved general registers & NaT's
- //
- ld8.fill r4 = [r11], J_R6-J_R4
- ;;
- ld8.fill r5 = [r10], J_R7-J_R5
- ld8.fill r6 = [r11], J_SP-J_R6
- ;;
- ld8.fill r7 = [r10], J_F2-J_R7
- ld8.fill sp = [r11], J_F3-J_SP
- ;;
- //
- // restore floating registers
- //
- ldf.fill f2 = [r10], J_F4-J_F2
- ldf.fill f3 = [r11], J_F5-J_F3
- ;;
- ldf.fill f4 = [r10], J_F16-J_F4
- ldf.fill f5 = [r11], J_F17-J_F5
- ;;
- ldf.fill f16 = [r10], J_F18-J_F16
- ldf.fill f17 = [r11], J_F19-J_F17
- ;;
- ldf.fill f18 = [r10], J_F20-J_F18
- ldf.fill f19 = [r11], J_F21-J_F19
- ;;
- ldf.fill f20 = [r10], J_F22-J_F20
- ldf.fill f21 = [r11], J_F23-J_F21
- ;;
- ldf.fill f22 = [r10], J_F24-J_F22
- ldf.fill f23 = [r11], J_F25-J_F23
- ;;
- ldf.fill f24 = [r10], J_F26-J_F24
- ldf.fill f25 = [r11], J_F27-J_F25
- ;;
- ldf.fill f26 = [r10], J_F28-J_F26
- ldf.fill f27 = [r11], J_F29-J_F27
- ;;
- ldf.fill f28 = [r10], J_F30-J_F28
- ldf.fill f29 = [r11], J_F31-J_F29
- ;;
- ldf.fill f30 = [r10], J_FPSR-J_F30
- ldf.fill f31 = [r11], J_B0-J_F31 ;;
-
- //
- // restore branch registers and fpsr
- //
- ld8 r16 = [r10], J_B1-J_FPSR // get fpsr
- ld8 r17 = [r11], J_B2-J_B0 // get return pointer
- ;;
- mov ar.fpsr = r16
- mov b0 = r17
- ld8 r2 = [r10], J_B3-J_B1
- ld8 r3 = [r11], J_B4-J_B2
- ;;
- mov b1 = r2
- mov b2 = r3
- ld8 r2 = [r10], J_B5-J_B3
- ld8 r3 = [r11]
- ;;
- mov b3 = r2
- mov b4 = r3
- ld8 r2 = [r10]
- ld8 r21 = [r31] // get user unat
- ;;
- mov b5 = r2
- mov ar.unat = r21
-
- //
- // invalidate ALAT
- //
- invala ;;
-
- br.ret.sptk b0
-
-END(___longjmp)
diff --git a/lib/libc/ia64/gen/fabs.S b/lib/libc/ia64/gen/fabs.S
deleted file mode 100644
index 036d49201321..000000000000
--- a/lib/libc/ia64/gen/fabs.S
+++ /dev/null
@@ -1,33 +0,0 @@
-/*-
- * Copyright (c) 2000 Doug Rabson
- * 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-ENTRY(fabs, 1)
- fabs fret0=farg0
- br.ret.sptk.few rp
-END(fabs)
diff --git a/lib/libc/ia64/gen/flt_rounds.c b/lib/libc/ia64/gen/flt_rounds.c
deleted file mode 100644
index d65096545abc..000000000000
--- a/lib/libc/ia64/gen/flt_rounds.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Written by J.T. Conklin, Apr 10, 1995
- * Public domain.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <float.h>
-
-static const int map[] = {
- 1, /* round to nearest */
- 3, /* round to zero */
- 2, /* round to negative infinity */
- 0 /* round to positive infinity */
-};
-
-int
-__flt_rounds(void)
-{
- int x;
-
- __asm("mov %0=ar.fpsr" : "=r" (x));
- return (map[(x >> 10) & 0x03]);
-}
diff --git a/lib/libc/ia64/gen/fpgetmask.c b/lib/libc/ia64/gen/fpgetmask.c
deleted file mode 100644
index ac166e249388..000000000000
--- a/lib/libc/ia64/gen/fpgetmask.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*-
- * Copyright (c) 2001 Doug Rabson
- * 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <ieeefp.h>
-
-fp_except_t
-fpgetmask(void)
-{
- u_int64_t fpsr;
-
- __asm __volatile("mov %0=ar.fpsr" : "=r" (fpsr));
- return (~fpsr & 0x3d);
-}
diff --git a/lib/libc/ia64/gen/fpgetround.c b/lib/libc/ia64/gen/fpgetround.c
deleted file mode 100644
index 6f5e8cc86c4c..000000000000
--- a/lib/libc/ia64/gen/fpgetround.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2003 Marcel Moolenaar
- * 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 ``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 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$
- */
-
-#include <sys/types.h>
-#include <ieeefp.h>
-
-fp_rnd_t
-fpgetround(void)
-{
- uint64_t fpsr;
-
- __asm __volatile("mov %0=ar.fpsr" : "=r"(fpsr));
- return ((fp_rnd_t)((fpsr >> 10) & 3));
-}
diff --git a/lib/libc/ia64/gen/fpsetmask.c b/lib/libc/ia64/gen/fpsetmask.c
deleted file mode 100644
index d959dc6281ab..000000000000
--- a/lib/libc/ia64/gen/fpsetmask.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*-
- * Copyright (c) 2001 Doug Rabson
- * 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <ieeefp.h>
-
-fp_except_t
-fpsetmask(fp_except_t mask)
-{
- u_int64_t fpsr;
- u_int64_t oldmask;
-
- __asm __volatile("mov %0=ar.fpsr" : "=r" (fpsr));
- oldmask = ~fpsr & 0x3d;
- fpsr = (fpsr & ~0x3d) | (~mask & 0x3d);
- __asm __volatile("mov ar.fpsr=%0" :: "r" (fpsr));
- return (oldmask);
-}
diff --git a/lib/libc/ia64/gen/fpsetround.c b/lib/libc/ia64/gen/fpsetround.c
deleted file mode 100644
index db2eef1e49c2..000000000000
--- a/lib/libc/ia64/gen/fpsetround.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2003 Marcel Moolenaar
- * 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 ``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 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$
- */
-
-#include <sys/types.h>
-#include <ieeefp.h>
-
-fp_rnd_t
-fpsetround(fp_rnd_t rnd)
-{
- uint64_t fpsr;
- fp_rnd_t prev;
-
- __asm __volatile("mov %0=ar.fpsr" : "=r"(fpsr));
- prev = (fp_rnd_t)((fpsr >> 10) & 3);
- fpsr = (fpsr & ~0xC00ULL) | ((unsigned int)rnd << 10);
- __asm __volatile("mov ar.fpsr=%0" :: "r"(fpsr));
- return (prev);
-}
diff --git a/lib/libc/ia64/gen/getcontextx.c b/lib/libc/ia64/gen/getcontextx.c
deleted file mode 100644
index 54f851384811..000000000000
--- a/lib/libc/ia64/gen/getcontextx.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2011 Konstantin Belousov <kib@FreeBSD.org>
- * 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/ucontext.h>
-#include <errno.h>
-#include <stdlib.h>
-
-int
-__getcontextx_size(void)
-{
-
- return (sizeof(ucontext_t));
-}
-
-int
-__fillcontextx2(char *ctx)
-{
-
- return (0);
-}
-
-int
-__fillcontextx(char *ctx)
-{
- ucontext_t *ucp;
-
- ucp = (ucontext_t *)ctx;
- return (getcontext(ucp));
-}
-
-__weak_reference(__getcontextx, getcontextx);
-
-ucontext_t *
-__getcontextx(void)
-{
- char *ctx;
- int error;
-
- ctx = malloc(__getcontextx_size());
- if (ctx == NULL)
- return (NULL);
- if (__fillcontextx(ctx) == -1) {
- error = errno;
- free(ctx);
- errno = error;
- return (NULL);
- }
- return ((ucontext_t *)ctx);
-}
diff --git a/lib/libc/ia64/gen/infinity.c b/lib/libc/ia64/gen/infinity.c
deleted file mode 100644
index 1ae92a804d55..000000000000
--- a/lib/libc/ia64/gen/infinity.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $NetBSD: infinity.c,v 1.1 1995/02/10 17:50:23 cgd Exp $ */
-
-/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Author: Chris G. Demetriou
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/endian.h>
-#include <math.h>
-
-/* bytes for +Infinity on an ia64 (IEEE double format) */
-#if _BYTE_ORDER == _LITTLE_ENDIAN
-const union __infinity_un __infinity = { { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } };
-#else /* _BIG_ENDIAN */
-const union __infinity_un __infinity = { { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } };
-#endif
-
-/* bytes for NaN */
-#if _BYTE_ORDER == _LITTLE_ENDIAN
-const union __nan_un __nan = { { 0, 0, 0xc0, 0xff } };
-#else /* _BIG_ENDIAN */
-const union __nan_un __nan = { { 0xff, 0xc0, 0, 0 } };
-#endif
diff --git a/lib/libc/ia64/gen/makecontext.c b/lib/libc/ia64/gen/makecontext.c
deleted file mode 100644
index bee47f11ce57..000000000000
--- a/lib/libc/ia64/gen/makecontext.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2003 Marcel Moolenaar
- * 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/ucontext.h>
-#include <machine/fpu.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-struct fdesc {
- uint64_t ip;
- uint64_t gp;
-};
-
-typedef void (*func_t)(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t,
- uint64_t, uint64_t, uint64_t);
-
-static __inline uint64_t *
-spill(uint64_t *bsp, uint64_t arg)
-{
- *bsp++ = arg;
- if (((intptr_t)bsp & 0x1ff) == 0x1f8)
- *bsp++ = 0;
- return (bsp);
-}
-
-static void
-ctx_wrapper(ucontext_t *ucp, func_t func, uint64_t *args)
-{
-
- (*func)(args[0], args[1], args[2], args[3], args[4], args[5], args[6],
- args[7]);
- if (ucp->uc_link == NULL)
- exit(0);
- setcontext((const ucontext_t *)ucp->uc_link);
- /* should never get here */
- abort();
- /* NOTREACHED */
-}
-
-__weak_reference(__makecontext, makecontext);
-
-void
-__makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
-{
- uint64_t *args, *bsp;
- va_list ap;
- int i;
-
- /*
- * Drop the ball completely if something's not right. We only
- * support general registers as arguments and not more than 8
- * of them. Things get hairy if we need to support FP registers
- * (alignment issues) or more than 8 arguments (stack based).
- */
- if (argc < 0 || argc > 8 || ucp == NULL ||
- ucp->uc_stack.ss_sp == NULL || (ucp->uc_stack.ss_size & 15) ||
- ((intptr_t)ucp->uc_stack.ss_sp & 15) ||
- ucp->uc_stack.ss_size < MINSIGSTKSZ)
- abort();
-
- /*
- * Copy the arguments of function 'func' onto the (memory) stack.
- * Always take up space for 8 arguments.
- */
- va_start(ap, argc);
- args = (uint64_t*)(ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size) - 8;
- i = 0;
- while (i < argc)
- args[i++] = va_arg(ap, uint64_t);
- while (i < 8)
- args[i++] = 0;
- va_end(ap);
-
- /*
- * Push (spill) the arguments of the context wrapper onto the register
- * stack. They get loaded by the RSE on a context switch.
- */
- bsp = (uint64_t*)ucp->uc_stack.ss_sp;
- bsp = spill(bsp, (intptr_t)ucp);
- bsp = spill(bsp, (intptr_t)func);
- bsp = spill(bsp, (intptr_t)args);
-
- /*
- * Setup the MD portion of the context.
- */
- memset(&ucp->uc_mcontext, 0, sizeof(ucp->uc_mcontext));
- ucp->uc_mcontext.mc_special.sp = (intptr_t)args - 16;
- ucp->uc_mcontext.mc_special.bspstore = (intptr_t)bsp;
- ucp->uc_mcontext.mc_special.pfs = (3 << 7) | 3;
- ucp->uc_mcontext.mc_special.rsc = 0xf;
- ucp->uc_mcontext.mc_special.rp = ((struct fdesc*)ctx_wrapper)->ip;
- ucp->uc_mcontext.mc_special.gp = ((struct fdesc*)ctx_wrapper)->gp;
- ucp->uc_mcontext.mc_special.fpsr = IA64_FPSR_DEFAULT;
-}
diff --git a/lib/libc/ia64/gen/setjmp.S b/lib/libc/ia64/gen/setjmp.S
deleted file mode 100644
index a2b56d6af9f0..000000000000
--- a/lib/libc/ia64/gen/setjmp.S
+++ /dev/null
@@ -1,82 +0,0 @@
-/* $NetBSD: setjmp.S,v 1.3 1997/12/05 02:06:27 thorpej Exp $ */
-
-/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Author: Chris G. Demetriou
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#define LOCORE
-#include <machine/setjmp.h>
-
-/*
- * C library -- setjmp, longjmp
- *
- * longjmp(a,v)
- * will generate a "return(v)" from
- * the last call to
- * setjmp(a)
- * by restoring registers from the stack,
- * and the previous signal state.
- */
-
-ENTRY(setjmp, 1)
- alloc loc0=ar.pfs,1,2,3,0
- mov loc1=rp
- ;;
- mov out0=1 // how = SIG_BLOCK
- mov out1=0 // set = NULL
- add out2=J_SIGSET,in0 // oset = &jb[J_SIGSET]
- br.call.sptk.few rp=__sys_sigprocmask
- ;;
- mov rp=loc1
- mov r14=loc0
- ;;
- alloc r15=ar.pfs,1,0,0,0 // drop register frame
- ;;
- mov ar.pfs=r14 // restore ar.pfs
- br.sptk.many _setjmp // finish saving state
-END(setjmp)
-
- WEAK_ALIAS(longjmp,__longjmp)
-ENTRY(__longjmp, 2)
- alloc loc0=ar.pfs,2,2,3,0
- mov loc1=rp
- ;;
- mov out0=3 // how = SIG_SETMASK
- add out1=J_SIGSET,in0 // set = &jb[J_SIGSET]
- mov out2=0 // oset = NULL
- br.call.sptk.few rp=__sys_sigprocmask
- ;;
- mov rp=loc1
- mov r14=loc0
- ;;
- alloc r15=ar.pfs,2,0,0,0 // drop register frame
- ;;
- mov ar.pfs=r14 // restore ar.pfs
- br.sptk.many _longjmp // finish restoring state
-END(__longjmp)
diff --git a/lib/libc/ia64/gen/signalcontext.c b/lib/libc/ia64/gen/signalcontext.c
deleted file mode 100644
index b47daf37d9ea..000000000000
--- a/lib/libc/ia64/gen/signalcontext.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2003 Marcel Moolenaar
- * 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/ucontext.h>
-#include <machine/fpu.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <strings.h>
-
-struct fdesc {
- uint64_t ip;
- uint64_t gp;
-};
-
-typedef void (*handler_t)(uint64_t, uint64_t, uint64_t);
-
-static __inline uint64_t *
-spill(uint64_t *bsp, uint64_t arg)
-{
- *bsp++ = arg;
- if (((intptr_t)bsp & 0x1ff) == 0x1f8)
- *bsp++ = 0;
- return (bsp);
-}
-
-static void
-ctx_wrapper(ucontext_t *ucp, handler_t func, uint64_t *args)
-{
-
- (*func)(args[0], args[1], args[2]);
- if (ucp->uc_link == NULL)
- exit(0);
- setcontext((const ucontext_t *)ucp->uc_link);
- /* should never get here */
- abort();
- /* NOTREACHED */
-}
-
-__weak_reference(__signalcontext, signalcontext);
-
-int
-__signalcontext(ucontext_t *ucp, int sig, __sighandler_t *func)
-{
- uint64_t *args, *bsp;
- siginfo_t *sig_si;
- ucontext_t *sig_uc;
- uint64_t sp;
-
- /* Bail out if we don't have a valid ucontext pointer. */
- if (ucp == NULL)
- abort();
-
- /*
- * Build a signal frame and copy the arguments of signal handler
- * 'func' onto the (memory) stack. We only need 3 arguments, but
- * we create room for 4 so that we are 16-byte aligned.
- */
- sp = (ucp->uc_mcontext.mc_special.sp - sizeof(ucontext_t)) & ~15UL;
- sig_uc = (ucontext_t*)sp;
- bcopy(ucp, sig_uc, sizeof(*sig_uc));
- sp = (sp - sizeof(siginfo_t)) & ~15UL;
- sig_si = (siginfo_t*)sp;
- bzero(sig_si, sizeof(*sig_si));
- sig_si->si_signo = sig;
- sp -= 4 * sizeof(uint64_t);
- args = (uint64_t*)sp;
- args[0] = sig;
- args[1] = (intptr_t)sig_si;
- args[2] = (intptr_t)sig_uc;
-
- /*
- * Push (spill) the arguments of the context wrapper onto the register
- * stack. They get loaded by the RSE on a context switch.
- */
- bsp = (uint64_t*)ucp->uc_mcontext.mc_special.bspstore;
- bsp = spill(bsp, (intptr_t)ucp);
- bsp = spill(bsp, (intptr_t)func);
- bsp = spill(bsp, (intptr_t)args);
-
- /*
- * Setup the ucontext of the signal handler.
- */
- memset(&ucp->uc_mcontext, 0, sizeof(ucp->uc_mcontext));
- ucp->uc_link = sig_uc;
- sigdelset(&ucp->uc_sigmask, sig);
- ucp->uc_mcontext.mc_special.sp = (intptr_t)args - 16;
- ucp->uc_mcontext.mc_special.bspstore = (intptr_t)bsp;
- ucp->uc_mcontext.mc_special.pfs = (3 << 7) | 3;
- ucp->uc_mcontext.mc_special.rsc = 0xf;
- ucp->uc_mcontext.mc_special.rp = ((struct fdesc*)ctx_wrapper)->ip;
- ucp->uc_mcontext.mc_special.gp = ((struct fdesc*)ctx_wrapper)->gp;
- ucp->uc_mcontext.mc_special.fpsr = IA64_FPSR_DEFAULT;
- return (0);
-}
diff --git a/lib/libc/ia64/gen/sigsetjmp.S b/lib/libc/ia64/gen/sigsetjmp.S
deleted file mode 100644
index 9f02a26a5a7a..000000000000
--- a/lib/libc/ia64/gen/sigsetjmp.S
+++ /dev/null
@@ -1,66 +0,0 @@
-/* $NetBSD: sigsetjmp.S,v 1.2 1996/10/17 03:08:07 cgd Exp $ */
-
-/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Author: Chris G. Demetriou
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#define LOCORE
-#include <machine/setjmp.h>
-
-/*
- * C library -- sigsetjmp, siglongjmp
- *
- * siglongjmp(a,v)
- * will generate a "return(v)" from
- * the last call to
- * sigsetjmp(a, mask)
- * by restoring registers from the stack.
- * If `mask' is non-zero, the previous signal
- * state will be restored.
- */
-
-ENTRY(sigsetjmp, 2)
- add r14=J_SIGMASK,in0 // place to save mask
- cmp.ne p6,p7=0,in1 // save signal state?
- ;;
- st8 [r14]=in1 // save mask value
-(p6) br.cond.dptk.many setjmp
-(p7) br.cond.dpnt.many _setjmp
-END(sigsetjmp)
-
- WEAK_ALIAS(siglongjmp,__siglongjmp)
-ENTRY(__siglongjmp, 2)
- add r14=J_SIGMASK,in0 // address of mask value
- ;;
- ld8 r14=[r14]
- ;;
- cmp.ne p6,p7=0,r14 // did we save signals?
-(p6) br.cond.dptk.many longjmp
-(p7) br.cond.dpnt.many _longjmp
-END(__siglongjmp)
diff --git a/lib/libc/ia64/gen/unwind.c b/lib/libc/ia64/gen/unwind.c
deleted file mode 100644
index 7afd0eff496e..000000000000
--- a/lib/libc/ia64/gen/unwind.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (c) 2002 Marcel Moolenaar
- * 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 ``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 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$
- */
-
-#include <sys/types.h>
-
-#include <assert.h>
-#include <dlfcn.h>
-#include <stdlib.h>
-
-#include <machine/elf.h>
-
-#ifndef PT_IA_64_UNWIND
-#define PT_IA_64_UNWIND 0x70000001
-#endif
-
-#define SANITY 0
-
-struct ia64_unwind_entry
-{
- Elf64_Addr start;
- Elf64_Addr end;
- Elf64_Addr descr;
-};
-
-struct ia64_unwind_entry *
-_Unwind_FindTableEntry(const void *pc, unsigned long *pseg, unsigned long *pgp)
-{
- Dl_info info;
- Elf_Dyn *dyn;
- Elf_Ehdr *ehdr;
- Elf_Phdr *phdr;
- char *p, *p_top;
- struct ia64_unwind_entry *unw, *res;
- register unsigned long gp __asm__("gp"); /* XXX assumes gcc */
- unsigned long reloc, vaddr;
- size_t l, m, r;
-
- if (!dladdr(pc, &info))
- return NULL;
-
- ehdr = (Elf_Ehdr*)info.dli_fbase;
-
-#if SANITY
- assert(IS_ELF(*ehdr));
- assert(ehdr->e_ident[EI_CLASS] == ELFCLASS64);
- assert(ehdr->e_ident[EI_DATA] == ELFDATA2LSB);
- assert(ehdr->e_machine == EM_IA_64);
-#endif
-
- reloc = (ehdr->e_type == ET_DYN) ? (uintptr_t)info.dli_fbase : 0;
- *pgp = gp;
- *pseg = 0UL;
- res = NULL;
-
- p = (char*)info.dli_fbase + ehdr->e_phoff;
- p_top = p + ehdr->e_phnum * ehdr->e_phentsize;
- while (p < p_top) {
- phdr = (Elf_Phdr*)p;
- vaddr = phdr->p_vaddr + reloc;
-
- switch (phdr->p_type) {
- case PT_DYNAMIC:
- dyn = (Elf_Dyn*)vaddr;
- while (dyn->d_tag != DT_NULL) {
- if (dyn->d_tag == DT_PLTGOT) {
- *pgp = dyn->d_un.d_ptr + reloc;
- break;
- }
- dyn++;
- }
- break;
- case PT_LOAD:
- if (pc >= (void*)vaddr &&
- pc < (void*)(vaddr + phdr->p_memsz))
- *pseg = vaddr;
- break;
- case PT_IA_64_UNWIND:
-#if SANITY
- assert(*pseg != 0UL);
- assert(res == NULL);
-#endif
- unw = (struct ia64_unwind_entry*)vaddr;
- l = 0;
- r = phdr->p_memsz / sizeof(struct ia64_unwind_entry);
- while (l < r) {
- m = (l + r) >> 1;
- res = unw + m;
- if (pc < (void*)(res->start + *pseg))
- r = m;
- else if (pc >= (void*)(res->end + *pseg))
- l = m + 1;
- else
- break; /* found */
- }
- if (l >= r)
- res = NULL;
- break;
- }
-
- p += ehdr->e_phentsize;
- }
-
- return res;
-}
diff --git a/lib/libc/ia64/string/Makefile.inc b/lib/libc/ia64/string/Makefile.inc
deleted file mode 100644
index 7bbcc8de10e9..000000000000
--- a/lib/libc/ia64/string/Makefile.inc
+++ /dev/null
@@ -1,3 +0,0 @@
-# $FreeBSD$
-
-MDSRCS+= bcopy.S bzero.S ffs.S memcpy.S memmove.S
diff --git a/lib/libc/ia64/string/bcopy.S b/lib/libc/ia64/string/bcopy.S
deleted file mode 100644
index 34aac1984cf4..000000000000
--- a/lib/libc/ia64/string/bcopy.S
+++ /dev/null
@@ -1,95 +0,0 @@
-/*-
- * Copyright (c) 2000 Doug Rabson
- * 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * Not the fastest bcopy in the world.
- */
-ENTRY(bcopy, 3)
-
- cmp.le p6,p0=in2,r0 // bail if len <= 0
-(p6) br.ret.spnt.few rp
-
- sub r14=in1,in0 ;; // check for overlap
- cmp.ltu p6,p0=r14,in2 // dst-src < len
-(p6) br.cond.spnt.few 5f
-
- extr.u r14=in0,0,3 // src & 7
- extr.u r15=in1,0,3 ;; // dst & 7
- cmp.eq p6,p0=r14,r15 // different alignment?
-(p6) br.cond.spnt.few 2f // branch if same alignment
-
-1: ld1 r14=[in0],1 ;; // copy bytewise
- st1 [in1]=r14,1
- add in2=-1,in2 ;; // len--
- cmp.ne p6,p0=r0,in2
-(p6) br.cond.dptk.few 1b // loop
- br.ret.sptk.few rp // done
-
-2: cmp.eq p6,p0=r14,r0 // aligned?
-(p6) br.cond.sptk.few 4f
-
-3: ld1 r14=[in0],1 ;; // copy bytewise
- st1 [in1]=r14,1
- extr.u r15=in0,0,3 // src & 7
- add in2=-1,in2 ;; // len--
- cmp.eq p6,p0=r0,in2 // done?
- cmp.eq p7,p0=r0,r15 ;; // aligned now?
-(p6) br.ret.spnt.few rp // return if done
-(p7) br.cond.spnt.few 4f // go to main copy
- br.cond.sptk.few 3b // more bytes to copy
-
- // At this point, in2 is non-zero
-
-4: mov r14=8 ;;
- cmp.ltu p6,p0=in2,r14 ;; // len < 8?
-(p6) br.cond.spnt.few 1b // byte copy the end
- ld8 r15=[in0],8 ;; // copy word
- st8 [in1]=r15,8
- add in2=-8,in2 ;; // len -= 8
- cmp.ne p6,p0=r0,in2 // done?
-(p6) br.cond.spnt.few 4b // again
-
- br.ret.sptk.few rp // return
-
- // Don't bother optimising overlap case
-
-5: add in0=in0,in2
- add in1=in1,in2 ;;
- add in0=-1,in0
- add in1=-1,in1 ;;
-
-6: ld1 r14=[in0],-1 ;;
- st1 [in1]=r14,-1
- add in2=-1,in2 ;;
- cmp.ne p6,p0=r0,in2
-(p6) br.cond.spnt.few 6b
-
- br.ret.sptk.few rp
-
-END(bcopy)
diff --git a/lib/libc/ia64/string/bzero.S b/lib/libc/ia64/string/bzero.S
deleted file mode 100644
index 0963c36aac80..000000000000
--- a/lib/libc/ia64/string/bzero.S
+++ /dev/null
@@ -1,81 +0,0 @@
-/*-
- * Copyright (c) 2000 Doug Rabson
- * 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-ENTRY(bzero, 2)
-
- cmp.le p6,p0=in1,r0 // bail if len <= 0
-(p6) br.ret.spnt.few rp
- ;;
- mov r14=ar.lc // save ar.lc
-
- cmp.ltu p6,p0=17,in1 // check for small
-(p6) br.dptk.few 3f
-
-1: add r15=-1,in1 ;;
- mov ar.lc=r15 ;;
-2: st1 [in0]=r0,1 // zero one byte
- br.cloop.sptk.few 2b // loop
-
- ;;
- mov ar.lc=r14 // done
- br.ret.sptk.few rp
-
- // Zero up to 8byte alignment
-
-3: tbit.nz p6,p0=in0,0 ;;
-(p6) st1 [in0]=r0,1
-(p6) add in1=-1,in1 ;;
-
- tbit.nz p6,p0=in0,1 ;;
-(p6) st2 [in0]=r0,2
-(p6) add in1=-2,in1 ;;
-
- tbit.nz p6,p0=in0,2 ;;
-(p6) st4 [in0]=r0,4
-(p6) add in1=-4,in1
-
- ;;
- shr.u r15=in1,3 // word count
- extr.u in1=in1,0,3 ;; // trailing bytes
- cmp.eq p6,p0=r15,r0 // check for zero
- cmp.ne p7,p0=in1,r0
-(p6) br.dpnt.few 1b // zero last bytes
-
- add r15=-1,r15 ;;
- mov ar.lc=r15 ;;
-4: st8 [in0]=r0,8
- br.cloop.sptk.few 4b
-
-(p7) br.dpnt.few 1b // zero last bytes
-
- ;;
- mov ar.lc=r14 // done
- br.ret.sptk.few rp
-
-END(bzero)
diff --git a/lib/libc/ia64/string/ffs.S b/lib/libc/ia64/string/ffs.S
deleted file mode 100644
index d99d76581341..000000000000
--- a/lib/libc/ia64/string/ffs.S
+++ /dev/null
@@ -1,99 +0,0 @@
-/* $NetBSD: ffs.S,v 1.3 1996/10/17 03:08:13 cgd Exp $ */
-
-/*
- * Copyright (c) 1995 Christopher G. Demetriou
- * 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 Christopher G. Demetriou
- * for the NetBSD Project.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-ENTRY(ffs, 1)
- sxt4 r14=in0 ;;
- cmp.eq p6,p0=r14,r0
-(p6) br.dpnt.few Lallzero
-
- /*
- * Initialize return value (ret0), and set up r15 so that it
- * contains the mask with only the lowest bit set.
- */
- sub r15=r0,r14
- mov ret0=1 ;;
- and r15=r14,r15 ;;
-
- extr.u r16=r15,0,8 ;;
- cmp.ne p6,p0=r0,r16
-(p6) br.dptk.few Ldo8
-
- /*
- * If lower 16 bits empty, add 16 to result and use upper 16.
- */
- extr.u r16=r15,0,16 ;;
- cmp.ne p6,p0=r0,r16
-(p6) br.dptk.few Ldo16
- extr.u r15=r15,16,16
- add ret0=16,ret0 ;;
-
-Ldo16:
- /*
- * If lower 8 bits empty, add 8 to result and use upper 8.
- */
- extr.u r16=r15,0,8 ;;
- cmp.ne p6,p0=r0,r16
-(p6) br.dptk.few Ldo8
- extr.u r15=r15,8,24
- add ret0=8,ret0 ;;
-
-Ldo8:
- and r16=0x0f,r15 /* lower 4 of 8 empty? */
- and r17=0x33,r15 /* lower 2 of each 4 empty? */
- and r18=0x55,r15 ;; /* lower 1 of each 2 empty? */
- cmp.ne p6,p0=r16,r0
- cmp.ne p7,p0=r17,r0
- cmp.ne p8,p0=r18,r0
-
- /* If lower 4 bits empty, add 4 to result. */
-(p6) br.dptk.few Ldo4
- add ret0=4,ret0 ;;
-
-Ldo4: /* If lower 2 bits of each 4 empty, add 2 to result. */
-(p7) br.dptk.few Ldo2
- add ret0=2,ret0 ;;
-
-Ldo2: /* If lower bit of each 2 empty, add 1 to result. */
-(p8) br.dptk.few Ldone
- add ret0=1,ret0
-
-Ldone:
- br.ret.sptk.few rp
-
-Lallzero:
- mov ret0=0
- br.ret.sptk.few rp
-END(ffs)
diff --git a/lib/libc/ia64/string/memcpy.S b/lib/libc/ia64/string/memcpy.S
deleted file mode 100644
index d7557c1f039f..000000000000
--- a/lib/libc/ia64/string/memcpy.S
+++ /dev/null
@@ -1,36 +0,0 @@
-/*-
- * Copyright (c) 2000 Doug Rabson
- * 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-ENTRY(memcpy,3)
- mov r8 = in0
- mov in0 = in1
- ;;
- mov in1 = r8
- br.sptk.few bcopy
-END(memcpy)
diff --git a/lib/libc/ia64/string/memmove.S b/lib/libc/ia64/string/memmove.S
deleted file mode 100644
index 19fa8affc399..000000000000
--- a/lib/libc/ia64/string/memmove.S
+++ /dev/null
@@ -1,36 +0,0 @@
-/*-
- * Copyright (c) 2000 Doug Rabson
- * 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-ENTRY(memmove,3)
- mov r8 = in0
- mov in0 = in1
- ;;
- mov in1 = r8
- br.sptk.few bcopy
-END(memmove)
diff --git a/lib/libc/ia64/sys/Makefile.inc b/lib/libc/ia64/sys/Makefile.inc
deleted file mode 100644
index b3bacd4cd65e..000000000000
--- a/lib/libc/ia64/sys/Makefile.inc
+++ /dev/null
@@ -1,14 +0,0 @@
-# $FreeBSD$
-
-SRCS+= __vdso_gettc.c
-
-MDASM+= Ovfork.S brk.S cerror.S exect.S fork.S getcontext.S pipe.S ptrace.S \
- sbrk.S setlogin.S sigreturn.S swapcontext.S
-
-# Don't generate default code for these syscalls:
-NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o
-
-PSEUDO= _getlogin.o _exit.o
-.if ${MK_SYSCALL_COMPAT} != "no"
-PSEUDO+= _pread.o _pwrite.o _lseek.o _mmap.o _ftruncate.o _truncate.o
-.endif
diff --git a/lib/libc/ia64/sys/Ovfork.S b/lib/libc/ia64/sys/Ovfork.S
deleted file mode 100644
index 6eb69583f7e9..000000000000
--- a/lib/libc/ia64/sys/Ovfork.S
+++ /dev/null
@@ -1,37 +0,0 @@
-/*-
- * Copyright (c) 2000 Doug Rabson
- * 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#include "SYS.h"
-
-SYSCALL(vfork)
- cmp.ne p7,p0=ret1,r0 /* ret1!=0 for child */
- ;;
-(p7) mov ret0=r0
- br.ret.sptk.few rp
-END(__sys_vfork)
diff --git a/lib/libc/ia64/sys/__vdso_gettc.c b/lib/libc/ia64/sys/__vdso_gettc.c
deleted file mode 100644
index b99bbc4f3d0f..000000000000
--- a/lib/libc/ia64/sys/__vdso_gettc.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * Copyright (c) 2013 Konstantin Belousov <kib@FreeBSD.org>
- *
- * 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/vdso.h>
-#include <errno.h>
-
-#pragma weak __vdso_gettc
-u_int
-__vdso_gettc(const struct vdso_timehands *th)
-{
-
- return (0);
-}
-
-#pragma weak __vdso_gettimekeep
-int
-__vdso_gettimekeep(struct vdso_timekeep **tk)
-{
-
- return (ENOSYS);
-}
diff --git a/lib/libc/ia64/sys/brk.S b/lib/libc/ia64/sys/brk.S
deleted file mode 100644
index fee1728bc0da..000000000000
--- a/lib/libc/ia64/sys/brk.S
+++ /dev/null
@@ -1,57 +0,0 @@
-/* $NetBSD: brk.S,v 1.4 1996/10/17 03:08:15 cgd Exp $ */
-
-/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Author: Chris G. Demetriou
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#include "SYS.h"
-
- .globl _end
-IMPORT(curbrk, 8)
-
- .data
-EXPORT(minbrk)
- .quad _end
-
- .text
-ENTRY(brk, 1)
- add r14=@ltoff(minbrk),gp ;;
- ld8 r14=[r14] ;;
- ld8 r14=[r14] ;;
- cmp.ltu p6,p0=r32,r14 ;;
-(p6) mov r32=r14 ;;
- st8 [sp]=r32
- CALLSYS_ERROR(break)
- ld8 r15=[sp]
- add r14=@ltoff(curbrk),gp ;;
- ld8 r14=[r14] ;;
- st8 [r14]=r15
- mov ret0=0
- br.ret.sptk.few rp
-END(brk)
diff --git a/lib/libc/ia64/sys/cerror.S b/lib/libc/ia64/sys/cerror.S
deleted file mode 100644
index ca0b0c735b1b..000000000000
--- a/lib/libc/ia64/sys/cerror.S
+++ /dev/null
@@ -1,46 +0,0 @@
-/*-
- * Copyright (c) 2000 Doug Rabson
- * 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-
-ENTRY(.cerror, 0)
- alloc loc0=ar.pfs,0,3,1,0
- ;;
- mov loc1=rp
- mov loc2=ret0
- mov out0=ret0
- ;;
- br.call.sptk.few rp=__error
- st4 [ret0]=loc2
- ;;
- mov ret0=-1
- mov ar.pfs=loc0
- mov rp=loc1
- ;;
- br.ret.sptk.few rp
-END(.cerror)
diff --git a/lib/libc/ia64/sys/exect.S b/lib/libc/ia64/sys/exect.S
deleted file mode 100644
index 817d3b1b3848..000000000000
--- a/lib/libc/ia64/sys/exect.S
+++ /dev/null
@@ -1,38 +0,0 @@
-/* $NetBSD: exect.S,v 1.2 1996/10/17 03:08:18 cgd Exp $ */
-
-/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Author: Chris G. Demetriou
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#include "SYS.h"
-
-ENTRY(exect, 3)
- CALLSYS_ERROR(execve)
- br.ret.sptk.few rp
-END(exect)
diff --git a/lib/libc/ia64/sys/fork.S b/lib/libc/ia64/sys/fork.S
deleted file mode 100644
index 5b09f7711820..000000000000
--- a/lib/libc/ia64/sys/fork.S
+++ /dev/null
@@ -1,37 +0,0 @@
-/*-
- * Copyright (c) 2000 Doug Rabson
- * 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#include "SYS.h"
-
-SYSCALL(fork)
- cmp.ne p7,p0=ret1,r0 /* ret1!=0 for child */
- ;;
-(p7) mov ret0=r0
- br.ret.sptk.few rp
-END(__sys_fork)
diff --git a/lib/libc/ia64/sys/getcontext.S b/lib/libc/ia64/sys/getcontext.S
deleted file mode 100644
index 0ec6f92e4f85..000000000000
--- a/lib/libc/ia64/sys/getcontext.S
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2003 Marcel Moolenaar
- * 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#include "SYS.h"
-
-ENTRY(__sys_getcontext,2)
- WEAK_ALIAS(getcontext, __sys_getcontext)
- WEAK_ALIAS(_getcontext, __sys_getcontext)
- flushrs
- ;;
- CALLSYS_ERROR(getcontext)
- br.ret.sptk.few rp
-END(__sys_getcontext)
diff --git a/lib/libc/ia64/sys/pipe.S b/lib/libc/ia64/sys/pipe.S
deleted file mode 100644
index a6413dfd464b..000000000000
--- a/lib/libc/ia64/sys/pipe.S
+++ /dev/null
@@ -1,47 +0,0 @@
-/* $NetBSD: pipe.S,v 1.1 1995/02/10 17:50:35 cgd Exp $ */
-
-/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Author: Chris G. Demetriou
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#include "SYS.h"
-
-ENTRY(__sys_pipe, 1)
- WEAK_ALIAS(pipe, __sys_pipe)
- WEAK_ALIAS(_pipe, __sys_pipe)
- st8 [sp]=r32
- CALLSYS_ERROR(pipe)
- ld8 r14=[sp]
- ;;
- st4 [r14]=ret0,4
- ;;
- st4 [r14]=ret1
- mov ret0=0
- br.ret.sptk.few rp
-END(__sys_pipe)
diff --git a/lib/libc/ia64/sys/ptrace.S b/lib/libc/ia64/sys/ptrace.S
deleted file mode 100644
index b6d3abdedda9..000000000000
--- a/lib/libc/ia64/sys/ptrace.S
+++ /dev/null
@@ -1,41 +0,0 @@
-/* $NetBSD: ptrace.S,v 1.4 1996/11/08 00:51:24 cgd Exp $ */
-
-/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Author: Chris G. Demetriou
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#include "SYS.h"
-
-ENTRY(ptrace, 4)
- add r14=@ltoff(errno),gp ;;
- ld8 r14=[r14] ;;
- st4 [r14]=r0
- CALLSYS_ERROR(ptrace)
- br.ret.sptk.few rp
-END(ptrace)
diff --git a/lib/libc/ia64/sys/sbrk.S b/lib/libc/ia64/sys/sbrk.S
deleted file mode 100644
index 98b5ce92c21f..000000000000
--- a/lib/libc/ia64/sys/sbrk.S
+++ /dev/null
@@ -1,63 +0,0 @@
-/* $NetBSD: sbrk.S,v 1.4 1996/10/17 03:08:20 cgd Exp $ */
-
-/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Author: Chris G. Demetriou
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#include "SYS.h"
-
- .globl _end
-
- .data
-EXPORT(curbrk)
- .quad _end
-
- .text
-ENTRY(sbrk, 1)
- add r14 = @ltoff(curbrk), gp
- ;;
- ld8 r14 = [r14]
- cmp.eq p6, p0 = r32, r0
- ;;
- ld8 ret0 = [r14]
-(p6) br.ret.sptk.few rp
- ;;
- add r32 = ret0, r32
- ;;
- st8 [sp] = r32
- CALLSYS_ERROR(break)
- ld8 r15 = [sp]
- add r14 = @ltoff(curbrk), gp
- ;;
- ld8 r14 = [r14]
- ;;
- ld8 ret0 = [r14]
- st8 [r14] = r15
- br.ret.sptk.few rp
-END(sbrk)
diff --git a/lib/libc/ia64/sys/setlogin.S b/lib/libc/ia64/sys/setlogin.S
deleted file mode 100644
index 1d29a40664a3..000000000000
--- a/lib/libc/ia64/sys/setlogin.S
+++ /dev/null
@@ -1,42 +0,0 @@
-/* $NetBSD: setlogin.S,v 1.1 1995/02/10 17:50:39 cgd Exp $ */
-
-/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Author: Chris G. Demetriou
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#include "SYS.h"
-
-IMPORT(_logname_valid, 4) /* in getlogin() */
-
-SYSCALL(setlogin)
- add r14=@ltoff(_logname_valid),gp ;;
- ld8 r14=[r14] ;;
- st4 [r14]=r0 /* clear it */
- br.ret.sptk.few rp
-END(__sys_setlogin)
diff --git a/lib/libc/ia64/sys/sigreturn.S b/lib/libc/ia64/sys/sigreturn.S
deleted file mode 100644
index 2c7a710a1461..000000000000
--- a/lib/libc/ia64/sys/sigreturn.S
+++ /dev/null
@@ -1,41 +0,0 @@
-/* $NetBSD: sigreturn.S,v 1.1 1995/02/10 17:50:42 cgd Exp $ */
-
-/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Author: Chris G. Demetriou
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#include "SYS.h"
-
-/*
- * We must preserve the state of the registers as the user has set them up.
- * However, that doesn't involve any special work on the ia64.
- * (XXX PROFILING)
- */
-
-RSYSCALL(sigreturn)
diff --git a/lib/libc/ia64/sys/swapcontext.S b/lib/libc/ia64/sys/swapcontext.S
deleted file mode 100644
index 210189f6ff4f..000000000000
--- a/lib/libc/ia64/sys/swapcontext.S
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2003 Marcel Moolenaar
- * 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#include "SYS.h"
-
-ENTRY(__sys_swapcontext,2)
- WEAK_ALIAS(swapcontext, __sys_swapcontext)
- WEAK_ALIAS(_swapcontext, __sys_swapcontext)
- flushrs
- ;;
- CALLSYS_ERROR(swapcontext)
- br.ret.sptk.few rp
-END(__sys_swapcontext)
diff --git a/lib/libc/iconv/__iconv_get_list.3 b/lib/libc/iconv/__iconv_get_list.3
index 4db88d8faa61..076f4d5b6a1d 100644
--- a/lib/libc/iconv/__iconv_get_list.3
+++ b/lib/libc/iconv/__iconv_get_list.3
@@ -92,4 +92,4 @@ The iconv implementation of the Citrus Project was adopted in
.Fx 9.0 .
.Sh AUTHORS
This manual page was written by
-.An Gabor Kovesdan Aq gabor@FreeBSD.org .
+.An Gabor Kovesdan Aq Mt gabor@FreeBSD.org .
diff --git a/lib/libc/iconv/bsd_iconv.c b/lib/libc/iconv/bsd_iconv.c
index 40a1a4e88909..f764886d7851 100644
--- a/lib/libc/iconv/bsd_iconv.c
+++ b/lib/libc/iconv/bsd_iconv.c
@@ -83,6 +83,7 @@ __bsd___iconv_open(const char *out, const char *in, struct _citrus_iconv *handle
}
handle->cv_shared->ci_discard_ilseq = strcasestr(out, "//IGNORE");
+ handle->cv_shared->ci_ilseq_invalid = false;
handle->cv_shared->ci_hooks = NULL;
return ((iconv_t)(void *)handle);
@@ -223,7 +224,7 @@ __bsd_iconvlist(int (*do_one) (unsigned int, const char * const *,
return;
}
strlcpy(curkey, list[i], slashpos - list[i] + 1);
- names[j++] = strdup(curkey);
+ names[j++] = curkey;
for (; (i < sz) && (memcmp(curkey, list[i], strlen(curkey)) == 0); i++) {
slashpos = strchr(list[i], '/');
curitem = (char *)malloc(strlen(slashpos) + 1);
@@ -235,7 +236,7 @@ __bsd_iconvlist(int (*do_one) (unsigned int, const char * const *,
if (strcmp(curkey, curitem) == 0) {
continue;
}
- names[j++] = strdup(curitem);
+ names[j++] = curitem;
}
np = (const char * const *)names;
do_one(j, np, data);
diff --git a/lib/libc/iconv/citrus_db_factory.c b/lib/libc/iconv/citrus_db_factory.c
index e9823ab04393..691fe4e84351 100644
--- a/lib/libc/iconv/citrus_db_factory.c
+++ b/lib/libc/iconv/citrus_db_factory.c
@@ -270,11 +270,9 @@ _citrus_db_factory_serialize(struct _citrus_db_factory *df, const char *magic,
return (0);
}
/* allocate hash table */
- depp = malloc(sizeof(*depp) * df->df_num_entries);
+ depp = calloc(df->df_num_entries, sizeof(*depp));
if (depp == NULL)
return (-1);
- for (i = 0; i < df->df_num_entries; i++)
- depp[i] = NULL;
/* step1: store the entries which are not conflicting */
STAILQ_FOREACH(de, &df->df_entries, de_entry) {
diff --git a/lib/libc/iconv/citrus_iconv.c b/lib/libc/iconv/citrus_iconv.c
index df2ed73ffc7f..5c8bf4923668 100644
--- a/lib/libc/iconv/citrus_iconv.c
+++ b/lib/libc/iconv/citrus_iconv.c
@@ -344,9 +344,8 @@ const char
{
char *buf;
- if ((buf = malloc((size_t)PATH_MAX)) == NULL)
+ if ((buf = calloc((size_t)PATH_MAX, sizeof(*buf))) == NULL)
return (NULL);
- memset((void *)buf, 0, (size_t)PATH_MAX);
_citrus_esdb_alias(name, buf, (size_t)PATH_MAX);
return (buf);
}
diff --git a/lib/libc/iconv/iconv_canonicalize.3 b/lib/libc/iconv/iconv_canonicalize.3
index a5d3e7716623..d98235aabbfd 100644
--- a/lib/libc/iconv/iconv_canonicalize.3
+++ b/lib/libc/iconv/iconv_canonicalize.3
@@ -71,4 +71,4 @@ the GNU implementation and was adopted in
for compatibility's sake.
.Sh AUTHORS
This manual page was written by
-.An Gabor Kovesdan Aq gabor@FreeBSD.org .
+.An Gabor Kovesdan Aq Mt gabor@FreeBSD.org .
diff --git a/lib/libc/iconv/iconvctl.3 b/lib/libc/iconv/iconvctl.3
index 5728ad3ee5e8..d6bc67f9b98d 100644
--- a/lib/libc/iconv/iconvctl.3
+++ b/lib/libc/iconv/iconvctl.3
@@ -179,7 +179,7 @@ the GNU implementation and was adopted in
for compatibility's sake.
.Sh AUTHORS
This manual page was written by
-.An Gabor Kovesdan Aq gabor@FreeBSD.org .
+.An Gabor Kovesdan Aq Mt gabor@FreeBSD.org .
.Sh BUGS
Transliteration is enabled in this implementation by default, so it
is impossible by design to turn it off.
diff --git a/lib/libc/iconv/iconvlist.3 b/lib/libc/iconv/iconvlist.3
index ff9ea6b3f0f3..bef609b31362 100644
--- a/lib/libc/iconv/iconvlist.3
+++ b/lib/libc/iconv/iconvlist.3
@@ -90,4 +90,4 @@ the GNU implementation and was adopted in
for compatibility's sake.
.Sh AUTHORS
This manual page was written by
-.An Gabor Kovesdan Aq gabor@FreeBSD.org .
+.An Gabor Kovesdan Aq Mt gabor@FreeBSD.org .
diff --git a/lib/libc/locale/utf8.c b/lib/libc/locale/utf8.c
index cffa241133a5..ce49279cb2d7 100644
--- a/lib/libc/locale/utf8.c
+++ b/lib/libc/locale/utf8.c
@@ -1,4 +1,5 @@
/*-
+ * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2002-2004 Tim J. Robbins
* All rights reserved.
*
@@ -112,13 +113,6 @@ _UTF8_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
/* Incomplete multibyte sequence */
return ((size_t)-2);
- if (us->want == 0 && ((ch = (unsigned char)*s) & ~0x7f) == 0) {
- /* Fast path for plain ASCII characters. */
- if (pwc != NULL)
- *pwc = ch;
- return (ch != '\0' ? 1 : 0);
- }
-
if (us->want == 0) {
/*
* Determine the number of octets that make up this character
@@ -134,10 +128,12 @@ _UTF8_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
*/
ch = (unsigned char)*s;
if ((ch & 0x80) == 0) {
- mask = 0x7f;
- want = 1;
- lbound = 0;
- } else if ((ch & 0xe0) == 0xc0) {
+ /* Fast path for plain ASCII characters. */
+ if (pwc != NULL)
+ *pwc = ch;
+ return (ch != '\0' ? 1 : 0);
+ }
+ if ((ch & 0xe0) == 0xc0) {
mask = 0x1f;
want = 2;
lbound = 0x80;
@@ -316,12 +312,6 @@ _UTF8_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
/* Reset to initial shift state (no-op) */
return (1);
- if ((wc & ~0x7f) == 0) {
- /* Fast path for plain ASCII characters. */
- *s = (char)wc;
- return (1);
- }
-
/*
* Determine the number of octets needed to represent this character.
* We always output the shortest sequence possible. Also specify the
@@ -329,8 +319,9 @@ _UTF8_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
* about the sequence length.
*/
if ((wc & ~0x7f) == 0) {
- lead = 0;
- len = 1;
+ /* Fast path for plain ASCII characters. */
+ *s = (char)wc;
+ return (1);
} else if ((wc & ~0x7ff) == 0) {
lead = 0xc0;
len = 2;
diff --git a/lib/libc/mips/arith.h b/lib/libc/mips/arith.h
index 02d6d2e80a95..61f3930f4a89 100644
--- a/lib/libc/mips/arith.h
+++ b/lib/libc/mips/arith.h
@@ -18,9 +18,6 @@
#define Double_Align
#else
/* TODO: Generate these values on a LE machine */
-/* Current values were stolen from ia64 except the
- * Xpointer define.
- */
#define IEEE_8087
#define Arith_Kind_ASL 1
#define Long int
diff --git a/lib/libc/net/Makefile.inc b/lib/libc/net/Makefile.inc
index 59cbdea47697..c6307afc1d53 100644
--- a/lib/libc/net/Makefile.inc
+++ b/lib/libc/net/Makefile.inc
@@ -34,11 +34,13 @@ CFLAGS+=-I${LIBC_SRCTOP}/resolv
YFLAGS+=-p_nsyy
LFLAGS+=-P_nsyy
-CLEANFILES+=nslexer.c
+CLEANFILES+=nslexer.c nslexer.c.*
nslexer.c: nslexer.l nsparser.h
- ${LEX} ${LFLAGS} -o/dev/stdout ${.IMPSRC} | \
- sed -e '/YY_BUF_SIZE/s/16384/1024/' >${.TARGET}
+ ${LEX} ${LFLAGS} -o${.TARGET}.tmp1 ${.IMPSRC}
+ sed -e '/YY_BUF_SIZE/s/16384/1024/' ${.TARGET}.tmp1 >${.TARGET}.tmp2
+ rm -f ${.TARGET}.tmp1
+ mv -f ${.TARGET}.tmp2 ${.TARGET}
MAN+= byteorder.3 ethers.3 eui64.3 \
getaddrinfo.3 gai_strerror.3 gethostbyname.3 \
diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c
index 00ab7963ff7d..b4c1a33ddff4 100644
--- a/lib/libc/net/getaddrinfo.c
+++ b/lib/libc/net/getaddrinfo.c
@@ -62,12 +62,15 @@ __FBSDID("$FreeBSD$");
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/in.h>
+#include <net/if_types.h>
+#include <ifaddrs.h>
#include <sys/queue.h>
#ifdef INET6
#include <net/if_var.h>
#include <sys/sysctl.h>
#include <sys/ioctl.h>
-#include <netinet6/in6_var.h> /* XXX */
+#include <netinet6/in6_var.h>
+#include <netinet6/nd6.h>
#endif
#include <arpa/inet.h>
#include <arpa/nameser.h>
@@ -245,6 +248,9 @@ static int get_portmatch(const struct addrinfo *, const char *);
static int get_port(struct addrinfo *, const char *, int);
static const struct afd *find_afd(int);
static int addrconfig(struct addrinfo *);
+#ifdef INET6
+static int is_ifdisabled(char *);
+#endif
static void set_source(struct ai_order *, struct policyhead *);
static int comp_dst(const void *, const void *);
#ifdef INET6
@@ -1003,7 +1009,8 @@ comp_dst(const void *arg1, const void *arg2)
* We compare the match length in a same AF only.
*/
if (dst1->aio_ai->ai_addr->sa_family ==
- dst2->aio_ai->ai_addr->sa_family) {
+ dst2->aio_ai->ai_addr->sa_family &&
+ dst1->aio_ai->ai_addr->sa_family != AF_INET) {
if (dst1->aio_matchlen > dst2->aio_matchlen) {
return(-1);
}
@@ -1525,10 +1532,11 @@ find_afd(int af)
}
/*
- * post-2553: AI_ADDRCONFIG check. if we use getipnodeby* as backend, backend
- * will take care of it.
- * the semantics of AI_ADDRCONFIG is not defined well. we are not sure
- * if the code is right or not.
+ * RFC 3493: AI_ADDRCONFIG check. Determines which address families are
+ * configured on the local system and correlates with pai->ai_family value.
+ * If an address family is not configured on the system, it will not be
+ * queried for. For this purpose, loopback addresses are not considered
+ * configured addresses.
*
* XXX PF_UNSPEC -> PF_INET6 + PF_INET mapping needs to be in sync with
* _dns_getaddrinfo.
@@ -1536,38 +1544,80 @@ find_afd(int af)
static int
addrconfig(struct addrinfo *pai)
{
- int s, af;
+ struct ifaddrs *ifaddrs, *ifa;
+ struct sockaddr_in *sin;
+#ifdef INET6
+ struct sockaddr_in6 *sin6;
+#endif
+ int seen_inet = 0, seen_inet6 = 0;
- /*
- * TODO:
- * Note that implementation dependent test for address
- * configuration should be done everytime called
- * (or apropriate interval),
- * because addresses will be dynamically assigned or deleted.
- */
- af = pai->ai_family;
- if (af == AF_UNSPEC) {
- if ((s = _socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0)) < 0)
- af = AF_INET;
- else {
- _close(s);
- if ((s = _socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC,
- 0)) < 0)
- af = AF_INET6;
- else
- _close(s);
+ if (getifaddrs(&ifaddrs) != 0)
+ return (0);
+
+ for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) {
+ if (ifa->ifa_addr == NULL || (ifa->ifa_flags & IFF_UP) == 0)
+ continue;
+ switch (ifa->ifa_addr->sa_family) {
+ case AF_INET:
+ if (seen_inet)
+ continue;
+ sin = (struct sockaddr_in *)(ifa->ifa_addr);
+ if (IN_LOOPBACK(htonl(sin->sin_addr.s_addr)))
+ continue;
+ seen_inet = 1;
+ break;
+#ifdef INET6
+ case AF_INET6:
+ if (seen_inet6)
+ continue;
+ sin6 = (struct sockaddr_in6 *)(ifa->ifa_addr);
+ if (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr))
+ continue;
+ if ((ifa->ifa_flags & IFT_LOOP) != 0 &&
+ IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr))
+ continue;
+ if (is_ifdisabled(ifa->ifa_name))
+ continue;
+ seen_inet6 = 1;
+ break;
+#endif
}
}
- if (af != AF_UNSPEC) {
- if ((s = _socket(af, SOCK_DGRAM | SOCK_CLOEXEC, 0)) < 0)
- return 0;
- _close(s);
+ freeifaddrs(ifaddrs);
+
+ switch(pai->ai_family) {
+ case AF_INET6:
+ return (seen_inet6);
+ case AF_INET:
+ return (seen_inet);
+ case AF_UNSPEC:
+ if (seen_inet == seen_inet6)
+ return (seen_inet);
+ pai->ai_family = seen_inet ? AF_INET : AF_INET6;
+ return (1);
}
- pai->ai_family = af;
- return 1;
+ return (1);
}
#ifdef INET6
+static int
+is_ifdisabled(char *name)
+{
+ struct in6_ndireq nd;
+ int fd;
+
+ if ((fd = _socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0)) < 0)
+ return (-1);
+ memset(&nd, 0, sizeof(nd));
+ strlcpy(nd.ifname, name, sizeof(nd.ifname));
+ if (_ioctl(fd, SIOCGIFINFO_IN6, &nd) < 0) {
+ _close(fd);
+ return (-1);
+ }
+ _close(fd);
+ return ((nd.ndi.flags & ND6_IFF_IFDISABLED) != 0);
+}
+
/* convert a string to a scope identifier. XXX: IPv6 specific */
static int
ip6_str2scopeid(char *scope, struct sockaddr_in6 *sin6, u_int32_t *scopeid)
diff --git a/lib/libc/net/nsdispatch.3 b/lib/libc/net/nsdispatch.3
index 577bce98e451..e08e9bef7cae 100644
--- a/lib/libc/net/nsdispatch.3
+++ b/lib/libc/net/nsdispatch.3
@@ -239,8 +239,7 @@ where it appeared first in
Support for NSS modules first appeared in
.Fx 5.1 .
.Sh AUTHORS
-Luke Mewburn
-.Aq lukem@netbsd.org
+.An Luke Mewburn Aq Mt lukem@netbsd.org
wrote this freely-distributable name-service switch implementation,
using ideas from the
.Tn ULTRIX
diff --git a/lib/libc/net/sourcefilter.3 b/lib/libc/net/sourcefilter.3
index 225b0209bd95..a123ff38d68e 100644
--- a/lib/libc/net/sourcefilter.3
+++ b/lib/libc/net/sourcefilter.3
@@ -236,5 +236,4 @@ The
functions first appeared in
.Fx 7.0 .
.Sh AUTHORS
-Bruce M. Simpson
-.Aq bms@FreeBSD.org
+.An Bruce M. Simpson Aq Mt bms@FreeBSD.org
diff --git a/lib/libc/net/sourcefilter.c b/lib/libc/net/sourcefilter.c
index 4d29d9f36e0b..cb64701e6f9e 100644
--- a/lib/libc/net/sourcefilter.c
+++ b/lib/libc/net/sourcefilter.c
@@ -337,7 +337,8 @@ getsourcefilter(int s, uint32_t interface, struct sockaddr *group,
{
struct __msfilterreq msfr;
sockunion_t *psu;
- int err, level, nsrcs, optlen, optname;
+ socklen_t optlen;
+ int err, level, nsrcs, optname;
if (interface == 0 || group == NULL || numsrc == NULL ||
fmode == NULL) {
diff --git a/lib/libc/posix1e/acl_add_flag_np.3 b/lib/libc/posix1e/acl_add_flag_np.3
index 057de0393ca1..9f7b21e09379 100644
--- a/lib/libc/posix1e/acl_add_flag_np.3
+++ b/lib/libc/posix1e/acl_add_flag_np.3
@@ -94,4 +94,4 @@ function was added in
The
.Fn acl_add_flag_np
function was written by
-.An Edward Tomasz Napierala Aq trasz@FreeBSD.org .
+.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org .
diff --git a/lib/libc/posix1e/acl_add_perm.3 b/lib/libc/posix1e/acl_add_perm.3
index 564b83d9a332..c59aac8e41fa 100644
--- a/lib/libc/posix1e/acl_add_perm.3
+++ b/lib/libc/posix1e/acl_add_perm.3
@@ -126,4 +126,4 @@ function was added in
The
.Fn acl_add_perm
function was written by
-.An Chris D. Faulhaber Aq jedgar@fxp.org .
+.An Chris D. Faulhaber Aq Mt jedgar@fxp.org .
diff --git a/lib/libc/posix1e/acl_calc_mask.3 b/lib/libc/posix1e/acl_calc_mask.3
index 7bcdb4082e25..1cd3fd7c03c7 100644
--- a/lib/libc/posix1e/acl_calc_mask.3
+++ b/lib/libc/posix1e/acl_calc_mask.3
@@ -95,4 +95,4 @@ function was added in
The
.Fn acl_calc_mask
function was written by
-.An Chris D. Faulhaber Aq jedgar@fxp.org .
+.An Chris D. Faulhaber Aq Mt jedgar@fxp.org .
diff --git a/lib/libc/posix1e/acl_clear_flags_np.3 b/lib/libc/posix1e/acl_clear_flags_np.3
index 0780e149d5f0..a3da4815371d 100644
--- a/lib/libc/posix1e/acl_clear_flags_np.3
+++ b/lib/libc/posix1e/acl_clear_flags_np.3
@@ -76,4 +76,4 @@ function was added in
The
.Fn acl_clear_flags_np
function was written by
-.An Edward Tomasz Napierala Aq trasz@FreeBSD.org .
+.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org .
diff --git a/lib/libc/posix1e/acl_clear_perms.3 b/lib/libc/posix1e/acl_clear_perms.3
index df82b6c78694..4b055fcf5e64 100644
--- a/lib/libc/posix1e/acl_clear_perms.3
+++ b/lib/libc/posix1e/acl_clear_perms.3
@@ -76,4 +76,4 @@ function was added in
The
.Fn acl_clear_perms
function was written by
-.An Chris D. Faulhaber Aq jedgar@fxp.org .
+.An Chris D. Faulhaber Aq Mt jedgar@fxp.org .
diff --git a/lib/libc/posix1e/acl_copy_entry.3 b/lib/libc/posix1e/acl_copy_entry.3
index 586b8227176e..5fd31ed793e6 100644
--- a/lib/libc/posix1e/acl_copy_entry.3
+++ b/lib/libc/posix1e/acl_copy_entry.3
@@ -82,4 +82,4 @@ function was added in
The
.Fn acl_copy_entry
function was written by
-.An Chris D. Faulhaber Aq jedgar@fxp.org .
+.An Chris D. Faulhaber Aq Mt jedgar@fxp.org .
diff --git a/lib/libc/posix1e/acl_create_entry.3 b/lib/libc/posix1e/acl_create_entry.3
index 784f6875cf9b..76c14f3f0e91 100644
--- a/lib/libc/posix1e/acl_create_entry.3
+++ b/lib/libc/posix1e/acl_create_entry.3
@@ -95,4 +95,4 @@ function was added in
The
.Fn acl_create_entry
function was written by
-.An Chris D. Faulhaber Aq jedgar@fxp.org .
+.An Chris D. Faulhaber Aq Mt jedgar@fxp.org .
diff --git a/lib/libc/posix1e/acl_delete_entry.3 b/lib/libc/posix1e/acl_delete_entry.3
index b1bdc5ac74bd..06bb0ded1ed0 100644
--- a/lib/libc/posix1e/acl_delete_entry.3
+++ b/lib/libc/posix1e/acl_delete_entry.3
@@ -98,4 +98,4 @@ function was added in
The
.Fn acl_delete_entry
function was written by
-.An Chris D. Faulhaber Aq jedgar@fxp.org .
+.An Chris D. Faulhaber Aq Mt jedgar@fxp.org .
diff --git a/lib/libc/posix1e/acl_delete_flag_np.3 b/lib/libc/posix1e/acl_delete_flag_np.3
index a288978b8a33..ba7a738394fe 100644
--- a/lib/libc/posix1e/acl_delete_flag_np.3
+++ b/lib/libc/posix1e/acl_delete_flag_np.3
@@ -81,4 +81,4 @@ function was added in
The
.Fn acl_delete_flag_np
function was written by
-.An Edward Tomasz Napierala Aq trasz@FreeBSD.org .
+.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org .
diff --git a/lib/libc/posix1e/acl_delete_perm.3 b/lib/libc/posix1e/acl_delete_perm.3
index b6c725058b4a..90f244e147c2 100644
--- a/lib/libc/posix1e/acl_delete_perm.3
+++ b/lib/libc/posix1e/acl_delete_perm.3
@@ -81,4 +81,4 @@ function was added in
The
.Fn acl_delete_perm
function was written by
-.An Chris D. Faulhaber Aq jedgar@fxp.org .
+.An Chris D. Faulhaber Aq Mt jedgar@fxp.org .
diff --git a/lib/libc/posix1e/acl_get_brand_np.3 b/lib/libc/posix1e/acl_get_brand_np.3
index 5caa40c862a9..44b83e23293c 100644
--- a/lib/libc/posix1e/acl_get_brand_np.3
+++ b/lib/libc/posix1e/acl_get_brand_np.3
@@ -83,4 +83,4 @@ function was added in
The
.Fn acl_get_brand_np
function was written by
-.An Edward Tomasz Napierala Aq trasz@FreeBSD.org .
+.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org .
diff --git a/lib/libc/posix1e/acl_get_entry.3 b/lib/libc/posix1e/acl_get_entry.3
index 477b735edfb1..88c72db2559a 100644
--- a/lib/libc/posix1e/acl_get_entry.3
+++ b/lib/libc/posix1e/acl_get_entry.3
@@ -142,4 +142,4 @@ function was added in
The
.Fn acl_get_entry
function was written by
-.An Chris D. Faulhaber Aq jedgar@fxp.org .
+.An Chris D. Faulhaber Aq Mt jedgar@fxp.org .
diff --git a/lib/libc/posix1e/acl_get_entry_type_np.3 b/lib/libc/posix1e/acl_get_entry_type_np.3
index eea4b17425c6..6313d0607c7d 100644
--- a/lib/libc/posix1e/acl_get_entry_type_np.3
+++ b/lib/libc/posix1e/acl_get_entry_type_np.3
@@ -77,4 +77,4 @@ function was added in
The
.Fn acl_get_entry_type_np
function was written by
-.An Edward Tomasz Napierala Aq trasz@FreeBSD.org .
+.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org .
diff --git a/lib/libc/posix1e/acl_get_flag_np.3 b/lib/libc/posix1e/acl_get_flag_np.3
index b57fd04bc60c..d70ce84427d4 100644
--- a/lib/libc/posix1e/acl_get_flag_np.3
+++ b/lib/libc/posix1e/acl_get_flag_np.3
@@ -91,4 +91,4 @@ function was added in
The
.Fn acl_get_flag_np
function was written by
-.An Edward Tomasz Napierala Aq trasz@FreeBSD.org .
+.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org .
diff --git a/lib/libc/posix1e/acl_get_flagset_np.3 b/lib/libc/posix1e/acl_get_flagset_np.3
index 221b93bce91d..fd1c8b2aed35 100644
--- a/lib/libc/posix1e/acl_get_flagset_np.3
+++ b/lib/libc/posix1e/acl_get_flagset_np.3
@@ -80,4 +80,4 @@ function was added in
The
.Fn acl_get_flagset_np
function was written by
-.An Edward Tomasz Napierala Aq trasz@FreeBSD.org .
+.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org .
diff --git a/lib/libc/posix1e/acl_get_perm_np.3 b/lib/libc/posix1e/acl_get_perm_np.3
index de1c0b5f9dce..0f4126ecbe64 100644
--- a/lib/libc/posix1e/acl_get_perm_np.3
+++ b/lib/libc/posix1e/acl_get_perm_np.3
@@ -91,4 +91,4 @@ function was added in
The
.Fn acl_get_perm_np
function was written by
-.An Chris D. Faulhaber Aq jedgar@fxp.org .
+.An Chris D. Faulhaber Aq Mt jedgar@fxp.org .
diff --git a/lib/libc/posix1e/acl_get_permset.3 b/lib/libc/posix1e/acl_get_permset.3
index cf93b0a8d3f4..064f71ce45bc 100644
--- a/lib/libc/posix1e/acl_get_permset.3
+++ b/lib/libc/posix1e/acl_get_permset.3
@@ -80,4 +80,4 @@ function was added in
The
.Fn acl_get_permset
function was written by
-.An Chris D. Faulhaber Aq jedgar@fxp.org .
+.An Chris D. Faulhaber Aq Mt jedgar@fxp.org .
diff --git a/lib/libc/posix1e/acl_get_qualifier.3 b/lib/libc/posix1e/acl_get_qualifier.3
index 653a3b4f3279..fcafd2cc3bbb 100644
--- a/lib/libc/posix1e/acl_get_qualifier.3
+++ b/lib/libc/posix1e/acl_get_qualifier.3
@@ -137,4 +137,4 @@ function was added in
The
.Fn acl_get_qualifier
function was written by
-.An Chris D. Faulhaber Aq jedgar@fxp.org .
+.An Chris D. Faulhaber Aq Mt jedgar@fxp.org .
diff --git a/lib/libc/posix1e/acl_get_tag_type.3 b/lib/libc/posix1e/acl_get_tag_type.3
index 4856c5082770..64c57efed732 100644
--- a/lib/libc/posix1e/acl_get_tag_type.3
+++ b/lib/libc/posix1e/acl_get_tag_type.3
@@ -82,4 +82,4 @@ function was added in
The
.Fn acl_get_tag_type
function was written by
-.An Chris D. Faulhaber Aq jedgar@fxp.org .
+.An Chris D. Faulhaber Aq Mt jedgar@fxp.org .
diff --git a/lib/libc/posix1e/acl_is_trivial_np.3 b/lib/libc/posix1e/acl_is_trivial_np.3
index 4f5a22cd6dd7..142a76c8f1a8 100644
--- a/lib/libc/posix1e/acl_is_trivial_np.3
+++ b/lib/libc/posix1e/acl_is_trivial_np.3
@@ -82,4 +82,4 @@ The
function was added in
.Fx 8.0 .
.Sh AUTHORS
-.An Edward Tomasz Napierala Aq trasz@FreeBSD.org .
+.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org
diff --git a/lib/libc/posix1e/acl_set_entry_type_np.3 b/lib/libc/posix1e/acl_set_entry_type_np.3
index 648775d4e837..2257b53c3711 100644
--- a/lib/libc/posix1e/acl_set_entry_type_np.3
+++ b/lib/libc/posix1e/acl_set_entry_type_np.3
@@ -91,4 +91,4 @@ function was added in
The
.Fn acl_get_entry_type_np
function was written by
-.An Edward Tomasz Napierala Aq trasz@FreeBSD.org .
+.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org .
diff --git a/lib/libc/posix1e/acl_set_flagset_np.3 b/lib/libc/posix1e/acl_set_flagset_np.3
index 386665d4b4cc..3d271c86839d 100644
--- a/lib/libc/posix1e/acl_set_flagset_np.3
+++ b/lib/libc/posix1e/acl_set_flagset_np.3
@@ -82,4 +82,4 @@ function was added in
The
.Fn acl_set_flagset_np
function was written by
-.An Edward Tomasz Napierala Aq trasz@FreeBSD.org .
+.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org .
diff --git a/lib/libc/posix1e/acl_set_permset.3 b/lib/libc/posix1e/acl_set_permset.3
index 0cf658161b80..259aef6b8458 100644
--- a/lib/libc/posix1e/acl_set_permset.3
+++ b/lib/libc/posix1e/acl_set_permset.3
@@ -78,4 +78,4 @@ function was added in
The
.Fn acl_set_permset
function was written by
-.An Chris D. Faulhaber Aq jedgar@fxp.org .
+.An Chris D. Faulhaber Aq Mt jedgar@fxp.org .
diff --git a/lib/libc/posix1e/acl_set_qualifier.3 b/lib/libc/posix1e/acl_set_qualifier.3
index 47a60d81121c..26542ce28388 100644
--- a/lib/libc/posix1e/acl_set_qualifier.3
+++ b/lib/libc/posix1e/acl_set_qualifier.3
@@ -88,4 +88,4 @@ function was added in
The
.Fn acl_get_qualifier
function was written by
-.An Chris D. Faulhaber Aq jedgar@fxp.org .
+.An Chris D. Faulhaber Aq Mt jedgar@fxp.org .
diff --git a/lib/libc/posix1e/acl_set_tag_type.3 b/lib/libc/posix1e/acl_set_tag_type.3
index 79526a004453..42834c2657d0 100644
--- a/lib/libc/posix1e/acl_set_tag_type.3
+++ b/lib/libc/posix1e/acl_set_tag_type.3
@@ -99,4 +99,4 @@ function was added in
The
.Fn acl_set_tag_type
function was written by
-.An Chris D. Faulhaber Aq jedgar@fxp.org .
+.An Chris D. Faulhaber Aq Mt jedgar@fxp.org .
diff --git a/lib/libc/posix1e/acl_strip_np.3 b/lib/libc/posix1e/acl_strip_np.3
index cc6c65b70fd8..8c1a920a717b 100644
--- a/lib/libc/posix1e/acl_strip_np.3
+++ b/lib/libc/posix1e/acl_strip_np.3
@@ -106,4 +106,4 @@ The
function was added in
.Fx 8.0 .
.Sh AUTHORS
-.An Edward Tomasz Napierala Aq trasz@FreeBSD.org .
+.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org
diff --git a/lib/libc/regex/re_format.7 b/lib/libc/regex/re_format.7
index a2a527da519e..05b14947e45f 100644
--- a/lib/libc/regex/re_format.7
+++ b/lib/libc/regex/re_format.7
@@ -36,7 +36,7 @@
.\" @(#)re_format.7 8.3 (Berkeley) 3/20/94
.\" $FreeBSD$
.\"
-.Dd March 20, 1994
+.Dd June 30, 2014
.Dt RE_FORMAT 7
.Os
.Sh NAME
@@ -314,6 +314,13 @@ compatible with but not specified by
.St -p1003.2 ,
and should be used with
caution in software intended to be portable to other systems.
+The additional word delimiters
+.Ql \e<
+and
+.Ql \e>
+are provided to ease compatibility with traditional
+.Xr svr4 4
+systems but are not portable and should be avoided.
.Pp
In the event that an RE could match more than one substring of a given
string,
diff --git a/lib/libc/regex/regcomp.c b/lib/libc/regex/regcomp.c
index 55f9c04c6910..a01bb95931bf 100644
--- a/lib/libc/regex/regcomp.c
+++ b/lib/libc/regex/regcomp.c
@@ -412,7 +412,17 @@ p_ere_exp(struct parse *p)
case '\\':
(void)REQUIRE(MORE(), REG_EESCAPE);
wc = WGETNEXT();
- ordinary(p, wc);
+ switch (wc) {
+ case '<':
+ EMIT(OBOW, 0);
+ break;
+ case '>':
+ EMIT(OEOW, 0);
+ break;
+ default:
+ ordinary(p, wc);
+ break;
+ }
break;
case '{': /* okay as ordinary except if digit follows */
(void)REQUIRE(!MORE() || !isdigit((uch)PEEK()), REG_BADRPT);
@@ -569,6 +579,12 @@ p_simp_re(struct parse *p,
case '[':
p_bracket(p);
break;
+ case BACKSL|'<':
+ EMIT(OBOW, 0);
+ break;
+ case BACKSL|'>':
+ EMIT(OEOW, 0);
+ break;
case BACKSL|'{':
SETERROR(REG_BADRPT);
break;
diff --git a/lib/libc/stdio/fflush.c b/lib/libc/stdio/fflush.c
index 456b031dd01b..ef9b45b8b6f1 100644
--- a/lib/libc/stdio/fflush.c
+++ b/lib/libc/stdio/fflush.c
@@ -60,7 +60,7 @@ fflush(FILE *fp)
/*
* There is disagreement about the correct behaviour of fflush()
- * when passed a file which is not open for reading. According to
+ * when passed a file which is not open for writing. According to
* the ISO C standard, the behaviour is undefined.
* Under linux, such an fflush returns success and has no effect;
* under Windows, such an fflush is documented as behaving instead
@@ -68,11 +68,13 @@ fflush(FILE *fp)
* Given that applications may be written with the expectation of
* either of these two behaviours, the only safe (non-astonishing)
* option is to return EBADF and ask that applications be fixed.
+ * SUSv3 now requires that fflush() returns success on a read-only
+ * stream.
+ *
*/
- if ((fp->_flags & (__SWR | __SRW)) == 0) {
- errno = EBADF;
- retval = EOF;
- } else
+ if ((fp->_flags & (__SWR | __SRW)) == 0)
+ retval = 0;
+ else
retval = __sflush(fp);
FUNLOCKFILE(fp);
return (retval);
@@ -89,10 +91,9 @@ __fflush(FILE *fp)
if (fp == NULL)
return (_fwalk(sflush_locked));
- if ((fp->_flags & (__SWR | __SRW)) == 0) {
- errno = EBADF;
- retval = EOF;
- } else
+ if ((fp->_flags & (__SWR | __SRW)) == 0)
+ retval = 0;
+ else
retval = __sflush(fp);
return (retval);
}
@@ -122,6 +123,12 @@ __sflush(FILE *fp)
for (; n > 0; n -= t, p += t) {
t = _swrite(fp, (char *)p, n);
if (t <= 0) {
+ /* Reset _p and _w. */
+ if (p > fp->_p) /* Some was written. */
+ memmove(fp->_p, p, n);
+ fp->_p += n;
+ if ((fp->_flags & (__SLBF | __SNBF)) == 0)
+ fp->_w -= n;
fp->_flags |= __SERR;
return (EOF);
}
diff --git a/lib/libc/stdio/fmemopen.c b/lib/libc/stdio/fmemopen.c
index 581a91efd73b..ebd3596be775 100644
--- a/lib/libc/stdio/fmemopen.c
+++ b/lib/libc/stdio/fmemopen.c
@@ -57,6 +57,14 @@ fmemopen(void * __restrict buf, size_t size, const char * __restrict mode)
int flags, rc;
/*
+ * POSIX says we shall return EINVAL if size is 0.
+ */
+ if (size == 0) {
+ errno = EINVAL;
+ return (NULL);
+ }
+
+ /*
* Retrieve the flags as used by open(2) from the mode argument, and
* validate them.
*/
@@ -119,14 +127,7 @@ fmemopen(void * __restrict buf, size_t size, const char * __restrict mode)
*/
switch (mode[0]) {
case 'a':
- if (ck->bin) {
- /*
- * This isn't useful, since the buffer isn't allowed
- * to grow.
- */
- ck->off = ck->len = size;
- } else
- ck->off = ck->len = strnlen(ck->buf, ck->size);
+ ck->off = ck->len = strnlen(ck->buf, ck->size);
break;
case 'r':
ck->len = size;
diff --git a/lib/libc/stdio/fopen.3 b/lib/libc/stdio/fopen.3
index f11f4e07e3de..b39cb5a0d504 100644
--- a/lib/libc/stdio/fopen.3
+++ b/lib/libc/stdio/fopen.3
@@ -302,6 +302,15 @@ for any of the errors specified for the routines
.Xr fclose 3
and
.Xr fflush 3 .
+.Pp
+The
+.Fn fmemopen
+function
+may also fail and set
+.Va errno
+if the
+.Fa size
+argument is 0.
.Sh SEE ALSO
.Xr open 2 ,
.Xr fclose 3 ,
diff --git a/lib/libc/stdio/fputs.c b/lib/libc/stdio/fputs.c
index 3b8f2c9d1b68..32e57645f56a 100644
--- a/lib/libc/stdio/fputs.c
+++ b/lib/libc/stdio/fputs.c
@@ -55,7 +55,7 @@ fputs(const char * __restrict s, FILE * __restrict fp)
struct __siov iov;
iov.iov_base = (void *)s;
- iov.iov_len = uio.uio_resid = strlen(s);
+ uio.uio_resid = iov.iov_len = strlen(s);
uio.uio_iov = &iov;
uio.uio_iovcnt = 1;
FLOCKFILE(fp);
diff --git a/lib/libc/stdio/fputws.c b/lib/libc/stdio/fputws.c
index fa8d31784e09..41530673c007 100644
--- a/lib/libc/stdio/fputws.c
+++ b/lib/libc/stdio/fputws.c
@@ -67,7 +67,7 @@ fputws_l(const wchar_t * __restrict ws, FILE * __restrict fp, locale_t locale)
&fp->_mbstate);
if (nbytes == (size_t)-1)
goto error;
- iov.iov_len = uio.uio_resid = nbytes;
+ uio.uio_resid = iov.iov_len = nbytes;
if (__sfvwrite(fp, &uio) != 0)
goto error;
} while (wsp != NULL);
diff --git a/lib/libc/stdio/freopen.c b/lib/libc/stdio/freopen.c
index 0ff83bf96175..4dcd50fbb13d 100644
--- a/lib/libc/stdio/freopen.c
+++ b/lib/libc/stdio/freopen.c
@@ -97,7 +97,7 @@ freopen(const char * __restrict file, const char * __restrict mode,
(dflags & (O_ACCMODE | O_EXEC)) != (oflags & O_ACCMODE)) {
fclose(fp);
FUNLOCKFILE(fp);
- errno = EINVAL;
+ errno = EBADF;
return (NULL);
}
if (fp->_flags & __SWR)
@@ -151,6 +151,14 @@ freopen(const char * __restrict file, const char * __restrict mode,
/* Get a new descriptor to refer to the new file. */
f = _open(file, oflags, DEFFILEMODE);
+ /* If out of fd's close the old one and try again. */
+ if (f < 0 && isopen && wantfd > STDERR_FILENO &&
+ (errno == ENFILE || errno == EMFILE)) {
+ (void) (*fp->_close)(fp->_cookie);
+ isopen = 0;
+ wantfd = -1;
+ f = _open(file, oflags, DEFFILEMODE);
+ }
sverrno = errno;
finish:
diff --git a/lib/libc/stdio/ftell.c b/lib/libc/stdio/ftell.c
index 2c8800ccfe19..745d500513d9 100644
--- a/lib/libc/stdio/ftell.c
+++ b/lib/libc/stdio/ftell.c
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include "namespace.h"
#include <sys/types.h>
#include <errno.h>
+#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
#include "un-namespace.h"
@@ -87,6 +88,7 @@ _ftello(FILE *fp, fpos_t *offset)
{
fpos_t pos;
size_t n;
+ int dflags;
if (fp->_seek == NULL) {
errno = ESPIPE; /* historic practice */
@@ -118,6 +120,22 @@ _ftello(FILE *fp, fpos_t *offset)
if (HASUB(fp))
pos -= fp->_r; /* Can be negative at this point. */
} else if ((fp->_flags & __SWR) && fp->_p != NULL) {
+ dflags = 0;
+ if (fp->_flags & __SAPP)
+ dflags = O_APPEND;
+ else if (fp->_file != -1 &&
+ (dflags = _fcntl(fp->_file, F_GETFL)) < 0)
+ return (1);
+ if ((dflags & O_APPEND) &&
+ (pos = _sseek(fp, (fpos_t)0, SEEK_END)) == -1) {
+ if ((fp->_flags & __SOPT) || __sflush(fp) ||
+ (pos = _sseek(fp, (fpos_t)0, SEEK_CUR)) == -1)
+ return (1);
+ else {
+ *offset = pos;
+ return (0);
+ }
+ }
/*
* Writing. Any buffered characters cause the
* position to be greater than that in the
diff --git a/lib/libc/stdio/gets.c b/lib/libc/stdio/gets.c
index c7c1c2fa38c8..c9438515323a 100644
--- a/lib/libc/stdio/gets.c
+++ b/lib/libc/stdio/gets.c
@@ -52,7 +52,7 @@ gets(char *buf)
int c;
char *s;
static int warned;
- static char w[] =
+ static const char w[] =
"warning: this program uses gets(), which is unsafe.\n";
FLOCKFILE(stdin);
diff --git a/lib/libc/stdio/printf.3 b/lib/libc/stdio/printf.3
index 05c30dcfb523..058f9a9f7d67 100644
--- a/lib/libc/stdio/printf.3
+++ b/lib/libc/stdio/printf.3
@@ -827,14 +827,14 @@ first appeared in the
.Tn GNU C
library.
These were implemented by
-.An Peter Wemm Aq peter@FreeBSD.org
+.An Peter Wemm Aq Mt peter@FreeBSD.org
in
.Fx 2.2 ,
but were later replaced with a different implementation
from
.Ox 2.3
by
-.An Todd C. Miller Aq Todd.Miller@courtesan.com .
+.An Todd C. Miller Aq Mt Todd.Miller@courtesan.com .
The
.Fn dprintf
and
diff --git a/lib/libc/stdio/puts.c b/lib/libc/stdio/puts.c
index 5ee7fc1c63f0..124afc73d600 100644
--- a/lib/libc/stdio/puts.c
+++ b/lib/libc/stdio/puts.c
@@ -51,12 +51,12 @@ int
puts(char const *s)
{
int retval;
- size_t c = strlen(s);
+ size_t c;
struct __suio uio;
struct __siov iov[2];
iov[0].iov_base = (void *)s;
- iov[0].iov_len = c;
+ iov[0].iov_len = c = strlen(s);
iov[1].iov_base = "\n";
iov[1].iov_len = 1;
uio.uio_resid = c + 1;
diff --git a/lib/libc/stdio/putw.c b/lib/libc/stdio/putw.c
index 0360cafc4052..ecd5d095de5e 100644
--- a/lib/libc/stdio/putw.c
+++ b/lib/libc/stdio/putw.c
@@ -50,7 +50,7 @@ putw(int w, FILE *fp)
struct __siov iov;
iov.iov_base = &w;
- iov.iov_len = uio.uio_resid = sizeof(w);
+ uio.uio_resid = iov.iov_len = sizeof(w);
uio.uio_iov = &iov;
uio.uio_iovcnt = 1;
FLOCKFILE(fp);
diff --git a/lib/libc/stdio/rewind.c b/lib/libc/stdio/rewind.c
index ff4c9072c76b..133e3f43dd0c 100644
--- a/lib/libc/stdio/rewind.c
+++ b/lib/libc/stdio/rewind.c
@@ -53,9 +53,8 @@ rewind(FILE *fp)
__sinit();
FLOCKFILE(fp);
- if (_fseeko(fp, (off_t)0, SEEK_SET, 1) == 0) {
- clearerr_unlocked(fp);
+ if (_fseeko(fp, (off_t)0, SEEK_SET, 1) == 0)
errno = serrno;
- }
+ clearerr_unlocked(fp); /* POSIX: clear stdio error regardless */
FUNLOCKFILE(fp);
}
diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c
index ea47d36ea14a..e54e8acf00ff 100644
--- a/lib/libc/stdio/vfprintf.c
+++ b/lib/libc/stdio/vfprintf.c
@@ -455,8 +455,10 @@ __vfprintf(FILE *fp, locale_t locale, const char *fmt0, va_list ap)
return (__xvprintf(fp, fmt0, ap));
/* sorry, fprintf(read_only_file, "") returns EOF, not 0 */
- if (prepwrite(fp) != 0)
+ if (prepwrite(fp) != 0) {
+ errno = EBADF;
return (EOF);
+ }
convbuf = NULL;
fmt = (char *)fmt0;
diff --git a/lib/libc/stdio/vfwprintf.c b/lib/libc/stdio/vfwprintf.c
index 4350c48acafc..b75c504b1e72 100644
--- a/lib/libc/stdio/vfwprintf.c
+++ b/lib/libc/stdio/vfwprintf.c
@@ -531,8 +531,10 @@ __vfwprintf(FILE *fp, locale_t locale, const wchar_t *fmt0, va_list ap)
/* sorry, fwprintf(read_only_file, L"") returns WEOF, not 0 */
- if (prepwrite(fp) != 0)
+ if (prepwrite(fp) != 0) {
+ errno = EBADF;
return (EOF);
+ }
convbuf = NULL;
fmt = (wchar_t *)fmt0;
diff --git a/lib/libc/stdio/wbuf.c b/lib/libc/stdio/wbuf.c
index 3f697e287a1f..5bc3c4dc3e77 100644
--- a/lib/libc/stdio/wbuf.c
+++ b/lib/libc/stdio/wbuf.c
@@ -36,6 +36,7 @@ static char sccsid[] = "@(#)wbuf.c 8.1 (Berkeley) 6/4/93";
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <errno.h>
#include <stdio.h>
#include "local.h"
@@ -59,8 +60,10 @@ __swbuf(int c, FILE *fp)
* calls might wrap _w from negative to positive.
*/
fp->_w = fp->_lbfsize;
- if (prepwrite(fp) != 0)
+ if (prepwrite(fp) != 0) {
+ errno = EBADF;
return (EOF);
+ }
c = (unsigned char)c;
ORIENT(fp, -1);
diff --git a/lib/libc/stdlib/Makefile.inc b/lib/libc/stdlib/Makefile.inc
index 68dda94c5d40..57205a756a97 100644
--- a/lib/libc/stdlib/Makefile.inc
+++ b/lib/libc/stdlib/Makefile.inc
@@ -35,6 +35,7 @@ MLINKS+=exit.3 _Exit.3
MLINKS+=getenv.3 putenv.3 getenv.3 setenv.3 getenv.3 unsetenv.3
MLINKS+=getopt_long.3 getopt_long_only.3
MLINKS+=hcreate.3 hdestroy.3 hcreate.3 hsearch.3
+MLINKS+=hcreate.3 hcreate_r.3 hcreate.3 hdestroy_r.3 hcreate.3 hsearch_r.3
MLINKS+=insque.3 remque.3
MLINKS+=lsearch.3 lfind.3
MLINKS+=ptsname.3 grantpt.3 ptsname.3 unlockpt.3
diff --git a/lib/libc/stdlib/Symbol.map b/lib/libc/stdlib/Symbol.map
index d28a8e9ecbd5..64c0e169dd27 100644
--- a/lib/libc/stdlib/Symbol.map
+++ b/lib/libc/stdlib/Symbol.map
@@ -109,6 +109,9 @@ FBSD_1.4 {
heapsort_b;
mergesort_b;
qsort_b;
+ hcreate_r;
+ hdestroy_r;
+ hsearch_r;
};
FBSDprivate_1.0 {
diff --git a/lib/libc/stdlib/a64l.3 b/lib/libc/stdlib/a64l.3
index 61fbffdbab33..eadc2f393460 100644
--- a/lib/libc/stdlib/a64l.3
+++ b/lib/libc/stdlib/a64l.3
@@ -181,7 +181,7 @@ functions
were added to
.Fx
by
-.An Tom Rhodes Aq trhodes@FreeBSD.org .
+.An Tom Rhodes Aq Mt trhodes@FreeBSD.org .
Almost all of this manual page came from the
.Tn POSIX
standard.
diff --git a/lib/libc/stdlib/getopt.3 b/lib/libc/stdlib/getopt.3
index 03a63abb19c5..6e04e1704712 100644
--- a/lib/libc/stdlib/getopt.3
+++ b/lib/libc/stdlib/getopt.3
@@ -1,4 +1,4 @@
-.\" $NetBSD: getopt.3,v 1.31 2003/09/23 10:26:54 wiz Exp $
+.\" $NetBSD: getopt.3,v 1.34 2014/06/05 22:09:50 wiz Exp $
.\"
.\" Copyright (c) 1988, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -30,7 +30,7 @@
.\" @(#)getopt.3 8.5 (Berkeley) 4/27/95
.\" $FreeBSD$
.\"
-.Dd April 27, 1995
+.Dd June 5, 2014
.Dt GETOPT 3
.Os
.Sh NAME
@@ -65,6 +65,17 @@ The option string
may contain the following elements: individual characters, and
characters followed by a colon to indicate an option argument
is to follow.
+If an individual character is followed by two colons, then the
+option argument is optional;
+.Va optarg
+is set to the rest of the current
+.Va argv
+word, or
+.Dv NULL
+if there were no more characters in the current word.
+This is a
+.Tn GNU
+extension.
For example, an option string
.Li \&"x"
recognizes an option
diff --git a/lib/libc/stdlib/getopt.c b/lib/libc/stdlib/getopt.c
index b9d2ae31fc64..3929b321dca9 100644
--- a/lib/libc/stdlib/getopt.c
+++ b/lib/libc/stdlib/getopt.c
@@ -1,4 +1,4 @@
-/* $NetBSD: getopt.c,v 1.26 2003/08/07 16:43:40 agc Exp $ */
+/* $NetBSD: getopt.c,v 1.29 2014/06/05 22:00:22 christos Exp $ */
/*
* Copyright (c) 1987, 1993, 1994
@@ -59,10 +59,7 @@ char *optarg; /* argument associated with option */
* Parse argc/argv argument vector.
*/
int
-getopt(nargc, nargv, ostr)
- int nargc;
- char * const nargv[];
- const char *ostr;
+getopt(int nargc, char * const nargv[], const char *ostr)
{
static char *place = EMSG; /* option letter processing */
char *oli; /* option letter list index */
@@ -115,6 +112,12 @@ getopt(nargc, nargv, ostr)
entire next argument. */
if (*place)
optarg = place;
+ else if (oli[2] == ':')
+ /*
+ * GNU Extension, for optional arguments if the rest of
+ * the argument is empty, we return NULL
+ */
+ optarg = NULL;
else if (nargc > ++optind)
optarg = nargv[optind];
else {
diff --git a/lib/libc/stdlib/getopt_long.c b/lib/libc/stdlib/getopt_long.c
index 9f7f6d5ae733..9534a2aff67e 100644
--- a/lib/libc/stdlib/getopt_long.c
+++ b/lib/libc/stdlib/getopt_long.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getopt_long.c,v 1.22 2006/10/04 21:29:04 jmc Exp $ */
+/* $OpenBSD: getopt_long.c,v 1.26 2013/06/08 22:47:56 millert Exp $ */
/* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */
/*
@@ -248,7 +248,7 @@ parse_long_options(char * const *nargv, const char *options,
if (short_too && current_argv_len == 1)
continue;
- if (match == -1) /* first partial match */
+ if (match == -1) /* first partial match */
match = i;
else if ((flags & FLAG_LONGONLY) ||
long_options[i].has_arg !=
@@ -359,37 +359,31 @@ getopt_internal(int nargc, char * const *nargv, const char *options,
{
char *oli; /* option letter list index */
int optchar, short_too;
- int posixly_correct; /* no static, can be changed on the fly */
+ static int posixly_correct = -1;
if (options == NULL)
return (-1);
/*
+ * XXX Some GNU programs (like cvs) set optind to 0 instead of
+ * XXX using optreset. Work around this braindamage.
+ */
+ if (optind == 0)
+ optind = optreset = 1;
+
+ /*
* Disable GNU extensions if POSIXLY_CORRECT is set or options
* string begins with a '+'.
*/
- posixly_correct = (getenv("POSIXLY_CORRECT") != NULL);
-#ifdef GNU_COMPATIBLE
+ if (posixly_correct == -1 || optreset)
+ posixly_correct = (getenv("POSIXLY_CORRECT") != NULL);
if (*options == '-')
flags |= FLAG_ALLARGS;
else if (posixly_correct || *options == '+')
flags &= ~FLAG_PERMUTE;
-#else
- if (posixly_correct || *options == '+')
- flags &= ~FLAG_PERMUTE;
- else if (*options == '-')
- flags |= FLAG_ALLARGS;
-#endif
if (*options == '+' || *options == '-')
options++;
- /*
- * XXX Some GNU programs (like cvs) set optind to 0 instead of
- * XXX using optreset. Work around this braindamage.
- */
- if (optind == 0)
- optind = optreset = 1;
-
optarg = NULL;
if (optreset)
nonopt_start = nonopt_end = -1;
diff --git a/lib/libc/stdlib/hcreate.3 b/lib/libc/stdlib/hcreate.3
index 2466c9f428a6..2161f9262c8b 100644
--- a/lib/libc/stdlib/hcreate.3
+++ b/lib/libc/stdlib/hcreate.3
@@ -28,11 +28,16 @@
.\"
.\" $FreeBSD$
.\"
-.Dd July 6, 2008
+.Dd July 21, 2014
.Dt HCREATE 3
.Os
.Sh NAME
-.Nm hcreate , hdestroy , hsearch
+.Nm hcreate ,
+.Nm hcreate_r ,
+.Nm hdestroy ,
+.Nm hdestroy_r ,
+.Nm hsearch ,
+.Nm hsearch_r
.Nd manage hash search table
.Sh LIBRARY
.Lb libc
@@ -40,16 +45,25 @@
.In search.h
.Ft int
.Fn hcreate "size_t nel"
+.Ft int
+.Fn hcreate_r "size_t nel" "struct hsearch_data *table"
+.Ft void
+.Fn hdestroy "void"
.Ft void
-.Fn hdestroy void
+.Fn hdestroy_r "struct hsearch_data *table"
.Ft ENTRY *
.Fn hsearch "ENTRY item" "ACTION action"
+.Ft int
+.Fn hsearch_r "ENTRY item" "ACTION action" "ENTRY ** itemp" "struct hsearch_data *table"
.Sh DESCRIPTION
The
.Fn hcreate ,
+.Fn hcreate_r ,
.Fn hdestroy ,
+.Fn hdestroy_r
+.Fn hsearch ,
and
-.Fn hsearch
+.Fn hsearch_r
functions manage hash search tables.
.Pp
The
@@ -90,7 +104,7 @@ argument is a structure of type
.Vt ENTRY
(defined in the
.In search.h
-header) containing two pointers:
+header) that contains two pointers:
.Fa item.key
points to the comparison key (a
.Vt "char *" ) ,
@@ -136,21 +150,50 @@ is
and
.Fn hdestroy
is called.
+.Pp
+The
+.Fn hcreate_r ,
+.Fn hdestroy_r ,
+and
+.Fn hsearch_r
+functions are re-entrant versions of the above functions that can
+operate on a table supplied by the user.
+The
+.Fn hsearch_r
+function returns
+.Dv 0
+if the action is
+.Dv ENTER
+and the element cannot be created,
+.Dv 1
+otherwise.
+If the element exists or can be created, it will be placed in
+.Fa itemp ,
+otherwise
+.Fa itemp
+will be set to
+.Dv NULL .
.Sh RETURN VALUES
The
.Fn hcreate
-function returns 0 if the table creation failed and the global variable
+and
+.Fn hcreate_r
+functions return 0 if the table creation failed and the global variable
.Va errno
is set to indicate the error;
otherwise, a non-zero value is returned.
.Pp
The
.Fn hdestroy
-function does not return a value.
+and
+.Fn hdestroy_r
+functions return no value.
.Pp
The
.Fn hsearch
-function returns a
+and
+.Fn hsearch_r
+functions return a
.Dv NULL
pointer if either the
.Fa action
@@ -223,15 +266,31 @@ main(void)
.Sh ERRORS
The
.Fn hcreate
-and
+.Fn hcreate_r ,
.Fn hsearch
-functions may fail if:
+and
+.Fn hsearch_r
+functions will fail if:
.Bl -tag -width Er
.It Bq Er ENOMEM
-Insufficient storage space is available.
+Insufficient memory is available.
.It Bq Er EINVAL
A table already exists.
.El
+.Pp
+The
+.Fn hsearch
+and
+.Fn hsearch_r
+functions will also fail if the action is
+.Dv SEARCH
+and the element is not found:
+.Bl -tag -width Er
+.It Bq Er ESRCH
+The
+.Fa item
+given is not found.
+.El
.Sh SEE ALSO
.Xr bsearch 3 ,
.Xr lsearch 3 ,
@@ -254,5 +313,15 @@ and
.Fn hsearch
functions first appeared in
.At V .
+The
+.Fn hcreate_r ,
+.Fn hdestroy_r
+and
+.Fn hsearch_r
+functions are
+.Tn GNU
+extensions.
.Sh BUGS
-The interface permits the use of only one hash table at a time.
+The original,
+.Pf non- Tn GNU
+interface permits the use of only one hash table at a time.
diff --git a/lib/libc/stdlib/hcreate.c b/lib/libc/stdlib/hcreate.c
index c68fe1b76a52..b3be9b4dc435 100644
--- a/lib/libc/stdlib/hcreate.c
+++ b/lib/libc/stdlib/hcreate.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hcreate.c,v 1.2 2001/02/19 21:26:04 ross Exp $ */
+/* $NetBSD: hcreate.c,v 1.7 2011/09/14 23:33:51 christos Exp $ */
/*
* Copyright (c) 2001 Christopher G. Demetriou
@@ -12,12 +12,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the
- * NetBSD Project. See http://www.netbsd.org/ for
- * information about NetBSD.
- * 4. The name of the author may not be used to endorse or promote products
+ * 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
@@ -49,7 +44,7 @@
#include <sys/cdefs.h>
#if 0
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: hcreate.c,v 1.2 2001/02/19 21:26:04 ross Exp $");
+__RCSID("$NetBSD: hcreate.c,v 1.8 2011/09/17 16:54:39 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
__FBSDID("$FreeBSD$");
@@ -84,20 +79,27 @@ SLIST_HEAD(internal_head, internal_entry);
/* Default hash function, from db/hash/hash_func.c */
extern u_int32_t (*__default_hash)(const void *, size_t);
-static struct internal_head *htable;
-static size_t htablesize;
+static struct hsearch_data htable;
int
hcreate(size_t nel)
{
- size_t idx;
- unsigned int p2;
/* Make sure this is not called when a table already exists. */
- if (htable != NULL) {
+ if (htable.table != NULL) {
errno = EINVAL;
return 0;
}
+ return hcreate_r(nel, &htable);
+}
+
+int
+hcreate_r(size_t nel, struct hsearch_data *head)
+{
+ struct internal_head *table;
+ size_t idx;
+ unsigned int p2;
+ void *p;
/* If nel is too small, make it min sized. */
if (nel < MIN_BUCKETS)
@@ -115,16 +117,19 @@ hcreate(size_t nel)
}
/* Allocate the table. */
- htablesize = nel;
- htable = malloc(htablesize * sizeof htable[0]);
- if (htable == NULL) {
+ head->size = nel;
+ head->filled = 0;
+ p = malloc(nel * sizeof table[0]);
+ if (p == NULL) {
errno = ENOMEM;
return 0;
}
+ head->table = p;
+ table = p;
/* Initialize it. */
- for (idx = 0; idx < htablesize; idx++)
- SLIST_INIT(&htable[idx]);
+ for (idx = 0; idx < nel; idx++)
+ SLIST_INIT(&table[idx]);
return 1;
}
@@ -132,54 +137,82 @@ hcreate(size_t nel)
void
hdestroy(void)
{
+ hdestroy_r(&htable);
+}
+
+void
+hdestroy_r(struct hsearch_data *head)
+{
struct internal_entry *ie;
size_t idx;
+ void *p;
+ struct internal_head *table;
- if (htable == NULL)
+ if (head == NULL)
return;
- for (idx = 0; idx < htablesize; idx++) {
- while (!SLIST_EMPTY(&htable[idx])) {
- ie = SLIST_FIRST(&htable[idx]);
- SLIST_REMOVE_HEAD(&htable[idx], link);
- free(ie->ent.key);
+ p = head->table;
+ head->table = NULL;
+ table = p;
+
+ for (idx = 0; idx < head->size; idx++) {
+ while (!SLIST_EMPTY(&table[idx])) {
+ ie = SLIST_FIRST(&table[idx]);
+ SLIST_REMOVE_HEAD(&table[idx], link);
free(ie);
}
}
- free(htable);
- htable = NULL;
+ free(table);
}
ENTRY *
hsearch(ENTRY item, ACTION action)
{
- struct internal_head *head;
+ ENTRY *ep;
+ (void)hsearch_r(item, action, &ep, &htable);
+ return ep;
+}
+
+int
+hsearch_r(ENTRY item, ACTION action, ENTRY **itemp, struct hsearch_data *head)
+{
+ struct internal_head *table, *chain;
struct internal_entry *ie;
uint32_t hashval;
size_t len;
+ void *p;
+
+ p = head->table;
+ table = p;
len = strlen(item.key);
hashval = (*__default_hash)(item.key, len);
- head = &htable[hashval & (htablesize - 1)];
- ie = SLIST_FIRST(head);
+ chain = &table[hashval & (head->size - 1)];
+ ie = SLIST_FIRST(chain);
while (ie != NULL) {
if (strcmp(ie->ent.key, item.key) == 0)
break;
ie = SLIST_NEXT(ie, link);
}
- if (ie != NULL)
- return &ie->ent;
- else if (action == FIND)
- return NULL;
+ if (ie != NULL) {
+ *itemp = &ie->ent;
+ return 1;
+ } else if (action == FIND) {
+ *itemp = NULL;
+ errno = ESRCH;
+ return 1;
+ }
ie = malloc(sizeof *ie);
if (ie == NULL)
- return NULL;
+ return 0;
ie->ent.key = item.key;
ie->ent.data = item.data;
- SLIST_INSERT_HEAD(head, ie, link);
- return &ie->ent;
+ SLIST_INSERT_HEAD(chain, ie, link);
+ *itemp = &ie->ent;
+ head->filled++;
+ return 1;
}
diff --git a/lib/libc/stdlib/strfmon.3 b/lib/libc/stdlib/strfmon.3
index f82dfa30290a..47f7131b677c 100644
--- a/lib/libc/stdlib/strfmon.3
+++ b/lib/libc/stdlib/strfmon.3
@@ -171,10 +171,10 @@ function conforms to
The
.Fn strfmon
function was implemented by
-.An Alexey Zelkin Aq phantom@FreeBSD.org .
+.An Alexey Zelkin Aq Mt phantom@FreeBSD.org .
.Pp
This manual page was written by
-.An Jeroen Ruigrok van der Werven Aq asmodai@FreeBSD.org
+.An Jeroen Ruigrok van der Werven Aq Mt asmodai@FreeBSD.org
based on the standards' text.
.Sh BUGS
The
diff --git a/lib/libc/stdlib/strfmon.c b/lib/libc/stdlib/strfmon.c
index b82797dc6d1e..689c78b8bff3 100644
--- a/lib/libc/stdlib/strfmon.c
+++ b/lib/libc/stdlib/strfmon.c
@@ -526,7 +526,6 @@ __format_grouped_double(double value, int *flags,
char *rslt;
char *avalue;
int avalue_size;
- char fmt[32];
size_t bufsize;
char *bufend;
@@ -567,14 +566,13 @@ __format_grouped_double(double value, int *flags,
left_prec += get_groups(left_prec, grouping);
/* convert to string */
- snprintf(fmt, sizeof(fmt), "%%%d.%df", left_prec + right_prec + 1,
- right_prec);
- avalue_size = asprintf(&avalue, fmt, value);
+ avalue_size = asprintf(&avalue, "%*.*f", left_prec + right_prec + 1,
+ right_prec, value);
if (avalue_size < 0)
return (NULL);
/* make sure that we've enough space for result string */
- bufsize = strlen(avalue)*2+1;
+ bufsize = avalue_size * 2 + 1;
rslt = calloc(1, bufsize);
if (rslt == NULL) {
free(avalue);
diff --git a/lib/libc/stdlib/tsearch.c b/lib/libc/stdlib/tsearch.c
index 149c2bb00f16..16bbf7c2587d 100644
--- a/lib/libc/stdlib/tsearch.c
+++ b/lib/libc/stdlib/tsearch.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tsearch.c,v 1.3 1999/09/16 11:45:37 lukem Exp $ */
+/* $NetBSD: tsearch.c,v 1.7 2012/06/25 22:32:45 abs Exp $ */
/*
* Tree search generalized from Knuth (6.2.2) Algorithm T just like
@@ -14,7 +14,7 @@
#include <sys/cdefs.h>
#if 0
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: tsearch.c,v 1.3 1999/09/16 11:45:37 lukem Exp $");
+__RCSID("$NetBSD: tsearch.c,v 1.7 2012/06/25 22:32:45 abs Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
__FBSDID("$FreeBSD$");
@@ -25,10 +25,8 @@ __FBSDID("$FreeBSD$");
/* find or insert datum into search tree */
void *
-tsearch(vkey, vrootp, compar)
- const void *vkey; /* key to be located */
- void **vrootp; /* address of tree root */
- int (*compar)(const void *, const void *);
+tsearch(const void *vkey, void **vrootp,
+ int (*compar)(const void *, const void *))
{
node_t *q;
node_t **rootp = (node_t **)vrootp;
@@ -50,8 +48,7 @@ tsearch(vkey, vrootp, compar)
q = malloc(sizeof(node_t)); /* T5: key not found */
if (q != 0) { /* make new node */
*rootp = q; /* link new node to old */
- /* LINTED const castaway ok */
- q->key = (void *)vkey; /* initialize new node */
+ q->key = __DECONST(void *, vkey);/* initialize new node */
q->llink = q->rlink = NULL;
}
return q;
diff --git a/lib/libc/stdlib/twalk.c b/lib/libc/stdlib/twalk.c
index 55f220f38750..7acee414d11f 100644
--- a/lib/libc/stdlib/twalk.c
+++ b/lib/libc/stdlib/twalk.c
@@ -1,4 +1,4 @@
-/* $NetBSD: twalk.c,v 1.1 1999/02/22 10:33:16 christos Exp $ */
+/* $NetBSD: twalk.c,v 1.4 2012/03/20 16:38:45 matt Exp $ */
/*
* Tree search generalized from Knuth (6.2.2) Algorithm T just like
@@ -14,7 +14,7 @@
#include <sys/cdefs.h>
#if 0
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: twalk.c,v 1.1 1999/02/22 10:33:16 christos Exp $");
+__RCSID("$NetBSD: twalk.c,v 1.4 2012/03/20 16:38:45 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
__FBSDID("$FreeBSD$");
@@ -23,15 +23,12 @@ __FBSDID("$FreeBSD$");
#include <search.h>
#include <stdlib.h>
-static void trecurse(const node_t *,
- void (*action)(const void *, VISIT, int), int level);
+typedef void (*cmp_fn_t)(const void *, VISIT, int);
/* Walk the nodes of a tree */
static void
-trecurse(root, action, level)
- const node_t *root; /* Root of the tree to be walked */
- void (*action)(const void *, VISIT, int);
- int level;
+trecurse(const node_t *root, /* Root of the tree to be walked */
+ cmp_fn_t action, int level)
{
if (root->llink == NULL && root->rlink == NULL)
@@ -49,9 +46,7 @@ trecurse(root, action, level)
/* Walk the nodes of a tree */
void
-twalk(vroot, action)
- const void *vroot; /* Root of the tree to be walked */
- void (*action)(const void *, VISIT, int);
+twalk(const void *vroot, cmp_fn_t action) /* Root of the tree to be walked */
{
if (vroot != NULL && action != NULL)
trecurse(vroot, action, 0);
diff --git a/lib/libc/stdtime/strftime.3 b/lib/libc/stdtime/strftime.3
index 0ed023b2cb3a..5847a6b7267d 100644
--- a/lib/libc/stdtime/strftime.3
+++ b/lib/libc/stdtime/strftime.3
@@ -248,7 +248,7 @@ function
conforms to
.St -isoC
with a lot of extensions including
-.Ql %C ,
+.Ql \&%C ,
.Ql \&%D ,
.Ql %E* ,
.Ql %e ,
diff --git a/lib/libc/stdtime/strftime.c b/lib/libc/stdtime/strftime.c
index 4ad0bc4352a9..898101136ea5 100644
--- a/lib/libc/stdtime/strftime.c
+++ b/lib/libc/stdtime/strftime.c
@@ -24,9 +24,9 @@
#ifndef NOID
static const char elsieid[] = "@(#)strftime.3 8.3";
/*
-** Based on the UCB version with the ID appearing below.
-** This is ANSIish only when "multibyte character == plain character".
-*/
+ * Based on the UCB version with the ID appearing below.
+ * This is ANSIish only when "multibyte character == plain character".
+ */
#endif /* !defined NOID */
#endif /* !defined lint */
@@ -46,10 +46,10 @@ __FBSDID("$FreeBSD$");
#include "timelocal.h"
static char * _add(const char *, char *, const char *);
-static char * _conv(int, const char *, char *, const char *);
+static char * _conv(int, const char *, char *, const char *, locale_t);
static char * _fmt(const char *, const struct tm *, char *, const char *,
int *, locale_t);
-static char * _yconv(int, int, int, int, char *, const char *);
+static char * _yconv(int, int, int, int, char *, const char *, locale_t);
extern char * tzname[];
@@ -57,32 +57,32 @@ extern char * tzname[];
#define YEAR_2000_NAME "CHECK_STRFTIME_FORMATS_FOR_TWO_DIGIT_YEARS"
#endif /* !defined YEAR_2000_NAME */
-#define IN_NONE 0
-#define IN_SOME 1
-#define IN_THIS 2
-#define IN_ALL 3
+#define IN_NONE 0
+#define IN_SOME 1
+#define IN_THIS 2
+#define IN_ALL 3
-#define PAD_DEFAULT 0
-#define PAD_LESS 1
-#define PAD_SPACE 2
-#define PAD_ZERO 3
+#define PAD_DEFAULT 0
+#define PAD_LESS 1
+#define PAD_SPACE 2
+#define PAD_ZERO 3
static const char fmt_padding[][4][5] = {
/* DEFAULT, LESS, SPACE, ZERO */
-#define PAD_FMT_MONTHDAY 0
-#define PAD_FMT_HMS 0
-#define PAD_FMT_CENTURY 0
-#define PAD_FMT_SHORTYEAR 0
-#define PAD_FMT_MONTH 0
-#define PAD_FMT_WEEKOFYEAR 0
-#define PAD_FMT_DAYOFMONTH 0
+#define PAD_FMT_MONTHDAY 0
+#define PAD_FMT_HMS 0
+#define PAD_FMT_CENTURY 0
+#define PAD_FMT_SHORTYEAR 0
+#define PAD_FMT_MONTH 0
+#define PAD_FMT_WEEKOFYEAR 0
+#define PAD_FMT_DAYOFMONTH 0
{ "%02d", "%d", "%2d", "%02d" },
-#define PAD_FMT_SDAYOFMONTH 1
-#define PAD_FMT_SHMS 1
+#define PAD_FMT_SDAYOFMONTH 1
+#define PAD_FMT_SHMS 1
{ "%2d", "%d", "%2d", "%02d" },
#define PAD_FMT_DAYOFYEAR 2
{ "%03d", "%d", "%3d", "%03d" },
-#define PAD_FMT_YEAR 3
+#define PAD_FMT_YEAR 3
{ "%04d", "%d", "%4d", "%04d" }
};
@@ -101,20 +101,20 @@ strftime_l(char * __restrict s, size_t maxsize, const char * __restrict format,
if (warn != IN_NONE && getenv(YEAR_2000_NAME) != NULL) {
(void) fprintf_l(stderr, loc, "\n");
if (format == NULL)
- (void) fprintf_l(stderr, loc, "NULL strftime format ");
+ (void) fputs("NULL strftime format ", stderr);
else (void) fprintf_l(stderr, loc, "strftime format \"%s\" ",
format);
- (void) fprintf_l(stderr, loc, "yields only two digits of years in ");
+ (void) fputs("yields only two digits of years in ", stderr);
if (warn == IN_SOME)
- (void) fprintf_l(stderr, loc, "some locales");
+ (void) fputs("some locales", stderr);
else if (warn == IN_THIS)
- (void) fprintf_l(stderr, loc, "the current locale");
- else (void) fprintf_l(stderr, loc, "all locales");
- (void) fprintf_l(stderr, loc, "\n");
+ (void) fputs("the current locale", stderr);
+ else (void) fputs("all locales", stderr);
+ (void) fputs("\n", stderr);
}
#endif /* !defined NO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU */
if (p == s + maxsize)
- return 0;
+ return (0);
*p = '\0';
return p - s;
}
@@ -176,14 +176,14 @@ label:
continue;
case 'C':
/*
- ** %C used to do a...
- ** _fmt("%a %b %e %X %Y", t);
- ** ...whereas now POSIX 1003.2 calls for
- ** something completely different.
- ** (ado, 1993-05-24)
- */
+ * %C used to do a...
+ * _fmt("%a %b %e %X %Y", t);
+ * ...whereas now POSIX 1003.2 calls for
+ * something completely different.
+ * (ado, 1993-05-24)
+ */
pt = _yconv(t->tm_year, TM_YEAR_BASE, 1, 0,
- pt, ptlim);
+ pt, ptlim, loc);
continue;
case 'c':
{
@@ -200,8 +200,9 @@ label:
pt = _fmt("%m/%d/%y", t, pt, ptlim, warnp, loc);
continue;
case 'd':
- pt = _conv(t->tm_mday, fmt_padding[PAD_FMT_DAYOFMONTH][PadIndex],
- pt, ptlim);
+ pt = _conv(t->tm_mday,
+ fmt_padding[PAD_FMT_DAYOFMONTH][PadIndex],
+ pt, ptlim, loc);
continue;
case 'E':
if (Ealternative || Oalternative)
@@ -210,54 +211,57 @@ label:
goto label;
case 'O':
/*
- ** C99 locale modifiers.
- ** The sequences
- ** %Ec %EC %Ex %EX %Ey %EY
- ** %Od %oe %OH %OI %Om %OM
- ** %OS %Ou %OU %OV %Ow %OW %Oy
- ** are supposed to provide alternate
- ** representations.
- **
- ** FreeBSD extension
- ** %OB
- */
+ * C99 locale modifiers.
+ * The sequences
+ * %Ec %EC %Ex %EX %Ey %EY
+ * %Od %oe %OH %OI %Om %OM
+ * %OS %Ou %OU %OV %Ow %OW %Oy
+ * are supposed to provide alternate
+ * representations.
+ *
+ * FreeBSD extension
+ * %OB
+ */
if (Ealternative || Oalternative)
break;
Oalternative++;
goto label;
case 'e':
pt = _conv(t->tm_mday,
- fmt_padding[PAD_FMT_SDAYOFMONTH][PadIndex], pt, ptlim);
+ fmt_padding[PAD_FMT_SDAYOFMONTH][PadIndex],
+ pt, ptlim, loc);
continue;
case 'F':
pt = _fmt("%Y-%m-%d", t, pt, ptlim, warnp, loc);
continue;
case 'H':
pt = _conv(t->tm_hour, fmt_padding[PAD_FMT_HMS][PadIndex],
- pt, ptlim);
+ pt, ptlim, loc);
continue;
case 'I':
pt = _conv((t->tm_hour % 12) ?
(t->tm_hour % 12) : 12,
- fmt_padding[PAD_FMT_HMS][PadIndex], pt, ptlim);
+ fmt_padding[PAD_FMT_HMS][PadIndex],
+ pt, ptlim, loc);
continue;
case 'j':
pt = _conv(t->tm_yday + 1,
- fmt_padding[PAD_FMT_DAYOFYEAR][PadIndex], pt, ptlim);
+ fmt_padding[PAD_FMT_DAYOFYEAR][PadIndex],
+ pt, ptlim, loc);
continue;
case 'k':
/*
- ** This used to be...
- ** _conv(t->tm_hour % 12 ?
- ** t->tm_hour % 12 : 12, 2, ' ');
- ** ...and has been changed to the below to
- ** match SunOS 4.1.1 and Arnold Robbins'
- ** strftime version 3.0. That is, "%k" and
- ** "%l" have been swapped.
- ** (ado, 1993-05-24)
- */
+ * This used to be...
+ * _conv(t->tm_hour % 12 ?
+ * t->tm_hour % 12 : 12, 2, ' ');
+ * ...and has been changed to the below to
+ * match SunOS 4.1.1 and Arnold Robbins'
+ * strftime version 3.0. That is, "%k" and
+ * "%l" have been swapped.
+ * (ado, 1993-05-24)
+ */
pt = _conv(t->tm_hour, fmt_padding[PAD_FMT_SHMS][PadIndex],
- pt, ptlim);
+ pt, ptlim, loc);
continue;
#ifdef KITCHEN_SINK
case 'K':
@@ -269,33 +273,34 @@ label:
#endif /* defined KITCHEN_SINK */
case 'l':
/*
- ** This used to be...
- ** _conv(t->tm_hour, 2, ' ');
- ** ...and has been changed to the below to
- ** match SunOS 4.1.1 and Arnold Robbin's
- ** strftime version 3.0. That is, "%k" and
- ** "%l" have been swapped.
- ** (ado, 1993-05-24)
- */
+ * This used to be...
+ * _conv(t->tm_hour, 2, ' ');
+ * ...and has been changed to the below to
+ * match SunOS 4.1.1 and Arnold Robbin's
+ * strftime version 3.0. That is, "%k" and
+ * "%l" have been swapped.
+ * (ado, 1993-05-24)
+ */
pt = _conv((t->tm_hour % 12) ?
(t->tm_hour % 12) : 12,
- fmt_padding[PAD_FMT_SHMS][PadIndex], pt, ptlim);
+ fmt_padding[PAD_FMT_SHMS][PadIndex],
+ pt, ptlim, loc);
continue;
case 'M':
pt = _conv(t->tm_min, fmt_padding[PAD_FMT_HMS][PadIndex],
- pt, ptlim);
+ pt, ptlim, loc);
continue;
case 'm':
pt = _conv(t->tm_mon + 1,
- fmt_padding[PAD_FMT_MONTH][PadIndex], pt, ptlim);
+ fmt_padding[PAD_FMT_MONTH][PadIndex],
+ pt, ptlim, loc);
continue;
case 'n':
pt = _add("\n", pt, ptlim);
continue;
case 'p':
pt = _add((t->tm_hour >= (HOURSPERDAY / 2)) ?
- tptr->pm :
- tptr->am,
+ tptr->pm : tptr->am,
pt, ptlim);
continue;
case 'R':
@@ -307,7 +312,7 @@ label:
continue;
case 'S':
pt = _conv(t->tm_sec, fmt_padding[PAD_FMT_HMS][PadIndex],
- pt, ptlim);
+ pt, ptlim, loc);
continue;
case 's':
{
@@ -319,9 +324,9 @@ label:
tm = *t;
mkt = mktime(&tm);
if (TYPE_SIGNED(time_t))
- (void) sprintf(buf, "%ld",
+ (void) sprintf_l(buf, loc, "%ld",
(long) mkt);
- else (void) sprintf(buf, "%lu",
+ else (void) sprintf_l(buf, loc, "%lu",
(unsigned long) mkt);
pt = _add(buf, pt, ptlim);
}
@@ -335,40 +340,41 @@ label:
case 'U':
pt = _conv((t->tm_yday + DAYSPERWEEK -
t->tm_wday) / DAYSPERWEEK,
- fmt_padding[PAD_FMT_WEEKOFYEAR][PadIndex], pt, ptlim);
+ fmt_padding[PAD_FMT_WEEKOFYEAR][PadIndex],
+ pt, ptlim, loc);
continue;
case 'u':
/*
- ** From Arnold Robbins' strftime version 3.0:
- ** "ISO 8601: Weekday as a decimal number
- ** [1 (Monday) - 7]"
- ** (ado, 1993-05-24)
- */
+ * From Arnold Robbins' strftime version 3.0:
+ * "ISO 8601: Weekday as a decimal number
+ * [1 (Monday) - 7]"
+ * (ado, 1993-05-24)
+ */
pt = _conv((t->tm_wday == 0) ?
DAYSPERWEEK : t->tm_wday,
- "%d", pt, ptlim);
+ "%d", pt, ptlim, loc);
continue;
case 'V': /* ISO 8601 week number */
case 'G': /* ISO 8601 year (four digits) */
case 'g': /* ISO 8601 year (two digits) */
/*
-** From Arnold Robbins' strftime version 3.0: "the week number of the
-** year (the first Monday as the first day of week 1) as a decimal number
-** (01-53)."
-** (ado, 1993-05-24)
-**
-** From "http://www.ft.uni-erlangen.de/~mskuhn/iso-time.html" by Markus Kuhn:
-** "Week 01 of a year is per definition the first week which has the
-** Thursday in this year, which is equivalent to the week which contains
-** the fourth day of January. In other words, the first week of a new year
-** is the week which has the majority of its days in the new year. Week 01
-** might also contain days from the previous year and the week before week
-** 01 of a year is the last week (52 or 53) of the previous year even if
-** it contains days from the new year. A week starts with Monday (day 1)
-** and ends with Sunday (day 7). For example, the first week of the year
-** 1997 lasts from 1996-12-30 to 1997-01-05..."
-** (ado, 1996-01-02)
-*/
+ * From Arnold Robbins' strftime version 3.0: "the week number of the
+ * year (the first Monday as the first day of week 1) as a decimal number
+ * (01-53)."
+ * (ado, 1993-05-24)
+ *
+ * From "http://www.ft.uni-erlangen.de/~mskuhn/iso-time.html" by Markus Kuhn:
+ * "Week 01 of a year is per definition the first week which has the
+ * Thursday in this year, which is equivalent to the week which contains
+ * the fourth day of January. In other words, the first week of a new year
+ * is the week which has the majority of its days in the new year. Week 01
+ * might also contain days from the previous year and the week before week
+ * 01 of a year is the last week (52 or 53) of the previous year even if
+ * it contains days from the new year. A week starts with Monday (day 1)
+ * and ends with Sunday (day 7). For example, the first week of the year
+ * 1997 lasts from 1996-12-30 to 1997-01-05..."
+ * (ado, 1996-01-02)
+ */
{
int year;
int base;
@@ -389,15 +395,15 @@ label:
DAYSPERLYEAR :
DAYSPERNYEAR;
/*
- ** What yday (-3 ... 3) does
- ** the ISO year begin on?
- */
+ * What yday (-3 ... 3) does
+ * the ISO year begin on?
+ */
bot = ((yday + 11 - wday) %
DAYSPERWEEK) - 3;
/*
- ** What yday does the NEXT
- ** ISO year begin on?
- */
+ * What yday does the NEXT
+ * ISO year begin on?
+ */
top = bot -
(len % DAYSPERWEEK);
if (top < -3)
@@ -427,21 +433,21 @@ label:
#endif /* defined XPG4_1994_04_09 */
if (*format == 'V')
pt = _conv(w, fmt_padding[PAD_FMT_WEEKOFYEAR][PadIndex],
- pt, ptlim);
+ pt, ptlim, loc);
else if (*format == 'g') {
*warnp = IN_ALL;
pt = _yconv(year, base, 0, 1,
- pt, ptlim);
+ pt, ptlim, loc);
} else pt = _yconv(year, base, 1, 1,
- pt, ptlim);
+ pt, ptlim, loc);
}
continue;
case 'v':
/*
- ** From Arnold Robbins' strftime version 3.0:
- ** "date as dd-bbb-YYYY"
- ** (ado, 1993-05-24)
- */
+ * From Arnold Robbins' strftime version 3.0:
+ * "date as dd-bbb-YYYY"
+ * (ado, 1993-05-24)
+ */
pt = _fmt("%e-%b-%Y", t, pt, ptlim, warnp, loc);
continue;
case 'W':
@@ -449,10 +455,11 @@ label:
(t->tm_wday ?
(t->tm_wday - 1) :
(DAYSPERWEEK - 1))) / DAYSPERWEEK,
- fmt_padding[PAD_FMT_WEEKOFYEAR][PadIndex], pt, ptlim);
+ fmt_padding[PAD_FMT_WEEKOFYEAR][PadIndex],
+ pt, ptlim, loc);
continue;
case 'w':
- pt = _conv(t->tm_wday, "%d", pt, ptlim);
+ pt = _conv(t->tm_wday, "%d", pt, ptlim, loc);
continue;
case 'X':
pt = _fmt(tptr->X_fmt, t, pt, ptlim, warnp, loc);
@@ -471,11 +478,11 @@ label:
case 'y':
*warnp = IN_ALL;
pt = _yconv(t->tm_year, TM_YEAR_BASE, 0, 1,
- pt, ptlim);
+ pt, ptlim, loc);
continue;
case 'Y':
pt = _yconv(t->tm_year, TM_YEAR_BASE, 1, 1,
- pt, ptlim);
+ pt, ptlim, loc);
continue;
case 'Z':
#ifdef TM_ZONE
@@ -487,10 +494,10 @@ label:
pt = _add(tzname[t->tm_isdst != 0],
pt, ptlim);
/*
- ** C99 says that %Z must be replaced by the
- ** empty string if the time zone is not
- ** determinable.
- */
+ * C99 says that %Z must be replaced by the
+ * empty string if the time zone is not
+ * determinable.
+ */
continue;
case 'z':
{
@@ -503,24 +510,24 @@ label:
diff = t->TM_GMTOFF;
#else /* !defined TM_GMTOFF */
/*
- ** C99 says that the UTC offset must
- ** be computed by looking only at
- ** tm_isdst. This requirement is
- ** incorrect, since it means the code
- ** must rely on magic (in this case
- ** altzone and timezone), and the
- ** magic might not have the correct
- ** offset. Doing things correctly is
- ** tricky and requires disobeying C99;
- ** see GNU C strftime for details.
- ** For now, punt and conform to the
- ** standard, even though it's incorrect.
- **
- ** C99 says that %z must be replaced by the
- ** empty string if the time zone is not
- ** determinable, so output nothing if the
- ** appropriate variables are not available.
- */
+ * C99 says that the UTC offset must
+ * be computed by looking only at
+ * tm_isdst. This requirement is
+ * incorrect, since it means the code
+ * must rely on magic (in this case
+ * altzone and timezone), and the
+ * magic might not have the correct
+ * offset. Doing things correctly is
+ * tricky and requires disobeying C99;
+ * see GNU C strftime for details.
+ * For now, punt and conform to the
+ * standard, even though it's incorrect.
+ *
+ * C99 says that %z must be replaced by the
+ * empty string if the time zone is not
+ * determinable, so output nothing if the
+ * appropriate variables are not available.
+ */
if (t->tm_isdst == 0)
#ifdef USG_COMPAT
diff = -timezone;
@@ -537,13 +544,15 @@ label:
if (diff < 0) {
sign = "-";
diff = -diff;
- } else sign = "+";
+ } else
+ sign = "+";
pt = _add(sign, pt, ptlim);
diff /= SECSPERMIN;
diff = (diff / MINSPERHOUR) * 100 +
(diff % MINSPERHOUR);
pt = _conv(diff,
- fmt_padding[PAD_FMT_YEAR][PadIndex], pt, ptlim);
+ fmt_padding[PAD_FMT_YEAR][PadIndex],
+ pt, ptlim, loc);
}
continue;
case '+':
@@ -567,10 +576,10 @@ label:
goto label;
case '%':
/*
- ** X311J/88-090 (4.12.3.5): if conversion char is
- ** undefined, behavior is undefined. Print out the
- ** character itself as printf(3) also does.
- */
+ * X311J/88-090 (4.12.3.5): if conversion char is
+ * undefined, behavior is undefined. Print out the
+ * character itself as printf(3) also does.
+ */
default:
break;
}
@@ -579,19 +588,20 @@ label:
break;
*pt++ = *format;
}
- return pt;
+ return (pt);
}
static char *
-_conv(n, format, pt, ptlim)
+_conv(n, format, pt, ptlim, loc)
const int n;
const char * const format;
char * const pt;
const char * const ptlim;
+locale_t loc;
{
char buf[INT_STRLEN_MAXIMUM(int) + 1];
- (void) sprintf(buf, format, n);
+ (void) sprintf_l(buf, loc, format, n);
return _add(buf, pt, ptlim);
}
@@ -603,30 +613,31 @@ const char * const ptlim;
{
while (pt < ptlim && (*pt = *str++) != '\0')
++pt;
- return pt;
+ return (pt);
}
/*
-** POSIX and the C Standard are unclear or inconsistent about
-** what %C and %y do if the year is negative or exceeds 9999.
-** Use the convention that %C concatenated with %y yields the
-** same output as %Y, and that %Y contains at least 4 bytes,
-** with more only if necessary.
-*/
+ * POSIX and the C Standard are unclear or inconsistent about
+ * what %C and %y do if the year is negative or exceeds 9999.
+ * Use the convention that %C concatenated with %y yields the
+ * same output as %Y, and that %Y contains at least 4 bytes,
+ * with more only if necessary.
+ */
static char *
-_yconv(a, b, convert_top, convert_yy, pt, ptlim)
+_yconv(a, b, convert_top, convert_yy, pt, ptlim, loc)
const int a;
const int b;
const int convert_top;
const int convert_yy;
char * pt;
const char * const ptlim;
+locale_t loc;
{
register int lead;
register int trail;
-#define DIVISOR 100
+#define DIVISOR 100
trail = a % DIVISOR + b % DIVISOR;
lead = a / DIVISOR + b / DIVISOR + trail / DIVISOR;
trail %= DIVISOR;
@@ -640,9 +651,10 @@ const char * const ptlim;
if (convert_top) {
if (lead == 0 && trail < 0)
pt = _add("-0", pt, ptlim);
- else pt = _conv(lead, "%02d", pt, ptlim);
+ else pt = _conv(lead, "%02d", pt, ptlim, loc);
}
if (convert_yy)
- pt = _conv(((trail < 0) ? -trail : trail), "%02d", pt, ptlim);
- return pt;
+ pt = _conv(((trail < 0) ? -trail : trail), "%02d", pt,
+ ptlim, loc);
+ return (pt);
}
diff --git a/lib/libc/stdtime/strptime.c b/lib/libc/stdtime/strptime.c
index fb94dcd0df43..2333ab47e76e 100644
--- a/lib/libc/stdtime/strptime.c
+++ b/lib/libc/stdtime/strptime.c
@@ -1,25 +1,6 @@
-/*
- * Powerdog Industries kindly requests feedback from anyone modifying
- * this function:
- *
- * Date: Thu, 05 Jun 1997 23:17:17 -0400
- * From: Kevin Ruddy <kevin.ruddy@powerdog.com>
- * To: James FitzGibbon <james@nexis.net>
- * Subject: Re: Use of your strptime(3) code (fwd)
- *
- * The reason for the "no mod" clause was so that modifications would
- * come back and we could integrate them and reissue so that a wider
- * audience could use it (thereby spreading the wealth). This has
- * made it possible to get strptime to work on many operating systems.
- * I'm not sure why that's "plain unacceptable" to the FreeBSD team.
- *
- * Anyway, you can change it to "with or without modification" as
- * you see fit. Enjoy.
- *
- * Kevin Ruddy
- * Powerdog Industries, Inc.
- */
-/*
+/*-
+ * Copyright (c) 2014 Gary Mills
+ * Copyright 2011, Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 1994 Powerdog Industries. All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
@@ -36,12 +17,6 @@
* 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 Powerdog Industries.
- * 4. The name of Powerdog Industries may not be used to endorse or
- * promote products derived from this software without specific prior
- * written permission.
*
* THIS SOFTWARE IS PROVIDED BY POWERDOG INDUSTRIES ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -54,6 +29,10 @@
* 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.
+ *
+ * The views and conclusions contained in the software and documentation
+ * are those of the authors and should not be interpreted as representing
+ * official policies, either expressed or implied, of Powerdog Industries.
*/
#include <sys/cdefs.h>
@@ -79,7 +58,7 @@ __FBSDID("$FreeBSD$");
static char * _strptime(const char *, const char *, struct tm *, int *, locale_t);
-#define asizeof(a) (sizeof (a) / sizeof ((a)[0]))
+#define asizeof(a) (sizeof (a) / sizeof ((a)[0]))
static char *
_strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp,
@@ -87,8 +66,7 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp,
{
char c;
const char *ptr;
- int i,
- len;
+ int i, len;
int Ealternative, Oalternative;
struct lc_time_T *tptr = __get_current_time_locale(locale);
@@ -105,7 +83,7 @@ _strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp,
isspace_l((unsigned char)*buf, locale))
buf++;
else if (c != *buf++)
- return 0;
+ return (NULL);
continue;
}
@@ -117,18 +95,18 @@ label:
case 0:
case '%':
if (*buf++ != '%')
- return 0;
+ return (NULL);
break;
case '+':
buf = _strptime(buf, tptr->date_fmt, tm, GMTp, locale);
- if (buf == 0)
- return 0;
+ if (buf == NULL)
+ return (NULL);
break;
case 'C':
if (!isdigit_l((unsigned char)*buf, locale))
- return 0;
+ return (NULL);
/* XXX This will break for 3-digit centuries. */
len = 2;
@@ -139,21 +117,21 @@ label:
len--;
}
if (i < 19)
- return 0;
+ return (NULL);
tm->tm_year = i * 100 - 1900;
break;
case 'c':
buf = _strptime(buf, tptr->c_fmt, tm, GMTp, locale);
- if (buf == 0)
- return 0;
+ if (buf == NULL)
+ return (NULL);
break;
case 'D':
buf = _strptime(buf, "%m/%d/%y", tm, GMTp, locale);
- if (buf == 0)
- return 0;
+ if (buf == NULL)
+ return (NULL);
break;
case 'E':
@@ -170,43 +148,43 @@ label:
case 'F':
buf = _strptime(buf, "%Y-%m-%d", tm, GMTp, locale);
- if (buf == 0)
- return 0;
+ if (buf == NULL)
+ return (NULL);
break;
case 'R':
buf = _strptime(buf, "%H:%M", tm, GMTp, locale);
- if (buf == 0)
- return 0;
+ if (buf == NULL)
+ return (NULL);
break;
case 'r':
buf = _strptime(buf, tptr->ampm_fmt, tm, GMTp, locale);
- if (buf == 0)
- return 0;
+ if (buf == NULL)
+ return (NULL);
break;
case 'T':
buf = _strptime(buf, "%H:%M:%S", tm, GMTp, locale);
- if (buf == 0)
- return 0;
+ if (buf == NULL)
+ return (NULL);
break;
case 'X':
buf = _strptime(buf, tptr->X_fmt, tm, GMTp, locale);
- if (buf == 0)
- return 0;
+ if (buf == NULL)
+ return (NULL);
break;
case 'x':
buf = _strptime(buf, tptr->x_fmt, tm, GMTp, locale);
- if (buf == 0)
- return 0;
+ if (buf == NULL)
+ return (NULL);
break;
case 'j':
if (!isdigit_l((unsigned char)*buf, locale))
- return 0;
+ return (NULL);
len = 3;
for (i = 0; len && *buf != 0 &&
@@ -216,7 +194,7 @@ label:
len--;
}
if (i < 1 || i > 366)
- return 0;
+ return (NULL);
tm->tm_yday = i - 1;
break;
@@ -228,7 +206,7 @@ label:
break;
if (!isdigit_l((unsigned char)*buf, locale))
- return 0;
+ return (NULL);
len = 2;
for (i = 0; len && *buf != 0 &&
@@ -240,19 +218,14 @@ label:
if (c == 'M') {
if (i > 59)
- return 0;
+ return (NULL);
tm->tm_min = i;
} else {
if (i > 60)
- return 0;
+ return (NULL);
tm->tm_sec = i;
}
- if (*buf != 0 &&
- isspace_l((unsigned char)*buf, locale))
- while (*ptr != 0 &&
- !isspace_l((unsigned char)*ptr, locale))
- ptr++;
break;
case 'H':
@@ -268,7 +241,7 @@ label:
* digits if used incorrectly.
*/
if (!isdigit_l((unsigned char)*buf, locale))
- return 0;
+ return (NULL);
len = 2;
for (i = 0; len && *buf != 0 &&
@@ -279,17 +252,12 @@ label:
}
if (c == 'H' || c == 'k') {
if (i > 23)
- return 0;
+ return (NULL);
} else if (i > 12)
- return 0;
+ return (NULL);
tm->tm_hour = i;
- if (*buf != 0 &&
- isspace_l((unsigned char)*buf, locale))
- while (*ptr != 0 &&
- !isspace_l((unsigned char)*ptr, locale))
- ptr++;
break;
case 'p':
@@ -300,7 +268,7 @@ label:
len = strlen(tptr->am);
if (strncasecmp_l(buf, tptr->am, len, locale) == 0) {
if (tm->tm_hour > 12)
- return 0;
+ return (NULL);
if (tm->tm_hour == 12)
tm->tm_hour = 0;
buf += len;
@@ -310,14 +278,14 @@ label:
len = strlen(tptr->pm);
if (strncasecmp_l(buf, tptr->pm, len, locale) == 0) {
if (tm->tm_hour > 12)
- return 0;
+ return (NULL);
if (tm->tm_hour != 12)
tm->tm_hour += 12;
buf += len;
break;
}
- return 0;
+ return (NULL);
case 'A':
case 'a':
@@ -332,7 +300,7 @@ label:
break;
}
if (i == asizeof(tptr->weekday))
- return 0;
+ return (NULL);
tm->tm_wday = i;
buf += len;
@@ -347,7 +315,7 @@ label:
* range for now.
*/
if (!isdigit_l((unsigned char)*buf, locale))
- return 0;
+ return (NULL);
len = 2;
for (i = 0; len && *buf != 0 &&
@@ -357,44 +325,43 @@ label:
len--;
}
if (i > 53)
- return 0;
+ return (NULL);
- if (*buf != 0 &&
- isspace_l((unsigned char)*buf, locale))
- while (*ptr != 0 &&
- !isspace_l((unsigned char)*ptr, locale))
- ptr++;
break;
case 'w':
if (!isdigit_l((unsigned char)*buf, locale))
- return 0;
+ return (NULL);
i = *buf - '0';
if (i > 6)
- return 0;
+ return (NULL);
tm->tm_wday = i;
- if (*buf != 0 &&
- isspace_l((unsigned char)*buf, locale))
- while (*ptr != 0 &&
- !isspace_l((unsigned char)*ptr, locale))
- ptr++;
break;
- case 'd':
case 'e':
/*
- * The %e specifier is explicitly documented as not
- * being zero-padded but there is no harm in allowing
+ * With %e format, our strftime(3) adds a blank space
+ * before single digits.
+ */
+ if (*buf != 0 &&
+ isspace_l((unsigned char)*buf, locale))
+ buf++;
+ /* FALLTHROUGH */
+ case 'd':
+ /*
+ * The %e specifier was once explicitly documented as
+ * not being zero-padded but was later changed to
+ * equivalent to %d. There is no harm in allowing
* such padding.
*
* XXX The %e specifier may gobble one too many
* digits if used incorrectly.
*/
if (!isdigit_l((unsigned char)*buf, locale))
- return 0;
+ return (NULL);
len = 2;
for (i = 0; len && *buf != 0 &&
@@ -404,15 +371,10 @@ label:
len--;
}
if (i > 31)
- return 0;
+ return (NULL);
tm->tm_mday = i;
- if (*buf != 0 &&
- isspace_l((unsigned char)*buf, locale))
- while (*ptr != 0 &&
- !isspace_l((unsigned char)*ptr, locale))
- ptr++;
break;
case 'B':
@@ -447,7 +409,7 @@ label:
}
}
if (i == asizeof(tptr->month))
- return 0;
+ return (NULL);
tm->tm_mon = i;
buf += len;
@@ -455,7 +417,7 @@ label:
case 'm':
if (!isdigit_l((unsigned char)*buf, locale))
- return 0;
+ return (NULL);
len = 2;
for (i = 0; len && *buf != 0 &&
@@ -465,15 +427,10 @@ label:
len--;
}
if (i < 1 || i > 12)
- return 0;
+ return (NULL);
tm->tm_mon = i - 1;
- if (*buf != 0 &&
- isspace_l((unsigned char)*buf, locale))
- while (*ptr != 0 &&
- !isspace_l((unsigned char)*ptr, locale))
- ptr++;
break;
case 's':
@@ -488,7 +445,7 @@ label:
n = strtol_l(buf, &cp, 10, locale);
if (errno == ERANGE || (long)(t = n) != n) {
errno = sverrno;
- return 0;
+ return (NULL);
}
errno = sverrno;
buf = cp;
@@ -504,7 +461,7 @@ label:
break;
if (!isdigit_l((unsigned char)*buf, locale))
- return 0;
+ return (NULL);
len = (c == 'Y') ? 4 : 2;
for (i = 0; len && *buf != 0 &&
@@ -518,15 +475,10 @@ label:
if (c == 'y' && i < 69)
i += 100;
if (i < 0)
- return 0;
+ return (NULL);
tm->tm_year = i;
- if (*buf != 0 &&
- isspace_l((unsigned char)*buf, locale))
- while (*ptr != 0 &&
- !isspace_l((unsigned char)*ptr, locale))
- ptr++;
break;
case 'Z':
@@ -549,7 +501,7 @@ label:
} else if (0 == strcmp(zonestr, tzname[1])) {
tm->tm_isdst = 1;
} else {
- return 0;
+ return (NULL);
}
buf += cp - buf;
}
@@ -564,7 +516,7 @@ label:
if (*buf == '-')
sign = -1;
else
- return 0;
+ return (NULL);
}
buf++;
@@ -575,7 +527,7 @@ label:
i += *buf - '0';
buf++;
} else
- return 0;
+ return (NULL);
}
tm->tm_hour -= sign * (i / 100);
@@ -583,9 +535,15 @@ label:
*GMTp = 1;
}
break;
+
+ case 'n':
+ case 't':
+ while (isspace_l((unsigned char)*buf, locale))
+ buf++;
+ break;
}
}
- return (char *)buf;
+ return ((char *)buf);
}
diff --git a/lib/libc/stdtime/timelocal.c b/lib/libc/stdtime/timelocal.c
index 3d9d096c7492..362cec3958ce 100644
--- a/lib/libc/stdtime/timelocal.c
+++ b/lib/libc/stdtime/timelocal.c
@@ -46,7 +46,7 @@ struct xlocale_time {
struct xlocale_time __xlocale_global_time;
-#define LCTIME_SIZE (sizeof(struct lc_time_T) / sizeof(char *))
+#define LCTIME_SIZE (sizeof(struct lc_time_T) / sizeof(char *))
static const struct lc_time_T _C_time_locale = {
{
diff --git a/lib/libc/string/Makefile.inc b/lib/libc/string/Makefile.inc
index 9ad5cbb0c18e..731f4fc90415 100644
--- a/lib/libc/string/Makefile.inc
+++ b/lib/libc/string/Makefile.inc
@@ -30,7 +30,7 @@ SYM_MAPS+= ${LIBC_SRCTOP}/string/Symbol.map
MAN+= bcmp.3 bcopy.3 bstring.3 bzero.3 ffs.3 index.3 memccpy.3 memchr.3 \
memcmp.3 memcpy.3 memmem.3 memmove.3 memset.3 strcasecmp.3 strcat.3 \
- strchr.3 strcmp.3 strcoll.3 strcpy.3 strcspn.3 strdup.3 strerror.3 \
+ strchr.3 strcmp.3 strcoll.3 strcpy.3 strdup.3 strerror.3 \
string.3 strlcpy.3 strlen.3 strmode.3 strpbrk.3 strsep.3 \
strspn.3 strstr.3 strtok.3 strxfrm.3 swab.3 wcscoll.3 wcstok.3 \
wcswidth.3 wcsxfrm.3 wmemchr.3
@@ -60,6 +60,7 @@ MLINKS+=strerror.3 perror.3 \
strerror.3 sys_nerr.3
MLINKS+=strlcpy.3 strlcat.3
MLINKS+=strlen.3 strnlen.3
+MLINKS+=strspn.3 strcspn.3
MLINKS+=strstr.3 strcasestr.3 \
strstr.3 strnstr.3 \
strstr.3 strcasestr_l.3
diff --git a/lib/libc/string/memmem.3 b/lib/libc/string/memmem.3
index 73c267c14c10..31cdf77135e2 100644
--- a/lib/libc/string/memmem.3
+++ b/lib/libc/string/memmem.3
@@ -80,7 +80,7 @@ The
function first appeared in
.Fx 6.0 .
.Sh AUTHORS
-.An Pascal Gloor Aq pascal.gloor@spale.com
+.An Pascal Gloor Aq Mt pascal.gloor@spale.com
.Sh BUGS
This function was broken in Linux libc up to and including version 5.0.9
and in GNU libc prior to version 2.1.
diff --git a/lib/libc/string/strcasecmp.3 b/lib/libc/string/strcasecmp.3
index 1c8504214f46..4a13cc41d934 100644
--- a/lib/libc/string/strcasecmp.3
+++ b/lib/libc/string/strcasecmp.3
@@ -30,7 +30,7 @@
.\" @(#)strcasecmp.3 8.1 (Berkeley) 6/9/93
.\" $FreeBSD$
.\"
-.Dd June 9, 1993
+.Dd May 29, 2014
.Dt STRCASECMP 3
.Os
.Sh NAME
@@ -45,7 +45,7 @@
.Fn strcasecmp "const char *s1" "const char *s2"
.Ft int
.Fn strncasecmp "const char *s1" "const char *s2" "size_t len"
-.In string.h
+.In strings.h
.In xlocale.h
.Ft int
.Fn strcasecmp_l "const char *s1" "const char *s2" "locale_t loc"
diff --git a/lib/libc/string/strcspn.3 b/lib/libc/string/strcspn.3
deleted file mode 100644
index 0331ca1b60c8..000000000000
--- a/lib/libc/string/strcspn.3
+++ /dev/null
@@ -1,88 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)strcspn.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd June 4, 1993
-.Dt STRCSPN 3
-.Os
-.Sh NAME
-.Nm strcspn
-.Nd span the complement of a string
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In string.h
-.Ft size_t
-.Fn strcspn "const char *s" "const char *charset"
-.Sh DESCRIPTION
-The
-.Fn strcspn
-function
-spans the initial part of the null-terminated string
-.Fa s
-as long as the characters from
-.Fa s
-do not occur in string
-.Fa charset
-(it
-spans the
-.Em complement
-of
-.Fa charset ) .
-In other words, it computes the string array index in
-.Fa s
-of the first character of
-.Fa s
-which is also in
-.Fa charset ,
-else the index of the first null character.
-.Sh RETURN VALUES
-The
-.Fn strcspn
-function
-returns the number of characters spanned.
-.Sh SEE ALSO
-.Xr memchr 3 ,
-.Xr strchr 3 ,
-.Xr strpbrk 3 ,
-.Xr strrchr 3 ,
-.Xr strsep 3 ,
-.Xr strspn 3 ,
-.Xr strstr 3 ,
-.Xr strtok 3
-.Sh STANDARDS
-The
-.Fn strcspn
-function
-conforms to
-.St -isoC .
diff --git a/lib/libc/string/strerror.3 b/lib/libc/string/strerror.3
index 50b155530017..a47494fd0784 100644
--- a/lib/libc/string/strerror.3
+++ b/lib/libc/string/strerror.3
@@ -172,7 +172,7 @@ The
function was implemented in
.Fx 4.4
by
-.An Wes Peters Aq wes@FreeBSD.org .
+.An Wes Peters Aq Mt wes@FreeBSD.org .
.Sh BUGS
The
.Fn strerror
diff --git a/lib/libc/string/strspn.3 b/lib/libc/string/strspn.3
index 2ba6a6b5575a..542b190f6412 100644
--- a/lib/libc/string/strspn.3
+++ b/lib/libc/string/strspn.3
@@ -32,11 +32,12 @@
.\" @(#)strspn.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd June 4, 1993
+.Dd May 24, 2014
.Dt STRSPN 3
.Os
.Sh NAME
-.Nm strspn
+.Nm strspn ,
+.Nm strcspn
.Nd span a string
.Sh LIBRARY
.Lb libc
@@ -44,6 +45,8 @@
.In string.h
.Ft size_t
.Fn strspn "const char *s" "const char *charset"
+.Ft size_t
+.Fn strcspn "const char *s" "const char *charset"
.Sh DESCRIPTION
The
.Fn strspn
@@ -54,22 +57,44 @@ as long as the characters from
.Fa s
occur in the null-terminated string
.Fa charset .
-In other words, it computes the string array index in
-.Fa s
+In other words, it computes the string array index
of the first character of
.Fa s
which is not in
.Fa charset ,
else the index of the first null character.
+.Pp
+The
+.Fn strcspn
+function
+spans the initial part of the null-terminated string
+.Fa s
+as long as the characters from
+.Fa s
+.Sy do not
+occur in the null-terminated string
+.Fa charset
+.Po it spans the
+.Sy complement
+of
+.Fa charset
+.Pc .
+In other words, it computes the string array index
+of the first character of
+.Fa s
+which is also in
+.Fa charset ,
+else the index of the first null character.
.Sh RETURN VALUES
The
.Fn strspn
-function
-returns the number of characters spanned.
+and
+.Fn strcspn
+functions
+return the number of characters spanned.
.Sh SEE ALSO
.Xr memchr 3 ,
.Xr strchr 3 ,
-.Xr strcspn 3 ,
.Xr strpbrk 3 ,
.Xr strrchr 3 ,
.Xr strsep 3 ,
@@ -79,6 +104,8 @@ returns the number of characters spanned.
.Sh STANDARDS
The
.Fn strspn
-function
-conforms to
+and
+.Fn strcspn
+functions
+conform to
.St -isoC .
diff --git a/lib/libc/string/strtok.3 b/lib/libc/string/strtok.3
index 97a8b156b929..78c22655d4ac 100644
--- a/lib/libc/string/strtok.3
+++ b/lib/libc/string/strtok.3
@@ -150,9 +150,8 @@ function
conforms to
.St -isoC .
.Sh AUTHORS
-.An Wes Peters ,
-Softweyr LLC:
-.Aq wes@softweyr.com
+.An Wes Peters Aq Mt wes@softweyr.com ,
+Softweyr LLC
.Pp
Based on the
.Fx 3.0
diff --git a/lib/libc/sys/abort2.2 b/lib/libc/sys/abort2.2
index 4698c7283846..ca31d74267f3 100644
--- a/lib/libc/sys/abort2.2
+++ b/lib/libc/sys/abort2.2
@@ -108,6 +108,6 @@ system call first appeared in
The
.Fn abort2
system call was designed by
-.An "Poul-Henning Kamp" Aq phk@FreeBSD.org .
+.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org .
It was implemented by
-.An "Wojciech A. Koszek" Aq dunstan@freebsd.czest.pl .
+.An Wojciech A. Koszek Aq Mt dunstan@freebsd.czest.pl .
diff --git a/lib/libc/sys/aio_cancel.2 b/lib/libc/sys/aio_cancel.2
index 54e7b394fc8e..3d9cbaf2ff4f 100644
--- a/lib/libc/sys/aio_cancel.2
+++ b/lib/libc/sys/aio_cancel.2
@@ -109,8 +109,8 @@ appeared in
.An -nosplit
This
manual page was originally written by
-.An Wes Peters Aq wes@softweyr.com .
-.An Christopher M Sedore Aq cmsedore@maxwell.syr.edu
+.An Wes Peters Aq Mt wes@softweyr.com .
+.An Christopher M Sedore Aq Mt cmsedore@maxwell.syr.edu
updated it when
.Fn aio_cancel
was implemented for
diff --git a/lib/libc/sys/aio_error.2 b/lib/libc/sys/aio_error.2
index f63a2dd06c21..030914616121 100644
--- a/lib/libc/sys/aio_error.2
+++ b/lib/libc/sys/aio_error.2
@@ -98,4 +98,4 @@ system call first appeared in
.Sh AUTHORS
This
manual page was written by
-.An Wes Peters Aq wes@softweyr.com .
+.An Wes Peters Aq Mt wes@softweyr.com .
diff --git a/lib/libc/sys/aio_mlock.2 b/lib/libc/sys/aio_mlock.2
index 386393f32b12..95055e8c42b5 100644
--- a/lib/libc/sys/aio_mlock.2
+++ b/lib/libc/sys/aio_mlock.2
@@ -130,4 +130,4 @@ system call first appeared in
.Fx 10.0 .
.Sh AUTHORS
The system call was introduced by
-.An Gleb Smirnoff Aq glebius@FreeBSD.org .
+.An Gleb Smirnoff Aq Mt glebius@FreeBSD.org .
diff --git a/lib/libc/sys/aio_read.2 b/lib/libc/sys/aio_read.2
index ddf4f7630239..65b5e10d75fd 100644
--- a/lib/libc/sys/aio_read.2
+++ b/lib/libc/sys/aio_read.2
@@ -207,7 +207,7 @@ system call first appeared in
.Sh AUTHORS
This
manual page was written by
-.An Terry Lambert Aq terry@whistle.com .
+.An Terry Lambert Aq Mt terry@whistle.com .
.Sh BUGS
Invalid information in
.Fa iocb->_aiocb_private
diff --git a/lib/libc/sys/aio_return.2 b/lib/libc/sys/aio_return.2
index 2034f9d04822..2ef6c25953f7 100644
--- a/lib/libc/sys/aio_return.2
+++ b/lib/libc/sys/aio_return.2
@@ -99,4 +99,4 @@ system call first appeared in
.Sh AUTHORS
This
manual page was written by
-.An Wes Peters Aq wes@softweyr.com .
+.An Wes Peters Aq Mt wes@softweyr.com .
diff --git a/lib/libc/sys/aio_suspend.2 b/lib/libc/sys/aio_suspend.2
index 5859d1527a93..0ff25f51c5ab 100644
--- a/lib/libc/sys/aio_suspend.2
+++ b/lib/libc/sys/aio_suspend.2
@@ -114,4 +114,4 @@ system call first appeared in
.Sh AUTHORS
This
manual page was written by
-.An Wes Peters Aq wes@softweyr.com .
+.An Wes Peters Aq Mt wes@softweyr.com .
diff --git a/lib/libc/sys/aio_waitcomplete.2 b/lib/libc/sys/aio_waitcomplete.2
index 5145f78118ab..885b3d7fa481 100644
--- a/lib/libc/sys/aio_waitcomplete.2
+++ b/lib/libc/sys/aio_waitcomplete.2
@@ -134,4 +134,4 @@ system call first appeared in
The
.Fn aio_waitcomplete
system call and this manual page were written by
-.An Christopher M Sedore Aq cmsedore@maxwell.syr.edu .
+.An Christopher M Sedore Aq Mt cmsedore@maxwell.syr.edu .
diff --git a/lib/libc/sys/aio_write.2 b/lib/libc/sys/aio_write.2
index 291fd7154bf7..080a6b8bbf58 100644
--- a/lib/libc/sys/aio_write.2
+++ b/lib/libc/sys/aio_write.2
@@ -202,7 +202,7 @@ system call first appeared in
.Fx 3.0 .
.Sh AUTHORS
This manual page was written by
-.An Wes Peters Aq wes@softweyr.com .
+.An Wes Peters Aq Mt wes@softweyr.com .
.Sh BUGS
Invalid information in
.Fa iocb->_aiocb_private
diff --git a/lib/libc/sys/bind.2 b/lib/libc/sys/bind.2
index 896b0053cad2..c0f84110ab06 100644
--- a/lib/libc/sys/bind.2
+++ b/lib/libc/sys/bind.2
@@ -28,7 +28,7 @@
.\" @(#)bind.2 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd June 4, 1993
+.Dd June 26, 2014
.Dt BIND 2
.Os
.Sh NAME
@@ -85,6 +85,10 @@ is not a valid descriptor.
.It Bq Er EINVAL
The socket is already bound to an address, and the protocol does not support
binding to a new address; or the socket has been shut down.
+.It Bq Er EINVAL
+The
+.Fa addrlen
+argument is not a valid length for the address family.
.It Bq Er ENOTSOCK
The
.Fa s
diff --git a/lib/libc/sys/bindat.2 b/lib/libc/sys/bindat.2
index 9274679374a8..692099092d6c 100644
--- a/lib/libc/sys/bindat.2
+++ b/lib/libc/sys/bindat.2
@@ -105,5 +105,5 @@ nor a file descriptor associated with a directory.
The
.Nm
was developed by
-.An Pawel Jakub Dawidek Aq pawel@dawidek.net
+.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net
under sponsorship from the FreeBSD Foundation.
diff --git a/lib/libc/sys/cap_fcntls_limit.2 b/lib/libc/sys/cap_fcntls_limit.2
index 0f792a5bb3d9..193d97da37eb 100644
--- a/lib/libc/sys/cap_fcntls_limit.2
+++ b/lib/libc/sys/cap_fcntls_limit.2
@@ -122,5 +122,5 @@ Support for capabilities and capabilities mode was developed as part of the
Project.
.Sh AUTHORS
This function was created by
-.An Pawel Jakub Dawidek Aq pawel@dawidek.net
+.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net
under sponsorship of the FreeBSD Foundation.
diff --git a/lib/libc/sys/cap_ioctls_limit.2 b/lib/libc/sys/cap_ioctls_limit.2
index 4fdd2551d274..2d1eef9724c4 100644
--- a/lib/libc/sys/cap_ioctls_limit.2
+++ b/lib/libc/sys/cap_ioctls_limit.2
@@ -153,5 +153,5 @@ Support for capabilities and capabilities mode was developed as part of the
Project.
.Sh AUTHORS
This function was created by
-.An Pawel Jakub Dawidek Aq pawel@dawidek.net
+.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net
under sponsorship of the FreeBSD Foundation.
diff --git a/lib/libc/sys/cap_rights_limit.2 b/lib/libc/sys/cap_rights_limit.2
index 33b57e135c58..4663951e5029 100644
--- a/lib/libc/sys/cap_rights_limit.2
+++ b/lib/libc/sys/cap_rights_limit.2
@@ -153,5 +153,5 @@ Support for capabilities and capabilities mode was developed as part of the
Project.
.Sh AUTHORS
This function was created by
-.An Pawel Jakub Dawidek Aq pawel@dawidek.net
+.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net
under sponsorship of the FreeBSD Foundation.
diff --git a/lib/libc/sys/connect.2 b/lib/libc/sys/connect.2
index ac019e829c37..8ed3f12bc8a2 100644
--- a/lib/libc/sys/connect.2
+++ b/lib/libc/sys/connect.2
@@ -28,7 +28,7 @@
.\" @(#)connect.2 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd September 5, 2010
+.Dd June 26, 2014
.Dt CONNECT 2
.Os
.Sh NAME
@@ -80,6 +80,10 @@ The
.Fa s
argument
is not a valid descriptor.
+.It Bq Er EINVAL
+The
+.Fa namelen
+argument is not a valid length for the address family.
.It Bq Er ENOTSOCK
The
.Fa s
diff --git a/lib/libc/sys/connectat.2 b/lib/libc/sys/connectat.2
index 8cebf98372eb..759b7eac8e2e 100644
--- a/lib/libc/sys/connectat.2
+++ b/lib/libc/sys/connectat.2
@@ -105,5 +105,5 @@ nor a file descriptor associated with a directory.
The
.Nm
was developed by
-.An Pawel Jakub Dawidek Aq pawel@dawidek.net
+.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net
under sponsorship from the FreeBSD Foundation.
diff --git a/lib/libc/sys/cpuset.2 b/lib/libc/sys/cpuset.2
index 3e76de39ca32..0c32b42192e8 100644
--- a/lib/libc/sys/cpuset.2
+++ b/lib/libc/sys/cpuset.2
@@ -224,5 +224,5 @@ The
.Nm
family of system calls first appeared in
.Fx 7.1 .
-.Sh AUTHOR
-.An Jeffrey Roberson Aq jeff@FreeBSD.org
+.Sh AUTHORS
+.An Jeffrey Roberson Aq Mt jeff@FreeBSD.org
diff --git a/lib/libc/sys/cpuset_getaffinity.2 b/lib/libc/sys/cpuset_getaffinity.2
index 93cfe95dae22..810a03c72e9d 100644
--- a/lib/libc/sys/cpuset_getaffinity.2
+++ b/lib/libc/sys/cpuset_getaffinity.2
@@ -159,5 +159,5 @@ The
.Nm
family of system calls first appeared in
.Fx 7.1 .
-.Sh AUTHOR
-.An Jeffrey Roberson Aq jeff@FreeBSD.org
+.Sh AUTHORS
+.An Jeffrey Roberson Aq Mt jeff@FreeBSD.org
diff --git a/lib/libc/sys/ffclock.2 b/lib/libc/sys/ffclock.2
index 68ea922e4d69..78fed527b148 100644
--- a/lib/libc/sys/ffclock.2
+++ b/lib/libc/sys/ffclock.2
@@ -171,7 +171,7 @@ Feed-forward clock support first appeared in
.Sh AUTHORS
.An -nosplit
The feed-forward clock support was written by
-.An Julien Ridoux Aq jridoux@unimelb.edu.au
+.An Julien Ridoux Aq Mt jridoux@unimelb.edu.au
in collaboration with
-.An Darryl Veitch Aq dveitch@unimelb.edu.au
+.An Darryl Veitch Aq Mt dveitch@unimelb.edu.au
at the University of Melbourne under sponsorship from the FreeBSD Foundation.
diff --git a/lib/libc/sys/intro.2 b/lib/libc/sys/intro.2
index bc10b1de59de..7ce57aaf2d7c 100644
--- a/lib/libc/sys/intro.2
+++ b/lib/libc/sys/intro.2
@@ -133,7 +133,6 @@ executable file.
A file descriptor argument was out of range, referred to no open file,
or a read (write) request was made to a file that was only open for
writing (reading).
-.Pp
.It Er 10 ECHILD Em "\&No child processes" .
A
.Xr wait 2
@@ -302,7 +301,6 @@ addresses with
Internet protocols.
.It Er 48 EADDRINUSE Em "Address already in use" .
Only one usage of each address is normally permitted.
-.Pp
.It Er 49 EADDRNOTAVAIL Em "Can't assign requested address" .
Normally results from an attempt to create a socket with an
address not on this machine.
diff --git a/lib/libc/sys/kenv.2 b/lib/libc/sys/kenv.2
index 866c0d38a6f1..dc17388f08ba 100644
--- a/lib/libc/sys/kenv.2
+++ b/lib/libc/sys/kenv.2
@@ -171,9 +171,9 @@ or the value of a variable is longer than
.Sh AUTHORS
.An -nosplit
This manual page was written by
-.An Chad David Aq davidc@FreeBSD.org .
+.An Chad David Aq Mt davidc@FreeBSD.org .
.Pp
The
.Fn kenv
system call was written by
-.An Maxime Henrion Aq mux@FreeBSD.org .
+.An Maxime Henrion Aq Mt mux@FreeBSD.org .
diff --git a/lib/libc/sys/kqueue.2 b/lib/libc/sys/kqueue.2
index b9e496a3c9cd..f84bc05ba293 100644
--- a/lib/libc/sys/kqueue.2
+++ b/lib/libc/sys/kqueue.2
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 7, 2014
+.Dd July 18, 2014
.Dt KQUEUE 2
.Os
.Sh NAME
@@ -454,7 +454,7 @@ Establishes an arbitrary timer identified by
.Va ident .
When adding a timer,
.Va data
-specifies the timeout period in milliseconds.
+specifies the timeout period.
The timer will be periodic unless EV_ONESHOT is specified.
On return,
.Va data
@@ -465,8 +465,25 @@ There is a system wide limit on the number of timers
which is controlled by the
.Va kern.kq_calloutmax
sysctl.
+.Bl -tag -width XXNOTE_USECONDS
+.It Dv NOTE_SECONDS
+.Va data
+is in seconds.
+.It Dv NOTE_MSECONDS
+.Va data
+is in milliseconds.
+.It Dv NOTE_USECONDS
+.Va data
+is in microseconds.
+.It Dv NOTE_NSECONDS
+.Va data
+is in nanoseconds.
+.It
+.El
.Pp
-On return,
+If
+.Va fflags
+is not set, the default is milliseconds. On return,
.Va fflags
contains the events which triggered the filter.
.It Dv EVFILT_USER
@@ -613,7 +630,7 @@ system calls first appeared in
The
.Fn kqueue
system and this manual page were written by
-.An Jonathan Lemon Aq jlemon@FreeBSD.org .
+.An Jonathan Lemon Aq Mt jlemon@FreeBSD.org .
.Sh BUGS
The
.Fa timeout
diff --git a/lib/libc/sys/kse.2 b/lib/libc/sys/kse.2
index 41fcc373ea88..95e725624040 100644
--- a/lib/libc/sys/kse.2
+++ b/lib/libc/sys/kse.2
@@ -665,15 +665,15 @@ The KSE system calls first appeared in
.Sh AUTHORS
KSE was originally implemented by
.An -nosplit
-.An "Julian Elischer" Aq julian@FreeBSD.org ,
+.An Julian Elischer Aq Mt julian@FreeBSD.org ,
with additional contributions by
-.An "Jonathan Mini" Aq mini@FreeBSD.org ,
-.An "Daniel Eischen" Aq deischen@FreeBSD.org ,
+.An Jonathan Mini Aq Mt mini@FreeBSD.org ,
+.An Daniel Eischen Aq Mt deischen@FreeBSD.org ,
and
-.An "David Xu" Aq davidxu@FreeBSD.org .
+.An David Xu Aq Mt davidxu@FreeBSD.org .
.Pp
This manual page was written by
-.An "Archie Cobbs" Aq archie@FreeBSD.org .
+.An Archie Cobbs Aq Mt archie@FreeBSD.org .
.Sh BUGS
The KSE code is
.Ud
diff --git a/lib/libc/sys/listen.2 b/lib/libc/sys/listen.2
index ab22fd18e885..90059f89334b 100644
--- a/lib/libc/sys/listen.2
+++ b/lib/libc/sys/listen.2
@@ -28,7 +28,7 @@
.\" From: @(#)listen.2 8.2 (Berkeley) 12/11/93
.\" $FreeBSD$
.\"
-.Dd October 20, 2012
+.Dd July 15, 2014
.Dt LISTEN 2
.Os
.Sh NAME
@@ -139,6 +139,9 @@ will fail if:
The argument
.Fa s
is not a valid descriptor.
+.It Bq Er EDESTADDRREQ
+The socket is not bound to a local address, and the protocol does not
+support listening on an unbound socket.
.It Bq Er EINVAL
The socket is already connected, or in the process of being connected.
.It Bq Er ENOTSOCK
diff --git a/lib/libc/sys/mlock.2 b/lib/libc/sys/mlock.2
index 42acc971661f..4f264206fd26 100644
--- a/lib/libc/sys/mlock.2
+++ b/lib/libc/sys/mlock.2
@@ -28,7 +28,7 @@
.\" @(#)mlock.2 8.2 (Berkeley) 12/11/93
.\" $FreeBSD$
.\"
-.Dd March 18, 2013
+.Dd May 17, 2014
.Dt MLOCK 2
.Os
.Sh NAME
@@ -91,14 +91,21 @@ Locked mappings are not inherited by the child process after a
.Pp
Since physical memory is a potentially scarce resource, processes are
limited in how much they can lock down.
-A single process can
+The amount of memory that a single process can
.Fn mlock
-the minimum of
-a system-wide ``wired pages'' limit
+is limited by both the per-process
+.Dv RLIMIT_MEMLOCK
+resource limit and the
+system-wide
+.Dq wired pages
+limit
+.Va vm.max_wired .
.Va vm.max_wired
-and the per-process
-.Li RLIMIT_MEMLOCK
-resource limit.
+applies to the system as a whole, so the amount available to a single
+process at any given time is the difference between
+.Va vm.max_wired
+and
+.Va vm.stats.vm.v_wire_count .
.Pp
If
.Va security.bsd.unprivileged_mlock
diff --git a/lib/libc/sys/mmap.2 b/lib/libc/sys/mmap.2
index 01cde0ee5fe9..3dd830326ad0 100644
--- a/lib/libc/sys/mmap.2
+++ b/lib/libc/sys/mmap.2
@@ -28,7 +28,7 @@
.\" @(#)mmap.2 8.4 (Berkeley) 5/11/95
.\" $FreeBSD$
.\"
-.Dd September 9, 2013
+.Dd June 19, 2014
.Dt MMAP 2
.Os
.Sh NAME
@@ -141,6 +141,12 @@ argument must be 0.
This flag is identical to
.Dv MAP_ANON
and is provided for compatibility.
+.It Dv MAP_EXCL
+This flag can only be used in combination with
+.Dv MAP_FIXED .
+Please see the definition of
+.Dv MAP_FIXED
+for the description of its effect.
.It Dv MAP_FIXED
Do not permit the system to select a different address than the one
specified.
@@ -152,17 +158,21 @@ If
is specified,
.Fa addr
must be a multiple of the pagesize.
-If a
+If
+.Dv MAP_EXCL
+is not specified, a successfull
.Dv MAP_FIXED
-request is successful, the mapping established by
-.Fn mmap
-replaces any previous mappings for the process' pages in the range from
+request replaces any previous mappings for the process'
+pages in the range from
.Fa addr
to
.Fa addr
+
.Fa len .
-Use of this option is discouraged.
+In contrast, if
+.Dv MAP_EXCL
+is specified, the request will fail if a mapping
+already exists within the range.
.It Dv MAP_HASSEMAPHORE
Notify the kernel that the region may contain semaphores and that special
handling may be necessary.
@@ -393,6 +403,17 @@ argument was not -1.
was specified and the
.Fa offset
argument was not 0.
+.It Bq Er EINVAL
+Both
+.Dv MAP_FIXED
+and
+.Dv MAP_EXCL
+were specified, but the requested region is already used by a mapping.
+.It Bq Er EINVAL
+.Dv MAP_EXCL
+was specified, but
+.Dv MAP_FIXED
+was not.
.It Bq Er ENODEV
.Dv MAP_ANON
has not been specified and
diff --git a/lib/libc/sys/mmap.c b/lib/libc/sys/mmap.c
index cfdb9448ea38..0fa03baa374d 100644
--- a/lib/libc/sys/mmap.c
+++ b/lib/libc/sys/mmap.c
@@ -44,18 +44,13 @@ __FBSDID("$FreeBSD$");
* is not supplied by GCC 1.X but is supplied by GCC 2.X.
*/
void *
-mmap(addr, len, prot, flags, fd, offset)
- void * addr;
- size_t len;
- int prot;
- int flags;
- int fd;
- off_t offset;
+mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset)
{
- if (__getosreldate() >= 700051)
+ if (__getosreldate() >= 700051) {
return (__sys_mmap(addr, len, prot, flags, fd, offset));
- else
-
- return (__sys_freebsd6_mmap(addr, len, prot, flags, fd, 0, offset));
+ } else {
+ return (__sys_freebsd6_mmap(addr, len, prot, flags, fd, 0,
+ offset));
+ }
}
diff --git a/lib/libc/sys/pdfork.2 b/lib/libc/sys/pdfork.2
index a4895159f2ab..e057f769b89e 100644
--- a/lib/libc/sys/pdfork.2
+++ b/lib/libc/sys/pdfork.2
@@ -188,9 +188,9 @@ Project.
.Sh AUTHORS
.An -nosplit
These functions and the capability facility were created by
-.An "Robert N. M. Watson" Aq rwatson@FreeBSD.org
+.An Robert N. M. Watson Aq Mt rwatson@FreeBSD.org
and
-.An "Jonathan Anderson" Aq jonathan@FreeBSD.org
+.An Jonathan Anderson Aq Mt jonathan@FreeBSD.org
at the University of Cambridge Computer Laboratory with support from a grant
from Google, Inc.
.Sh BUGS
diff --git a/lib/libc/sys/posix_fallocate.2 b/lib/libc/sys/posix_fallocate.2
index 750177751e9a..4c92d9b9c2be 100644
--- a/lib/libc/sys/posix_fallocate.2
+++ b/lib/libc/sys/posix_fallocate.2
@@ -141,4 +141,4 @@ function appeared in
.Sh AUTHORS
.Fn posix_fallocate
and this manual page were initially written by
-.An Matthew Fleming Aq mdf@FreeBSD.org .
+.An Matthew Fleming Aq Mt mdf@FreeBSD.org .
diff --git a/lib/libc/sys/posix_openpt.2 b/lib/libc/sys/posix_openpt.2
index 9ba26068ac72..916e75ac586b 100644
--- a/lib/libc/sys/posix_openpt.2
+++ b/lib/libc/sys/posix_openpt.2
@@ -137,4 +137,4 @@ is included for compatibility; in
opening a terminal does not cause it to become a process's controlling
terminal.
.Sh AUTHORS
-.An Ed Schouten Aq ed@FreeBSD.org
+.An Ed Schouten Aq Mt ed@FreeBSD.org
diff --git a/lib/libc/sys/procctl.2 b/lib/libc/sys/procctl.2
index 8f553eac057e..6ad0590804ad 100644
--- a/lib/libc/sys/procctl.2
+++ b/lib/libc/sys/procctl.2
@@ -50,7 +50,7 @@ If multiple processes match the identifier,
.Nm
will make a
.Dq best effort
-to control as many of the selected possibles as possible.
+to control as many of the selected processes as possible.
An error is only returned if no selected processes successfully complete
the request.
The following identifier types are supported:
diff --git a/lib/libc/sys/pselect.2 b/lib/libc/sys/pselect.2
index ed66aade1cde..6221c473e7d7 100644
--- a/lib/libc/sys/pselect.2
+++ b/lib/libc/sys/pselect.2
@@ -120,4 +120,4 @@ function first appeared in
The first implementation of
.Fn pselect
function and this manual page were written by
-.An Garrett Wollman Aq wollman@FreeBSD.org .
+.An Garrett Wollman Aq Mt wollman@FreeBSD.org .
diff --git a/lib/libc/sys/rtprio.2 b/lib/libc/sys/rtprio.2
index f30ed225475b..23088a705967 100644
--- a/lib/libc/sys/rtprio.2
+++ b/lib/libc/sys/rtprio.2
@@ -188,7 +188,7 @@ The specified process or thread was not found or visible.
.Sh AUTHORS
.An -nosplit
The original author was
-.An Henrik Vestergaard Draboel Aq hvd@terry.ping.dk .
+.An Henrik Vestergaard Draboel Aq Mt hvd@terry.ping.dk .
This implementation in
.Fx
was substantially rewritten by
diff --git a/lib/libc/sys/sendfile.2 b/lib/libc/sys/sendfile.2
index 0e7dbe36263b..b363382af153 100644
--- a/lib/libc/sys/sendfile.2
+++ b/lib/libc/sys/sendfile.2
@@ -315,4 +315,4 @@ The
.Fn sendfile
system call
and this manual page were written by
-.An David G. Lawrence Aq dg@dglawrence.com .
+.An David G. Lawrence Aq Mt dg@dglawrence.com .
diff --git a/lib/libc/sys/shm_open.2 b/lib/libc/sys/shm_open.2
index 76d8f3c150aa..b56f717b76d5 100644
--- a/lib/libc/sys/shm_open.2
+++ b/lib/libc/sys/shm_open.2
@@ -275,8 +275,8 @@ The functions were reimplemented as system calls using shared memory objects
directly rather than files in
.Fx 8.0 .
.Sh AUTHORS
-.An Garrett A. Wollman Aq wollman@FreeBSD.org
+.An Garrett A. Wollman Aq Mt wollman@FreeBSD.org
(C library support and this manual page)
.Pp
-.An Matthew Dillon Aq dillon@FreeBSD.org
+.An Matthew Dillon Aq Mt dillon@FreeBSD.org
.Pq Dv MAP_NOSYNC
diff --git a/lib/libc/sys/shutdown.2 b/lib/libc/sys/shutdown.2
index 70211ffb2ebd..e8a434b23955 100644
--- a/lib/libc/sys/shutdown.2
+++ b/lib/libc/sys/shutdown.2
@@ -171,7 +171,7 @@ constants appeared in
.Sh AUTHORS
.An -nosplit
This manual page was updated by
-.An Bruce M. Simpson Aq bms@FreeBSD.org
+.An Bruce M. Simpson Aq Mt bms@FreeBSD.org
to reflect how
.Fn shutdown
behaves with
diff --git a/lib/libc/sys/socket.2 b/lib/libc/sys/socket.2
index 74730be9bf36..c0b1bdc35fd1 100644
--- a/lib/libc/sys/socket.2
+++ b/lib/libc/sys/socket.2
@@ -57,24 +57,30 @@ These families are defined in the include file
The currently understood formats are:
.Pp
.Bd -literal -offset indent -compact
-PF_LOCAL Host-internal protocols, formerly called PF_UNIX,
-PF_UNIX Host-internal protocols, deprecated, use PF_LOCAL,
+PF_LOCAL Host-internal protocols (alias for PF_UNIX),
+PF_UNIX Host-internal protocols,
PF_INET Internet version 4 protocols,
-PF_PUP PUP protocols, like BSP,
-PF_APPLETALK AppleTalk protocols,
-PF_ROUTE Internal Routing protocol,
+PF_INET6 Internet version 6 protocols,
+PF_ROUTE Internal routing protocol,
PF_LINK Link layer interface,
-PF_IPX Novell Internet Packet eXchange protocol,
-PF_RTIP Help Identify RTIP packets,
-PF_PIP Help Identify PIP packets,
-PF_ISDN Integrated Services Digital Network,
PF_KEY Internal key-management function,
-PF_INET6 Internet version 6 protocols,
-PF_NATM Native ATM access,
-PF_ATM ATM,
-PF_NETGRAPH Netgraph sockets
+PF_NATM Asynchronous transfer mode protocols,
+PF_NETGRAPH Netgraph sockets,
+PF_IEEE80211 IEEE 802.11 wireless link-layer protocols (WiFi),
+PF_BLUETOOTH Bluetooth protocols,
+PF_INET_SDP OFED socket direct protocol (IPv4),
+PF_INET6_SDP OFED socket direct protocol (IPv6)
.Ed
.Pp
+Each protocol family is connected to an address family, which has the
+same name except that the prefix is
+.Dq Dv AF_
+in place of
+.Dq Dv PF_ .
+Other protocol families may be also defined, beginning with
+.Dq Dv PF_ ,
+with corresponding address families.
+.Pp
The socket has the indicated
.Fa type ,
which specifies the semantics of communication.
@@ -307,6 +313,37 @@ The socket type is not supported by the protocol.
.%B PS1
.%N 8
.Re
+.Sh STANDARDS
+The
+.Fn socket
+function conforms to
+.St -p1003.1-2008 .
+The
+.Tn POSIX
+standard specifies only the
+.Dv AF_INET ,
+.Dv AF_INET6 ,
+and
+.Dv AF_UNIX
+constants for address families, and requires the use of
+.Dv AF_*
+constants for the
+.Fa domain
+argument of
+.Fn socket .
+The
+.Dv SOCK_CLOEXEC
+flag is expected to conform to the next revision of the
+.Tn POSIX
+standard.
+The
+.Dv SOCK_RDM
+.Fa type ,
+the
+.Dv PF_*
+constants, and other address families are
+.Fx
+extensions.
.Sh HISTORY
The
.Fn socket
diff --git a/lib/libc/sys/utimes.2 b/lib/libc/sys/utimes.2
index 74a7dd02ee48..15db6270407a 100644
--- a/lib/libc/sys/utimes.2
+++ b/lib/libc/sys/utimes.2
@@ -30,7 +30,7 @@
.\" @(#)utimes.2 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd April 10, 2008
+.Dd July 3, 2014
.Dt UTIMES 2
.Os
.Sh NAME
@@ -119,22 +119,18 @@ is passed the special value
.Dv AT_FDCWD
in the
.Fa fd
-parameter, the current working directory is used and the behavior is identical to
-a call to
+parameter, the current working directory is used and the behavior
+is identical to a call to
.Fn utimes .
.Sh RETURN VALUES
.Rv -std
.Sh ERRORS
-The
-.Fn utimes
-and
-.Fn lutimes
-system calls
-will fail if:
+All of the system call will fail if:
.Bl -tag -width Er
.It Bq Er EACCES
-Search permission is denied for a component of the path prefix;
-or the
+Search permission is denied for a component of the path prefix.
+.It Bq Er EACCES
+The
.Fa times
argument is
.Dv NULL
@@ -148,6 +144,17 @@ or
.Fa times
argument
points outside the process's allocated address space.
+.It Bq Er EFAULT
+The
+.Fa times
+argument
+points outside the process's allocated address space.
+.It Bq Er EINVAL
+The
+.Va tv_usec
+component of at least one of the values specified by the
+.Fa times
+argument has a value less than 0 or greater than 999999.
.It Bq Er EIO
An I/O error occurred while reading or writing the affected inode.
.It Bq Er ELOOP
@@ -170,7 +177,8 @@ argument is not
and the calling process's effective user ID
does not match the owner of the file and is not the super-user.
.It Bq Er EPERM
-The named file has its immutable or append-only flag set, see the
+The named file has its immutable or append-only flags set.
+See the
.Xr chflags 2
manual page for more information.
.It Bq Er EROFS
@@ -189,40 +197,6 @@ argument
does not refer to a valid descriptor.
.El
.Pp
-All of the system calls will fail if:
-.Bl -tag -width Er
-.It Bq Er EACCES
-The
-.Fa times
-argument is
-.Dv NULL
-and the effective user ID of the process does not
-match the owner of the file, and is not the super-user, and write
-access is denied.
-.It Bq Er EFAULT
-The
-.Fa times
-argument
-points outside the process's allocated address space.
-.It Bq Er EINVAL
-The
-.Va tv_usec
-component of at least one of the values specified by the
-.Fa times
-argument has a value less than 0 or greater than 999999.
-.It Bq Er EIO
-An I/O error occurred while reading or writing the affected inode.
-.It Bq Er EPERM
-The
-.Fa times
-argument is not
-.Dv NULL
-and the calling process's effective user ID
-does not match the owner of the file and is not the super-user.
-.It Bq Er EROFS
-The file system containing the file is mounted read-only.
-.El
-.Pp
In addition to the errors returned by the
.Fn utimes ,
the
diff --git a/lib/libc/xdr/xdr_float.c b/lib/libc/xdr/xdr_float.c
index 8051649202d2..11358069e00c 100644
--- a/lib/libc/xdr/xdr_float.c
+++ b/lib/libc/xdr/xdr_float.c
@@ -63,7 +63,7 @@ __FBSDID("$FreeBSD$");
#if defined(__m68k__) || defined(__sparc__) || defined(__i386__) || \
defined(__mips__) || defined(__ns32k__) || defined(__alpha__) || \
- defined(__arm__) || defined(__ppc__) || defined(__ia64__) || \
+ defined(__arm__) || defined(__ppc__) || \
defined(__arm26__) || defined(__sparc64__) || defined(__amd64__)
#include <machine/endian.h>
#define IEEEFP