diff options
author | Simon J. Gerraty <sjg@FreeBSD.org> | 2014-08-19 06:50:54 +0000 |
---|---|---|
committer | Simon J. Gerraty <sjg@FreeBSD.org> | 2014-08-19 06:50:54 +0000 |
commit | ee7b0571c2c18bdec848ed2044223cc88db29bd8 (patch) | |
tree | b04f4bd7cd887f50e7d98af35f46b9834ff86c80 /lib | |
parent | ffda191e301f128a62c152fde92b692548367fca (diff) | |
parent | 15fc2873832ea5b9b639e701bbbf2e73af8b6a88 (diff) | |
download | src-ee7b0571c2c18bdec848ed2044223cc88db29bd8.tar.gz src-ee7b0571c2c18bdec848ed2044223cc88db29bd8.zip |
Merge head from 7/28
Notes
Notes:
svn path=/projects/bmake/; revision=270164
Diffstat (limited to 'lib')
443 files changed, 4861 insertions, 7126 deletions
diff --git a/lib/Makefile b/lib/Makefile index de87cbaa8560..05fab01e23fb 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -3,83 +3,47 @@ .include <src.opts.mk> -# To satisfy shared library or ELF linkage when only the libraries being -# built are visible: -# -# csu must be built before all shared libaries for ELF. -# libc must be built before all other shared libraries. -# libbsm must be built before libauditd. -# libcom_err must be built before libpam. -# libcrypt must be built before libpam. -# libkvm must be built before libdevstat. -# libldns must be built before libunbound. -# msun must be built before libg++ and libstdc++. -# libmd must be built before libatm, libopie, libradius, and libtacplus. -# ncurses must be built before libdialog, libedit and libreadline. -# libnetgraph must be built before libbsnmp/modules/snmp_netgraph. -# libopie must be built before libpam. -# libradius must be built before libpam. -# librpcsvc must be built before libpam. -# libsbuf must be built before libcam. -# libtacplus must be built before libpam. -# libutil must be built before libpam. -# libypclnt must be built before libpam. -# libgssapi must be built before librpcsec_gss -# -# Otherwise, the SUBDIR list should be in alphabetical order. -# -# Except it appears bind needs to be compiled last +# The SUBDIR_ORDERED list is a small set of libraries which are used by many +# of the other libraries. These are built first with a .WAIT between them +# and the main list to avoid needing a SUBDIR_DEPEND line on every library +# naming just these few items. SUBDIR_ORDERED= ${_csu} \ + .WAIT \ libc \ libc_nonshared \ - libbsm \ - libauditd \ - libutil \ - libpjdlog \ - libnv \ - ${_libcapsicum} \ libcompiler_rt \ - libcrypt \ - libelf \ - ${_libiconv_modules} \ - libkvm \ - ${_libldns} \ - msun \ - libmd \ - ncurses \ - ${_libnetgraph} \ - libradius \ - librpcsvc \ - libsbuf \ - libtacplus \ - ${_libypclnt} \ + ${_libcplusplus} \ ${_libcxxrt} \ - ${_libcplusplus} + libelf \ + msun -.if ${MK_KERBEROS_SUPPORT} != "no" -SUBDIR_ORDERED+= libcom_err -.endif +# The main list; please keep these sorted alphabetically. SUBDIR= ${SUBDIR_ORDERED} \ + .WAIT \ libalias \ libarchive \ ${_libatm} \ + libauditd \ libbegemot \ libblocksruntime \ ${_libbluetooth} \ ${_libbsnmp} \ libbsdstat \ + libbsm \ libbz2 \ libcalendar \ libcam \ + ${_libcapsicum} \ ${_libcasper} \ + ${_libcom_err} \ libcompat \ + libcrypt \ libdevinfo \ libdevstat \ libdwarf \ libedit \ - ${_libefi} \ libexecinfo \ libexpat \ libfetch \ @@ -87,26 +51,36 @@ SUBDIR= ${SUBDIR_ORDERED} \ ${_libgpib} \ ${_libgssapi} \ ${_librpcsec_gss} \ + ${_libiconv_modules} \ libipsec \ libjail \ libkiconv \ + libkvm \ + ${_libldns} \ liblzma \ libmagic \ libmandoc \ libmemstat \ + libmd \ ${_libmilter} \ ${_libmp} \ ${_libnandfs} \ libnetbsd \ + ${_libnetgraph} \ ${_libngatm} \ + libnv \ libopie \ libpam \ libpcap \ + libpjdlog \ ${_libpmc} \ ${_libproc} \ libprocstat \ + libradius \ + librpcsvc \ librt \ ${_librtld_db} \ + libsbuf \ ${_libsdp} \ ${_libsm} \ ${_libsmb} \ @@ -115,6 +89,7 @@ SUBDIR= ${SUBDIR_ORDERED} \ libstand \ libstdbuf \ libstdthreads \ + libtacplus \ ${_libtelnet} \ ${_libthr} \ libthread_db \ @@ -125,15 +100,51 @@ SUBDIR= ${SUBDIR_ORDERED} \ ${_libunbound} \ ${_libusbhid} \ ${_libusb} \ + libutil \ ${_libvgl} \ ${_libvmmapi} \ libwrap \ liby \ + ${_libypclnt} \ libz \ + ncurses \ ${_atf} \ ${_clang} \ + ${_cuse} \ ${_tests} +# Inter-library dependencies. When the makefile for a library contains LDADD +# libraries, those libraries should be listed as build order dependencies here. + +SUBDIR_DEPEND_libarchive= libz libbz2 libexpat liblzma libmd +SUBDIR_DEPEND_libatm= libmd +SUBDIR_DEPEND_libauditdm= libbsm +SUBDIR_DEPEND_libbsnmp= ${_libnetgraph} +SUBDIR_DEPEND_libc++= libcxxrt +SUBDIR_DEPEND_libc= libcompiler_rt +SUBDIR_DEPEND_libcam= libsbuf +SUBDIR_DEPEND_libcapsicum= libnv +SUBDIR_DEPEND_libcasper= libcapsicum libnv libpjdlog +SUBDIR_DEPEND_libdevstat= libkvm +SUBDIR_DEPEND_libdiaglog= ncurses +SUBDIR_DEPEND_libedit= ncurses +SUBDIR_DEPEND_libg++= msun +SUBDIR_DEPEND_libgeom= libexpat libsbuf +SUBDIR_DEPEND_liblibrpcsec_gss= libgssapi +SUBDIR_DEPEND_libmagic= libz +SUBDIR_DEPEND_libmemstat= libkvm +SUBDIR_DEPEND_libopie= libmd +SUBDIR_DEPEND_libpam= libcrypt libopie libradius librpcsvc libtacplus libutil ${_libypclnt} ${_libcom_err} +SUBDIR_DEPEND_libpjdlog= libutil +SUBDIR_DEPEND_libprocstat= libkvm libutil +SUBDIR_DEPEND_libradius= libmd +SUBDIR_DEPEND_libreadline= ncurses +SUBDIR_DEPEND_libsmb= libkiconv +SUBDIR_DEPEND_libstdc++= msun +SUBDIR_DEPEND_libtacplus= libmd +SUBDIR_DEPEND_libulog= libmd +SUBDIR_DEPEND_libunbound= ${_libldns} + .if exists(${.CURDIR}/csu/${MACHINE_ARCH}-elf) _csu=csu/${MACHINE_ARCH}-elf .elif exists(${.CURDIR}/csu/${MACHINE_ARCH}) @@ -168,6 +179,10 @@ _libcasper= libcasper _clang= clang .endif +.if ${MK_CUSE} != "no" +_cuse= libcuse +.endif + .if ${MK_GPIB} != "no" _libgpib= libgpib .endif @@ -181,6 +196,10 @@ _librpcsec_gss= librpcsec_gss _libiconv_modules= libiconv_modules .endif +.if ${MK_KERBEROS_SUPPORT} != "no" +_libcom_err= libcom_err +.endif + .if ${MK_LDNS} != "no" _libldns= libldns .endif @@ -217,11 +236,6 @@ _librtld_db= librtld_db _libvmmapi= libvmmapi .endif -.if ${MACHINE_CPUARCH} == "ia64" -_libefi= libefi -_libsmb= libsmb -.endif - .if ${MACHINE_CPUARCH} == "mips" _libproc= libproc _librtld_db= librtld_db diff --git a/lib/atf/libatf-c++/Makefile b/lib/atf/libatf-c++/Makefile index 84477f79927d..163f7fbf363b 100644 --- a/lib/atf/libatf-c++/Makefile +++ b/lib/atf/libatf-c++/Makefile @@ -29,7 +29,8 @@ .include <bsd.init.mk> LIB= atf-c++ -SHLIB_MAJOR= 2 +PRIVATELIB= true +SHLIB_MAJOR= 1 # libatf-c++ depends on the C version of the ATF library to build. DPADD= ${LIBATFC} @@ -73,20 +74,6 @@ INCSDIR_atf-c++.hpp= ${INCLUDEDIR} MAN= atf-c++-api.3 -all: atf-c++.pc -atf-c++.pc: atf-c++.pc.in atf-version - sed -e 's,__CXX__,${CXX},g' \ - -e 's,__INCLUDEDIR__,${INCLUDEDIR},g' \ - -e 's,__LIBDIR__,${LIBDIR},g' \ - -e "s,__ATF_VERSION__,$$(cat atf-version),g" \ - <${ATF}/atf-c++/atf-c++.pc.in >atf-c++.pc - -beforeinstall: - ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ - atf-c++.pc ${DESTDIR}${LIBDATADIR}/pkgconfig - ${INSTALL} -C -o ${SHAREOWN} -g ${SHAREGRP} -m ${SHAREMODE} \ - ${ATF}/atf-c++/atf-c++.m4 ${DESTDIR}${SHAREDIR}/aclocal - .if ${MK_TESTS} != "no" SUBDIR= tests .endif diff --git a/lib/atf/libatf-c++/tests/Makefile b/lib/atf/libatf-c++/tests/Makefile index c5a1d2495b6c..56355f295227 100644 --- a/lib/atf/libatf-c++/tests/Makefile +++ b/lib/atf/libatf-c++/tests/Makefile @@ -26,6 +26,4 @@ ATF_TESTS_CXX+= ${_T} SRCS.${_T}= ${_T}.cpp test_helpers.cpp .endfor -ATF_TESTS_SH= pkg_config_test - .include <bsd.test.mk> diff --git a/lib/atf/libatf-c/Makefile b/lib/atf/libatf-c/Makefile index 5c607f7b42da..4920eb5c78cd 100644 --- a/lib/atf/libatf-c/Makefile +++ b/lib/atf/libatf-c/Makefile @@ -29,7 +29,8 @@ .include <bsd.init.mk> LIB= atf-c -SHLIB_MAJOR= 1 +PRIVATELIB= true +SHLIB_MAJOR= 0 ATF= ${.CURDIR:H:H:H}/contrib/atf .PATH: ${ATF} @@ -75,22 +76,6 @@ INCSDIR_atf-c.h= ${INCLUDEDIR} MAN= atf-c-api.3 -all: atf-c.pc -atf-c.pc: atf-c.pc.in atf-version - sed -e 's,__CC__,${CC},g' \ - -e 's,__INCLUDEDIR__,${INCLUDEDIR},g' \ - -e 's,__LIBDIR__,${LIBDIR},g' \ - -e "s,__ATF_VERSION__,$$(cat atf-version),g" \ - <${ATF}/atf-c/atf-c.pc.in >atf-c.pc - -beforeinstall: - ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ - atf-c.pc ${DESTDIR}${LIBDATADIR}/pkgconfig - ${INSTALL} -C -o ${SHAREOWN} -g ${SHAREGRP} -m ${SHAREMODE} \ - ${ATF}/atf-c/atf-common.m4 ${DESTDIR}${SHAREDIR}/aclocal - ${INSTALL} -C -o ${SHAREOWN} -g ${SHAREGRP} -m ${SHAREMODE} \ - ${ATF}/atf-c/atf-c.m4 ${DESTDIR}${SHAREDIR}/aclocal - .if ${MK_TESTS} != "no" SUBDIR= tests .endif diff --git a/lib/atf/libatf-c/tests/Makefile b/lib/atf/libatf-c/tests/Makefile index 1a091d3172f6..70ba1a5ca2ca 100644 --- a/lib/atf/libatf-c/tests/Makefile +++ b/lib/atf/libatf-c/tests/Makefile @@ -33,6 +33,4 @@ ATF_TESTS_C+= ${_T} SRCS.${_T}= ${_T}.c test_helpers.c .endfor -ATF_TESTS_SH= pkg_config_test - .include <bsd.test.mk> diff --git a/lib/clang/Makefile b/lib/clang/Makefile index ae7ae4a0a44d..328aa7871a92 100644 --- a/lib/clang/Makefile +++ b/lib/clang/Makefile @@ -3,8 +3,7 @@ .include <src.opts.mk> .if !make(install) -.if !defined(EARLY_BUILD) -.if defined(MK_CLANG_FULL) && ${MK_CLANG_FULL} != "no" +.if ${MK_CLANG_FULL} != "no" _libclangstaticanalyzer= \ libclangstaticanalyzercheckers \ libclangstaticanalyzercore \ @@ -12,13 +11,11 @@ _libclangstaticanalyzer= \ _libclangarcmigrate= \ libclangarcmigrate .endif # MK_CLANG_FULL -.if (defined(MK_CLANG_FULL) && ${MK_CLANG_FULL} != "no") || \ - (defined(MK_LLDB) && ${MK_LLDB} != "no") +.if ${MK_CLANG_FULL} != "no" || ${MK_LLDB} != "no" _libclangrewriter= \ libclangrewritecore \ libclangrewritefrontend .endif # (MK_CLANG_FULL || MK_LLDB) -.endif # !EARLY_BUILD SUBDIR= libclanganalysis \ ${_libclangarcmigrate} \ @@ -105,7 +102,7 @@ SUBDIR+=libllvmexecutionengine \ libllvmruntimedyld .endif # MK_CLANG_EXTRAS | LLDB -.if !defined(EARLY_BUILD) && ${MK_LLDB} != "no" +.if ${MK_LLDB} != "no" SUBDIR+=liblldb \ \ liblldbAPI \ @@ -141,7 +138,7 @@ SUBDIR+=liblldb \ liblldbPluginSymbolVendorELF \ liblldbPluginUnwindAssemblyInstEmulation \ liblldbPluginUnwindAssemblyX86 -.endif # !EARLY_BUILD && MK_LLDB +.endif # MK_LLDB .endif # !make(install) diff --git a/lib/clang/clang.build.mk b/lib/clang/clang.build.mk index c9d17982f690..ec8f4514ffc2 100644 --- a/lib/clang/clang.build.mk +++ b/lib/clang/clang.build.mk @@ -10,11 +10,11 @@ CFLAGS+= -I${LLVM_SRCS}/include -I${CLANG_SRCS}/include \ -DLLVM_ON_UNIX -DLLVM_ON_FREEBSD \ -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS #-DNDEBUG -.if !defined(EARLY_BUILD) && defined(MK_CLANG_FULL) && ${MK_CLANG_FULL} != "no" +.if ${MK_CLANG_FULL} != "no" CFLAGS+= -DCLANG_ENABLE_ARCMT \ -DCLANG_ENABLE_REWRITER \ -DCLANG_ENABLE_STATIC_ANALYZER -.endif # !EARLY_BUILD && MK_CLANG_FULL +.endif # MK_CLANG_FULL # LLVM is not strict aliasing safe as of 12/31/2011 CFLAGS+= -fno-strict-aliasing @@ -56,17 +56,9 @@ CLANG_TBLGEN= ${TOOLSDIR}/usr/bin/clang-tblgen TBLGEN?= tblgen CLANG_TBLGEN?= clang-tblgen -Intrinsics.inc.h: ${LLVM_SRCS}/include/llvm/IR/Intrinsics.td \ - ${LLVM_SRCS}/include/llvm/IR/IntrinsicsARM.td \ - ${LLVM_SRCS}/include/llvm/IR/IntrinsicsHexagon.td \ - ${LLVM_SRCS}/include/llvm/IR/IntrinsicsMips.td \ - ${LLVM_SRCS}/include/llvm/IR/IntrinsicsNVVM.td \ - ${LLVM_SRCS}/include/llvm/IR/IntrinsicsPowerPC.td \ - ${LLVM_SRCS}/include/llvm/IR/IntrinsicsR600.td \ - ${LLVM_SRCS}/include/llvm/IR/IntrinsicsX86.td \ - ${LLVM_SRCS}/include/llvm/IR/IntrinsicsXCore.td - ${TBLGEN} -I ${LLVM_SRCS}/include \ - -gen-intrinsic -o ${.TARGET} \ +Intrinsics.inc.h: ${LLVM_SRCS}/include/llvm/IR/Intrinsics.td + ${TBLGEN} -gen-intrinsic \ + -I ${LLVM_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ ${LLVM_SRCS}/include/llvm/IR/Intrinsics.td .for arch in \ ARM/ARM Mips/Mips PowerPC/PPC Sparc/Sparc X86/X86 @@ -85,147 +77,181 @@ Intrinsics.inc.h: ${LLVM_SRCS}/include/llvm/IR/Intrinsics.td \ RegisterInfo/-gen-register-info \ SubtargetInfo/-gen-subtarget ${arch:T}Gen${hdr:H:C/$/.inc.h/}: ${LLVM_SRCS}/lib/Target/${arch:H}/${arch:T}.td - ${TBLGEN} -I ${LLVM_SRCS}/include -I ${LLVM_SRCS}/lib/Target/${arch:H} \ - ${hdr:T:C/,/ /g} -o ${.TARGET} \ + ${TBLGEN} ${hdr:T:C/,/ /g} \ + -I ${LLVM_SRCS}/include -I ${LLVM_SRCS}/lib/Target/${arch:H} \ + -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ ${LLVM_SRCS}/lib/Target/${arch:H}/${arch:T}.td . endfor .endfor Attrs.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-classes -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-classes \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td AttrDump.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-dump -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-dump \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td AttrIdentifierArg.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-identifier-arg-list -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-identifier-arg-list \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td AttrImpl.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-impl -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-impl \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td AttrLateParsed.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-late-parsed-list -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-late-parsed-list \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td AttrList.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-list -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-list \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td AttrParsedAttrImpl.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-parsed-attr-impl -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-parsed-attr-impl \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td AttrParsedAttrKinds.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-parsed-attr-kinds -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-parsed-attr-kinds \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td AttrParsedAttrList.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-parsed-attr-list -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-parsed-attr-list \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td AttrPCHRead.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-pch-read -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-pch-read \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td AttrPCHWrite.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-pch-write -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-pch-write \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td AttrSpellings.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-spelling-list -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-spelling-list \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td AttrSpellingListIndex.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-spelling-index -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-spelling-index \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td AttrTemplateInstantiate.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-template-instantiate -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-template-instantiate \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td AttrTypeArg.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-attr-type-arg-list -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-attr-type-arg-list \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/Attr.td CommentCommandInfo.inc.h: ${CLANG_SRCS}/include/clang/AST/CommentCommands.td - ${CLANG_TBLGEN} \ - -gen-clang-comment-command-info -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-comment-command-info \ + -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/AST/CommentCommands.td CommentCommandList.inc.h: ${CLANG_SRCS}/include/clang/AST/CommentCommands.td - ${CLANG_TBLGEN} \ - -gen-clang-comment-command-list -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-comment-command-list \ + -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/AST/CommentCommands.td CommentHTMLNamedCharacterReferences.inc.h: \ ${CLANG_SRCS}/include/clang/AST/CommentHTMLNamedCharacterReferences.td - ${CLANG_TBLGEN} \ - -gen-clang-comment-html-named-character-references -o ${.TARGET} \ - ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-comment-html-named-character-references \ + -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/AST/CommentHTMLNamedCharacterReferences.td CommentHTMLTags.inc.h: ${CLANG_SRCS}/include/clang/AST/CommentHTMLTags.td - ${CLANG_TBLGEN} \ - -gen-clang-comment-html-tags -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-comment-html-tags \ + -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/AST/CommentHTMLTags.td CommentHTMLTagsProperties.inc.h: \ ${CLANG_SRCS}/include/clang/AST/CommentHTMLTags.td - ${CLANG_TBLGEN} \ - -gen-clang-comment-html-tags-properties -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-comment-html-tags-properties \ + -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/AST/CommentHTMLTags.td CommentNodes.inc.h: ${CLANG_SRCS}/include/clang/Basic/CommentNodes.td - ${CLANG_TBLGEN} \ - -gen-clang-comment-nodes -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-comment-nodes \ + -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/CommentNodes.td DeclNodes.inc.h: ${CLANG_SRCS}/include/clang/Basic/DeclNodes.td - ${CLANG_TBLGEN} \ - -gen-clang-decl-nodes -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-decl-nodes \ + -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/DeclNodes.td StmtNodes.inc.h: ${CLANG_SRCS}/include/clang/Basic/StmtNodes.td - ${CLANG_TBLGEN} \ - -gen-clang-stmt-nodes -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-stmt-nodes \ + -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/StmtNodes.td arm_neon.h: ${CLANG_SRCS}/include/clang/Basic/arm_neon.td - ${CLANG_TBLGEN} \ - -gen-arm-neon -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-arm-neon \ + -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/arm_neon.td arm_neon.inc.h: ${CLANG_SRCS}/include/clang/Basic/arm_neon.td - ${CLANG_TBLGEN} \ - -gen-arm-neon-sema -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-arm-neon-sema \ + -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Basic/arm_neon.td DiagnosticGroups.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic \ - -gen-clang-diag-groups -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-diag-groups \ + -I ${CLANG_SRCS}/include/clang/Basic -d ${.TARGET:C/\.h$/.d/} \ + -o ${.TARGET} ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td DiagnosticIndexName.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic \ - -gen-clang-diags-index-name -o ${.TARGET} ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-diags-index-name \ + -I ${CLANG_SRCS}/include/clang/Basic -d ${.TARGET:C/\.h$/.d/} \ + -o ${.TARGET} ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td .for hdr in AST Analysis Comment Common Driver Frontend Lex Parse Sema Serialization Diagnostic${hdr}Kinds.inc.h: ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/Basic \ - -gen-clang-diags-defs -clang-component=${hdr} -o ${.TARGET} \ - ${.ALLSRC} + ${CLANG_TBLGEN} -gen-clang-diags-defs -clang-component=${hdr} \ + -I ${CLANG_SRCS}/include/clang/Basic -d ${.TARGET:C/\.h$/.d/} \ + -o ${.TARGET} ${CLANG_SRCS}/include/clang/Basic/Diagnostic.td .endfor Options.inc.h: ${CLANG_SRCS}/include/clang/Driver/Options.td - ${TBLGEN} -I ${LLVM_SRCS}/include -I ${CLANG_SRCS}/include/clang/Driver \ - -gen-opt-parser-defs -o ${.TARGET} ${.ALLSRC} + ${TBLGEN} -gen-opt-parser-defs \ + -I ${LLVM_SRCS}/include -I ${CLANG_SRCS}/include/clang/Driver \ + -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Driver/Options.td CC1AsOptions.inc.h: ${CLANG_SRCS}/include/clang/Driver/CC1AsOptions.td - ${TBLGEN} -I ${LLVM_SRCS}/include -I ${CLANG_SRCS}/include/clang/Driver \ - -gen-opt-parser-defs -o ${.TARGET} ${.ALLSRC} - -Checkers.inc.h: ${CLANG_SRCS}/lib/StaticAnalyzer/Checkers/Checkers.td \ - ${CLANG_SRCS}/include/clang/StaticAnalyzer/Checkers/CheckerBase.td - ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include \ - -gen-clang-sa-checkers -o ${.TARGET} \ + ${TBLGEN} -gen-opt-parser-defs \ + -I ${LLVM_SRCS}/include -I ${CLANG_SRCS}/include/clang/Driver \ + -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ + ${CLANG_SRCS}/include/clang/Driver/CC1AsOptions.td + +Checkers.inc.h: ${CLANG_SRCS}/lib/StaticAnalyzer/Checkers/Checkers.td + ${CLANG_TBLGEN} -gen-clang-sa-checkers \ + -I ${CLANG_SRCS}/include -d ${.TARGET:C/\.h$/.d/} -o ${.TARGET} \ ${CLANG_SRCS}/lib/StaticAnalyzer/Checkers/Checkers.td +.for dep in ${TGHDRS:C/$/.inc.d/} +. sinclude "${dep}" +.endfor + SRCS+= ${TGHDRS:C/$/.inc.h/} DPADD+= ${TGHDRS:C/$/.inc.h/} -CLEANFILES+= ${TGHDRS:C/$/.inc.h/} +CLEANFILES+= ${TGHDRS:C/$/.inc.h/} ${TGHDRS:C/$/.inc.d/} # if we are not doing explicit 'make depend', there is # nothing to cause these to be generated. diff --git a/lib/clang/include/IA64GenAsmWriter.inc b/lib/clang/include/IA64GenAsmWriter.inc deleted file mode 100644 index dddc7938ed2a..000000000000 --- a/lib/clang/include/IA64GenAsmWriter.inc +++ /dev/null @@ -1,2 +0,0 @@ -/* $FreeBSD$ */ -#include "IA64GenAsmWriter.inc.h" diff --git a/lib/clang/include/IA64GenDAGISel.inc b/lib/clang/include/IA64GenDAGISel.inc deleted file mode 100644 index c6ae3dc2af0b..000000000000 --- a/lib/clang/include/IA64GenDAGISel.inc +++ /dev/null @@ -1,2 +0,0 @@ -/* $FreeBSD$ */ -#include "IA64GenDAGISel.inc.h" diff --git a/lib/clang/include/IA64GenInstrInfo.inc b/lib/clang/include/IA64GenInstrInfo.inc deleted file mode 100644 index 7fe83f68e8c1..000000000000 --- a/lib/clang/include/IA64GenInstrInfo.inc +++ /dev/null @@ -1,2 +0,0 @@ -/* $FreeBSD$ */ -#include "IA64GenInstrInfo.inc.h" diff --git a/lib/clang/include/IA64GenRegisterInfo.inc b/lib/clang/include/IA64GenRegisterInfo.inc deleted file mode 100644 index 89405ed9e6fd..000000000000 --- a/lib/clang/include/IA64GenRegisterInfo.inc +++ /dev/null @@ -1,2 +0,0 @@ -/* $FreeBSD$ */ -#include "IA64GenRegisterInfo.inc.h" diff --git a/lib/clang/include/Makefile b/lib/clang/include/Makefile index da39f1ccbce7..1ffd3e1595a3 100644 --- a/lib/clang/include/Makefile +++ b/lib/clang/include/Makefile @@ -8,7 +8,7 @@ LLVM_SRCS= ${.CURDIR}/../../../contrib/llvm .PATH: ${LLVM_SRCS}/tools/clang/lib/Headers -INCSDIR=${INCLUDEDIR}/clang/3.4 +INCSDIR=${INCLUDEDIR}/clang/3.4.1 INCS= __wmmintrin_aes.h \ __wmmintrin_pclmul.h \ diff --git a/lib/clang/include/clang/Basic/Version.inc b/lib/clang/include/clang/Basic/Version.inc index d63713e823f7..d2fcc0467053 100644 --- a/lib/clang/include/clang/Basic/Version.inc +++ b/lib/clang/include/clang/Basic/Version.inc @@ -1,10 +1,11 @@ /* $FreeBSD$ */ -#define CLANG_VERSION 3.4 -#define CLANG_VERSION_MAJOR 3 -#define CLANG_VERSION_MINOR 4 +#define CLANG_VERSION 3.4.1 +#define CLANG_VERSION_MAJOR 3 +#define CLANG_VERSION_MINOR 4 +#define CLANG_VERSION_PATCHLEVEL 1 -#define CLANG_VENDOR "FreeBSD " -#define CLANG_VENDOR_SUFFIX " 20140216" +#define CLANG_VENDOR "FreeBSD " +#define CLANG_VENDOR_SUFFIX " 20140512" -#define SVN_REVISION "197956" +#define SVN_REVISION "208032" diff --git a/lib/clang/include/llvm/Config/config.h b/lib/clang/include/llvm/Config/config.h index 985d259dfbb0..cbbb4fb7dbf3 100644 --- a/lib/clang/include/llvm/Config/config.h +++ b/lib/clang/include/llvm/Config/config.h @@ -8,9 +8,6 @@ /* Get __FreeBSD_version. */ #include <osreldate.h> -/* Define if building universal (internal helper macro) */ -/* #undef AC_APPLE_UNIVERSAL_BUILD */ - /* Bug report URL. */ #define BUG_REPORT_URL "http://llvm.org/bugs/" @@ -634,7 +631,7 @@ /* #undef LLVM_PATH_XDOT */ /* Installation prefix directory */ -#define LLVM_PREFIX "" +#define LLVM_PREFIX "/usr" /* Define if we have the Intel JIT API runtime support library */ #define LLVM_USE_INTEL_JITEVENTS 0 @@ -648,6 +645,9 @@ /* Minor version of the LLVM API */ #define LLVM_VERSION_MINOR 4 +/* Patch version of the LLVM API */ +#define LLVM_VERSION_PATCH 1 + /* Define if the OS needs help to load dependent libraries for dlopen(). */ #define LTDL_DLOPEN_DEPLIBS 1 @@ -675,16 +675,13 @@ #define PACKAGE_NAME "LLVM" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "LLVM 3.4" +#define PACKAGE_STRING "LLVM 3.4.1" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "llvm" -/* Define to the home page for this package. */ -/* #undef PACKAGE_URL */ - /* Define to the version of this package. */ -#define PACKAGE_VERSION "3.4" +#define PACKAGE_VERSION "3.4.1" /* Define as the return type of signal handlers (`int' or `void'). */ #define RETSIGTYPE void @@ -707,18 +704,6 @@ /* Type of 1st arg on ELM Callback */ /* #undef WIN32_ELMCB_PCSTR */ -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -/* # undef WORDS_BIGENDIAN */ -# endif -#endif - /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ diff --git a/lib/clang/include/llvm/Config/llvm-config.h b/lib/clang/include/llvm/Config/llvm-config.h index c7466874ff11..1717863779a0 100644 --- a/lib/clang/include/llvm/Config/llvm-config.h +++ b/lib/clang/include/llvm/Config/llvm-config.h @@ -109,7 +109,7 @@ /* #undef LLVM_PATH_XDOT_PY */ /* Installation prefix directory */ -#define LLVM_PREFIX "" +#define LLVM_PREFIX "/usr" /* Define if we have the Intel JIT API runtime support library */ #define LLVM_USE_INTEL_JITEVENTS 0 diff --git a/lib/clang/libllvmasmparser/Makefile.depend b/lib/clang/libllvmasmparser/Makefile.depend index d4069a675840..4d8f064b840b 100644 --- a/lib/clang/libllvmasmparser/Makefile.depend +++ b/lib/clang/libllvmasmparser/Makefile.depend @@ -5,7 +5,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ include \ include/xlocale \ - lib/clang/include \ lib/libc++ \ lib/msun \ diff --git a/lib/clang/libllvmbitwriter/Makefile.depend b/lib/clang/libllvmbitwriter/Makefile.depend index d4069a675840..4d8f064b840b 100644 --- a/lib/clang/libllvmbitwriter/Makefile.depend +++ b/lib/clang/libllvmbitwriter/Makefile.depend @@ -5,7 +5,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ include \ include/xlocale \ - lib/clang/include \ lib/libc++ \ lib/msun \ diff --git a/lib/clang/libllvmdebuginfo/Makefile.depend b/lib/clang/libllvmdebuginfo/Makefile.depend index d4069a675840..4d8f064b840b 100644 --- a/lib/clang/libllvmdebuginfo/Makefile.depend +++ b/lib/clang/libllvmdebuginfo/Makefile.depend @@ -5,7 +5,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ include \ include/xlocale \ - lib/clang/include \ lib/libc++ \ lib/msun \ diff --git a/lib/clang/libllvmirreader/Makefile.depend b/lib/clang/libllvmirreader/Makefile.depend index d4069a675840..4d8f064b840b 100644 --- a/lib/clang/libllvmirreader/Makefile.depend +++ b/lib/clang/libllvmirreader/Makefile.depend @@ -5,7 +5,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ include \ include/xlocale \ - lib/clang/include \ lib/libc++ \ lib/msun \ diff --git a/lib/clang/libllvmlinker/Makefile.depend b/lib/clang/libllvmlinker/Makefile.depend index d4069a675840..4d8f064b840b 100644 --- a/lib/clang/libllvmlinker/Makefile.depend +++ b/lib/clang/libllvmlinker/Makefile.depend @@ -5,7 +5,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ include \ include/xlocale \ - lib/clang/include \ lib/libc++ \ lib/msun \ diff --git a/lib/clang/libllvmmcdisassembler/Makefile.depend b/lib/clang/libllvmmcdisassembler/Makefile.depend index d4069a675840..4d8f064b840b 100644 --- a/lib/clang/libllvmmcdisassembler/Makefile.depend +++ b/lib/clang/libllvmmcdisassembler/Makefile.depend @@ -5,7 +5,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ include \ include/xlocale \ - lib/clang/include \ lib/libc++ \ lib/msun \ diff --git a/lib/clang/libllvmmcparser/Makefile.depend b/lib/clang/libllvmmcparser/Makefile.depend index d4069a675840..4d8f064b840b 100644 --- a/lib/clang/libllvmmcparser/Makefile.depend +++ b/lib/clang/libllvmmcparser/Makefile.depend @@ -5,7 +5,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ include \ include/xlocale \ - lib/clang/include \ lib/libc++ \ lib/msun \ diff --git a/lib/clang/libllvmobject/Makefile.depend b/lib/clang/libllvmobject/Makefile.depend index d4069a675840..4d8f064b840b 100644 --- a/lib/clang/libllvmobject/Makefile.depend +++ b/lib/clang/libllvmobject/Makefile.depend @@ -5,7 +5,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ include \ include/xlocale \ - lib/clang/include \ lib/libc++ \ lib/msun \ diff --git a/lib/clang/libllvmoption/Makefile.depend b/lib/clang/libllvmoption/Makefile.depend index ff10d3df73aa..4d8f064b840b 100644 --- a/lib/clang/libllvmoption/Makefile.depend +++ b/lib/clang/libllvmoption/Makefile.depend @@ -5,10 +5,8 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ include \ include/xlocale \ - lib/clang/include \ lib/libc++ \ lib/msun \ - tools/usr/bin.host \ .include <dirdeps.mk> diff --git a/lib/clang/libllvmruntimedyld/Makefile.depend b/lib/clang/libllvmruntimedyld/Makefile.depend index d4069a675840..4d8f064b840b 100644 --- a/lib/clang/libllvmruntimedyld/Makefile.depend +++ b/lib/clang/libllvmruntimedyld/Makefile.depend @@ -5,7 +5,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ include \ include/xlocale \ - lib/clang/include \ lib/libc++ \ lib/msun \ diff --git a/lib/clang/libllvmsparccodegen/Makefile.depend b/lib/clang/libllvmsparccodegen/Makefile.depend index ce49f971ecc6..19188f948753 100644 --- a/lib/clang/libllvmsparccodegen/Makefile.depend +++ b/lib/clang/libllvmsparccodegen/Makefile.depend @@ -7,7 +7,6 @@ DIRDEPS = \ include/xlocale \ lib/libc++ \ lib/msun \ - tools/usr/bin.host \ usr.bin/clang/tblgen.host \ diff --git a/lib/clang/libllvmsparcdesc/Makefile.depend b/lib/clang/libllvmsparcdesc/Makefile.depend index 940c6310de9a..c7de05425c15 100644 --- a/lib/clang/libllvmsparcdesc/Makefile.depend +++ b/lib/clang/libllvmsparcdesc/Makefile.depend @@ -7,7 +7,6 @@ DIRDEPS = \ include/xlocale \ lib/libc++ \ lib/msun \ - tools/usr/bin.host \ usr.bin/clang/tblgen.host \ diff --git a/lib/clang/libllvmtarget/Makefile.depend b/lib/clang/libllvmtarget/Makefile.depend index d4069a675840..4d8f064b840b 100644 --- a/lib/clang/libllvmtarget/Makefile.depend +++ b/lib/clang/libllvmtarget/Makefile.depend @@ -5,7 +5,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ include \ include/xlocale \ - lib/clang/include \ lib/libc++ \ lib/msun \ diff --git a/lib/clang/libllvmx86utils/Makefile.depend b/lib/clang/libllvmx86utils/Makefile.depend index d4069a675840..4d8f064b840b 100644 --- a/lib/clang/libllvmx86utils/Makefile.depend +++ b/lib/clang/libllvmx86utils/Makefile.depend @@ -5,7 +5,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ include \ include/xlocale \ - lib/clang/include \ lib/libc++ \ lib/msun \ diff --git a/lib/csu/amd64/Makefile b/lib/csu/amd64/Makefile index 5ddbab661f43..7b888fad52d5 100644 --- a/lib/csu/amd64/Makefile +++ b/lib/csu/amd64/Makefile @@ -14,6 +14,7 @@ FILESOWN= ${LIBOWN} FILESGRP= ${LIBGRP} FILESMODE= ${LIBMODE} FILESDIR= ${LIBDIR} +NO_PIE= yes all: ${OBJS} diff --git a/lib/csu/i386-elf/Makefile b/lib/csu/i386-elf/Makefile index 52e1955c1093..8a685dcf9a09 100644 --- a/lib/csu/i386-elf/Makefile +++ b/lib/csu/i386-elf/Makefile @@ -13,6 +13,8 @@ CFLAGS+= -I${.CURDIR}/../common \ CLEANFILES= ${FILES} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o CLEANFILES+= crt1_c.s gcrt1_c.s Scrt1_c.s +NO_PIE= yes + # See the comment in lib/csu/common/crtbrand.c for the reason crt1_c.c is not # directly compiled to .o files. @@ -24,7 +26,7 @@ gcrt1_c.o: gcrt1_c.s ${CC} ${ACFLAGS} -c -o ${.TARGET} gcrt1_c.s gcrt1.o: gcrt1_c.o crt1_s.o - ${LD} ${LDFLAGS:N-[BL]/*} -o gcrt1.o -r crt1_s.o gcrt1_c.o + ${LD} ${_LDFLAGS} -o gcrt1.o -r crt1_s.o gcrt1_c.o crt1_c.s: crt1_c.c ${CC} ${CFLAGS} -S -o ${.TARGET} ${.CURDIR}/crt1_c.c @@ -34,7 +36,7 @@ crt1_c.o: crt1_c.s ${CC} ${ACFLAGS} -c -o ${.TARGET} crt1_c.s crt1.o: crt1_c.o crt1_s.o - ${LD} ${LDFLAGS:N-[BL]/*} -o crt1.o -r crt1_s.o crt1_c.o + ${LD} ${_LDFLAGS} -o crt1.o -r crt1_s.o crt1_c.o objcopy --localize-symbol _start1 crt1.o Scrt1_c.s: crt1_c.c @@ -45,7 +47,7 @@ Scrt1_c.o: Scrt1_c.s ${CC} ${ACFLAGS} -c -o ${.TARGET} Scrt1_c.s Scrt1.o: Scrt1_c.o crt1_s.o - ${LD} ${LDFLAGS:N-[BL]/*} -o Scrt1.o -r crt1_s.o Scrt1_c.o + ${LD} ${_LDFLAGS} -o Scrt1.o -r crt1_s.o Scrt1_c.o objcopy --localize-symbol _start1 Scrt1.o .include <bsd.prog.mk> diff --git a/lib/csu/ia64/Makefile b/lib/csu/ia64/Makefile deleted file mode 100644 index b12e88822d17..000000000000 --- a/lib/csu/ia64/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -# $FreeBSD$ - -.PATH: ${.CURDIR}/../common - -SRCS= crti.S crtn.S -OBJS= ${SRCS:N*.h:R:S/$/.o/g} -OBJS+= crt1.o gcrt1.o Scrt1.o - -all: ${OBJS} - -CLEANFILES= ${OBJS} -CLEANFILES+= crt1_.o gcrt1_.o Scrt1_.o -CLEANFILES+= crtbrand.o gcrtbrand.o Scrtbrand.o -CLEANFILES+= crtbrand.s gcrtbrand.s Scrtbrand.s - -crt1_.o: crt1.S - ${CC} ${CFLAGS} -c -o ${.TARGET} ${.ALLSRC} - -# See the comment in lib/csu/common/crtbrand.c for the reason crtbrand.c is not -# directly compiled to .o files. - -crtbrand.s: crtbrand.c - ${CC} ${CFLAGS} -S -o ${.TARGET} ${.ALLSRC} - sed -i "" -e '/\.note\.ABI-tag/s/progbits/note/' ${.TARGET} - -crtbrand.o: crtbrand.s - ${CC} ${ACFLAGS} -c -o ${.TARGET} crtbrand.s - -crt1.o: crt1_.o crtbrand.o - ${LD} ${LDFLAGS} -r -o ${.TARGET} crt1_.o crtbrand.o - -gcrt1_.o: crt1.S - ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.ALLSRC} - -gcrtbrand.s: crtbrand.c - ${CC} ${CFLAGS} -DGCRT -S -o ${.TARGET} ${.ALLSRC} - sed -i "" -e '/\.note\.ABI-tag/s/progbits/note/' ${.TARGET} - -gcrtbrand.o: gcrtbrand.s - ${CC} ${ACFLAGS} -c -o ${.TARGET} gcrtbrand.s - -gcrt1.o: gcrt1_.o gcrtbrand.o - ${LD} ${LDFLAGS} -r -o ${.TARGET} ${.ALLSRC} - -Scrt1_.o: crt1.S - ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.ALLSRC} - -Scrtbrand.s: crtbrand.c - ${CC} ${CFLAGS} -fPIC -DPIC -S -o ${.TARGET} ${.ALLSRC} - sed -i "" -e '/\.note\.ABI-tag/s/progbits/note/' ${.TARGET} - -Scrtbrand.o: Scrtbrand.s - ${CC} ${ACFLAGS} -c -o ${.TARGET} Scrtbrand.s - -Scrt1.o: Scrt1_.o Scrtbrand.o - ${LD} ${LDFLAGS} -r -o ${.TARGET} ${.ALLSRC} - -realinstall: - ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ - ${OBJS} ${DESTDIR}${LIBDIR} - -.include <bsd.lib.mk> diff --git a/lib/csu/ia64/crt1.S b/lib/csu/ia64/crt1.S deleted file mode 100644 index 6ff9cd9171ae..000000000000 --- a/lib/csu/ia64/crt1.S +++ /dev/null @@ -1,197 +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$"); - - .text - -/* - * void _start(char **ap, struct ps_strings *, void (*cleanup)(void)); - */ -#define AP in0 -#define CLEANUP in2 - -#define GP loc0 -#define ARGC loc1 -#define ARGV loc2 -#define ENVP loc3 - - .global _start - .type _start, @function - .proc _start -_start: - .prologue - .save rp, r0 - .body -{ .mlx - alloc r14=ar.pfs,3,4,3,0 - movl r15=@gprel(1f) -} -1: -{ .mmi - ld4 ARGC=[AP] - adds ARGV=8,AP - mov r16=ip - ;; -} -{ .mmi - sub gp=r16,r15 - sub GP=r16,r15 - shladd r14=ARGC,3,AP - ;; -} -{ .mii - addl r15=@ltoff(environ),gp - cmp4.ge p6,p7=0,ARGC - adds ENVP=16,r14 - ;; -} -{ .mmi - ld8 r14=[r15] -(p7) ld8 r15=[ARGV] - addl r16=@gprel(__progname),gp - ;; -} -{ .mib - st8 [r14]=ENVP -(p7) cmp.eq p6,p0=0,r15 -(p6) br.dpnt .L1 - ;; -} - /* Normalize __progname. */ -{ .mmi - st8 [r16]=r15 - ld1 r14=[r15],1 - nop 0 - ;; -} -.L0: -{ .mib - cmp4.eq p7,p0=0,r14 - cmp4.eq p6,p0=0x2f,r14 -(p7) br.dptk .L1 - ;; -} -{ .mmb -(p6) st8 [r16]=r15 - ld1 r14=[r15],1 - br.dptk.many .L0 -} -.L1: -{ .mib - cmp.ne p7,p0=0,CLEANUP - mov out0=CLEANUP -(p7) br.call.sptk b0=atexit - ;; -} -{ .mfb - mov gp=GP - nop 0 - br.call.sptk b0=_init_tls -} -#ifdef GCRT -{ .mmi - mov gp=GP - ;; - addl r14=@ltoff(@fptr(_mcleanup)),gp - nop 0 - ;; -} -{ .mfb - ld8 out0=[r14] - nop 0 - br.call.sptk b0=atexit - ;; -} -#endif -{ .mmi - mov gp=GP - ;; - addl r14=@ltoff(@fptr(_fini)),gp - nop 0 - ;; -} -{ .mfb - ld8 out0=[r14] - nop 0 - br.call.sptk b0=atexit - ;; -} -#ifdef GCRT -{ .mmi - mov gp=GP - ;; - addl r14=@ltoff(eprol),gp - addl r15=@ltoff(etext),gp - ;; -} -{ .mmb - ld8 out0=[r14] - ld8 out1=[r15] - br.call.sptk b0=monstartup - ;; -} -#endif -{ .mfb - mov gp=GP - nop 0 - br.call.sptk b0=_init - ;; -} -{ .mmi - mov gp=GP - mov out0=ARGC - mov out1=ARGV -} -{ .mfb - mov out2=ENVP - nop 0 - br.call.sptk b0=main - ;; -} -{ .mib - mov gp=GP - mov out0=r8 - br.call.sptk b0=exit - ;; -} - .endp _start - -#ifdef GCRT -eprol: -#endif - - .rodata -.empty: stringz "" - - .sdata - .global __progname - .size __progname,8 - .type __progname,@object -__progname: data8 .empty - - .common environ,8,8 diff --git a/lib/csu/ia64/crtn.S b/lib/csu/ia64/crtn.S deleted file mode 100644 index 681fba38c9b2..000000000000 --- a/lib/csu/ia64/crtn.S +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * Copyright (c) 2001 Peter Wemm <peter@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 <machine/asm.h> -__FBSDID("$FreeBSD$"); - - .file "crtn.S" - - .section .init,"ax",@progbits - .regstk 0,2,0,0 - mov b0=loc0 /* Recover return addr */ - mov ar.pfs=loc1 - br.ret.sptk.many b0 - - .section .fini,"ax",@progbits - .regstk 0,2,0,0 - mov b0=loc0 /* Recover return addr */ - mov ar.pfs=loc1 - br.ret.sptk.many b0 diff --git a/lib/libarchive/Makefile b/lib/libarchive/Makefile index bbe03a0bf126..146032991169 100644 --- a/lib/libarchive/Makefile +++ b/lib/libarchive/Makefile @@ -41,7 +41,7 @@ SHARED_CFLAGS+= -DHAVE_ICONV=1 -DHAVE_ICONV_H=1 -DICONV_CONST=const .endif .if ${MACHINE_ARCH:Marm*} != "" || ${MACHINE_ARCH:Mmips*} != "" || \ - ${MACHINE_ARCH:Msparc64*} != "" || ${MACHINE_ARCH:Mia64*} != "" + ${MACHINE_ARCH:Msparc64*} != "" NO_WCAST_ALIGN= yes .if ${MACHINE_ARCH:M*64*} == "" CFLAGS+= -DPPMD_32BIT diff --git a/lib/libarchive/config_freebsd.h b/lib/libarchive/config_freebsd.h index bcbad161446d..0df3f917e92d 100644 --- a/lib/libarchive/config_freebsd.h +++ b/lib/libarchive/config_freebsd.h @@ -228,15 +228,15 @@ /* FreeBSD defines for archive_hash.h */ #ifdef WITH_OPENSSL -#define ARCHIVE_HASH_MD5_OPENSSL 1 -#define ARCHIVE_HASH_RMD160_OPENSSL 1 -#define ARCHIVE_HASH_SHA1_OPENSSL -#define ARCHIVE_HASH_SHA256_OPENSSL 1 -#define ARCHIVE_HASH_SHA384_OPENSSL 1 -#define ARCHIVE_HASH_SHA512_OPENSSL 1 +#define ARCHIVE_CRYPTO_MD5_OPENSSL 1 +#define ARCHIVE_CRYPTO_RMD160_OPENSSL 1 +#define ARCHIVE_CRYPTO_SHA1_OPENSSL +#define ARCHIVE_CRYPTO_SHA256_OPENSSL 1 +#define ARCHIVE_CRYPTO_SHA384_OPENSSL 1 +#define ARCHIVE_CRYPTO_SHA512_OPENSSL 1 #else -#define ARCHIVE_HASH_MD5_LIBMD 1 -#define ARCHIVE_HASH_SHA1_LIBMD 1 -#define ARCHIVE_HASH_SHA256_LIBMD 1 -#define ARCHIVE_HASH_SHA512_LIBMD 1 +#define ARCHIVE_CRYPTO_MD5_LIBMD 1 +#define ARCHIVE_CRYPTO_SHA1_LIBMD 1 +#define ARCHIVE_CRYPTO_SHA256_LIBMD 1 +#define ARCHIVE_CRYPTO_SHA512_LIBMD 1 #endif diff --git a/lib/libbegemot/Makefile.depend b/lib/libbegemot/Makefile.depend index 467741f6d1a9..4acc32f64da1 100644 --- a/lib/libbegemot/Makefile.depend +++ b/lib/libbegemot/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/libbluetooth/bluetooth.3 b/lib/libbluetooth/bluetooth.3 index e011094a18c8..482c73285936 100644 --- a/lib/libbluetooth/bluetooth.3 +++ b/lib/libbluetooth/bluetooth.3 @@ -720,7 +720,7 @@ The function guarantees that the socket, passed to the callback function, will be bound and connected to the Bluetooth device being enumerated. .Sh AUTHORS -.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com +.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com .Sh BUGS Some of those functions use static data storage; if the data is needed for future use, it should be 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 diff --git a/lib/libcalendar/calendar.3 b/lib/libcalendar/calendar.3 index 469f1c9e70c5..f86d5e34eb06 100644 --- a/lib/libcalendar/calendar.3 +++ b/lib/libcalendar/calendar.3 @@ -198,6 +198,6 @@ library first appeared in .Fx 3.0 . .Sh AUTHORS This manual page and the library was written by -.An Wolfgang Helbig Aq helbig@FreeBSD.org . +.An Wolfgang Helbig Aq Mt helbig@FreeBSD.org . .Sh BUGS The library was coded with great care so there are no bugs left. diff --git a/lib/libcam/cam.3 b/lib/libcam/cam.3 index 4f918d2c09f9..7fe2a168fe72 100644 --- a/lib/libcam/cam.3 +++ b/lib/libcam/cam.3 @@ -406,7 +406,7 @@ characters long. The CAM library first appeared in .Fx 3.0 . .Sh AUTHORS -.An Kenneth Merry Aq ken@FreeBSD.org +.An Kenneth Merry Aq Mt ken@FreeBSD.org .Sh BUGS .Fn cam_open_device does not check to see if the diff --git a/lib/libcapsicum/libcapsicum.3 b/lib/libcapsicum/libcapsicum.3 index efeec2f131f2..9df565a4077d 100644 --- a/lib/libcapsicum/libcapsicum.3 +++ b/lib/libcapsicum/libcapsicum.3 @@ -284,5 +284,5 @@ printf("Name associated with %s is %s.\\n", ipstr, hp->h_name); The .Nm libcapsicum library was implemented 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/libcrypt/crypt.3 b/lib/libcrypt/crypt.3 index 50829c2fa43b..828c37f51d63 100644 --- a/lib/libcrypt/crypt.3 +++ b/lib/libcrypt/crypt.3 @@ -283,7 +283,7 @@ libcrypt encryption library. .Sh AUTHORS .An -nosplit Originally written by -.An David Burren Aq davidb@werj.com.au , +.An David Burren Aq Mt davidb@werj.com.au , later additions and changes by .An Poul-Henning Kamp , .An Mark R V Murray , diff --git a/lib/libcrypt/crypt.c b/lib/libcrypt/crypt.c index 040fdc1b90af..c3ca4c225cb7 100644 --- a/lib/libcrypt/crypt.c +++ b/lib/libcrypt/crypt.c @@ -104,12 +104,16 @@ char * crypt(const char *passwd, const char *salt) { const struct crypt_format *cf; +#ifdef HAS_DES + int len; +#endif for (cf = crypt_formats; cf->name != NULL; ++cf) if (cf->magic != NULL && strstr(salt, cf->magic) == salt) return (cf->func(passwd, salt)); #ifdef HAS_DES - if (strlen(salt) == 13 && strspn(salt, DES_SALT_ALPHABET) == 13) + len = strlen(salt); + if ((len == 13 || len == 2) && strspn(salt, DES_SALT_ALPHABET) == len) return (crypt_des(passwd, salt)); #endif return (crypt_format->func(passwd, salt)); diff --git a/lib/libcuse/Makefile b/lib/libcuse/Makefile new file mode 100644 index 000000000000..6269cbe28801 --- /dev/null +++ b/lib/libcuse/Makefile @@ -0,0 +1,69 @@ +# $FreeBSD$ +# +# Copyright (c) 2010 Hans Petter Selasky. 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. +# + +LIB= cuse +SHLIB_MAJOR= 1 +SHLIB_MINOR= 0 +SRCS= cuse_lib.c +INCS= cuse.h +MAN= cuse.3 +PTHREAD_LIBS?= -lpthread +CFLAGS+= -D_GNU_SOURCE +.if defined(HAVE_DEBUG) +CFLAGS+= -g +CFLAGS+= -DHAVE_DEBUG +.endif +LDADD+= ${PTHREAD_LIBS} + +MLINKS= +MLINKS+= cuse.3 cuse_alloc_unit_number.3 +MLINKS+= cuse.3 cuse_alloc_unit_number_by_id.3 +MLINKS+= cuse.3 cuse_copy_in.3 +MLINKS+= cuse.3 cuse_copy_out.3 +MLINKS+= cuse.3 cuse_dev_create.3 +MLINKS+= cuse.3 cuse_dev_destroy.3 +MLINKS+= cuse.3 cuse_dev_get_current.3 +MLINKS+= cuse.3 cuse_dev_get_per_file_handle.3 +MLINKS+= cuse.3 cuse_dev_get_priv0.3 +MLINKS+= cuse.3 cuse_dev_get_priv1.3 +MLINKS+= cuse.3 cuse_dev_set_per_file_handle.3 +MLINKS+= cuse.3 cuse_dev_set_priv0.3 +MLINKS+= cuse.3 cuse_dev_set_priv1.3 +MLINKS+= cuse.3 cuse_free_unit_number.3 +MLINKS+= cuse.3 cuse_free_unit_number_by_id.3 +MLINKS+= cuse.3 cuse_got_peer_signal.3 +MLINKS+= cuse.3 cuse_init.3 +MLINKS+= cuse.3 cuse_poll_wakeup.3 +MLINKS+= cuse.3 cuse_set_local.3 +MLINKS+= cuse.3 cuse_get_local.3 +MLINKS+= cuse.3 cuse_uninit.3 +MLINKS+= cuse.3 cuse_vmalloc.3 +MLINKS+= cuse.3 cuse_is_vmalloc_addr.3 +MLINKS+= cuse.3 cuse_vmfree.3 +MLINKS+= cuse.3 cuse_vmoffset.3 +MLINKS+= cuse.3 cuse_wait_and_process.3 + +.include <bsd.lib.mk> diff --git a/lib/libcuse/Makefile.depend b/lib/libcuse/Makefile.depend new file mode 100644 index 000000000000..37acbe0cd621 --- /dev/null +++ b/lib/libcuse/Makefile.depend @@ -0,0 +1,21 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DIRDEPS = \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + lib/libthr \ + usr.bin/xinstall.host \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/lib/libcuse/cuse.3 b/lib/libcuse/cuse.3 new file mode 100644 index 000000000000..6d8d2a3cd860 --- /dev/null +++ b/lib/libcuse/cuse.3 @@ -0,0 +1,388 @@ +.\" $FreeBSD$ +.\" +.\" Copyright (c) 2010-2013 Hans Petter Selasky +.\" +.\" 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. +.\" +.Dd June 6, 2014 +.Dt CUSE 3 +.Os +.Sh NAME +.Nm libcuse +.Nd "Userland character device library" +.Sh LIBRARY +.Lb libcuse +.Sh SYNOPSIS +To load the required kernel module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +cuse_load="YES" +.Ed +.Pp +.In cuse.h +.Sh DESCRIPTION +The +.Nm +library contains functions to create a character device in userspace. +The +.Nm +library is thread safe. +.Sh LIBRARY INITIALISATION / DEINITIALISATION +.Ft "int" +.Fn "cuse_init" "void" +This function initialises +.Nm . +Must be called at the beginning of the program. +This function returns 0 on success or a negative value on failure. +See +.Dv CUSE_ERR_XXX +for known error codes. +If the cuse kernel module is not loaded, +.Dv CUSE_ERR_NOT_LOADED +is returned. +.Pp +.Ft "int" +.Fn "cuse_uninit" "void" +Deinitialise +.Nm . +Can be called at the end of the application. +This function returns 0 on success or a negative value on failure. +See +.Dv CUSE_ERR_XXX +for known error codes. +.Sh UNIT MANAGEMENT +.Ft "int" +.Fn "cuse_alloc_unit_number" "int *" +This function stores a uniq system unit number at the pointed +integer loation. +This function returns 0 on success or a negative value on failure. +See +.Dv CUSE_ERR_XXX +for known error codes. +.Pp +.Ft "int" +.Fn "cuse_alloc_unit_number_by_id" "int *" "int id" +This function stores a unique system unit number at the pointed +integer loation. +The returned unit number is uniq within the given ID. +Valid ID values are defined by the cuse include file. +See the +.Fn CUSE_ID_XXX +macros for more information. +This function returns 0 on success or a negative value on failure. +See +.Dv CUSE_ERR_XXX +for known error codes. +.Pp +.Ft "int" +.Fn "cuse_free_unit_number" "int" +This function frees the given allocated system unit number. +This function returns 0 on success or a negative value on failure. +See +.Dv CUSE_ERR_XXX +for known error codes. +.Pp +.Ft "int" +.Fn "cuse_free_unit_number_by_id" "int unit" "int id" +This function frees the given allocated system unit number belonging +to the given ID. +If both the unit and id argument is -1, all allocated units will be freed. +This function returns 0 on success or a negative value on failure. +See +.Dv CUSE_ERR_XXX +for known error codes. +.Sh LIBRARY USAGE +.Ft "void *" +.Fn "cuse_vmalloc" "int size" +This function allocates +.Ar size +bytes of memory. +Only memory allocated by this function can be memory +mapped by +.Xr mmap 2 . +This function returns a valid data pointer on success or +.Dv NULL +on failure. +.Pp +.Ft "int" +.Fn "cuse_is_vmalloc_addr" "void *" +This function returns non-zero if the passed pointer points to a valid +and non-freed allocation, as returned by +.Fn cuse_vmalloc . +Else this function returns zero. +.Pp +.Ft "void" +.Fn "cuse_vmfree" "void *" +This function frees memory allocated by +.Fn cuse_vmalloc . +Note that the +cuse library will internally not free the memory until the +.Fn cuse_uninit +function is called and that the number of unique +allocations is limited. +.Pp +.Ft "unsigned long" +.Fn "cuse_vmoffset" "void *" +This function returns the mmap offset that the client must use to +access the allocated memory. +.Pp +.Ft "struct cuse_dev *" +.Fn "cuse_dev_create" "const struct cuse_methods *mtod" "void *priv0" "void *priv1" "uid_t" "gid_t" "int permission" "const char *fmt" "..." +This function creates a new character device according to the given +parameters. +This function returns a valid cuse_dev structure pointer +on success or +.Dv NULL +on failure. +The device name can only contain a-z, +A-Z, 0-9, dot, / and underscore characters. +.Pp +.Ft "void" +.Fn "cuse_dev_destroy" "struct cuse_dev *" +This functions destroys a previously created character device. +.Pp +.Ft "void *" +.Fn "cuse_dev_get_priv0" "struct cuse_dev *" , +.Ft "void *" +.Fn "cuse_dev_get_priv1" "struct cuse_dev *" , +.Ft "void" +.Fn "cuse_dev_set_priv0" "struct cuse_dev *" "void *" , +.Ft "void" +.Fn "cuse_dev_set_priv1" "struct cuse_dev *" "void *" +These functions are used to set and get the private data of the given +cuse device. +.Pp +.Ft "int" +.Fn "cuse_wait_and_process" "void" +This function will block and do event processing. +If parallel I/O is +required multiple threads must be created looping on this +function. +This function returns 0 on success or a negative value on failure. +See +.Dv CUSE_ERR_XXX +for known error codes. +.Pp +.Ft "void *" +.Fn "cuse_dev_get_per_file_handle" "struct cuse_dev *" , +.Ft "void" +.Fn "cuse_dev_set_per_file_handle" "struct cuse_dev *" "void *" +These functions are used to set and get the per-file-open specific handle +and should only be used inside the cuse file operation callbacks. +.Pp +.Ft "void" +.Fn "cuse_set_local" "int" +This function instructs +.Fn cuse_copy_out +and +.Fn cuse_copy_in +that the +user pointer is local, if the argument passed to it is non-zero. +Else the user pointer is assumed to be at the peer application. +This function should only be used inside the cuse file operation callbacks. +The value is reset to zero when the given file operation returns, and +does not affect any other file operation callbacks. +.Pp +.Ft "int" +.Fn "cuse_get_local" "void" +Returns the current local state. +See +.Fn cuse_set_local . +.Pp +.Ft "int" +.Fn "cuse_copy_out" "const void *src" "void *peer_dst" "int len" , +.Ft "int" +.Fn "cuse_copy_in" "const void *peer_src" "void *dst" "int len" +These functions are used to transfer data between the local +application and the peer application. +These functions must be used +when operating on the data pointers passed to the +.Fn cm_read , +.Fn cm_write , +and +.Fn cm_ioctl +callback functions. +These functions return 0 on success or a negative value on failure. +See +.Dv CUSE_ERR_XXX +for known error codes. +.Pp +.Ft "int" +.Fn "cuse_got_peer_signal" "void" +This function is used to check if a signal has been delivered to the +peer application and should only be used inside the cuse file +operation callbacks. +This function returns 0 if a signal has been +delivered to the caller. +Else it returns a negative value. +See +.Dv CUSE_ERR_XXX +for known error codes. +.Pp +.Ft "struct cuse_dev *" +.Fn "cuse_dev_get_current" "int *pcmd" +This function is used to get the current cuse device pointer and the +currently executing command, by +.Dv CUSE_CMD_XXX +value. +The +.Ar pcmd +argument +is allowed to be +.Dv NULL . +This function should only be used inside the +cuse file operation callbacks. +On success a valid cuse device pointer +is returned. +On failure +.Dv NULL +is returned. +.Pp +.Ft "void" +.Fn "cuse_poll_wakeup" "void" +This function will wake up any file pollers. +.Sh LIBRARY LIMITATIONS +Transfer lengths for +.Fn read , +.Fn write , +.Fn cuse_copy_in , +and +.Fn cuse_copy_out +should not exceed what can fit into a 32-bit signed integer and is +defined by the +.Fn CUSE_LENGTH_MAX +macro. +Transfer lengths for ioctls should not exceed what is defined by the +.Fn CUSE_BUFFER_MAX +macro. +.Sh LIBRARY CALLBACK METHODS +In general fflags are defined by +.Dv CUSE_FFLAG_XXX +and errors are defined by +.Dv CUSE_ERR_XXX . +.Bd -literal -offset indent +enum { + CUSE_ERR_NONE + CUSE_ERR_BUSY + CUSE_ERR_WOULDBLOCK + CUSE_ERR_INVALID + CUSE_ERR_NO_MEMORY + CUSE_ERR_FAULT + CUSE_ERR_SIGNAL + CUSE_ERR_OTHER + CUSE_ERR_NOT_LOADED + + CUSE_POLL_NONE + CUSE_POLL_READ + CUSE_POLL_WRITE + CUSE_POLL_ERROR + + CUSE_FFLAG_NONE + CUSE_FFLAG_READ + CUSE_FFLAG_WRITE + CUSE_FFLAG_NONBLOCK + + CUSE_CMD_NONE + CUSE_CMD_OPEN + CUSE_CMD_CLOSE + CUSE_CMD_READ + CUSE_CMD_WRITE + CUSE_CMD_IOCTL + CUSE_CMD_POLL + CUSE_CMD_SIGNAL + CUSE_CMD_SYNC + CUSE_CMD_MAX +}; +.Ed +.Pp +.Ft "int" +.Fn "cuse_open_t" "struct cuse_dev *" "int fflags" +This function returns a +.Dv CUSE_ERR_XXX +value. +.Pp +.Ft "int" +.Fn "cuse_close_t" "struct cuse_dev *" "int fflags" +This function returns a +.Dv CUSE_ERR_XXX +value. +.Pp +.Ft "int" +.Fn "cuse_read_t" "struct cuse_dev *" "int fflags" "void *peer_ptr" "int len" +This function returns a +.Dv CUSE_ERR_XXX +value in case of failure or the +actually transferred length in case of success. +.Fn cuse_copy_in +and +.Fn cuse_copy_out +must be used to transfer data to and from the +.Ar peer_ptr . +.Pp +.Ft "int" +.Fn "cuse_write_t" "struct cuse_dev *" "int fflags" "const void *peer_ptr" "int len" +This function returns a +.Dv CUSE_ERR_XXX +value in case of failure or the +actually transferred length in case of success. +.Fn cuse_copy_in +and +.Fn cuse_copy_out +must be used to transfer data to and from the +.Ar peer_ptr . +.Pp +.Ft "int" +.Fn "cuse_ioctl_t" "struct cuse_dev *" "int fflags" "unsigned long cmd" "void *peer_data" +This function returns a +.Dv CUSE_ERR_XXX +value in case of failure or zero +in case of success. +.Fn cuse_copy_in +and +.Fn cuse_copy_out +must be used to +transfer data to and from the +.Ar peer_data . +.Pp +.Ft "int" +.Fn "cuse_poll_t" "struct cuse_dev *" "int fflags" "int events" +This function returns a mask of +.Dv CUSE_POLL_XXX +values in case of failure and success. +The events argument is also a mask of +.Dv CUSE_POLL_XXX +values. +.Bd -literal -offset indent +struct cuse_methods { + cuse_open_t *cm_open; + cuse_close_t *cm_close; + cuse_read_t *cm_read; + cuse_write_t *cm_write; + cuse_ioctl_t *cm_ioctl; + cuse_poll_t *cm_poll; +}; +.Ed +.Sh HISTORY +.Nm +was written by Hans Petter Selasky. diff --git a/lib/libcuse/cuse.h b/lib/libcuse/cuse.h new file mode 100644 index 000000000000..d502c5bd5415 --- /dev/null +++ b/lib/libcuse/cuse.h @@ -0,0 +1,97 @@ +/* $FreeBSD$ */ +/*- + * Copyright (c) 2014 Hans Petter Selasky. 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. + */ + +#ifndef _CUSE_H_ +#define _CUSE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <fs/cuse/cuse_defs.h> + +struct cuse_dev; + +typedef int (cuse_open_t)(struct cuse_dev *, int fflags); +typedef int (cuse_close_t)(struct cuse_dev *, int fflags); +typedef int (cuse_read_t)(struct cuse_dev *, int fflags, void *user_ptr, int len); +typedef int (cuse_write_t)(struct cuse_dev *, int fflags, const void *user_ptr, int len); +typedef int (cuse_ioctl_t)(struct cuse_dev *, int fflags, unsigned long cmd, void *user_data); +typedef int (cuse_poll_t)(struct cuse_dev *, int fflags, int events); + +struct cuse_methods { + cuse_open_t *cm_open; + cuse_close_t *cm_close; + cuse_read_t *cm_read; + cuse_write_t *cm_write; + cuse_ioctl_t *cm_ioctl; + cuse_poll_t *cm_poll; +}; + +int cuse_init(void); +int cuse_uninit(void); + +void *cuse_vmalloc(int); +int cuse_is_vmalloc_addr(void *); +void cuse_vmfree(void *); +unsigned long cuse_vmoffset(void *ptr); + +int cuse_alloc_unit_number_by_id(int *, int); +int cuse_free_unit_number_by_id(int, int); +int cuse_alloc_unit_number(int *); +int cuse_free_unit_number(int); + +struct cuse_dev *cuse_dev_create(const struct cuse_methods *, void *, void *, uid_t, gid_t, int, const char *,...); +void cuse_dev_destroy(struct cuse_dev *); + +void *cuse_dev_get_priv0(struct cuse_dev *); +void *cuse_dev_get_priv1(struct cuse_dev *); + +void cuse_dev_set_priv0(struct cuse_dev *, void *); +void cuse_dev_set_priv1(struct cuse_dev *, void *); + +void cuse_set_local(int); +int cuse_get_local(void); + +int cuse_wait_and_process(void); + +void cuse_dev_set_per_file_handle(struct cuse_dev *, void *); +void *cuse_dev_get_per_file_handle(struct cuse_dev *); + +int cuse_copy_out(const void *src, void *user_dst, int len); +int cuse_copy_in(const void *user_src, void *dst, int len); +int cuse_got_peer_signal(void); +void cuse_poll_wakeup(void); + +struct cuse_dev *cuse_dev_get_current(int *); + +extern int cuse_debug_level; + +#ifdef __cplusplus +} +#endif + +#endif /* _CUSE_H_ */ diff --git a/lib/libcuse/cuse_lib.c b/lib/libcuse/cuse_lib.c new file mode 100644 index 000000000000..9d8352f81df1 --- /dev/null +++ b/lib/libcuse/cuse_lib.c @@ -0,0 +1,800 @@ +/* $FreeBSD$ */ +/*- + * Copyright (c) 2010-2012 Hans Petter Selasky. 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 <stdio.h> +#include <stdint.h> +#include <pthread.h> +#include <signal.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> +#include <stdarg.h> + +#include <sys/types.h> +#include <sys/queue.h> +#include <sys/fcntl.h> +#include <sys/mman.h> +#include <sys/param.h> + +#include <fs/cuse/cuse_ioctl.h> + +#include "cuse.h" + +int cuse_debug_level; + +#ifdef HAVE_DEBUG +static const char *cuse_cmd_str(int cmd); + +#define DPRINTF(...) do { \ + if (cuse_debug_level != 0) \ + printf(__VA_ARGS__); \ +} while (0) +#else +#define DPRINTF(...) do { } while (0) +#endif + +struct cuse_vm_allocation { + uint8_t *ptr; + uint32_t size; +}; + +struct cuse_dev_entered { + TAILQ_ENTRY(cuse_dev_entered) entry; + pthread_t thread; + void *per_file_handle; + struct cuse_dev *cdev; + int cmd; + int is_local; + int got_signal; +}; + +struct cuse_dev { + TAILQ_ENTRY(cuse_dev) entry; + const struct cuse_methods *mtod; + void *priv0; + void *priv1; +}; + +static TAILQ_HEAD(, cuse_dev) h_cuse; +static TAILQ_HEAD(, cuse_dev_entered) h_cuse_entered; +static int f_cuse = -1; +static pthread_mutex_t m_cuse; +static struct cuse_vm_allocation a_cuse[CUSE_ALLOC_UNIT_MAX]; + +static void +cuse_lock(void) +{ + pthread_mutex_lock(&m_cuse); +} + +static void +cuse_unlock(void) +{ + pthread_mutex_unlock(&m_cuse); +} + +int +cuse_init(void) +{ + pthread_mutexattr_t attr; + + f_cuse = open("/dev/cuse", O_RDWR); + if (f_cuse < 0) { + if (feature_present("cuse") == 0) + return (CUSE_ERR_NOT_LOADED); + else + return (CUSE_ERR_INVALID); + } + pthread_mutexattr_init(&attr); + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init(&m_cuse, &attr); + + TAILQ_INIT(&h_cuse); + TAILQ_INIT(&h_cuse_entered); + + return (0); +} + +int +cuse_uninit(void) +{ + int f; + + if (f_cuse < 0) + return (CUSE_ERR_INVALID); + + f = f_cuse; + f_cuse = -1; + + close(f); + + pthread_mutex_destroy(&m_cuse); + + memset(a_cuse, 0, sizeof(a_cuse)); + + return (0); +} + +unsigned long +cuse_vmoffset(void *_ptr) +{ + uint8_t *ptr_min; + uint8_t *ptr_max; + uint8_t *ptr = _ptr; + unsigned long remainder; + int n; + + cuse_lock(); + for (n = 0; n != CUSE_ALLOC_UNIT_MAX; n++) { + if (a_cuse[n].ptr == NULL) + continue; + + ptr_min = a_cuse[n].ptr; + ptr_max = a_cuse[n].ptr + a_cuse[n].size - 1; + + if ((ptr >= ptr_min) && (ptr <= ptr_max)) { + + cuse_unlock(); + + remainder = (ptr - ptr_min); + + remainder -= remainder % PAGE_SIZE; + + return ((n * PAGE_SIZE * CUSE_ALLOC_PAGES_MAX) + remainder); + } + } + cuse_unlock(); + + return (0x80000000UL); /* failure */ +} + +void * +cuse_vmalloc(int size) +{ + struct cuse_alloc_info info; + void *ptr; + int error; + int n; + + if (f_cuse < 0) + return (NULL); + + memset(&info, 0, sizeof(info)); + + if (size < 1) + return (NULL); + + info.page_count = (size + PAGE_SIZE - 1) / PAGE_SIZE; + + cuse_lock(); + for (n = 0; n != CUSE_ALLOC_UNIT_MAX; n++) { + + if (a_cuse[n].ptr != NULL) + continue; + + a_cuse[n].ptr = ((uint8_t *)1); /* reserve */ + a_cuse[n].size = 0; + + cuse_unlock(); + + info.alloc_nr = n; + + error = ioctl(f_cuse, CUSE_IOCTL_ALLOC_MEMORY, &info); + + if (error) { + + cuse_lock(); + + a_cuse[n].ptr = NULL; + + if (errno == EBUSY) + continue; + else + break; + } + ptr = mmap(NULL, info.page_count * PAGE_SIZE, + PROT_READ | PROT_WRITE, + MAP_SHARED, f_cuse, CUSE_ALLOC_PAGES_MAX * + PAGE_SIZE * n); + + if (ptr == MAP_FAILED) { + + error = ioctl(f_cuse, CUSE_IOCTL_FREE_MEMORY, &info); + + if (error) { + /* ignore */ + } + cuse_lock(); + + a_cuse[n].ptr = NULL; + + break; + } + cuse_lock(); + a_cuse[n].ptr = ptr; + a_cuse[n].size = size; + cuse_unlock(); + + return (ptr); /* success */ + } + cuse_unlock(); + return (NULL); /* failure */ +} + +int +cuse_is_vmalloc_addr(void *ptr) +{ + int n; + + if (f_cuse < 0 || ptr == NULL) + return (0); /* false */ + + cuse_lock(); + for (n = 0; n != CUSE_ALLOC_UNIT_MAX; n++) { + if (a_cuse[n].ptr == ptr) + break; + } + cuse_unlock(); + + return (n != CUSE_ALLOC_UNIT_MAX); +} + +void +cuse_vmfree(void *ptr) +{ + struct cuse_alloc_info info; + int error; + int n; + + if (f_cuse < 0) + return; + + memset(&info, 0, sizeof(info)); + + cuse_lock(); + for (n = 0; n != CUSE_ALLOC_UNIT_MAX; n++) { + if (a_cuse[n].ptr != ptr) + continue; + + cuse_unlock(); + + info.alloc_nr = n; + + munmap(ptr, a_cuse[n].size); + + error = ioctl(f_cuse, CUSE_IOCTL_FREE_MEMORY, &info); + + if (error) { + /* ignore */ + } + cuse_lock(); + + a_cuse[n].ptr = NULL; + a_cuse[n].size = 0; + + break; + } + cuse_unlock(); +} + +int +cuse_alloc_unit_number_by_id(int *pnum, int id) +{ + int error; + + if (f_cuse < 0) + return (CUSE_ERR_INVALID); + + *pnum = (id & CUSE_ID_MASK); + + error = ioctl(f_cuse, CUSE_IOCTL_ALLOC_UNIT_BY_ID, pnum); + if (error) + return (CUSE_ERR_NO_MEMORY); + + return (0); + +} + +int +cuse_free_unit_number_by_id(int num, int id) +{ + int error; + + if (f_cuse < 0) + return (CUSE_ERR_INVALID); + + if (num != -1 || id != -1) + num = (id & CUSE_ID_MASK) | (num & 0xFF); + + error = ioctl(f_cuse, CUSE_IOCTL_FREE_UNIT_BY_ID, &num); + if (error) + return (CUSE_ERR_NO_MEMORY); + + return (0); +} + +int +cuse_alloc_unit_number(int *pnum) +{ + int error; + + if (f_cuse < 0) + return (CUSE_ERR_INVALID); + + error = ioctl(f_cuse, CUSE_IOCTL_ALLOC_UNIT, pnum); + if (error) + return (CUSE_ERR_NO_MEMORY); + + return (0); +} + +int +cuse_free_unit_number(int num) +{ + int error; + + if (f_cuse < 0) + return (CUSE_ERR_INVALID); + + error = ioctl(f_cuse, CUSE_IOCTL_FREE_UNIT, &num); + if (error) + return (CUSE_ERR_NO_MEMORY); + + return (0); +} + +struct cuse_dev * +cuse_dev_create(const struct cuse_methods *mtod, void *priv0, void *priv1, + uid_t _uid, gid_t _gid, int _perms, const char *_fmt,...) +{ + struct cuse_create_dev info; + struct cuse_dev *cdev; + va_list args; + int error; + + if (f_cuse < 0) + return (NULL); + + cdev = malloc(sizeof(*cdev)); + if (cdev == NULL) + return (NULL); + + memset(cdev, 0, sizeof(*cdev)); + + cdev->mtod = mtod; + cdev->priv0 = priv0; + cdev->priv1 = priv1; + + memset(&info, 0, sizeof(info)); + + info.dev = cdev; + info.user_id = _uid; + info.group_id = _gid; + info.permissions = _perms; + + va_start(args, _fmt); + vsnprintf(info.devname, sizeof(info.devname), _fmt, args); + va_end(args); + + error = ioctl(f_cuse, CUSE_IOCTL_CREATE_DEV, &info); + if (error) { + free(cdev); + return (NULL); + } + cuse_lock(); + TAILQ_INSERT_TAIL(&h_cuse, cdev, entry); + cuse_unlock(); + + return (cdev); +} + + +void +cuse_dev_destroy(struct cuse_dev *cdev) +{ + int error; + + if (f_cuse < 0) + return; + + cuse_lock(); + TAILQ_REMOVE(&h_cuse, cdev, entry); + cuse_unlock(); + + error = ioctl(f_cuse, CUSE_IOCTL_DESTROY_DEV, &cdev); + if (error) + return; + + free(cdev); +} + +void * +cuse_dev_get_priv0(struct cuse_dev *cdev) +{ + return (cdev->priv0); +} + +void * +cuse_dev_get_priv1(struct cuse_dev *cdev) +{ + return (cdev->priv1); +} + +void +cuse_dev_set_priv0(struct cuse_dev *cdev, void *priv) +{ + cdev->priv0 = priv; +} + +void +cuse_dev_set_priv1(struct cuse_dev *cdev, void *priv) +{ + cdev->priv1 = priv; +} + +int +cuse_wait_and_process(void) +{ + pthread_t curr = pthread_self(); + struct cuse_dev_entered *pe; + struct cuse_dev_entered enter; + struct cuse_command info; + struct cuse_dev *cdev; + int error; + + if (f_cuse < 0) + return (CUSE_ERR_INVALID); + + error = ioctl(f_cuse, CUSE_IOCTL_GET_COMMAND, &info); + if (error) + return (CUSE_ERR_OTHER); + + cdev = info.dev; + + cuse_lock(); + enter.thread = curr; + enter.per_file_handle = (void *)info.per_file_handle; + enter.cmd = info.command; + enter.is_local = 0; + enter.got_signal = 0; + enter.cdev = cdev; + TAILQ_INSERT_TAIL(&h_cuse_entered, &enter, entry); + cuse_unlock(); + + DPRINTF("cuse: Command = %d = %s, flags = %d, arg = 0x%08x, ptr = 0x%08x\n", + (int)info.command, cuse_cmd_str(info.command), (int)info.fflags, + (int)info.argument, (int)info.data_pointer); + + switch (info.command) { + case CUSE_CMD_OPEN: + if (cdev->mtod->cm_open != NULL) + error = (cdev->mtod->cm_open) (cdev, (int)info.fflags); + else + error = 0; + break; + + case CUSE_CMD_CLOSE: + + /* wait for other threads to stop */ + + while (1) { + + error = 0; + + cuse_lock(); + TAILQ_FOREACH(pe, &h_cuse_entered, entry) { + if (pe->cdev != cdev) + continue; + if (pe->thread == curr) + continue; + if (pe->per_file_handle != + enter.per_file_handle) + continue; + pe->got_signal = 1; + pthread_kill(pe->thread, SIGHUP); + error = CUSE_ERR_BUSY; + } + cuse_unlock(); + + if (error == 0) + break; + else + usleep(10000); + } + + if (cdev->mtod->cm_close != NULL) + error = (cdev->mtod->cm_close) (cdev, (int)info.fflags); + else + error = 0; + break; + + case CUSE_CMD_READ: + if (cdev->mtod->cm_read != NULL) { + error = (cdev->mtod->cm_read) (cdev, (int)info.fflags, + (void *)info.data_pointer, (int)info.argument); + } else { + error = CUSE_ERR_INVALID; + } + break; + + case CUSE_CMD_WRITE: + if (cdev->mtod->cm_write != NULL) { + error = (cdev->mtod->cm_write) (cdev, (int)info.fflags, + (void *)info.data_pointer, (int)info.argument); + } else { + error = CUSE_ERR_INVALID; + } + break; + + case CUSE_CMD_IOCTL: + if (cdev->mtod->cm_ioctl != NULL) { + error = (cdev->mtod->cm_ioctl) (cdev, (int)info.fflags, + (unsigned int)info.argument, (void *)info.data_pointer); + } else { + error = CUSE_ERR_INVALID; + } + break; + + case CUSE_CMD_POLL: + if (cdev->mtod->cm_poll != NULL) { + error = (cdev->mtod->cm_poll) (cdev, (int)info.fflags, + (int)info.argument); + } else { + error = CUSE_POLL_ERROR; + } + break; + + case CUSE_CMD_SIGNAL: + cuse_lock(); + TAILQ_FOREACH(pe, &h_cuse_entered, entry) { + if (pe->cdev != cdev) + continue; + if (pe->thread == curr) + continue; + if (pe->per_file_handle != + enter.per_file_handle) + continue; + pe->got_signal = 1; + pthread_kill(pe->thread, SIGHUP); + } + cuse_unlock(); + break; + + default: + error = CUSE_ERR_INVALID; + break; + } + + DPRINTF("cuse: Command error = %d for %s\n", + error, cuse_cmd_str(info.command)); + + cuse_lock(); + TAILQ_REMOVE(&h_cuse_entered, &enter, entry); + cuse_unlock(); + + /* we ignore any sync command failures */ + ioctl(f_cuse, CUSE_IOCTL_SYNC_COMMAND, &error); + + return (0); +} + +static struct cuse_dev_entered * +cuse_dev_get_entered(void) +{ + struct cuse_dev_entered *pe; + pthread_t curr = pthread_self(); + + cuse_lock(); + TAILQ_FOREACH(pe, &h_cuse_entered, entry) { + if (pe->thread == curr) + break; + } + cuse_unlock(); + return (pe); +} + +void +cuse_dev_set_per_file_handle(struct cuse_dev *cdev, void *handle) +{ + struct cuse_dev_entered *pe; + + pe = cuse_dev_get_entered(); + if (pe == NULL || pe->cdev != cdev) + return; + + pe->per_file_handle = handle; + ioctl(f_cuse, CUSE_IOCTL_SET_PFH, &handle); +} + +void * +cuse_dev_get_per_file_handle(struct cuse_dev *cdev) +{ + struct cuse_dev_entered *pe; + + pe = cuse_dev_get_entered(); + if (pe == NULL || pe->cdev != cdev) + return (NULL); + + return (pe->per_file_handle); +} + +void +cuse_set_local(int val) +{ + struct cuse_dev_entered *pe; + + pe = cuse_dev_get_entered(); + if (pe == NULL) + return; + + pe->is_local = val; +} + +#ifdef HAVE_DEBUG +static const char * +cuse_cmd_str(int cmd) +{ + static const char *str[CUSE_CMD_MAX] = { + [CUSE_CMD_NONE] = "none", + [CUSE_CMD_OPEN] = "open", + [CUSE_CMD_CLOSE] = "close", + [CUSE_CMD_READ] = "read", + [CUSE_CMD_WRITE] = "write", + [CUSE_CMD_IOCTL] = "ioctl", + [CUSE_CMD_POLL] = "poll", + [CUSE_CMD_SIGNAL] = "signal", + [CUSE_CMD_SYNC] = "sync", + }; + + if ((cmd >= 0) && (cmd < CUSE_CMD_MAX) && + (str[cmd] != NULL)) + return (str[cmd]); + else + return ("unknown"); +} + +#endif + +int +cuse_get_local(void) +{ + struct cuse_dev_entered *pe; + + pe = cuse_dev_get_entered(); + if (pe == NULL) + return (0); + + return (pe->is_local); +} + +int +cuse_copy_out(const void *src, void *user_dst, int len) +{ + struct cuse_data_chunk info; + struct cuse_dev_entered *pe; + int error; + + if ((f_cuse < 0) || (len < 0)) + return (CUSE_ERR_INVALID); + + pe = cuse_dev_get_entered(); + if (pe == NULL) + return (CUSE_ERR_INVALID); + + DPRINTF("cuse: copy_out(%p,%p,%d), cmd = %d = %s\n", + src, user_dst, len, pe->cmd, cuse_cmd_str(pe->cmd)); + + if (pe->is_local) { + memcpy(user_dst, src, len); + } else { + info.local_ptr = (unsigned long)src; + info.peer_ptr = (unsigned long)user_dst; + info.length = len; + + error = ioctl(f_cuse, CUSE_IOCTL_WRITE_DATA, &info); + if (error) { + DPRINTF("cuse: copy_out() error = %d\n", errno); + return (CUSE_ERR_FAULT); + } + } + return (0); +} + +int +cuse_copy_in(const void *user_src, void *dst, int len) +{ + struct cuse_data_chunk info; + struct cuse_dev_entered *pe; + int error; + + if ((f_cuse < 0) || (len < 0)) + return (CUSE_ERR_INVALID); + + pe = cuse_dev_get_entered(); + if (pe == NULL) + return (CUSE_ERR_INVALID); + + DPRINTF("cuse: copy_in(%p,%p,%d), cmd = %d = %s\n", + user_src, dst, len, pe->cmd, cuse_cmd_str(pe->cmd)); + + if (pe->is_local) { + memcpy(dst, user_src, len); + } else { + info.local_ptr = (unsigned long)dst; + info.peer_ptr = (unsigned long)user_src; + info.length = len; + + error = ioctl(f_cuse, CUSE_IOCTL_READ_DATA, &info); + if (error) { + DPRINTF("cuse: copy_in() error = %d\n", errno); + return (CUSE_ERR_FAULT); + } + } + return (0); +} + +struct cuse_dev * +cuse_dev_get_current(int *pcmd) +{ + struct cuse_dev_entered *pe; + + pe = cuse_dev_get_entered(); + if (pe == NULL) { + if (pcmd != NULL) + *pcmd = 0; + return (NULL); + } + if (pcmd != NULL) + *pcmd = pe->cmd; + return (pe->cdev); +} + +int +cuse_got_peer_signal(void) +{ + struct cuse_dev_entered *pe; + + pe = cuse_dev_get_entered(); + if (pe == NULL) + return (CUSE_ERR_INVALID); + + if (pe->got_signal) + return (0); + + return (CUSE_ERR_OTHER); +} + +void +cuse_poll_wakeup(void) +{ + int error = 0; + + if (f_cuse < 0) + return; + + ioctl(f_cuse, CUSE_IOCTL_SELWAKEUP, &error); +} diff --git a/lib/libdevinfo/devinfo.3 b/lib/libdevinfo/devinfo.3 index 0788100b7e88..ee094dd62f86 100644 --- a/lib/libdevinfo/devinfo.3 +++ b/lib/libdevinfo/devinfo.3 @@ -238,7 +238,7 @@ The library first appeared in .Fx 5.0 . .Sh AUTHORS -.An Michael Smith Aq msmith@FreeBSD.org +.An Michael Smith Aq Mt msmith@FreeBSD.org .Sh BUGS This is the first implementation of the library, and the interface is still subject to refinement. diff --git a/lib/libdevstat/devstat.3 b/lib/libdevstat/devstat.3 index 39be6ac0ecef..2bbe2d770ac3 100644 --- a/lib/libdevstat/devstat.3 +++ b/lib/libdevstat/devstat.3 @@ -797,7 +797,7 @@ The new interface (the functions prefixed with first appeared in .Fx 5.0 . .Sh AUTHORS -.An Kenneth Merry Aq ken@FreeBSD.org +.An Kenneth Merry Aq Mt ken@FreeBSD.org .Sh BUGS There should probably be an interface to de-allocate memory allocated by .Fn devstat_getdevs , diff --git a/lib/libedit/Makefile b/lib/libedit/Makefile index d8ae64681960..df86778c5778 100644 --- a/lib/libedit/Makefile +++ b/lib/libedit/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.34 2005/05/28 12:02:53 lukem Exp $ +# $NetBSD: Makefile,v 1.37 2009/01/18 12:17:49 lukem Exp $ # @(#)Makefile 8.1 (Berkeley) 6/4/93 # $FreeBSD$ @@ -10,8 +10,8 @@ OSRCS= chared.c common.c el.c emacs.c fcns.c filecomplete.c help.c \ hist.c key.c map.c \ parse.c prompt.c read.c refresh.c search.c sig.c term.c tty.c vi.c -DPADD= ${LIBNCURSES} -LDADD= -lncurses +DPADD= ${LIBNCURSESW} +LDADD= -lncursesw MAN= editline.3 editrc.5 @@ -70,9 +70,9 @@ editline.c: ${OSRCS} editline.o editline.po editline.So editline.ln: \ common.h emacs.h fcns.c fcns.h help.c help.h vi.h -test.o: ${.CURDIR}/TEST/test.c +tc1.o: ${.CURDIR}/TEST/tc1.c -test: test.o libedit.a ${DPADD} ${LIBTERMCAP} +test: tc1.o libedit.a ${DPADD} ${LIBTERMCAP} ${CC} ${CFLAGS} ${.ALLSRC} -o ${.TARGET} libedit.a ${LDADD} .include <bsd.lib.mk> diff --git a/lib/libedit/Makefile.depend b/lib/libedit/Makefile.depend index 1d7ae9448400..918d4927d649 100644 --- a/lib/libedit/Makefile.depend +++ b/lib/libedit/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ @@ -10,7 +11,6 @@ DIRDEPS = \ lib/${CSU_DIR} \ lib/libc \ lib/libcompiler_rt \ - lib/ncurses/ncurses \ lib/ncurses/ncursesw \ usr.bin/xinstall.host \ diff --git a/lib/libedit/TEST/test.c b/lib/libedit/TEST/tc1.c index facbdaa7e3df..a60aa75775e1 100644 --- a/lib/libedit/TEST/test.c +++ b/lib/libedit/TEST/tc1.c @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\ #if !defined(lint) && !defined(SCCSID) static char sccsid[] = "@(#)test.c 8.1 (Berkeley) 6/4/93"; #endif /* not lint && not SCCSID */ -__RCSID("$NetBSD: test.c,v 1.18 2005/06/01 11:37:52 lukem Exp $"); +__RCSID("$NetBSD: test.c,v 1.3 2009/07/17 12:25:52 christos Exp $"); __FBSDID("$FreeBSD$"); /* @@ -68,7 +68,7 @@ static void sig(int); static char * prompt(EditLine *el) { - static char a[] = "Edit$ "; + static char a[] = "\1\e[7m\1Edit$\1\e[0m\1 "; static char b[] = "Edit> "; return (continuation ? b : a); @@ -143,7 +143,7 @@ main(int argc, char *argv[]) el_set(el, EL_EDITOR, "vi"); /* Default editor is vi */ el_set(el, EL_SIGNAL, 1); /* Handle signals gracefully */ - el_set(el, EL_PROMPT, prompt); /* Set the prompt function */ + el_set(el, EL_PROMPT_ESC, prompt, '\1');/* Set the prompt function */ /* Tell editline to use this history interface */ el_set(el, EL_HIST, history, hist); @@ -183,7 +183,7 @@ main(int argc, char *argv[]) #endif if (gotsig) { - (void) fprintf(stderr, "Got signal %d.\n", gotsig); + (void) fprintf(stderr, "Got signal %d.\n", (int)gotsig); gotsig = 0; el_reset(el); } @@ -269,7 +269,7 @@ main(int argc, char *argv[]) } else if (el_parse(el, ac, av) == -1) { switch (fork()) { case 0: - execvp(av[0], __DECONST(char *const *, av)); + execvp(av[0], __DECONST(char **, av)); perror(av[0]); _exit(1); /*NOTREACHED*/ diff --git a/lib/libedit/common.c b/lib/libedit/common.c index 059955425418..64490c986290 100644 --- a/lib/libedit/common.c +++ b/lib/libedit/common.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $NetBSD: common.c,v 1.19 2006/03/06 21:11:56 christos Exp $ + * $NetBSD: common.c,v 1.23 2009/02/27 04:18:45 msaitoh Exp $ */ #if !defined(lint) && !defined(SCCSID) @@ -121,7 +121,7 @@ ed_delete_prev_word(EditLine *el, int c __unused) *kp++ = *p; el->el_chared.c_kill.last = kp; - c_delbefore(el, el->el_line.cursor - cp); /* delete before dot */ + c_delbefore(el, (int)(el->el_line.cursor - cp));/* delete before dot */ el->el_line.cursor = cp; if (el->el_line.cursor < el->el_line.buffer) el->el_line.cursor = el->el_line.buffer; /* bounds check */ @@ -208,9 +208,6 @@ ed_move_to_end(EditLine *el, int c __unused) el->el_line.cursor = el->el_line.lastchar; if (el->el_map.type == MAP_VI) { -#ifdef VI_MOVE - el->el_line.cursor--; -#endif if (el->el_chared.c_vcmd.action != NOP) { cv_delfini(el); return (CC_REFRESH); diff --git a/lib/libedit/editline.3 b/lib/libedit/editline.3 index 33f7666f4283..df7cd8791803 100644 --- a/lib/libedit/editline.3 +++ b/lib/libedit/editline.3 @@ -682,6 +682,9 @@ Load the history list stored in .It Dv H_SAVE , Fa "const char *file" Save the history list to .Fa file . +.It Dv H_SAVE_FP , Fa "FILE*" +Save the history list to the opened +.Fa FILE* . .It Dv H_SETUNIQUE , Fa "int unique" Set flag that adjacent identical event strings should not be entered into the history. diff --git a/lib/libedit/emacs.c b/lib/libedit/emacs.c index a285b1c305ee..edcc84bb23bc 100644 --- a/lib/libedit/emacs.c +++ b/lib/libedit/emacs.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $NetBSD: emacs.c,v 1.21 2006/03/06 21:11:56 christos Exp $ + * $NetBSD: emacs.c,v 1.22 2009/02/15 21:55:23 christos Exp $ */ #if !defined(lint) && !defined(SCCSID) @@ -101,7 +101,7 @@ em_delete_next_word(EditLine *el, int c __unused) *kp++ = *p; el->el_chared.c_kill.last = kp; - c_delafter(el, cp - el->el_line.cursor); /* delete after dot */ + c_delafter(el, (int)(cp - el->el_line.cursor)); /* delete after dot */ if (el->el_line.cursor > el->el_line.lastchar) el->el_line.cursor = el->el_line.lastchar; /* bounds check */ @@ -131,7 +131,8 @@ em_yank(EditLine *el, int c __unused) cp = el->el_line.cursor; /* open the space, */ - c_insert(el, el->el_chared.c_kill.last - el->el_chared.c_kill.buf); + c_insert(el, + (int)(el->el_chared.c_kill.last - el->el_chared.c_kill.buf)); /* copy the chars */ for (kp = el->el_chared.c_kill.buf; kp < el->el_chared.c_kill.last; kp++) *cp++ = *kp; @@ -185,14 +186,14 @@ em_kill_region(EditLine *el, int c __unused) while (cp < el->el_chared.c_kill.mark) *kp++ = *cp++; /* copy it */ el->el_chared.c_kill.last = kp; - c_delafter(el, cp - el->el_line.cursor); + c_delafter(el, (int)(cp - el->el_line.cursor)); } else { /* mark is before cursor */ cp = el->el_chared.c_kill.mark; kp = el->el_chared.c_kill.buf; while (cp < el->el_line.cursor) *kp++ = *cp++; /* copy it */ el->el_chared.c_kill.last = kp; - c_delbefore(el, cp - el->el_chared.c_kill.mark); + c_delbefore(el, (int)(cp - el->el_chared.c_kill.mark)); el->el_line.cursor = el->el_chared.c_kill.mark; } return (CC_REFRESH); @@ -446,7 +447,7 @@ em_copy_prev_word(EditLine *el, int c __unused) cp = c__prev_word(el->el_line.cursor, el->el_line.buffer, el->el_state.argument, ce__isword); - c_insert(el, oldc - cp); + c_insert(el, (int)(oldc - cp)); for (dp = oldc; cp < oldc && dp < el->el_line.lastchar; cp++) *dp++ = *cp; diff --git a/lib/libedit/filecomplete.h b/lib/libedit/filecomplete.h index a3156e942b99..215cf7d7b0b4 100644 --- a/lib/libedit/filecomplete.h +++ b/lib/libedit/filecomplete.h @@ -26,7 +26,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $NetBSD: filecomplete.h,v 1.9 2009/12/30 22:37:40 christos Exp $ + * $NetBSD: filecomplete.h,v 1.8 2009/02/16 00:15:45 christos Exp $ * $FreeBSD$ */ #ifndef _FILECOMPLETE_H_ diff --git a/lib/libedit/hist.h b/lib/libedit/hist.h index 4f2824aff200..4ddedcc59b3d 100644 --- a/lib/libedit/hist.h +++ b/lib/libedit/hist.h @@ -65,6 +65,7 @@ typedef struct el_history_t { #define HIST_SET(el, num) HIST_FUN(el, H_SET, num) #define HIST_LOAD(el, fname) HIST_FUN(el, H_LOAD fname) #define HIST_SAVE(el, fname) HIST_FUN(el, H_SAVE fname) +#define HIST_SAVE_FP(el, fp) HIST_FUN(el, H_SAVE_FP fp) protected int hist_init(EditLine *); protected void hist_end(EditLine *); diff --git a/lib/libedit/histedit.h b/lib/libedit/histedit.h index 8a6caf96c035..7cc524653c31 100644 --- a/lib/libedit/histedit.h +++ b/lib/libedit/histedit.h @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * @(#)histedit.h 8.2 (Berkeley) 1/3/94 - * $NetBSD: histedit.h,v 1.32 2007/06/10 20:20:28 christos Exp $ + * $NetBSD: histedit.h,v 1.41 2009/09/07 21:24:33 christos Exp $ * $FreeBSD$ */ @@ -208,6 +208,7 @@ int history(History *, HistEvent *, int, ...); #define H_NEXT_EVDATA 23 /* , const int, histdata_t *); */ #define H_DELDATA 24 /* , int, histdata_t *);*/ #define H_REPLACE 25 /* , const char *, histdata_t); */ +#define H_SAVE_FP 26 /* , FILE*); */ /* diff --git a/lib/libedit/history.c b/lib/libedit/history.c index 8f30a05a9973..cd8697724f1d 100644 --- a/lib/libedit/history.c +++ b/lib/libedit/history.c @@ -103,6 +103,7 @@ private int history_getunique(History *, HistEvent *); private int history_set_fun(History *, History *); private int history_load(History *, const char *); private int history_save(History *, const char *); +private int history_save_fp(History *, FILE*); private int history_prev_event(History *, HistEvent *, int); private int history_next_event(History *, HistEvent *, int); private int history_next_string(History *, HistEvent *, const char *); @@ -773,22 +774,16 @@ done: return (i); } - -/* history_save(): - * History save function +/* history_save_fp(): + * History save with open FILE* */ -private int -history_save(History *h, const char *fname) +private int history_save_fp(History *h, FILE* fp) { - FILE *fp; HistEvent ev; int i = -1, retval; size_t len, max_size; char *ptr; - if ((fp = fopen(fname, "w")) == NULL) - return (-1); - if (fchmod(fileno(fp), S_IRUSR|S_IWUSR) == -1) goto done; if (fputs(hist_cookie, fp) == EOF) @@ -816,6 +811,26 @@ history_save(History *h, const char *fname) oomem: h_free((ptr_t)ptr); done: + return (i); + +} + + +/* history_save(): + * History save function + */ +private int +history_save(History *h, const char *fname) +{ + FILE *fp; + int i; + + if ((fp = fopen(fname, "w")) == NULL) + return (-1); + + i = history_save_fp(h, fp); + +done: (void) fclose(fp); return (i); } @@ -1001,6 +1016,12 @@ history(History *h, HistEvent *ev, int fun, ...) he_seterrev(ev, _HE_HIST_WRITE); break; + case H_SAVE_FP: + retval = history_save_fp(h, va_arg(va, FILE*)); + if (retval == -1) + he_seterrev(ev, _HE_HIST_WRITE); + break; + case H_PREV_EVENT: retval = history_prev_event(h, ev, va_arg(va, int)); break; diff --git a/lib/libedit/prompt.c b/lib/libedit/prompt.c index 76d2d64a44a0..2d37b67154d0 100644 --- a/lib/libedit/prompt.c +++ b/lib/libedit/prompt.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $NetBSD: prompt.c,v 1.11 2003/08/07 16:44:32 agc Exp $ + * $NetBSD: prompt.c,v 1.14 2009/03/31 17:38:27 christos Exp $ */ #if !defined(lint) && !defined(SCCSID) diff --git a/lib/libedit/prompt.h b/lib/libedit/prompt.h index fe69ca488b55..c796d938d4bb 100644 --- a/lib/libedit/prompt.h +++ b/lib/libedit/prompt.h @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * @(#)prompt.h 8.1 (Berkeley) 6/4/93 - * $NetBSD: prompt.h,v 1.6 2003/08/07 16:44:32 agc Exp $ + * $NetBSD: prompt.h,v 1.9 2009/03/31 17:38:27 christos Exp $ * $FreeBSD$ */ @@ -45,8 +45,8 @@ typedef char * (*el_pfunc_t)(EditLine*); typedef struct el_prompt_t { - el_pfunc_t p_func; /* Function to return the prompt */ - coord_t p_pos; /* position in the line after prompt */ + el_pfunc_t p_func; /* Function to return the prompt */ + coord_t p_pos; /* position in the line after prompt */ char p_ignore; /* character to start/end literal */ } el_prompt_t; diff --git a/lib/libedit/read.h b/lib/libedit/read.h index 1dcf16429a48..60189344ea4c 100644 --- a/lib/libedit/read.h +++ b/lib/libedit/read.h @@ -26,7 +26,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $NetBSD: read.h,v 1.5 2006/08/21 12:45:30 christos Exp $ + * $NetBSD: read.h,v 1.6 2008/04/29 06:53:01 martin Exp $ * $FreeBSD$ */ diff --git a/lib/libedit/sys.h b/lib/libedit/sys.h index 9b1f04031072..5c017d3350b7 100644 --- a/lib/libedit/sys.h +++ b/lib/libedit/sys.h @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * @(#)sys.h 8.1 (Berkeley) 6/4/93 - * $NetBSD: sys.h,v 1.9 2004/01/17 17:57:40 christos Exp $ + * $NetBSD: sys.h,v 1.12 2009/08/31 00:05:43 christos Exp $ * $FreeBSD$ */ @@ -70,6 +70,15 @@ typedef void *ioctl_t; #define REGEX /* Use POSIX.2 regular expression functions */ #undef REGEXP /* Use UNIX V8 regular expression functions */ +#if defined(__sun) +extern int tgetent(char *, const char *); +extern int tgetflag(char *); +extern int tgetnum(char *); +extern int tputs(const char *, int, int (*)(int)); +extern char* tgoto(const char*, int, int); +extern char* tgetstr(char*, char**); +#endif + #ifdef notdef # undef REGEX # undef REGEXP diff --git a/lib/libedit/term.h b/lib/libedit/term.h index 4bf4685f7f79..cf7a909bfc8a 100644 --- a/lib/libedit/term.h +++ b/lib/libedit/term.h @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * @(#)term.h 8.1 (Berkeley) 6/4/93 - * $NetBSD: term.h,v 1.18 2006/11/24 00:01:17 christos Exp $ + * $NetBSD: term.h,v 1.20 2009/03/31 17:38:27 christos Exp $ * $FreeBSD$ */ diff --git a/lib/libedit/tty.c b/lib/libedit/tty.c index c0b4638b323c..f8bae9424a79 100644 --- a/lib/libedit/tty.c +++ b/lib/libedit/tty.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $NetBSD: tty.c,v 1.25 2006/03/18 09:09:41 christos Exp $ + * $NetBSD: tty.c,v 1.31 2009/07/22 15:58:09 christos Exp $ */ #if !defined(lint) && !defined(SCCSID) @@ -443,13 +443,12 @@ private const ttymodes_t ttymodes[] = { -#define tty_getty(el, td) tcgetattr((el)->el_infd, (td)) -#define tty_setty(el, td) tcsetattr((el)->el_infd, TCSADRAIN, (td)) - #define tty__gettabs(td) ((((td)->c_oflag & TAB3) == TAB3) ? 0 : 1) #define tty__geteightbit(td) (((td)->c_cflag & CSIZE) == CS8) #define tty__cooked_mode(td) ((td)->c_lflag & ICANON) +private int tty_getty(EditLine *, struct termios *); +private int tty_setty(EditLine *, int, const struct termios *); private int tty__getcharindex(int); private void tty__getchar(struct termios *, unsigned char *); private void tty__setchar(struct termios *, unsigned char *); @@ -458,6 +457,29 @@ private int tty_setup(EditLine *); #define t_qu t_ts +/* tty_getty(): + * Wrapper for tcgetattr to handle EINTR + */ +private int +tty_getty(EditLine *el, struct termios *t) +{ + int rv; + while ((rv = tcgetattr(el->el_infd, t)) == -1 && errno == EINTR) + continue; + return rv; +} + +/* tty_setty(): + * Wrapper for tcsetattr to handle EINTR + */ +private int +tty_setty(EditLine *el, int action, const struct termios *t) +{ + int rv; + while ((rv = tcsetattr(el->el_infd, action, t)) == -1 && errno == EINTR) + continue; + return rv; +} /* tty_setup(): * Get the tty parameters and initialize the editing state @@ -996,7 +1018,7 @@ tty_rawmode(EditLine *el) if (el->el_tty.t_mode == EX_IO) el->el_tty.t_ex = el->el_tty.t_ts; - if (tty_setty(el, &el->el_tty.t_ed) == -1) { + if (tty_setty(el, TCSADRAIN, &el->el_tty.t_ed) == -1) { #ifdef DEBUG_TTY (void) fprintf(el->el_errfile, "tty_rawmode: tty_setty: %s\n", strerror(errno)); @@ -1021,7 +1043,7 @@ tty_cookedmode(EditLine *el) if (el->el_flags & EDIT_DISABLED) return (0); - if (tty_setty(el, &el->el_tty.t_ex) == -1) { + if (tty_setty(el, TCSADRAIN, &el->el_tty.t_ex) == -1) { #ifdef DEBUG_TTY (void) fprintf(el->el_errfile, "tty_cookedmode: tty_setty: %s\n", @@ -1057,7 +1079,7 @@ tty_quotemode(EditLine *el) el->el_tty.t_qu.c_lflag &= ~el->el_tty.t_t[QU_IO][MD_LIN].t_clrmask; el->el_tty.t_qu.c_lflag |= el->el_tty.t_t[QU_IO][MD_LIN].t_setmask; - if (tty_setty(el, &el->el_tty.t_qu) == -1) { + if (tty_setty(el, TCSADRAIN, &el->el_tty.t_qu) == -1) { #ifdef DEBUG_TTY (void) fprintf(el->el_errfile, "QuoteModeOn: tty_setty: %s\n", strerror(errno)); @@ -1078,7 +1100,7 @@ tty_noquotemode(EditLine *el) if (el->el_tty.t_mode != QU_IO) return (0); - if (tty_setty(el, &el->el_tty.t_ed) == -1) { + if (tty_setty(el, TCSADRAIN, &el->el_tty.t_ed) == -1) { #ifdef DEBUG_TTY (void) fprintf(el->el_errfile, "QuoteModeOff: tty_setty: %s\n", strerror(errno)); @@ -1139,7 +1161,7 @@ tty_stty(EditLine *el, int argc __unused, const char **argv) if (!argv || !*argv) { int i = -1; - int len = 0, st = 0, cu; + size_t len = 0, st = 0, cu; for (m = ttymodes; m->m_name; m++) { if (m->m_type != i) { (void) fprintf(el->el_outfile, "%s%s", @@ -1162,9 +1184,9 @@ tty_stty(EditLine *el, int argc __unused, const char **argv) cu = strlen(m->m_name) + (x != '\0') + 1; - if (len + cu >= el->el_term.t_size.h) { + if (len + cu >= (size_t)el->el_term.t_size.h) { (void) fprintf(el->el_outfile, "\n%*s", - st, ""); + (int)st, ""); len = st + cu; } else len += cu; @@ -1208,7 +1230,8 @@ tty_stty(EditLine *el, int argc __unused, const char **argv) int c = ffs((int)m->m_value); int v = *++p ? parse__escape((const char **) &p) : el->el_tty.t_vdisable; - assert(c-- != 0); + assert(c != 0); + c--; c = tty__getcharindex(c); assert(c != -1); tios->c_cc[c] = v; @@ -1229,6 +1252,17 @@ tty_stty(EditLine *el, int argc __unused, const char **argv) break; } } + + if (el->el_tty.t_mode == z) { + if (tty_setty(el, TCSADRAIN, tios) == -1) { +#ifdef DEBUG_TTY + (void) fprintf(el->el_errfile, + "tty_stty: tty_setty: %s\n", strerror(errno)); +#endif /* DEBUG_TTY */ + return (-1); + } + } + return (0); } diff --git a/lib/libefi/libefi.3 b/lib/libefi/libefi.3 index 7350508f8558..e090fd6e711f 100644 --- a/lib/libefi/libefi.3 +++ b/lib/libefi/libefi.3 @@ -140,4 +140,4 @@ for the ia64 architecture. The .Nm libefi library and this manual page were written by -.An Marcel Moolenaar Aq marcel@FreeBSD.org . +.An Marcel Moolenaar Aq Mt marcel@FreeBSD.org . diff --git a/lib/libexpat/libbsdxml.3 b/lib/libexpat/libbsdxml.3 index 04887f0f33a5..0d706ea7219d 100644 --- a/lib/libexpat/libbsdxml.3 +++ b/lib/libexpat/libbsdxml.3 @@ -59,11 +59,11 @@ For full documentation, please see the eXpat webpage at .Sh AUTHORS .An -nosplit The original eXpat was written by -.An James Clark Aq jjc@jclark.com . +.An James Clark Aq Mt jjc@jclark.com . .Pp Subsequently eXpat maintenance and development been taken up by a group of people under the leadership of -.An Fred Drake Aq fdrake@acm.com , +.An Fred Drake Aq Mt fdrake@acm.com , .An Paul Prescod , and .An Clark Cooper . diff --git a/lib/libfetch/Makefile.depend b/lib/libfetch/Makefile.depend index 3fcefec42ea7..4bedb02c7bc6 100644 --- a/lib/libfetch/Makefile.depend +++ b/lib/libfetch/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/libfetch/common.c b/lib/libfetch/common.c index 5cc7e263b0c5..a6fc47c60e44 100644 --- a/lib/libfetch/common.c +++ b/lib/libfetch/common.c @@ -688,6 +688,8 @@ fetch_ssl_setup_transport_layer(SSL_CTX *ctx, int verbose) /* * Configure peer verification based on environment. */ +#define LOCAL_CERT_FILE "/usr/local/etc/ssl/cert.pem" +#define BASE_CERT_FILE "/etc/ssl/cert.pem" static int fetch_ssl_setup_peer_verification(SSL_CTX *ctx, int verbose) { @@ -696,8 +698,12 @@ fetch_ssl_setup_peer_verification(SSL_CTX *ctx, int verbose) const char *ca_cert_file, *ca_cert_path, *crl_file; if (getenv("SSL_NO_VERIFY_PEER") == NULL) { - ca_cert_file = getenv("SSL_CA_CERT_FILE") != NULL ? - getenv("SSL_CA_CERT_FILE") : "/etc/ssl/cert.pem"; + ca_cert_file = getenv("SSL_CA_CERT_FILE"); + if (ca_cert_file == NULL && + access(LOCAL_CERT_FILE, R_OK) == 0) + ca_cert_file = LOCAL_CERT_FILE; + if (ca_cert_file == NULL) + ca_cert_file = BASE_CERT_FILE; ca_cert_path = getenv("SSL_CA_CERT_PATH"); if (verbose) { fetch_info("Peer verification enabled"); @@ -1104,6 +1110,9 @@ fetch_writev(conn_t *conn, struct iovec *iov, int iovcnt) errno = 0; pfd.revents = 0; if (poll(&pfd, 1, deltams) < 0) { + /* POSIX compliance */ + if (errno == EAGAIN) + continue; if (errno == EINTR && fetchRestartCalls) continue; return (-1); diff --git a/lib/libfetch/common.h b/lib/libfetch/common.h index 875eef196e98..41c10d20bbff 100644 --- a/lib/libfetch/common.h +++ b/lib/libfetch/common.h @@ -117,6 +117,9 @@ int fetch_no_proxy_match(const char *); */ FILE *http_request(struct url *, const char *, struct url_stat *, struct url *, const char *); +FILE *http_request_body(struct url *, const char *, + struct url_stat *, struct url *, const char *, + const char *, const char *); FILE *ftp_request(struct url *, const char *, struct url_stat *, struct url *, const char *); diff --git a/lib/libfetch/fetch.3 b/lib/libfetch/fetch.3 index 6b2e4c00b50b..57ecea593392 100644 --- a/lib/libfetch/fetch.3 +++ b/lib/libfetch/fetch.3 @@ -627,6 +627,7 @@ the document URL will be used as referrer URL. Specifies the User-Agent string to use for HTTP requests. This can be useful when working with HTTP origin or proxy servers that differentiate between user agents. +If defined but empty, no User-Agent header is sent. .It Ev NETRC Specifies a file to use instead of .Pa ~/.netrc @@ -773,27 +774,27 @@ library first appeared in The .Nm fetch library was mostly written by -.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org +.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org with numerous suggestions and contributions from -.An Jordan K. Hubbard Aq jkh@FreeBSD.org , -.An Eugene Skepner Aq eu@qub.com , -.An Hajimu Umemoto Aq ume@FreeBSD.org , -.An Henry Whincup Aq henry@techiebod.com , -.An Jukka A. Ukkonen Aq jau@iki.fi , -.An Jean-Fran\(,cois Dockes Aq jf@dockes.org , -.An Michael Gmelin Aq freebsd@grem.de +.An Jordan K. Hubbard Aq Mt jkh@FreeBSD.org , +.An Eugene Skepner Aq Mt eu@qub.com , +.An Hajimu Umemoto Aq Mt ume@FreeBSD.org , +.An Henry Whincup Aq Mt henry@techiebod.com , +.An Jukka A. Ukkonen Aq Mt jau@iki.fi , +.An Jean-Fran\(,cois Dockes Aq Mt jf@dockes.org , +.An Michael Gmelin Aq Mt freebsd@grem.de and others. It replaces the older .Nm ftpio library written by -.An Poul-Henning Kamp Aq phk@FreeBSD.org +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org and -.An Jordan K. Hubbard Aq jkh@FreeBSD.org . +.An Jordan K. Hubbard Aq Mt jkh@FreeBSD.org . .Pp This manual page was written by -.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org +.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org and -.An Michael Gmelin Aq freebsd@grem.de . +.An Michael Gmelin Aq Mt freebsd@grem.de . .Sh BUGS Some parts of the library are not yet implemented. The most notable diff --git a/lib/libfetch/fetch.h b/lib/libfetch/fetch.h index be494821261e..d56a1036a462 100644 --- a/lib/libfetch/fetch.h +++ b/lib/libfetch/fetch.h @@ -102,6 +102,8 @@ FILE *fetchGetHTTP(struct url *, const char *); FILE *fetchPutHTTP(struct url *, const char *); int fetchStatHTTP(struct url *, struct url_stat *, const char *); struct url_ent *fetchListHTTP(struct url *, const char *); +FILE *fetchReqHTTP(struct url *, const char *, const char *, + const char *, const char *); /* FTP-specific functions */ FILE *fetchXGetFTP(struct url *, struct url_stat *, const char *); diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c index cbbb8a8d351f..ad4a41952151 100644 --- a/lib/libfetch/http.c +++ b/lib/libfetch/http.c @@ -1030,7 +1030,7 @@ typedef struct { static void init_http_auth_params(http_auth_params_t *s) { - s->scheme = s->realm = s->user = s->password = 0; + s->scheme = s->realm = s->user = s->password = NULL; } static void @@ -1129,7 +1129,7 @@ CvtHex(IN HASH Bin, OUT HASHHEX Hex) Hex[i*2] = hexchars[j]; j = Bin[i] & 0xf; Hex[i*2+1] = hexchars[j]; - }; + } Hex[HASHHEXLEN] = '\0'; }; @@ -1164,7 +1164,7 @@ DigestCalcHA1( MD5Update(&Md5Ctx, ":", 1); MD5Update(&Md5Ctx, pszCNonce, strlen(pszCNonce)); MD5Final(HA1, &Md5Ctx); - }; + } CvtHex(HA1, SessionKey); } @@ -1198,7 +1198,7 @@ DigestCalcResponse( if (strcasecmp(pszQop, "auth-int") == 0) { MD5Update(&Md5Ctx, ":", 1); MD5Update(&Md5Ctx, HEntity, HASHHEXLEN); - }; + } MD5Final(HA2, &Md5Ctx); CvtHex(HA2, HA2Hex); @@ -1215,7 +1215,7 @@ DigestCalcResponse( MD5Update(&Md5Ctx, ":", 1); MD5Update(&Md5Ctx, pszQop, strlen(pszQop)); MD5Update(&Md5Ctx, ":", 1); - }; + } MD5Update(&Md5Ctx, HA2Hex, HASHHEXLEN); MD5Final(RespHash, &Md5Ctx); CvtHex(RespHash, Response); @@ -1249,7 +1249,7 @@ http_digest_auth(conn_t *conn, const char *hdr, http_auth_challenge_t *c, int r; char noncecount[10]; char cnonce[40]; - char *options = 0; + char *options = NULL; if (!c->realm || !c->nonce) { DEBUG(fprintf(stderr, "realm/nonce not set in challenge\n")); @@ -1494,6 +1494,14 @@ http_print_html(FILE *out, FILE *in) * Core */ +FILE * +http_request(struct url *URL, const char *op, struct url_stat *us, + struct url *purl, const char *flags) +{ + + return (http_request_body(URL, op, us, purl, flags, NULL, NULL)); +} + /* * Send a request and process the reply * @@ -1501,8 +1509,9 @@ http_print_html(FILE *out, FILE *in) * XXX off into a separate function. */ FILE * -http_request(struct url *URL, const char *op, struct url_stat *us, - struct url *purl, const char *flags) +http_request_body(struct url *URL, const char *op, struct url_stat *us, + struct url *purl, const char *flags, const char *content_type, + const char *body) { char timebuf[80]; char hbuf[MAXHOSTNAMELEN + 7], *host; @@ -1519,6 +1528,7 @@ http_request(struct url *URL, const char *op, struct url_stat *us, http_headerbuf_t headerbuf; http_auth_challenges_t server_challenges; http_auth_challenges_t proxy_challenges; + size_t body_len; /* The following calls don't allocate anything */ init_http_headerbuf(&headerbuf); @@ -1683,15 +1693,31 @@ http_request(struct url *URL, const char *op, struct url_stat *us, else http_cmd(conn, "Referer: %s", p); } - if ((p = getenv("HTTP_USER_AGENT")) != NULL && *p != '\0') - http_cmd(conn, "User-Agent: %s", p); - else - http_cmd(conn, "User-Agent: %s " _LIBFETCH_VER, getprogname()); + if ((p = getenv("HTTP_USER_AGENT")) != NULL) { + /* no User-Agent if defined but empty */ + if (*p != '\0') + http_cmd(conn, "User-Agent: %s", p); + } else { + /* default User-Agent */ + http_cmd(conn, "User-Agent: %s " _LIBFETCH_VER, + getprogname()); + } if (url->offset > 0) http_cmd(conn, "Range: bytes=%lld-", (long long)url->offset); http_cmd(conn, "Connection: close"); + + if (body) { + body_len = strlen(body); + http_cmd(conn, "Content-Length: %zu", body_len); + if (content_type != NULL) + http_cmd(conn, "Content-Type: %s", content_type); + } + http_cmd(conn, ""); + if (body) + fetch_write(conn, body, body_len); + /* * Force the queued request to be dispatched. Normally, one * would do this with shutdown(2) but squid proxies can be @@ -2042,3 +2068,12 @@ fetchListHTTP(struct url *url __unused, const char *flags __unused) warnx("fetchListHTTP(): not implemented"); return (NULL); } + +FILE * +fetchReqHTTP(struct url *URL, const char *method, const char *flags, + const char *content_type, const char *body) +{ + + return (http_request_body(URL, method, NULL, http_get_proxy(URL, flags), + flags, content_type, body)); +} diff --git a/lib/libgeom/libgeom.3 b/lib/libgeom/libgeom.3 index b897fad5f778..bda0c9d03c34 100644 --- a/lib/libgeom/libgeom.3 +++ b/lib/libgeom/libgeom.3 @@ -388,6 +388,6 @@ The library appeared in .Fx 5.1 . .Sh AUTHORS -.An Poul-Henning Kamp Aq phk@FreeBSD.org -.An Lukas Ertl Aq le@FreeBSD.org -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org +.An Lukas Ertl Aq Mt le@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org diff --git a/lib/libgssapi/Makefile.depend b/lib/libgssapi/Makefile.depend index 4a1f10886ac4..cf58a7bfde96 100644 --- a/lib/libgssapi/Makefile.depend +++ b/lib/libgssapi/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/libgssapi/mech.5 b/lib/libgssapi/mech.5 index dd15ba98938c..619de02e1de7 100644 --- a/lib/libgssapi/mech.5 +++ b/lib/libgssapi/mech.5 @@ -98,4 +98,4 @@ manual page first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/libiconv_modules/HZ/citrus_hz.c b/lib/libiconv_modules/HZ/citrus_hz.c index f9eb006af8dc..d772b385b47d 100644 --- a/lib/libiconv_modules/HZ/citrus_hz.c +++ b/lib/libiconv_modules/HZ/citrus_hz.c @@ -532,10 +532,9 @@ _citrus_HZ_parse_graphic(void *context, const char *name, const char *s) p = (void **)context; escape = (escape_t *)p[0]; ei = (_HZEncodingInfo *)p[1]; - graphic = malloc(sizeof(*graphic)); + graphic = calloc(1, sizeof(*graphic)); if (graphic == NULL) return (ENOMEM); - memset(graphic, 0, sizeof(*graphic)); if (strcmp("GL", name) == 0) { if (GL(escape) != NULL) goto release; @@ -598,10 +597,9 @@ _citrus_HZ_parse_escape(void *context, const char *name, const char *s) void *p[2]; ei = (_HZEncodingInfo *)context; - escape = malloc(sizeof(*escape)); + escape = calloc(1, sizeof(*escape)); if (escape == NULL) return (EINVAL); - memset(escape, 0, sizeof(*escape)); if (strcmp("0", name) == 0) { escape->set = E0SET(ei); TAILQ_INSERT_TAIL(E0SET(ei), escape, entry); diff --git a/lib/libkvm/kvm_amd64.c b/lib/libkvm/kvm_amd64.c index 65d697c96160..9a5ec64e95e2 100644 --- a/lib/libkvm/kvm_amd64.c +++ b/lib/libkvm/kvm_amd64.c @@ -81,7 +81,7 @@ struct vmstate { /* * Map the ELF headers into the process' address space. We do this in two * steps: first the ELF header itself and using that information the whole - * set of headers. (Taken from kvm_ia64.c) + * set of headers. */ static int _kvm_maphdrs(kvm_t *kd, size_t sz) @@ -105,7 +105,6 @@ _kvm_maphdrs(kvm_t *kd, size_t sz) /* * Translate a physical memory address to a file-offset in the crash-dump. - * (Taken from kvm_ia64.c) */ static size_t _kvm_pa2off(kvm_t *kd, uint64_t pa, off_t *ofs) diff --git a/lib/libkvm/kvm_i386.c b/lib/libkvm/kvm_i386.c index 601126bc7a3f..45f0a5e9b88c 100644 --- a/lib/libkvm/kvm_i386.c +++ b/lib/libkvm/kvm_i386.c @@ -87,7 +87,7 @@ struct vmstate { /* * Map the ELF headers into the process' address space. We do this in two * steps: first the ELF header itself and using that information the whole - * set of headers. (Taken from kvm_ia64.c) + * set of headers. */ static int _kvm_maphdrs(kvm_t *kd, size_t sz) @@ -111,7 +111,6 @@ _kvm_maphdrs(kvm_t *kd, size_t sz) /* * Translate a physical memory address to a file-offset in the crash-dump. - * (Taken from kvm_ia64.c) */ static size_t _kvm_pa2off(kvm_t *kd, uint64_t pa, off_t *ofs) diff --git a/lib/libkvm/kvm_ia64.c b/lib/libkvm/kvm_ia64.c deleted file mode 100644 index 5db7e1e7ab09..000000000000 --- a/lib/libkvm/kvm_ia64.c +++ /dev/null @@ -1,375 +0,0 @@ -/* $FreeBSD$ */ -/* $NetBSD: kvm_alpha.c,v 1.7.2.1 1997/11/02 20:34:26 mellon 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/types.h> -#include <sys/elf64.h> -#include <sys/mman.h> - -#ifndef CROSS_LIBKVM -#include <machine/atomic.h> -#include <machine/bootinfo.h> -#include <machine/elf.h> -#include <machine/pte.h> -#else -#include "../../sys/ia64/include/atomic.h" -#include "../../sys/ia64/include/bootinfo.h" -#include "../../sys/ia64/include/elf.h" -#include "../../sys/ia64/include/pte.h" -#endif - -#include <kvm.h> -#include <limits.h> -#include <stdint.h> -#include <stdlib.h> -#include <unistd.h> - -#include "kvm_private.h" - -#define REGION_BASE(n) (((uint64_t)(n)) << 61) -#define REGION_ADDR(x) ((x) & ((1LL<<61)-1LL)) - -#define NKPTEPG(ps) ((ps) / sizeof(struct ia64_lpte)) -#define NKPTEDIR(ps) ((ps) >> 3) -#define KPTE_PTE_INDEX(va,ps) (((va)/(ps)) % NKPTEPG(ps)) -#define KPTE_DIR0_INDEX(va,ps) ((((va)/(ps)) / NKPTEPG(ps)) / NKPTEDIR(ps)) -#define KPTE_DIR1_INDEX(va,ps) ((((va)/(ps)) / NKPTEPG(ps)) % NKPTEDIR(ps)) - -#define PBVM_BASE 0x9ffc000000000000UL -#define PBVM_PGSZ (64 * 1024) - -typedef size_t (a2p_f)(kvm_t *, uint64_t, off_t *); - -struct vmstate { - void *mmapbase; - size_t mmapsize; - size_t pagesize; - u_long kptdir; - u_long *pbvm_pgtbl; - u_int pbvm_pgtblsz; - a2p_f *kvatop; -}; - -/* - * Map the ELF headers into the process' address space. We do this in two - * steps: first the ELF header itself and using that information the whole - * set of headers. - */ -static int -ia64_maphdrs(kvm_t *kd, size_t sz) -{ - struct vmstate *vm = kd->vmst; - - /* munmap() previous mmap(). */ - if (vm->mmapbase != NULL) { - munmap(vm->mmapbase, vm->mmapsize); - vm->mmapbase = NULL; - } - - vm->mmapsize = sz; - vm->mmapbase = mmap(NULL, sz, PROT_READ, MAP_PRIVATE, kd->pmfd, 0); - if (vm->mmapbase == MAP_FAILED) { - _kvm_err(kd, kd->program, "cannot mmap corefile"); - return (-1); - } - - return (0); -} - -/* - * Physical core support. - */ - -static size_t -phys_addr2off(kvm_t *kd, uint64_t pa, off_t *ofs, size_t pgsz) -{ - Elf64_Ehdr *e; - Elf64_Phdr *p; - int n; - - if (pa != REGION_ADDR(pa)) - goto fail; - - e = (Elf64_Ehdr *)(kd->vmst->mmapbase); - n = e->e_phnum; - p = (Elf64_Phdr *)(void *)((uintptr_t)(void *)e + e->e_phoff); - while (n && (pa < p->p_paddr || pa >= p->p_paddr + p->p_memsz)) - p++, n--; - if (n == 0) - goto fail; - - *ofs = (pa - p->p_paddr) + p->p_offset; - if (pgsz == 0) - return (p->p_memsz - (pa - p->p_paddr)); - return (pgsz - ((size_t)pa & (pgsz - 1))); - - fail: - _kvm_err(kd, kd->program, "invalid physical address %#jx", - (uintmax_t)pa); - return (0); -} - -static size_t -phys_kvatop(kvm_t *kd, uint64_t va, off_t *ofs) -{ - struct ia64_lpte pte; - uint64_t pa, pgaddr, pt0addr, pt1addr; - size_t pgno, pgsz, pt0no, pt1no; - - if (va >= REGION_BASE(6)) { - /* Regions 6 and 7: direct mapped. */ - pa = REGION_ADDR(va); - return (phys_addr2off(kd, pa, ofs, 0)); - } else if (va >= REGION_BASE(5)) { - /* Region 5: Kernel Virtual Memory. */ - va = REGION_ADDR(va); - pgsz = kd->vmst->pagesize; - pt0no = KPTE_DIR0_INDEX(va, pgsz); - pt1no = KPTE_DIR1_INDEX(va, pgsz); - pgno = KPTE_PTE_INDEX(va, pgsz); - if (pt0no >= NKPTEDIR(pgsz)) - goto fail; - pt0addr = kd->vmst->kptdir + (pt0no << 3); - if (kvm_read(kd, pt0addr, &pt1addr, 8) != 8) - goto fail; - if (pt1addr == 0) - goto fail; - pt1addr += pt1no << 3; - if (kvm_read(kd, pt1addr, &pgaddr, 8) != 8) - goto fail; - if (pgaddr == 0) - goto fail; - pgaddr += pgno * sizeof(pte); - if (kvm_read(kd, pgaddr, &pte, sizeof(pte)) != sizeof(pte)) - goto fail; - if (!(pte.pte & PTE_PRESENT)) - goto fail; - pa = (pte.pte & PTE_PPN_MASK) + (va & (pgsz - 1)); - return (phys_addr2off(kd, pa, ofs, pgsz)); - } else if (va >= PBVM_BASE) { - /* Region 4: Pre-Boot Virtual Memory (PBVM). */ - va -= PBVM_BASE; - pgsz = PBVM_PGSZ; - pt0no = va / pgsz; - if (pt0no >= (kd->vmst->pbvm_pgtblsz >> 3)) - goto fail; - pt0addr = kd->vmst->pbvm_pgtbl[pt0no]; - if (!(pt0addr & PTE_PRESENT)) - goto fail; - pa = (pt0addr & PTE_PPN_MASK) + va % pgsz; - return (phys_addr2off(kd, pa, ofs, pgsz)); - } - - fail: - _kvm_err(kd, kd->program, "invalid kernel virtual address %#jx", - (uintmax_t)va); - *ofs = -1; - return (0); -} - -static ssize_t -phys_read(kvm_t *kd, uint64_t pa, void *buf, size_t bufsz) -{ - off_t ofs; - size_t sz; - - sz = phys_addr2off(kd, pa, &ofs, 0); - if (sz < bufsz) - return ((ssize_t)sz); - - if (lseek(kd->pmfd, ofs, 0) == -1) - return (-1); - return (read(kd->pmfd, buf, bufsz)); -} - -/* - * Virtual core support (aka minidump). - */ - -static size_t -virt_addr2off(kvm_t *kd, uint64_t va, off_t *ofs, size_t pgsz) -{ - Elf64_Ehdr *e; - Elf64_Phdr *p; - int n; - - if (va < REGION_BASE(4)) - goto fail; - - e = (Elf64_Ehdr *)(kd->vmst->mmapbase); - n = e->e_phnum; - p = (Elf64_Phdr *)(void *)((uintptr_t)(void *)e + e->e_phoff); - while (n && (va < p->p_vaddr || va >= p->p_vaddr + p->p_memsz)) - p++, n--; - if (n == 0) - goto fail; - - *ofs = (va - p->p_vaddr) + p->p_offset; - if (pgsz == 0) - return (p->p_memsz - (va - p->p_vaddr)); - return (pgsz - ((size_t)va & (pgsz - 1))); - - fail: - _kvm_err(kd, kd->program, "invalid virtual address %#jx", - (uintmax_t)va); - return (0); -} - -static size_t -virt_kvatop(kvm_t *kd, uint64_t va, off_t *ofs) -{ - - return (virt_addr2off(kd, va, ofs, 0)); -} - -/* - * KVM architecture support functions. - */ - -void -_kvm_freevtop(kvm_t *kd) -{ - struct vmstate *vm = kd->vmst; - - if (vm->pbvm_pgtbl != NULL) - free(vm->pbvm_pgtbl); - if (vm->mmapbase != NULL) - munmap(vm->mmapbase, vm->mmapsize); - free(vm); - kd->vmst = NULL; -} - -int -_kvm_initvtop(kvm_t *kd) -{ - struct bootinfo bi; - struct nlist nl[2]; - uint64_t va; - Elf64_Ehdr *ehdr; - size_t hdrsz; - ssize_t sz; - - kd->vmst = (struct vmstate *)_kvm_malloc(kd, sizeof(*kd->vmst)); - if (kd->vmst == NULL) { - _kvm_err(kd, kd->program, "cannot allocate vm"); - return (-1); - } - -#ifndef CROSS_LIBKVM - kd->vmst->pagesize = getpagesize(); -#else - kd->vmst->pagesize = 8192; -#endif - - if (ia64_maphdrs(kd, sizeof(Elf64_Ehdr)) == -1) - return (-1); - - ehdr = kd->vmst->mmapbase; - hdrsz = ehdr->e_phoff + ehdr->e_phentsize * ehdr->e_phnum; - if (ia64_maphdrs(kd, hdrsz) == -1) - return (-1); - - kd->vmst->kvatop = (ehdr->e_flags & EF_IA_64_ABSOLUTE) ? - phys_kvatop : virt_kvatop; - - /* - * Load the PBVM page table. We need this to resolve PBVM addresses. - * The PBVM page table is obtained from the bootinfo structure, of - * which the address is given to us in e_entry. If e_entry is 0, then - * this is assumed to be a pre-PBVM kernel. - * Note that the address of the bootinfo structure is either physical - * or virtual, depending on whether the core is physical or virtual. - */ - if (ehdr->e_entry != 0 && (ehdr->e_flags & EF_IA_64_ABSOLUTE) != 0) { - sz = phys_read(kd, ehdr->e_entry, &bi, sizeof(bi)); - if (sz != sizeof(bi)) { - _kvm_err(kd, kd->program, - "cannot read bootinfo at physical address %#jx", - (uintmax_t)ehdr->e_entry); - return (-1); - } - if (bi.bi_magic != BOOTINFO_MAGIC) { - _kvm_err(kd, kd->program, "invalid bootinfo"); - return (-1); - } - kd->vmst->pbvm_pgtbl = _kvm_malloc(kd, bi.bi_pbvm_pgtblsz); - if (kd->vmst->pbvm_pgtbl == NULL) { - _kvm_err(kd, kd->program, "cannot allocate page table"); - return (-1); - } - kd->vmst->pbvm_pgtblsz = bi.bi_pbvm_pgtblsz; - sz = phys_read(kd, bi.bi_pbvm_pgtbl, kd->vmst->pbvm_pgtbl, - bi.bi_pbvm_pgtblsz); - if (sz != bi.bi_pbvm_pgtblsz) { - _kvm_err(kd, kd->program, - "cannot read page table at physical address %#jx", - (uintmax_t)bi.bi_pbvm_pgtbl); - return (-1); - } - } else { - kd->vmst->pbvm_pgtbl = NULL; - kd->vmst->pbvm_pgtblsz = 0; - } - - /* - * At this point we've got enough information to use kvm_read() for - * direct mapped (ie region 6 and region 7) address, such as symbol - * addresses/values. - */ - - nl[0].n_name = "ia64_kptdir"; - nl[1].n_name = 0; - - if (kvm_nlist(kd, nl) != 0) { - _kvm_err(kd, kd->program, "bad namelist"); - return (-1); - } - - if (kvm_read(kd, (nl[0].n_value), &va, sizeof(va)) != sizeof(va)) { - _kvm_err(kd, kd->program, "cannot read kptdir"); - return (-1); - } - - if (va == REGION_BASE(5)) { - _kvm_err(kd, kd->program, "kptdir is itself virtual"); - return (-1); - } - - kd->vmst->kptdir = va; - return (0); -} - -int -_kvm_kvatop(kvm_t *kd, u_long va, off_t *ofs) -{ - size_t sz; - - sz = kd->vmst->kvatop(kd, va, ofs); - return ((sz > INT_MAX) ? INT_MAX : sz); -} diff --git a/lib/libldns/Makefile b/lib/libldns/Makefile index ae3518a4f263..db4b989506fb 100644 --- a/lib/libldns/Makefile +++ b/lib/libldns/Makefile @@ -12,11 +12,11 @@ CFLAGS+= -I${LDNSDIR} SRCS= buffer.c dane.c dname.c dnssec.c dnssec_sign.c dnssec_verify.c \ dnssec_zone.c duration.c error.c higher.c host2str.c host2wire.c \ - keys.c net.c packet.c parse.c rbtree.c rdata.c resolver.c rr.c \ - rr_functions.c sha1.c sha2.c str2host.c tsig.c update.c util.c \ + keys.c net.c packet.c parse.c radix.c rbtree.c rdata.c resolver.c \ + rr.c rr_functions.c sha1.c sha2.c str2host.c tsig.c update.c util.c \ wire2host.c zone.c -SRCS+= b32_ntop.c b32_pton.c b64_ntop.c b64_pton.c +SRCS+= b64_ntop.c b64_pton.c DPADD+= ${LIBCRYPTO} LDADD+= -lcrypto diff --git a/lib/liblzma/Makefile.depend b/lib/liblzma/Makefile.depend index 467741f6d1a9..4acc32f64da1 100644 --- a/lib/liblzma/Makefile.depend +++ b/lib/liblzma/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/libmagic/Makefile b/lib/libmagic/Makefile index 59d772df552f..14f17028e07d 100644 --- a/lib/libmagic/Makefile +++ b/lib/libmagic/Makefile @@ -2,7 +2,8 @@ # Copyright (c) David E. O'Brien, 2000-2004, 2006, 2009 CONTRDIR= ${.CURDIR}/../../contrib/file -.PATH: ${CONTRDIR} +.PATH: ${CONTRDIR}/src +.PATH: ${CONTRDIR}/doc LIB= magic SHLIB_MAJOR= 4 @@ -18,7 +19,7 @@ INCS= magic.h MAGICPATH?= /usr/share/misc CFLAGS+= -DMAGIC='"${MAGICPATH}/magic"' -DHAVE_CONFIG_H -CFLAGS+= -I${.CURDIR} -I${CONTRDIR} +CFLAGS+= -I${.CURDIR} -I${CONTRDIR}/src WARNS?= 3 @@ -27,9 +28,9 @@ CLEANFILES+= magic magic.mgc FILES= magic magic.mgc FILESDIR= ${MAGICPATH} -MAGFILES= ${CONTRDIR}/Header\ - ${CONTRDIR}/Localstuff\ - ${CONTRDIR}/Magdir/[a-z]* +MAGFILES= ${CONTRDIR}/magic/Header \ + ${CONTRDIR}/magic/Localstuff \ + ${CONTRDIR}/magic/Magdir/[a-z]* magic: ${MAGFILES} cat ${.ALLSRC:O} > ${.TARGET} @@ -39,7 +40,7 @@ magic.mgc: mkmagic magic CLEANFILES+= mkmagic build-tools: mkmagic -mkmagic: apprentice.c encoding.c funcs.c magic.c print.c +mkmagic: apprentice.c cdf_time.c encoding.c funcs.c magic.c print.c ${CC} ${CFLAGS} -DCOMPILE_ONLY ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} \ ${LDADD} diff --git a/lib/libmagic/Makefile.depend b/lib/libmagic/Makefile.depend index 934940fb76de..ace658ad7a0d 100644 --- a/lib/libmagic/Makefile.depend +++ b/lib/libmagic/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/libmagic/config.h b/lib/libmagic/config.h index c7e38ec761a1..d80926d520bd 100644 --- a/lib/libmagic/config.h +++ b/lib/libmagic/config.h @@ -3,15 +3,24 @@ /* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.ac by autoheader. */ +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + /* Define in built-in ELF support is used */ #define BUILTIN_ELF 1 /* Define for ELF core file support */ #define ELFCORE 1 +/* Define to 1 if you have the `asctime_r' function. */ +#define HAVE_ASCTIME_R 1 + /* Define to 1 if you have the `asprintf' function. */ #define HAVE_ASPRINTF 1 +/* Define to 1 if you have the `ctime_r' function. */ +#define HAVE_CTIME_R 1 + /* HAVE_DAYLIGHT */ /* #undef HAVE_DAYLIGHT */ @@ -32,6 +41,9 @@ /* Define to 1 if you have the <fcntl.h> header file. */ #define HAVE_FCNTL_H 1 +/* Define to 1 if you have the `fmtcheck' function. */ +#define HAVE_FMTCHECK 1 + /* Define to 1 if you have the `fork' function. */ #define HAVE_FORK 1 @@ -47,11 +59,11 @@ /* Define to 1 if you have the `getopt_long' function. */ #define HAVE_GETOPT_LONG 1 -/* Define to 1 if the system has the type `int32_t'. */ -#define HAVE_INT32_T 1 +/* Define to 1 if you have the `getpagesize' function. */ +#define HAVE_GETPAGESIZE 1 -/* Define to 1 if the system has the type `int64_t'. */ -#define HAVE_INT64_T 1 +/* Define to 1 if the system has the type `intptr_t'. */ +#define HAVE_INTPTR_T 1 /* Define to 1 if you have the <inttypes.h> header file. */ #define HAVE_INTTYPES_H 1 @@ -68,7 +80,7 @@ /* Define to 1 if you have the <locale.h> header file. */ #define HAVE_LOCALE_H 1 -/* Define to 1 if you have the `mbrtowc' function. */ +/* Define to 1 if mbrtowc and mbstate_t are properly declared. */ #define HAVE_MBRTOWC 1 /* Define to 1 if <wchar.h> declares mbstate_t. */ @@ -77,14 +89,20 @@ /* Define to 1 if you have the <memory.h> header file. */ #define HAVE_MEMORY_H 1 +/* Define to 1 if you have the `mkostemp' function. */ +#define HAVE_MKOSTEMP 1 + /* Define to 1 if you have the `mkstemp' function. */ #define HAVE_MKSTEMP 1 -/* Define to 1 if you have the `mmap' function. */ +/* Define to 1 if you have a working `mmap' system call. */ #define HAVE_MMAP 1 -/* Define to 1 if the system has the type `pid_t'. */ -#define HAVE_PID_T 1 +/* Define to 1 if you have the `pread' function. */ +#define HAVE_PREAD 1 + +/* Define to 1 if you have the <stddef.h> header file. */ +#define HAVE_STDDEF_H 1 /* Define to 1 if you have the <stdint.h> header file. */ #define HAVE_STDINT_H 1 @@ -92,6 +110,9 @@ /* Define to 1 if you have the <stdlib.h> header file. */ #define HAVE_STDLIB_H 1 +/* Define to 1 if you have the `strcasestr' function. */ +#define HAVE_STRCASESTR 1 + /* Define to 1 if you have the `strerror' function. */ #define HAVE_STRERROR 1 @@ -131,6 +152,9 @@ /* Define to 1 if you have the <sys/mman.h> header file. */ #define HAVE_SYS_MMAN_H 1 +/* Define to 1 if you have the <sys/param.h> header file. */ +#define HAVE_SYS_PARAM_H 1 + /* Define to 1 if you have the <sys/stat.h> header file. */ #define HAVE_SYS_STAT_H 1 @@ -155,17 +179,8 @@ /* HAVE_TZNAME */ #define HAVE_TZNAME 1 -/* Define to 1 if the system has the type `uint16_t'. */ -#define HAVE_UINT16_T 1 - -/* Define to 1 if the system has the type `uint32_t'. */ -#define HAVE_UINT32_T 1 - -/* Define to 1 if the system has the type `uint64_t'. */ -#define HAVE_UINT64_T 1 - -/* Define to 1 if the system has the type `uint8_t'. */ -#define HAVE_UINT8_T 1 +/* Define to 1 if the system has the type `uintptr_t'. */ +#define HAVE_UINTPTR_T 1 /* Define to 1 if you have the <unistd.h> header file. */ #define HAVE_UNISTD_H 1 @@ -182,6 +197,16 @@ /* Define to 1 if you have the `vasprintf' function. */ #define HAVE_VASPRINTF 1 +/* Define to 1 if you have the `vfork' function. */ +#define HAVE_VFORK 1 + +/* Define to 1 if you have the <vfork.h> header file. */ +/* #undef HAVE_VFORK_H */ + +/* Define to 1 or 0, depending whether the compiler supports simple visibility + declarations. */ +#define HAVE_VISIBILITY 1 + /* Define to 1 if you have the <wchar.h> header file. */ #define HAVE_WCHAR_H 1 @@ -191,6 +216,12 @@ /* Define to 1 if you have the `wcwidth' function. */ #define HAVE_WCWIDTH 1 +/* Define to 1 if `fork' works. */ +#define HAVE_WORKING_FORK 1 + +/* Define to 1 if `vfork' works. */ +#define HAVE_WORKING_VFORK 1 + /* Define to 1 if you have the <zlib.h> header file. */ #define HAVE_ZLIB_H 1 @@ -206,9 +237,6 @@ <sysmacros.h>. */ /* #undef MAJOR_IN_SYSMACROS */ -/* Define to 1 if your C compiler doesn't accept -c and -o together. */ -/* #undef NO_MINUS_C_MINUS_O */ - /* Name of package */ #define PACKAGE "file" @@ -219,7 +247,7 @@ #define PACKAGE_NAME "file" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "file 5.11" +#define PACKAGE_STRING "file 5.19" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "file" @@ -228,10 +256,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "5.11" - -/* The size of `long long', as computed by sizeof. */ -#define SIZEOF_LONG_LONG 8 +#define PACKAGE_VERSION "5.19" /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 @@ -262,7 +287,24 @@ /* Version number of package */ -#define VERSION "5.11" +#define VERSION "5.19" + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif + +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif /* Number of bits in a file offset, on hosts where this is settable. */ /* #undef _FILE_OFFSET_BITS */ @@ -283,45 +325,67 @@ /* Define to 1 if you need to in order for `stat' and other things to work. */ /* #undef _POSIX_SOURCE */ +/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>, + <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +/* #undef _UINT32_T */ + +/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>, + <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +/* #undef _UINT64_T */ + +/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>, + <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +/* #undef _UINT8_T */ + /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ +/* Define to the type of a signed integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +/* #undef int32_t */ + +/* Define to the type of a signed integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +/* #undef int64_t */ + +/* Define to the type of a signed integer type wide enough to hold a pointer, + if such a type exists, and if the system does not define it. */ +/* #undef intptr_t */ + /* Define to a type if <wchar.h> does not define. */ /* #undef mbstate_t */ /* Define to `long int' if <sys/types.h> does not define. */ /* #undef off_t */ +/* Define to `int' if <sys/types.h> does not define. */ +/* #undef pid_t */ + /* Define to `unsigned int' if <sys/types.h> does not define. */ /* #undef size_t */ +/* Define to the type of an unsigned integer type of width exactly 16 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint16_t */ -#ifdef _FREEBSD_UNUSED_ -#ifndef HAVE_UINT8_T -typedef unsigned char uint8_t; -#endif -#ifndef HAVE_UINT16_T -typedef unsigned short uint16_t; -#endif -#ifndef HAVE_UINT32_T -typedef unsigned int uint32_t; -#endif -#ifndef HAVE_INT32_T -typedef int int32_t; -#endif -#ifndef HAVE_UINT64_T -#if SIZEOF_LONG_LONG == 8 -typedef unsigned long long uint64_t; -#else -typedef unsigned long uint64_t; -#endif -#endif -#ifndef HAVE_INT64_T -#if SIZEOF_LONG_LONG == 8 -typedef long long int64_t; -#else -typedef long int64_t; -#endif -#endif -#endif /* _FREEBSD_UNUSED_ */ +/* Define to the type of an unsigned integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint32_t */ + +/* Define to the type of an unsigned integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint64_t */ + +/* Define to the type of an unsigned integer type of width exactly 8 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint8_t */ + +/* Define to the type of an unsigned integer type wide enough to hold a + pointer, if such a type exists, and if the system does not define it. */ +/* #undef uintptr_t */ +/* Define as `fork' if `vfork' does not work. */ +/* #undef vfork */ diff --git a/lib/libmd/Makefile.depend b/lib/libmd/Makefile.depend index 17ea6ebfae17..33e3fb551c7d 100644 --- a/lib/libmd/Makefile.depend +++ b/lib/libmd/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/libmd/mdX.3 b/lib/libmd/mdX.3 index 223e2efa4b26..4cc321fda792 100644 --- a/lib/libmd/mdX.3 +++ b/lib/libmd/mdX.3 @@ -178,7 +178,7 @@ The original MDX routines were developed by .Tn RSA Data Security, Inc., and published in the above references. This code is derived directly from these implementations by -.An Poul-Henning Kamp Aq phk@FreeBSD.org +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org . .Pp Phk ristede runen. .Sh BUGS diff --git a/lib/libmemstat/libmemstat.3 b/lib/libmemstat/libmemstat.3 index 3eff1566d03e..0f6255399ea5 100644 --- a/lib/libmemstat/libmemstat.3 +++ b/lib/libmemstat/libmemstat.3 @@ -484,7 +484,7 @@ library appeared in .Sh AUTHORS The kernel memory allocator changes necessary to support a general purpose monitoring library, along with the library, were written by -.An Robert Watson Aq rwatson@FreeBSD.org . +.An Robert Watson Aq Mt rwatson@FreeBSD.org . .Sh BUGS There are memory allocators in the kernel, such as the VM page allocator and diff --git a/lib/libmp/Makefile.depend b/lib/libmp/Makefile.depend index 4de5cd32a6b8..62e4b3caef0a 100644 --- a/lib/libmp/Makefile.depend +++ b/lib/libmp/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/libnetgraph/netgraph.3 b/lib/libnetgraph/netgraph.3 index bd557978f8ae..9d8d26a0571e 100644 --- a/lib/libnetgraph/netgraph.3 +++ b/lib/libnetgraph/netgraph.3 @@ -395,4 +395,4 @@ a version of .Fx 2.2 customized for the Whistle InterJet. .Sh AUTHORS -.An "Archie Cobbs" Aq archie@FreeBSD.org +.An Archie Cobbs Aq Mt archie@FreeBSD.org diff --git a/lib/libnv/nv.3 b/lib/libnv/nv.3 index 118f5bbd70bc..63c8e8b0e202 100644 --- a/lib/libnv/nv.3 +++ b/lib/libnv/nv.3 @@ -194,7 +194,7 @@ The API supports the following data types: .Bl -ohang -offset indent .It Sy null ( NV_TYPE_NULL ) There is no data associated with the name. -.It Sy bool ( NV_TYPE_BOLL ) +.It Sy bool ( NV_TYPE_BOOL ) The value can be either .Dv true or @@ -600,5 +600,5 @@ library appeared in The .Nm libnv library was implemented 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/libpam/modules/pam_group/pam_group.8 b/lib/libpam/modules/pam_group/pam_group.8 index 985094b1ed24..4f368e577c22 100644 --- a/lib/libpam/modules/pam_group/pam_group.8 +++ b/lib/libpam/modules/pam_group/pam_group.8 @@ -33,7 +33,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 9, 2011 +.Dd July 19, 2014 .Dt PAM_GROUP 8 .Os .Sh NAME @@ -48,6 +48,11 @@ .Sh DESCRIPTION The group service module for PAM accepts or rejects users based on their membership in a particular file group. +.Nm pam_group +provides functionality for two PAM categories: authentication and +account management. +In terms of the module-type parameter, they are the ``auth'' and +``account'' features. .Pp The following options may be passed to the .Nm diff --git a/lib/libpam/modules/pam_group/pam_group.c b/lib/libpam/modules/pam_group/pam_group.c index a6e32cd2bf7e..6cf2774a308f 100644 --- a/lib/libpam/modules/pam_group/pam_group.c +++ b/lib/libpam/modules/pam_group/pam_group.c @@ -47,15 +47,14 @@ __FBSDID("$FreeBSD$"); #include <unistd.h> #define PAM_SM_AUTH +#define PAM_SM_ACCOUNT #include <security/pam_appl.h> #include <security/pam_modules.h> #include <security/openpam.h> - -PAM_EXTERN int -pam_sm_authenticate(pam_handle_t *pamh, int flags __unused, - int argc __unused, const char *argv[] __unused) +static int +pam_group(pam_handle_t *pamh) { int local, remote; const char *group, *user; @@ -96,14 +95,12 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags __unused, if ((grp = getgrnam(group)) == NULL || grp->gr_mem == NULL) goto failed; - /* check if the group is empty */ - if (*grp->gr_mem == NULL) - goto failed; - - /* check membership */ + /* check if user's own primary group */ if (pwd->pw_gid == grp->gr_gid) goto found; - for (list = grp->gr_mem; *list != NULL; ++list) + + /* iterate over members */ + for (list = grp->gr_mem; list != NULL && *list != NULL; ++list) if (strcmp(*list, pwd->pw_name) == 0) goto found; @@ -123,6 +120,14 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags __unused, } PAM_EXTERN int +pam_sm_authenticate(pam_handle_t *pamh, int flags __unused, + int argc __unused, const char *argv[] __unused) +{ + + return (pam_group(pamh)); +} + +PAM_EXTERN int pam_sm_setcred(pam_handle_t * pamh __unused, int flags __unused, int argc __unused, const char *argv[] __unused) { @@ -130,4 +135,12 @@ pam_sm_setcred(pam_handle_t * pamh __unused, int flags __unused, return (PAM_SUCCESS); } +PAM_EXTERN int +pam_sm_acct_mgmt(pam_handle_t *pamh, int flags __unused, + int argc __unused, const char *argv[] __unused) +{ + + return (pam_group(pamh)); +} + PAM_MODULE_ENTRY("pam_group"); diff --git a/lib/libpam/modules/pam_lastlog/pam_lastlog.c b/lib/libpam/modules/pam_lastlog/pam_lastlog.c index 72bb94218104..814edb8c59af 100644 --- a/lib/libpam/modules/pam_lastlog/pam_lastlog.c +++ b/lib/libpam/modules/pam_lastlog/pam_lastlog.c @@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$"); #include <sys/time.h> #include <paths.h> -#include <pwd.h> #include <stdlib.h> #include <string.h> #include <time.h> @@ -68,7 +67,6 @@ PAM_EXTERN int pam_sm_open_session(pam_handle_t *pamh, int flags, int argc __unused, const char *argv[] __unused) { - struct passwd *pwd; struct utmpx *utx, utl; time_t t; const char *user; @@ -79,7 +77,7 @@ pam_sm_open_session(pam_handle_t *pamh, int flags, pam_err = pam_get_user(pamh, &user, NULL); if (pam_err != PAM_SUCCESS) return (pam_err); - if (user == NULL || (pwd = getpwnam(user)) == NULL) + if (user == NULL) return (PAM_SERVICE_ERR); PAM_LOG("Got user: %s", user); diff --git a/lib/libpam/modules/pam_passwdqc/pam_passwdqc.8 b/lib/libpam/modules/pam_passwdqc/pam_passwdqc.8 index 408f77d2707d..abdd3907e972 100644 --- a/lib/libpam/modules/pam_passwdqc/pam_passwdqc.8 +++ b/lib/libpam/modules/pam_passwdqc/pam_passwdqc.8 @@ -123,7 +123,6 @@ password are not counted. In addition to being sufficiently long, passwords are required to contain enough different characters for the character classes and the minimum length they have been checked against. -.Pp .It Cm max Ns = Ns Ar N .Pq Cm max Ns = Ns 40 The maximum allowed password length. @@ -257,7 +256,7 @@ is that the former is incompatible with The .Nm module was written by -.An Solar Designer Aq solar@openwall.com . +.An Solar Designer Aq Mt solar@openwall.com . This manual page, derived from the author's documentation, was written for the .Fx diff --git a/lib/libpam/modules/pam_radius/pam_radius.8 b/lib/libpam/modules/pam_radius/pam_radius.8 index da36b7fe6c42..d71b41434419 100644 --- a/lib/libpam/modules/pam_radius/pam_radius.8 +++ b/lib/libpam/modules/pam_radius/pam_radius.8 @@ -126,9 +126,9 @@ manual page first appeared in The .Nm manual page was written by -.An Andrzej Bialecki Aq abial@FreeBSD.org . +.An Andrzej Bialecki Aq Mt abial@FreeBSD.org . .Pp The .Nm module was written by -.An John D. Polstra Aq jdp@FreeBSD.org . +.An John D. Polstra Aq Mt jdp@FreeBSD.org . diff --git a/lib/libpam/modules/pam_ssh/pam_ssh.8 b/lib/libpam/modules/pam_ssh/pam_ssh.8 index ea41455f2e53..7c1ee40bf1ea 100644 --- a/lib/libpam/modules/pam_ssh/pam_ssh.8 +++ b/lib/libpam/modules/pam_ssh/pam_ssh.8 @@ -147,7 +147,7 @@ The .Nm module was originally written by .An -nosplit -.An "Andrew J. Korty" Aq ajk@iu.edu . +.An Andrew J. Korty Aq Mt ajk@iu.edu . The current implementation was developed for the .Fx Project by @@ -156,4 +156,4 @@ Associates, Inc.\& under DARPA/SPAWAR contract N66001-01-C-8035 .Pq Dq CBOSS , as part of the DARPA CHATS research program. This manual page was written by -.An "Mark R V Murray" Aq markm@FreeBSD.org . +.An Mark R V Murray Aq Mt markm@FreeBSD.org . diff --git a/lib/libpam/modules/pam_tacplus/pam_tacplus.8 b/lib/libpam/modules/pam_tacplus/pam_tacplus.8 index a1fe9ba7b8d5..ee8cc78e0d9f 100644 --- a/lib/libpam/modules/pam_tacplus/pam_tacplus.8 +++ b/lib/libpam/modules/pam_tacplus/pam_tacplus.8 @@ -116,11 +116,11 @@ module first appeared in The .Nm manual page was written by -.An Andrzej Bialecki Aq abial@FreeBSD.org +.An Andrzej Bialecki Aq Mt abial@FreeBSD.org and adapted to TACACS+ from RADIUS by -.An Mark R V Murray Aq markm@FreeBSD.org . +.An Mark R V Murray Aq Mt markm@FreeBSD.org . .Pp The .Nm module was written by -.An John D. Polstra Aq jdp@FreeBSD.org . +.An John D. Polstra Aq Mt jdp@FreeBSD.org . diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c index 2b7b61b2d6b0..5282bb29f897 100644 --- a/lib/libpmc/libpmc.c +++ b/lib/libpmc/libpmc.c @@ -190,6 +190,11 @@ static const struct pmc_event_descr corei7_event_table[] = __PMC_EV_ALIAS_COREI7() }; +static const struct pmc_event_descr nehalem_ex_event_table[] = +{ + __PMC_EV_ALIAS_COREI7() +}; + static const struct pmc_event_descr haswell_event_table[] = { __PMC_EV_ALIAS_HASWELL() @@ -220,6 +225,11 @@ static const struct pmc_event_descr westmere_event_table[] = __PMC_EV_ALIAS_WESTMERE() }; +static const struct pmc_event_descr westmere_ex_event_table[] = +{ + __PMC_EV_ALIAS_WESTMERE() +}; + static const struct pmc_event_descr corei7uc_event_table[] = { __PMC_EV_ALIAS_COREI7UC() @@ -255,12 +265,14 @@ PMC_MDEP_TABLE(atom_silvermont, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TS PMC_MDEP_TABLE(core, IAP, PMC_CLASS_SOFT, PMC_CLASS_TSC); PMC_MDEP_TABLE(core2, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); PMC_MDEP_TABLE(corei7, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); +PMC_MDEP_TABLE(nehalem_ex, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); PMC_MDEP_TABLE(haswell, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); PMC_MDEP_TABLE(ivybridge, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); PMC_MDEP_TABLE(ivybridge_xeon, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); PMC_MDEP_TABLE(sandybridge, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); PMC_MDEP_TABLE(sandybridge_xeon, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); PMC_MDEP_TABLE(westmere, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); +PMC_MDEP_TABLE(westmere_ex, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); PMC_MDEP_TABLE(k7, K7, PMC_CLASS_SOFT, PMC_CLASS_TSC); PMC_MDEP_TABLE(k8, K8, PMC_CLASS_SOFT, PMC_CLASS_TSC); PMC_MDEP_TABLE(p4, P4, PMC_CLASS_SOFT, PMC_CLASS_TSC); @@ -298,12 +310,14 @@ PMC_CLASS_TABLE_DESC(atom_silvermont, IAP, atom_silvermont, iap); PMC_CLASS_TABLE_DESC(core, IAP, core, iap); PMC_CLASS_TABLE_DESC(core2, IAP, core2, iap); PMC_CLASS_TABLE_DESC(corei7, IAP, corei7, iap); +PMC_CLASS_TABLE_DESC(nehalem_ex, IAP, nehalem_ex, iap); PMC_CLASS_TABLE_DESC(haswell, IAP, haswell, iap); PMC_CLASS_TABLE_DESC(ivybridge, IAP, ivybridge, iap); PMC_CLASS_TABLE_DESC(ivybridge_xeon, IAP, ivybridge_xeon, iap); PMC_CLASS_TABLE_DESC(sandybridge, IAP, sandybridge, iap); PMC_CLASS_TABLE_DESC(sandybridge_xeon, IAP, sandybridge_xeon, iap); PMC_CLASS_TABLE_DESC(westmere, IAP, westmere, iap); +PMC_CLASS_TABLE_DESC(westmere_ex, IAP, westmere_ex, iap); PMC_CLASS_TABLE_DESC(ucf, UCF, ucf, ucf); PMC_CLASS_TABLE_DESC(corei7uc, UCP, corei7uc, ucp); PMC_CLASS_TABLE_DESC(haswelluc, UCP, haswelluc, ucp); @@ -608,6 +622,8 @@ static struct pmc_event_alias core2_aliases_without_iaf[] = { #define atom_silvermont_aliases_without_iaf core2_aliases_without_iaf #define corei7_aliases core2_aliases #define corei7_aliases_without_iaf core2_aliases_without_iaf +#define nehalem_ex_aliases core2_aliases +#define nehalem_ex_aliases_without_iaf core2_aliases_without_iaf #define haswell_aliases core2_aliases #define haswell_aliases_without_iaf core2_aliases_without_iaf #define ivybridge_aliases core2_aliases @@ -620,6 +636,8 @@ static struct pmc_event_alias core2_aliases_without_iaf[] = { #define sandybridge_xeon_aliases_without_iaf core2_aliases_without_iaf #define westmere_aliases core2_aliases #define westmere_aliases_without_iaf core2_aliases_without_iaf +#define westmere_ex_aliases core2_aliases +#define westmere_ex_aliases_without_iaf core2_aliases_without_iaf #define IAF_KW_OS "os" #define IAF_KW_USR "usr" @@ -863,7 +881,9 @@ iap_allocate_pmc(enum pmc_event pe, char *ctrspec, } else return (-1); } else if (cpu_info.pm_cputype == PMC_CPU_INTEL_COREI7 || - cpu_info.pm_cputype == PMC_CPU_INTEL_WESTMERE) { + cpu_info.pm_cputype == PMC_CPU_INTEL_WESTMERE || + cpu_info.pm_cputype == PMC_CPU_INTEL_NEHALEM_EX || + cpu_info.pm_cputype == PMC_CPU_INTEL_WESTMERE_EX) { if (KWPREFIXMATCH(p, IAP_KW_RSP "=")) { n = pmc_parse_mask(iap_rsp_mask_i7_wm, p, &rsp); } else @@ -2760,6 +2780,10 @@ pmc_event_names_of_class(enum pmc_class cl, const char ***eventnames, ev = corei7_event_table; count = PMC_EVENT_TABLE_SIZE(corei7); break; + case PMC_CPU_INTEL_NEHALEM_EX: + ev = nehalem_ex_event_table; + count = PMC_EVENT_TABLE_SIZE(nehalem_ex); + break; case PMC_CPU_INTEL_HASWELL: ev = haswell_event_table; count = PMC_EVENT_TABLE_SIZE(haswell); @@ -2784,6 +2808,10 @@ pmc_event_names_of_class(enum pmc_class cl, const char ***eventnames, ev = westmere_event_table; count = PMC_EVENT_TABLE_SIZE(westmere); break; + case PMC_CPU_INTEL_WESTMERE_EX: + ev = westmere_ex_event_table; + count = PMC_EVENT_TABLE_SIZE(westmere_ex); + break; } break; case PMC_CLASS_UCF: @@ -3079,6 +3107,9 @@ pmc_init(void) pmc_class_table[n++] = &corei7uc_class_table_descr; PMC_MDEP_INIT_INTEL_V2(corei7); break; + case PMC_CPU_INTEL_NEHALEM_EX: + PMC_MDEP_INIT_INTEL_V2(nehalem_ex); + break; case PMC_CPU_INTEL_HASWELL: pmc_class_table[n++] = &ucf_class_table_descr; pmc_class_table[n++] = &haswelluc_class_table_descr; @@ -3103,6 +3134,9 @@ pmc_init(void) pmc_class_table[n++] = &westmereuc_class_table_descr; PMC_MDEP_INIT_INTEL_V2(westmere); break; + case PMC_CPU_INTEL_WESTMERE_EX: + PMC_MDEP_INIT_INTEL_V2(westmere_ex); + break; case PMC_CPU_INTEL_PIV: PMC_MDEP_INIT(p4); pmc_class_table[n] = &p4_class_table_descr; @@ -3237,6 +3271,11 @@ _pmc_name_of_event(enum pmc_event pe, enum pmc_cputype cpu) ev = corei7_event_table; evfence = corei7_event_table + PMC_EVENT_TABLE_SIZE(corei7); break; + case PMC_CPU_INTEL_NEHALEM_EX: + ev = nehalem_ex_event_table; + evfence = nehalem_ex_event_table + + PMC_EVENT_TABLE_SIZE(nehalem_ex); + break; case PMC_CPU_INTEL_HASWELL: ev = haswell_event_table; evfence = haswell_event_table + PMC_EVENT_TABLE_SIZE(haswell); @@ -3261,6 +3300,11 @@ _pmc_name_of_event(enum pmc_event pe, enum pmc_cputype cpu) ev = westmere_event_table; evfence = westmere_event_table + PMC_EVENT_TABLE_SIZE(westmere); break; + case PMC_CPU_INTEL_WESTMERE_EX: + ev = westmere_ex_event_table; + evfence = westmere_ex_event_table + + PMC_EVENT_TABLE_SIZE(westmere_ex); + break; default: /* Unknown CPU type. */ break; } diff --git a/lib/libpmc/pmc.3 b/lib/libpmc/pmc.3 index c970da846056..8e6db485ae37 100644 --- a/lib/libpmc/pmc.3 +++ b/lib/libpmc/pmc.3 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 24, 2008 +.Dd July 28, 2014 .Dt PMC 3 .Os .Sh NAME @@ -525,14 +525,26 @@ API is .Xr pmc.atom 3 , .Xr pmc.core 3 , .Xr pmc.core2 3 , +.Xr pmc.haswell 3 , +.Xr pmc.haswelluc 3 , .Xr pmc.iaf 3 , +.Xr pmc.ivybridge 3 , +.Xr pmc.ivybridgexeon 3 , .Xr pmc.k7 3 , .Xr pmc.k8 3 , +.Xr pmc.mips24k 3 , +.Xr pmc.octeon 3 , .Xr pmc.p4 3 , .Xr pmc.p5 3 , .Xr pmc.p6 3 , +.Xr pmc.sandybridge 3 , +.Xr pmc.sandybridgeuc 3 , +.Xr pmc.sandybridgexeon 3 , .Xr pmc.soft 3 , .Xr pmc.tsc 3 , +.Xr pmc.westmere 3 , +.Xr pmc.westmereuc 3 , +.Xr pmc.xscale 3 , .Xr pmclog 3 , .Xr hwpmc 4 , .Xr pmccontrol 8 , @@ -546,5 +558,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.atom.3 b/lib/libpmc/pmc.atom.3 index 9b9a58fa95c9..edf81ba54a5e 100644 --- a/lib/libpmc/pmc.atom.3 +++ b/lib/libpmc/pmc.atom.3 @@ -1191,5 +1191,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.atomsilvermont.3 b/lib/libpmc/pmc.atomsilvermont.3 index 91e22e9e3f50..dca200aa8db2 100644 --- a/lib/libpmc/pmc.atomsilvermont.3 +++ b/lib/libpmc/pmc.atomsilvermont.3 @@ -524,12 +524,11 @@ The library first appeared in .Fx 6.0 . .Sh AUTHORS +.An -nosplit The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . The support for the Atom Silvermont microarchitecture was written by -.An "Hiren Panchasara" -.Aq hiren@FreeBSD.org . +.An Hiren Panchasara Aq Mt hiren@FreeBSD.org . diff --git a/lib/libpmc/pmc.core.3 b/lib/libpmc/pmc.core.3 index 73e8d81d5dc2..551e615dc320 100644 --- a/lib/libpmc/pmc.core.3 +++ b/lib/libpmc/pmc.core.3 @@ -805,5 +805,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.core2.3 b/lib/libpmc/pmc.core2.3 index 5c6b533164f9..cd038fb411d9 100644 --- a/lib/libpmc/pmc.core2.3 +++ b/lib/libpmc/pmc.core2.3 @@ -1121,5 +1121,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.corei7.3 b/lib/libpmc/pmc.corei7.3 index aaf1f022615f..90d19dfcab33 100644 --- a/lib/libpmc/pmc.corei7.3 +++ b/lib/libpmc/pmc.corei7.3 @@ -1573,5 +1573,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.corei7uc.3 b/lib/libpmc/pmc.corei7uc.3 index 3114c8ea9f6a..5b991138b73b 100644 --- a/lib/libpmc/pmc.corei7uc.3 +++ b/lib/libpmc/pmc.corei7uc.3 @@ -877,5 +877,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.haswell.3 b/lib/libpmc/pmc.haswell.3 index dd0cbb82b44f..ace9c2a544ef 100644 --- a/lib/libpmc/pmc.haswell.3 +++ b/lib/libpmc/pmc.haswell.3 @@ -964,12 +964,11 @@ The library first appeared in .Fx 6.0 . .Sh AUTHORS +.An -nosplit The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . The support for the Haswell microarchitecture was written by -.An "Hiren Panchasara" -.Aq hiren.panchasara@gmail.com . +.An Hiren Panchasara Aq Mt hiren.panchasara@gmail.com . diff --git a/lib/libpmc/pmc.haswelluc.3 b/lib/libpmc/pmc.haswelluc.3 index dba9d4740019..fedf056eae7f 100644 --- a/lib/libpmc/pmc.haswelluc.3 +++ b/lib/libpmc/pmc.haswelluc.3 @@ -226,12 +226,11 @@ The library first appeared in .Fx 6.0 . .Sh AUTHORS +.An -nosplit The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . The support for the Haswell microarchitecture was added by -.An "Hiren Panchasara" -.Aq hiren.panchasara@gmail.com . +.An Hiren Panchasara Aq Mt hiren.panchasara@gmail.com . diff --git a/lib/libpmc/pmc.iaf.3 b/lib/libpmc/pmc.iaf.3 index 7e623d6548ac..3184c199c59c 100644 --- a/lib/libpmc/pmc.iaf.3 +++ b/lib/libpmc/pmc.iaf.3 @@ -146,5 +146,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.ivybridge.3 b/lib/libpmc/pmc.ivybridge.3 index 7d8bdca62e3e..b8ad8e00c712 100644 --- a/lib/libpmc/pmc.ivybridge.3 +++ b/lib/libpmc/pmc.ivybridge.3 @@ -870,12 +870,11 @@ The library first appeared in .Fx 6.0 . .Sh AUTHORS +.An -nosplit The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . The support for the Ivy Bridge microarchitecture was written by -.An "Fabien Thomas" -.Aq fabient@FreeBSD.org . +.An Fabien Thomas Aq Mt fabient@FreeBSD.org . diff --git a/lib/libpmc/pmc.ivybridgexeon.3 b/lib/libpmc/pmc.ivybridgexeon.3 index 76d5e60fce8f..3a5b7096b3a2 100644 --- a/lib/libpmc/pmc.ivybridgexeon.3 +++ b/lib/libpmc/pmc.ivybridgexeon.3 @@ -900,12 +900,11 @@ The library first appeared in .Fx 6.0 . .Sh AUTHORS +.An -nosplit The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . The support for the Ivy Bridge Xeon microarchitecture was written by -.An "Hiren Panchasara" -.Aq hiren.panchasara@gmail.com . +.An Hiren Panchasara Aq Mt hiren.panchasara@gmail.com . diff --git a/lib/libpmc/pmc.k7.3 b/lib/libpmc/pmc.k7.3 index 646f35275149..a8be8143f9ea 100644 --- a/lib/libpmc/pmc.k7.3 +++ b/lib/libpmc/pmc.k7.3 @@ -262,5 +262,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.k8.3 b/lib/libpmc/pmc.k8.3 index 628137d7ffaf..45c70baa438c 100644 --- a/lib/libpmc/pmc.k8.3 +++ b/lib/libpmc/pmc.k8.3 @@ -672,7 +672,6 @@ Count memory controller high priority bypasses. .It Li memory-controller-lo-pri-bypass Count memory controller low priority bypasses. .El -.Pp .It Li k8-nb-memory-controller-dram-slots-missed .Pq Event E2H Count memory controller DRAM command slots missed (in MemClks). @@ -796,5 +795,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.mips24k.3 b/lib/libpmc/pmc.mips24k.3 index 4acb0a7eab94..d886d0e8c906 100644 --- a/lib/libpmc/pmc.mips24k.3 +++ b/lib/libpmc/pmc.mips24k.3 @@ -403,11 +403,10 @@ The library first appeared in .Fx 6.0 . .Sh AUTHORS +.An -nosplit The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . MIPS support was added by -.An "George Neville-Neil" -.Aq gnn@FreeBSD.org . +.An George Neville-Neil Aq Mt gnn@FreeBSD.org . diff --git a/lib/libpmc/pmc.octeon.3 b/lib/libpmc/pmc.octeon.3 index be38dd8c5786..019b448522e9 100644 --- a/lib/libpmc/pmc.octeon.3 +++ b/lib/libpmc/pmc.octeon.3 @@ -243,11 +243,10 @@ The library first appeared in .Fx 6.0 . .Sh AUTHORS +.An -nosplit The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . MIPS support was added by -.An "George Neville-Neil" -.Aq gnn@FreeBSD.org . +.An George Neville-Neil Aq Mt gnn@FreeBSD.org . diff --git a/lib/libpmc/pmc.p4.3 b/lib/libpmc/pmc.p4.3 index b273edd8b1e7..e113b72001e1 100644 --- a/lib/libpmc/pmc.p4.3 +++ b/lib/libpmc/pmc.p4.3 @@ -541,7 +541,6 @@ can take the following value (which is also the default): .It Li running Count cycles when the processor is active. .El -.Pp .It Li p4-instr-retired Op Li ,mask= Ns Ar flags .Pq "TS event" Count instructions retired during a clock cycle. @@ -1221,5 +1220,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.p5.3 b/lib/libpmc/pmc.p5.3 index ebdd5054e2d5..91d7677057ba 100644 --- a/lib/libpmc/pmc.p5.3 +++ b/lib/libpmc/pmc.p5.3 @@ -457,5 +457,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.p6.3 b/lib/libpmc/pmc.p6.3 index 3fa98a75a396..6a8270a86793 100644 --- a/lib/libpmc/pmc.p6.3 +++ b/lib/libpmc/pmc.p6.3 @@ -1023,5 +1023,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.sandybridge.3 b/lib/libpmc/pmc.sandybridge.3 index 931bd9d5f4e7..0b8f6b2f09a9 100644 --- a/lib/libpmc/pmc.sandybridge.3 +++ b/lib/libpmc/pmc.sandybridge.3 @@ -949,12 +949,11 @@ The library first appeared in .Fx 6.0 . .Sh AUTHORS +.An -nosplit The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org. +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . The support for the Sandy Bridge microarchitecture was written by -.An "Davide Italiano" -.Aq davide@FreeBSD.org . +.An Davide Italiano Aq Mt davide@FreeBSD.org . diff --git a/lib/libpmc/pmc.sandybridgeuc.3 b/lib/libpmc/pmc.sandybridgeuc.3 index f952533334c6..0215c36a45d7 100644 --- a/lib/libpmc/pmc.sandybridgeuc.3 +++ b/lib/libpmc/pmc.sandybridgeuc.3 @@ -223,12 +223,11 @@ The library first appeared in .Fx 6.0 . .Sh AUTHORS +.An -nosplit The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . The support for the Sandy Bridge microarchitecture was added by -.An "Davide Italiano" -.Aq davide@FreeBSD.org . +.An Davide Italiano Aq Mt davide@FreeBSD.org . diff --git a/lib/libpmc/pmc.sandybridgexeon.3 b/lib/libpmc/pmc.sandybridgexeon.3 index 8d69abd107dd..9a80f7892d13 100644 --- a/lib/libpmc/pmc.sandybridgexeon.3 +++ b/lib/libpmc/pmc.sandybridgexeon.3 @@ -1013,12 +1013,11 @@ The library first appeared in .Fx 6.0 . .Sh AUTHORS +.An -nosplit The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . The support for the Sandy Bridge Xeon microarchitecture was written by -.An "Hiren Panchasara" -.Aq hiren.panchasara@gmail.com . +.An Hiren Panchasara Aq Mt hiren.panchasara@gmail.com . diff --git a/lib/libpmc/pmc.soft.3 b/lib/libpmc/pmc.soft.3 index a6919aef0ca0..5d331e220a97 100644 --- a/lib/libpmc/pmc.soft.3 +++ b/lib/libpmc/pmc.soft.3 @@ -96,11 +96,10 @@ The library first appeared in .Fx 6.0 . .Sh AUTHORS +.An -nosplit The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . Software PMC was written by -.An "Fabien Thomas" -.Aq fabient@FreeBSD.org . +.An Fabien Thomas Aq Mt fabient@FreeBSD.org . diff --git a/lib/libpmc/pmc.tsc.3 b/lib/libpmc/pmc.tsc.3 index 269200549d69..2392eb8db7a8 100644 --- a/lib/libpmc/pmc.tsc.3 +++ b/lib/libpmc/pmc.tsc.3 @@ -80,5 +80,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.ucf.3 b/lib/libpmc/pmc.ucf.3 index 15399e43d02e..6b027868d102 100644 --- a/lib/libpmc/pmc.ucf.3 +++ b/lib/libpmc/pmc.ucf.3 @@ -110,5 +110,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.westmere.3 b/lib/libpmc/pmc.westmere.3 index 547ee71eff0f..6bfdf391c8b6 100644 --- a/lib/libpmc/pmc.westmere.3 +++ b/lib/libpmc/pmc.westmere.3 @@ -1395,5 +1395,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.westmereuc.3 b/lib/libpmc/pmc.westmereuc.3 index 517c470fbe7d..2f260c24456d 100644 --- a/lib/libpmc/pmc.westmereuc.3 +++ b/lib/libpmc/pmc.westmereuc.3 @@ -1080,5 +1080,4 @@ library first appeared in The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . diff --git a/lib/libpmc/pmc.xscale.3 b/lib/libpmc/pmc.xscale.3 index 965ea741203d..5a496b942ade 100644 --- a/lib/libpmc/pmc.xscale.3 +++ b/lib/libpmc/pmc.xscale.3 @@ -144,14 +144,13 @@ library first appeared in Intel XScale support first appeared in .Fx 9.0 . .Sh AUTHORS +.An -nosplit The .Lb libpmc library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . .Pp Intel XScale support was added by -.An "Rui Paulo" -.Aq rpaulo@FreeBSD.org . +.An Rui Paulo Aq Mt rpaulo@FreeBSD.org . .Sh CAVEATS The Intel XScale code does not yet support sampling. diff --git a/lib/libproc/Makefile b/lib/libproc/Makefile index 930249628edc..5e5babffee70 100644 --- a/lib/libproc/Makefile +++ b/lib/libproc/Makefile @@ -17,7 +17,9 @@ CFLAGS+= -I${.CURDIR} # avoid cyclic dependency CFLAGS+= -I${.CURDIR:H}/librtld_db -.if ${MK_LIBCPLUSPLUS} != "no" +.if ${MK_CXX} == "no" +CFLAGS+= -DNO_CXA_DEMANGLE +.elif ${MK_LIBCPLUSPLUS} != "no" LDADD+= -lcxxrt DPADD+= ${LIBCXXRT} .else diff --git a/lib/libproc/proc_sym.c b/lib/libproc/proc_sym.c index 3777a46fd5e9..4d600436c676 100644 --- a/lib/libproc/proc_sym.c +++ b/lib/libproc/proc_sym.c @@ -46,27 +46,34 @@ #include "_libproc.h" +#ifndef NO_CXA_DEMANGLE extern char *__cxa_demangle(const char *, char *, size_t *, int *); +#endif /* NO_CXA_DEMANGLE */ static void proc_rdl2prmap(rd_loadobj_t *, prmap_t *); static void demangle(const char *symbol, char *buf, size_t len) { +#ifndef NO_CXA_DEMANGLE char *dembuf; - size_t demlen = len; + size_t demlen; - dembuf = malloc(len); - if (!dembuf) - goto fail; - dembuf = __cxa_demangle(symbol, dembuf, &demlen, NULL); - if (!dembuf) - goto fail; - strlcpy(buf, dembuf, len); - free(dembuf); + if (symbol[0] == '_' && symbol[1] == 'Z' && symbol[2]) { + dembuf = malloc(len); + if (!dembuf) + goto fail; + demlen = len; + dembuf = __cxa_demangle(symbol, dembuf, &demlen, NULL); + if (!dembuf) + goto fail; + strlcpy(buf, dembuf, len); + free(dembuf); + } return; fail: +#endif /* NO_CXA_DEMANGLE */ strlcpy(buf, symbol, len); } @@ -297,10 +304,7 @@ proc_addr2sym(struct proc_handle *p, uintptr_t addr, char *name, if (addr >= rsym && addr < rsym + sym.st_size) { s = elf_strptr(e, dynsymstridx, sym.st_name); if (s) { - if (s[0] == '_' && s[1] == 'Z' && s[2]) - demangle(s, name, namesz); - else - strlcpy(name, s, namesz); + demangle(s, name, namesz); memcpy(symcopy, &sym, sizeof(sym)); /* * DTrace expects the st_value to contain @@ -335,10 +339,7 @@ symtab: if (addr >= rsym && addr < rsym + sym.st_size) { s = elf_strptr(e, symtabstridx, sym.st_name); if (s) { - if (s[0] == '_' && s[1] == 'Z' && s[2]) - demangle(s, name, namesz); - else - strlcpy(name, s, namesz); + demangle(s, name, namesz); memcpy(symcopy, &sym, sizeof(sym)); /* * DTrace expects the st_value to contain diff --git a/lib/libprocstat/Makefile.depend b/lib/libprocstat/Makefile.depend index bf92deb89550..914766954c5e 100644 --- a/lib/libprocstat/Makefile.depend +++ b/lib/libprocstat/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/libprocstat/libprocstat.3 b/lib/libprocstat/libprocstat.3 index b472900dd8b9..1c1f811e6017 100644 --- a/lib/libprocstat/libprocstat.3 +++ b/lib/libprocstat/libprocstat.3 @@ -543,7 +543,7 @@ library appeared in The .Nm libprocstat library was written by -.An Stanislav Sedov Aq stas@FreeBSD.org . +.An Stanislav Sedov Aq Mt stas@FreeBSD.org . .Pp This manual page was written by -.An Sergey Kandaurov Aq pluknet@FreeBSD.org . +.An Sergey Kandaurov Aq Mt pluknet@FreeBSD.org . diff --git a/lib/libprocstat/zfs/Makefile.depend b/lib/libprocstat/zfs/Makefile.depend index 2b448e39c8b1..b142a6736e9e 100644 --- a/lib/libprocstat/zfs/Makefile.depend +++ b/lib/libprocstat/zfs/Makefile.depend @@ -5,7 +5,6 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ include \ include/xlocale \ - lib/clang/include \ lib/libkvm \ lib/msun \ diff --git a/lib/librpcsec_gss/Makefile.depend b/lib/librpcsec_gss/Makefile.depend index 89fa5dfd28c1..fc5d47143378 100644 --- a/lib/librpcsec_gss/Makefile.depend +++ b/lib/librpcsec_gss/Makefile.depend @@ -3,6 +3,7 @@ DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} DIRDEPS = \ + bin/cat.host \ gnu/lib/csu \ gnu/lib/libgcc \ include \ diff --git a/lib/librpcsec_gss/rpc_gss_get_error.3 b/lib/librpcsec_gss/rpc_gss_get_error.3 index f1d8fc74b4a5..eea77c755498 100644 --- a/lib/librpcsec_gss/rpc_gss_get_error.3 +++ b/lib/librpcsec_gss/rpc_gss_get_error.3 @@ -55,4 +55,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpc_gss_get_mech_info.3 b/lib/librpcsec_gss/rpc_gss_get_mech_info.3 index 9a26dc107d4b..0bf6d452f71a 100644 --- a/lib/librpcsec_gss/rpc_gss_get_mech_info.3 +++ b/lib/librpcsec_gss/rpc_gss_get_mech_info.3 @@ -65,4 +65,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpc_gss_get_mechanisms.3 b/lib/librpcsec_gss/rpc_gss_get_mechanisms.3 index c37acea3421e..7c3bcca0e647 100644 --- a/lib/librpcsec_gss/rpc_gss_get_mechanisms.3 +++ b/lib/librpcsec_gss/rpc_gss_get_mechanisms.3 @@ -52,4 +52,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpc_gss_get_principal_name.3 b/lib/librpcsec_gss/rpc_gss_get_principal_name.3 index 50fc65b0fb2e..286c09f68882 100644 --- a/lib/librpcsec_gss/rpc_gss_get_principal_name.3 +++ b/lib/librpcsec_gss/rpc_gss_get_principal_name.3 @@ -79,4 +79,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpc_gss_get_versions.3 b/lib/librpcsec_gss/rpc_gss_get_versions.3 index d624f85e1bb4..9d79db4f9892 100644 --- a/lib/librpcsec_gss/rpc_gss_get_versions.3 +++ b/lib/librpcsec_gss/rpc_gss_get_versions.3 @@ -61,4 +61,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpc_gss_getcred.3 b/lib/librpcsec_gss/rpc_gss_getcred.3 index 4ebd275728ae..515bd99743f8 100644 --- a/lib/librpcsec_gss/rpc_gss_getcred.3 +++ b/lib/librpcsec_gss/rpc_gss_getcred.3 @@ -82,4 +82,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpc_gss_is_installed.3 b/lib/librpcsec_gss/rpc_gss_is_installed.3 index d427e87effa1..3d83b71ad2b6 100644 --- a/lib/librpcsec_gss/rpc_gss_is_installed.3 +++ b/lib/librpcsec_gss/rpc_gss_is_installed.3 @@ -62,4 +62,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpc_gss_max_data_length.3 b/lib/librpcsec_gss/rpc_gss_max_data_length.3 index 1d3a9224f03f..57cf673032cb 100644 --- a/lib/librpcsec_gss/rpc_gss_max_data_length.3 +++ b/lib/librpcsec_gss/rpc_gss_max_data_length.3 @@ -61,4 +61,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpc_gss_mech_to_oid.3 b/lib/librpcsec_gss/rpc_gss_mech_to_oid.3 index 14bd5ee8e767..1156325365d5 100644 --- a/lib/librpcsec_gss/rpc_gss_mech_to_oid.3 +++ b/lib/librpcsec_gss/rpc_gss_mech_to_oid.3 @@ -65,4 +65,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpc_gss_oid_to_mech.3 b/lib/librpcsec_gss/rpc_gss_oid_to_mech.3 index 661bdff851f0..8ab8340f07cb 100644 --- a/lib/librpcsec_gss/rpc_gss_oid_to_mech.3 +++ b/lib/librpcsec_gss/rpc_gss_oid_to_mech.3 @@ -65,4 +65,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpc_gss_qop_to_num.3 b/lib/librpcsec_gss/rpc_gss_qop_to_num.3 index 0f95d278bf31..bb8b50a5d7f7 100644 --- a/lib/librpcsec_gss/rpc_gss_qop_to_num.3 +++ b/lib/librpcsec_gss/rpc_gss_qop_to_num.3 @@ -67,4 +67,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpc_gss_seccreate.3 b/lib/librpcsec_gss/rpc_gss_seccreate.3 index 836df2378feb..37e9efd5c04a 100644 --- a/lib/librpcsec_gss/rpc_gss_seccreate.3 +++ b/lib/librpcsec_gss/rpc_gss_seccreate.3 @@ -109,4 +109,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpc_gss_set_callback.3 b/lib/librpcsec_gss/rpc_gss_set_callback.3 index 4226285288a0..2d202a5b0383 100644 --- a/lib/librpcsec_gss/rpc_gss_set_callback.3 +++ b/lib/librpcsec_gss/rpc_gss_set_callback.3 @@ -105,7 +105,7 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . .Sh BUGS There is no mechanism for informing a server when a security context has been deleted. diff --git a/lib/librpcsec_gss/rpc_gss_set_defaults.3 b/lib/librpcsec_gss/rpc_gss_set_defaults.3 index 72f22147682c..dcef9dad0b60 100644 --- a/lib/librpcsec_gss/rpc_gss_set_defaults.3 +++ b/lib/librpcsec_gss/rpc_gss_set_defaults.3 @@ -67,4 +67,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpc_gss_set_svc_name.3 b/lib/librpcsec_gss/rpc_gss_set_svc_name.3 index a06d7d39aef5..97f1dee43943 100644 --- a/lib/librpcsec_gss/rpc_gss_set_svc_name.3 +++ b/lib/librpcsec_gss/rpc_gss_set_svc_name.3 @@ -84,4 +84,4 @@ function first appeared in .Sh AUTHORS This manual page was written by -.An Doug Rabson Aq dfr@FreeBSD.org . +.An Doug Rabson Aq Mt dfr@FreeBSD.org . diff --git a/lib/librpcsec_gss/rpc_gss_svc_max_data_length.3 b/lib/librpcsec_gss/rpc_gss_svc_max_data_length.3 index f466e107434f..24eeae90dd26 100644 --- a/lib/librpcsec_gss/rpc_gs |