diff options
Diffstat (limited to 'lib/libc')
286 files changed, 1798 insertions, 5458 deletions
diff --git a/lib/libc/Makefile b/lib/libc/Makefile index 93ab138..5653220 100644 --- a/lib/libc/Makefile +++ b/lib/libc/Makefile @@ -44,11 +44,13 @@ CFLAGS+=${CANCELPOINTS_CFLAGS} # # Link with static libcompiler_rt.a. # +DPADD+= ${LIBCOMPILER_RT} LDFLAGS+= -nodefaultlibs -LIBADD+= compiler_rt +LDADD+= -lcompiler_rt .if ${MK_SSP} != "no" -LIBADD+= ssp_nonshared +DPADD+= ${LIBSSP_NONSHARED} +LDADD+= -lssp_nonshared .endif # Extras that live in either libc.a or libc_nonshared.a @@ -79,8 +81,7 @@ NOASM= .include "${LIBC_SRCTOP}/net/Makefile.inc" .include "${LIBC_SRCTOP}/nls/Makefile.inc" .include "${LIBC_SRCTOP}/posix1e/Makefile.inc" -.if ${LIBC_ARCH} != "aarch64" && \ - ${LIBC_ARCH} != "amd64" && \ +.if ${LIBC_ARCH} != "amd64" && \ ${LIBC_ARCH} != "powerpc64" && \ ${LIBC_ARCH} != "sparc64" && \ ${MACHINE_ARCH:Mmipsn32*} == "" && \ @@ -150,19 +151,35 @@ KSRCS= bcmp.c ffs.c ffsl.c fls.c flsl.c mcount.c strcat.c strchr.c \ libkern: libkern.gen libkern.${LIBC_ARCH} libkern.gen: ${KQSRCS} ${KSRCS} - ${CP} ${LIBC_SRCTOP}/quad/quad.h ${.ALLSRC} ${DESTDIR}/sys/libkern + cp -fp ${LIBC_SRCTOP}/quad/quad.h ${.ALLSRC} ${DESTDIR}/sys/libkern libkern.${LIBC_ARCH}:: ${KMSRCS} .if defined(KMSRCS) && !empty(KMSRCS) - ${CP} ${.ALLSRC} ${DESTDIR}/sys/libkern/${LIBC_ARCH} + cp -fp ${.ALLSRC} ${DESTDIR}/sys/libkern/${LIBC_ARCH} .endif -.if ${MK_TESTS} != "no" -SUBDIR+= tests -.endif +.include <bsd.arch.inc.mk> .include <bsd.lib.mk> +.if !defined(_SKIP_BUILD) +# We need libutil.h, get it directly to avoid +# recording a build dependency +CFLAGS+= -I${.CURDIR:H}/libutil +# Same issue with libm +MSUN_ARCH_SUBDIR != ${MAKE} -B -C ${.CURDIR:H}/msun -V ARCH_SUBDIR +# unfortunately msun/src contains both private and public headers +CFLAGS+= -I${.CURDIR:H}/msun/${MSUN_ARCH_SUBDIR} +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +CFLAGS+= -I${.CURDIR:H}/msun/x86 +.endif +CFLAGS+= -I${.CURDIR:H}/msun/src +# and we do not want to record a dependency on msun +.if ${.MAKE.LEVEL} > 0 +GENDIRDEPS_FILTER+= N${RELDIR:H}/msun +.endif +.endif + # Disable warnings in contributed sources. CWARNFLAGS:= ${.IMPSRC:Ngdtoa_*.c:C/^.+$/${CWARNFLAGS}/:C/^$/-w/} # XXX For now, we don't allow libc to be compiled with diff --git a/lib/libc/Makefile.amd64 b/lib/libc/Makefile.amd64 new file mode 100644 index 0000000..dd0f5b0 --- /dev/null +++ b/lib/libc/Makefile.amd64 @@ -0,0 +1,6 @@ +# $FreeBSD$ + +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + diff --git a/lib/libc/Makefile.depend b/lib/libc/Makefile.depend new file mode 100644 index 0000000..d23769e --- /dev/null +++ b/lib/libc/Makefile.depend @@ -0,0 +1,169 @@ +# Autogenerated - do NOT edit! + +DEP_RELDIR := ${_PARSEDIR:S,${SRCTOP}/,,} + +DIRDEPS = \ + bin/cat.host \ + gnu/lib/csu \ + include \ + include/rpc \ + include/rpcsvc \ + lib/${CSU_DIR} \ + lib/libcompiler_rt \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +cancelpoints_sem.So: cancelpoints_sem.c +cancelpoints_sem.o: cancelpoints_sem.c +cancelpoints_sem.po: cancelpoints_sem.c +cancelpoints_sem_new.So: cancelpoints_sem_new.c +cancelpoints_sem_new.o: cancelpoints_sem_new.c +cancelpoints_sem_new.po: cancelpoints_sem_new.c +crypt_clnt.So: crypt.h +crypt_clnt.So: crypt_clnt.c +crypt_clnt.o: crypt.h +crypt_clnt.o: crypt_clnt.c +crypt_clnt.po: crypt.h +crypt_clnt.po: crypt_clnt.c +crypt_xdr.So: crypt.h +crypt_xdr.So: crypt_xdr.c +crypt_xdr.o: crypt.h +crypt_xdr.o: crypt_xdr.c +crypt_xdr.po: crypt.h +crypt_xdr.po: crypt_xdr.c +gdtoa_dmisc.So: gdtoa_dmisc.c +gdtoa_dmisc.o: gdtoa_dmisc.c +gdtoa_dmisc.po: gdtoa_dmisc.c +gdtoa_dtoa.So: gdtoa_dtoa.c +gdtoa_dtoa.o: gdtoa_dtoa.c +gdtoa_dtoa.po: gdtoa_dtoa.c +gdtoa_gdtoa.So: gdtoa_gdtoa.c +gdtoa_gdtoa.o: gdtoa_gdtoa.c +gdtoa_gdtoa.po: gdtoa_gdtoa.c +gdtoa_gethex.So: gdtoa_gethex.c +gdtoa_gethex.o: gdtoa_gethex.c +gdtoa_gethex.po: gdtoa_gethex.c +gdtoa_gmisc.So: gdtoa_gmisc.c +gdtoa_gmisc.o: gdtoa_gmisc.c +gdtoa_gmisc.po: gdtoa_gmisc.c +gdtoa_hd_init.So: gdtoa_hd_init.c +gdtoa_hd_init.o: gdtoa_hd_init.c +gdtoa_hd_init.po: gdtoa_hd_init.c +gdtoa_hexnan.So: gdtoa_hexnan.c +gdtoa_hexnan.o: gdtoa_hexnan.c +gdtoa_hexnan.po: gdtoa_hexnan.c +gdtoa_misc.So: gdtoa_misc.c +gdtoa_misc.o: gdtoa_misc.c +gdtoa_misc.po: gdtoa_misc.c +gdtoa_smisc.So: gdtoa_smisc.c +gdtoa_smisc.o: gdtoa_smisc.c +gdtoa_smisc.po: gdtoa_smisc.c +gdtoa_strtod.So: gdtoa_strtod.c +gdtoa_strtod.o: gdtoa_strtod.c +gdtoa_strtod.po: gdtoa_strtod.c +gdtoa_strtodg.So: gdtoa_strtodg.c +gdtoa_strtodg.o: gdtoa_strtodg.c +gdtoa_strtodg.po: gdtoa_strtodg.c +gdtoa_strtof.So: gdtoa_strtof.c +gdtoa_strtof.o: gdtoa_strtof.c +gdtoa_strtof.po: gdtoa_strtof.c +gdtoa_strtord.So: gdtoa_strtord.c +gdtoa_strtord.o: gdtoa_strtord.c +gdtoa_strtord.po: gdtoa_strtord.c +gdtoa_strtorx.So: gdtoa_strtorx.c +gdtoa_strtorx.o: gdtoa_strtorx.c +gdtoa_strtorx.po: gdtoa_strtorx.c +gdtoa_sum.So: gdtoa_sum.c +gdtoa_sum.o: gdtoa_sum.c +gdtoa_sum.po: gdtoa_sum.c +gdtoa_ulp.So: gdtoa_ulp.c +gdtoa_ulp.o: gdtoa_ulp.c +gdtoa_ulp.po: gdtoa_ulp.c +jemalloc_arena.So: jemalloc_arena.c +jemalloc_arena.o: jemalloc_arena.c +jemalloc_arena.po: jemalloc_arena.c +jemalloc_atomic.So: jemalloc_atomic.c +jemalloc_atomic.o: jemalloc_atomic.c +jemalloc_atomic.po: jemalloc_atomic.c +jemalloc_base.So: jemalloc_base.c +jemalloc_base.o: jemalloc_base.c +jemalloc_base.po: jemalloc_base.c +jemalloc_bitmap.So: jemalloc_bitmap.c +jemalloc_bitmap.o: jemalloc_bitmap.c +jemalloc_bitmap.po: jemalloc_bitmap.c +jemalloc_chunk.So: jemalloc_chunk.c +jemalloc_chunk.o: jemalloc_chunk.c +jemalloc_chunk.po: jemalloc_chunk.c +jemalloc_chunk_dss.So: jemalloc_chunk_dss.c +jemalloc_chunk_dss.o: jemalloc_chunk_dss.c +jemalloc_chunk_dss.po: jemalloc_chunk_dss.c +jemalloc_chunk_mmap.So: jemalloc_chunk_mmap.c +jemalloc_chunk_mmap.o: jemalloc_chunk_mmap.c +jemalloc_chunk_mmap.po: jemalloc_chunk_mmap.c +jemalloc_ckh.So: jemalloc_ckh.c +jemalloc_ckh.o: jemalloc_ckh.c +jemalloc_ckh.po: jemalloc_ckh.c +jemalloc_ctl.So: jemalloc_ctl.c +jemalloc_ctl.o: jemalloc_ctl.c +jemalloc_ctl.po: jemalloc_ctl.c +jemalloc_extent.So: jemalloc_extent.c +jemalloc_extent.o: jemalloc_extent.c +jemalloc_extent.po: jemalloc_extent.c +jemalloc_hash.So: jemalloc_hash.c +jemalloc_hash.o: jemalloc_hash.c +jemalloc_hash.po: jemalloc_hash.c +jemalloc_huge.So: jemalloc_huge.c +jemalloc_huge.o: jemalloc_huge.c +jemalloc_huge.po: jemalloc_huge.c +jemalloc_jemalloc.So: jemalloc_jemalloc.c +jemalloc_jemalloc.o: jemalloc_jemalloc.c +jemalloc_jemalloc.po: jemalloc_jemalloc.c +jemalloc_mb.So: jemalloc_mb.c +jemalloc_mb.o: jemalloc_mb.c +jemalloc_mb.po: jemalloc_mb.c +jemalloc_mutex.So: jemalloc_mutex.c +jemalloc_mutex.o: jemalloc_mutex.c +jemalloc_mutex.po: jemalloc_mutex.c +jemalloc_prof.So: jemalloc_prof.c +jemalloc_prof.o: jemalloc_prof.c +jemalloc_prof.po: jemalloc_prof.c +jemalloc_quarantine.So: jemalloc_quarantine.c +jemalloc_quarantine.o: jemalloc_quarantine.c +jemalloc_quarantine.po: jemalloc_quarantine.c +jemalloc_rtree.So: jemalloc_rtree.c +jemalloc_rtree.o: jemalloc_rtree.c +jemalloc_rtree.po: jemalloc_rtree.c +jemalloc_stats.So: jemalloc_stats.c +jemalloc_stats.o: jemalloc_stats.c +jemalloc_stats.po: jemalloc_stats.c +jemalloc_tcache.So: jemalloc_tcache.c +jemalloc_tcache.o: jemalloc_tcache.c +jemalloc_tcache.po: jemalloc_tcache.c +jemalloc_tsd.So: jemalloc_tsd.c +jemalloc_tsd.o: jemalloc_tsd.c +jemalloc_tsd.po: jemalloc_tsd.c +jemalloc_util.So: jemalloc_util.c +jemalloc_util.o: jemalloc_util.c +jemalloc_util.po: jemalloc_util.c +nslexer.So: nslexer.c +nslexer.So: nsparser.h +nslexer.o: nslexer.c +nslexer.o: nsparser.h +nslexer.po: nslexer.c +nslexer.po: nsparser.h +nsparser.So: nsparser.c +nsparser.o: nsparser.c +nsparser.po: nsparser.c +subr_acl_nfs4.So: subr_acl_nfs4.c +subr_acl_nfs4.o: subr_acl_nfs4.c +subr_acl_nfs4.po: subr_acl_nfs4.c +yp_xdr.So: yp.h +yp_xdr.So: yp_xdr.c +yp_xdr.o: yp.h +yp_xdr.o: yp_xdr.c +yp_xdr.po: yp.h +yp_xdr.po: yp_xdr.c +.endif diff --git a/lib/libc/Makefile.i386 b/lib/libc/Makefile.i386 new file mode 100644 index 0000000..dd0f5b0 --- /dev/null +++ b/lib/libc/Makefile.i386 @@ -0,0 +1,6 @@ +# $FreeBSD$ + +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + diff --git a/lib/libc/aarch64/Makefile.inc b/lib/libc/aarch64/Makefile.inc deleted file mode 100644 index 5f17200..0000000 --- a/lib/libc/aarch64/Makefile.inc +++ /dev/null @@ -1,9 +0,0 @@ -# $FreeBSD$ -# -# Machine dependent definitions for the arm 64-bit architecture. -# - -# Long double is quad precision -GDTOASRCS+=strtorQ.c -MDSRCS+=machdep_ldisQ.c -SYM_MAPS+=${LIBC_SRCTOP}/aarch64/Symbol.map diff --git a/lib/libc/aarch64/SYS.h b/lib/libc/aarch64/SYS.h deleted file mode 100644 index e0be59d..0000000 --- a/lib/libc/aarch64/SYS.h +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * Copyright (c) 2014 Andrew Turner - * Copyright (c) 2015 The FreeBSD Foundation - * All rights reserved. - * - * This software was developed by Andrew Turner under - * sponsorship from the FreeBSD Foundation. - * - * 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/syscall.h> -#include <machine/asm.h> - -#define _SYSCALL(name) \ - mov x8, SYS_ ## name; \ - svc 0 - -#define SYSCALL(name) \ -ENTRY(__sys_##name); \ - WEAK_REFERENCE(__sys_##name, name); \ - WEAK_REFERENCE(__sys_##name, _##name); \ - _SYSCALL(name); \ - ret; \ -END(__sys_##name) - -#define PSEUDO(name) \ -ENTRY(__sys_##name); \ - WEAK_REFERENCE(__sys_##name, _##name); \ - _SYSCALL(name); \ - b.cs cerror; \ - ret; \ -END(__sys_##name) - -#define RSYSCALL(name) \ -ENTRY(__sys_##name); \ - WEAK_REFERENCE(__sys_##name, name); \ - WEAK_REFERENCE(__sys_##name, _##name); \ - _SYSCALL(name); \ - b.cs cerror; \ - ret; \ -END(__sys_##name) diff --git a/lib/libc/aarch64/Symbol.map b/lib/libc/aarch64/Symbol.map deleted file mode 100644 index a0b33da..0000000 --- a/lib/libc/aarch64/Symbol.map +++ /dev/null @@ -1,30 +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; - - _setjmp; - _longjmp; - fabs; - setjmp; - longjmp; - sigsetjmp; - siglongjmp; - vfork; - brk; - sbrk; -}; - -FBSDprivate_1.0 { - _set_tp; - curbrk; - minbrk; -}; diff --git a/lib/libc/aarch64/_fpmath.h b/lib/libc/aarch64/_fpmath.h deleted file mode 100644 index 71d0a71..0000000 --- a/lib/libc/aarch64/_fpmath.h +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * Copyright (c) 2002, 2003 David Schultz <das@FreeBSD.ORG> - * Copyright (2) 2014 The FreeBSD Foundation - * 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$ - */ - -union IEEEl2bits { - long double e; - struct { - unsigned long manl :64; - unsigned long manh :48; - unsigned int exp :15; - unsigned int sign :1; - } bits; - /* TODO andrew: Check the packing here */ - struct { - unsigned long manl :64; - unsigned long manh :48; - unsigned int expsign :16; - } xbits; -}; - -#define LDBL_NBIT 0 -#define LDBL_IMPLICIT_NBIT -#define mask_nbit_l(u) ((void)0) - -#define LDBL_MANH_SIZE 48 -#define LDBL_MANL_SIZE 64 - -#define LDBL_TO_ARRAY32(u, a) do { \ - (a)[0] = (uint32_t)(u).bits.manl; \ - (a)[1] = (uint32_t)((u).bits.manl >> 32); \ - (a)[2] = (uint32_t)(u).bits.manh; \ - (a)[3] = (uint32_t)((u).bits.manh >> 32); \ -} while(0) diff --git a/lib/libc/aarch64/arith.h b/lib/libc/aarch64/arith.h deleted file mode 100644 index ecb1a33..0000000 --- a/lib/libc/aarch64/arith.h +++ /dev/null @@ -1,19 +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. - */ - -#define IEEE_8087 -#define Arith_Kind_ASL 1 -#define Long int -#define Intcast (int)(long) -#define Double_Align -#define X64_bit_pointers diff --git a/lib/libc/aarch64/gd_qnan.h b/lib/libc/aarch64/gd_qnan.h deleted file mode 100644 index 27e8d58..0000000 --- a/lib/libc/aarch64/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 0x0 -#define ld_QNAN2 0x0 -#define ld_QNAN3 0x7fff8000 -#define ldus_QNAN0 0x0 -#define ldus_QNAN1 0x0 -#define ldus_QNAN2 0x0 -#define ldus_QNAN3 0x0 -#define ldus_QNAN4 0x0 diff --git a/lib/libc/aarch64/gen/Makefile.inc b/lib/libc/aarch64/gen/Makefile.inc deleted file mode 100644 index c4f7c80..0000000 --- a/lib/libc/aarch64/gen/Makefile.inc +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD$ - -SRCS+= fabs.S \ - flt_rounds.c \ - ldexp.c \ - _setjmp.S \ - _set_tp.c \ - setjmp.S \ - sigsetjmp.S \ - trivial-getcontextx.c diff --git a/lib/libc/aarch64/gen/_setjmp.S b/lib/libc/aarch64/gen/_setjmp.S deleted file mode 100644 index 504423b..0000000 --- a/lib/libc/aarch64/gen/_setjmp.S +++ /dev/null @@ -1,105 +0,0 @@ -/*- - * Copyright (c) 2014 Andrew Turner - * Copyright (c) 2014 The FreeBSD Foundation - * All rights reserved. - * - * Portions of this software were developed by Andrew Turner - * under sponsorship from the FreeBSD Foundation - * - * 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 <machine/setjmp.h> - -ENTRY(_setjmp) - /* Store the magic value and stack pointer */ - ldr x8, .Lmagic - mov x9, sp - stp x8, x9, [x0], #16 - - /* Store the general purpose registers and lr */ - stp x19, x20, [x0], #16 - stp x21, x22, [x0], #16 - stp x23, x24, [x0], #16 - stp x25, x26, [x0], #16 - stp x27, x28, [x0], #16 - stp x29, lr, [x0], #16 - -#ifndef _STANDALONE - /* Store the vfp registers */ - stp d8, d9, [x0], #16 - stp d10, d11, [x0], #16 - stp d12, d13, [x0], #16 - stp d14, d15, [x0] -#endif - - /* Return value */ - mov x0, #0 - ret -.Lmagic: - .align 3 - .quad _JB_MAGIC__SETJMP -END(_setjmp) - -ENTRY(_longjmp) - /* Check the magic value */ - ldr x8, [x0], #8 - ldr x9, .Lmagic - cmp x8, x9 - b.ne botch - - /* Restore the stack pointer */ - ldr x8, [x0], #8 - mov sp, x8 - - /* Restore the general purpose registers and lr */ - ldp x19, x20, [x0], #16 - ldp x21, x22, [x0], #16 - ldp x23, x24, [x0], #16 - ldp x25, x26, [x0], #16 - ldp x27, x28, [x0], #16 - ldp x29, lr, [x0], #16 - -#ifndef _STANDALONE - /* Restore the vfp registers */ - ldp d8, d9, [x0], #16 - ldp d10, d11, [x0], #16 - ldp d12, d13, [x0], #16 - ldp d14, d15, [x0] -#endif - - /* Load the return value */ - mov x0, x1 - ret - -botch: -#ifdef _STANDALONE - b botch -#else - bl _C_LABEL(longjmperror) - bl _C_LABEL(abort) -#endif -END(_longjmp) diff --git a/lib/libc/aarch64/gen/fabs.S b/lib/libc/aarch64/gen/fabs.S deleted file mode 100644 index 2f5fd06..0000000 --- a/lib/libc/aarch64/gen/fabs.S +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * Copyright (c) 2015 The FreeBSD Foundation - * 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) - fabs d0, d0 - ret -END(fabs) diff --git a/lib/libc/aarch64/gen/setjmp.S b/lib/libc/aarch64/gen/setjmp.S deleted file mode 100644 index 80a9484..0000000 --- a/lib/libc/aarch64/gen/setjmp.S +++ /dev/null @@ -1,123 +0,0 @@ -/*- - * Copyright (c) 2014 Andrew Turner - * Copyright (c) 2014 The FreeBSD Foundation - * All rights reserved. - * - * Portions of this software were developed by Andrew Turner - * under sponsorship from the FreeBSD Foundation - * - * 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 <machine/setjmp.h> - -ENTRY(setjmp) - sub sp, sp, #16 - stp x0, lr, [sp] - - /* Store the signal mask */ - add x2, x0, #(_JB_SIGMASK * 8) /* oset */ - mov x1, #0 /* set */ - mov x0, #1 /* SIG_BLOCK */ - bl sigprocmask - - ldp x0, lr, [sp] - add sp, sp, #16 - - /* Store the magic value and stack pointer */ - ldr x8, .Lmagic - mov x9, sp - stp x8, x9, [x0], #16 - - /* Store the general purpose registers and lr */ - stp x19, x20, [x0], #16 - stp x21, x22, [x0], #16 - stp x23, x24, [x0], #16 - stp x25, x26, [x0], #16 - stp x27, x28, [x0], #16 - stp x29, lr, [x0], #16 - - /* Store the vfp registers */ - stp d8, d9, [x0], #16 - stp d10, d11, [x0], #16 - stp d12, d13, [x0], #16 - stp d14, d15, [x0] - - /* Return value */ - mov x0, #0 - ret -.Lmagic: - .align 3 - .quad _JB_MAGIC_SETJMP -END(setjmp) - -ENTRY(longjmp) - sub sp, sp, #32 - stp x0, lr, [sp] - str x1, [sp, #16] - - /* Restore the signal mask */ - mov x1, #0 /* oset */ - add x1, x0, #(_JB_SIGMASK * 8) /* set */ - mov x0, #3 /* SIG_BLOCK */ - bl sigprocmask - - ldr x1, [sp, #16] - ldp x0, lr, [sp] - add sp, sp, #32 - - /* Check the magic value */ - ldr x8, [x0], #8 - ldr x9, .Lmagic - cmp x8, x9 - b.ne botch - - /* Restore the stack pointer */ - ldr x8, [x0], #8 - mov sp, x8 - - /* Restore the general purpose registers and lr */ - ldp x19, x20, [x0], #16 - ldp x21, x22, [x0], #16 - ldp x23, x24, [x0], #16 - ldp x25, x26, [x0], #16 - ldp x27, x28, [x0], #16 - ldp x29, lr, [x0], #16 - - /* Restore the vfp registers */ - ldp d8, d9, [x0], #16 - ldp d10, d11, [x0], #16 - ldp d12, d13, [x0], #16 - ldp d14, d15, [x0] - - /* Load the return value */ - mov x0, x1 - ret - -botch: - bl _C_LABEL(longjmperror) - bl _C_LABEL(abort) -END(longjmp) diff --git a/lib/libc/aarch64/sys/Makefile.inc b/lib/libc/aarch64/sys/Makefile.inc deleted file mode 100644 index cb56f73..0000000 --- a/lib/libc/aarch64/sys/Makefile.inc +++ /dev/null @@ -1,25 +0,0 @@ -# $FreeBSD$ - -SRCS+= trivial-vdso_tc.c - -#MDASM= ptrace.S -MDASM= brk.S \ - cerror.S \ - pipe.S \ - sbrk.S \ - shmat.S \ - sigreturn.S \ - syscall.S \ - vfork.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= _exit.o \ - _getlogin.o diff --git a/lib/libc/aarch64/sys/brk.S b/lib/libc/aarch64/sys/brk.S deleted file mode 100644 index 09167b6..0000000 --- a/lib/libc/aarch64/sys/brk.S +++ /dev/null @@ -1,93 +0,0 @@ -/*- - * Copyright (c) 2014 The FreeBSD Foundation - * All rights reserved. - * - * This software was developed by Andrew Turner under - * sponsorship from the FreeBSD Foundation. - * - * 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" - - .data - .align 3 - .globl _C_LABEL(minbrk) - .type _C_LABEL(minbrk),#object -_C_LABEL(minbrk): - .quad _C_LABEL(_end) - - .text -/* - * int brk(const void *addr); - */ -ENTRY(_brk) - WEAK_REFERENCE(_brk, brk) - - /* Load the address of minbrk */ -#ifdef __PIC__ - adrp x2, :got:minbrk - ldr x3, [x2, #:got_lo12:minbrk] -#else - ldr x3, .Lminbrk -#endif - - /* Get the minimum allowable brk address */ - ldr x2, [x3] - - /* Validate the address */ - cmp x0, x2 - b.ge 1f - /* Invalid, set it to the minimum */ - mov x0, x2 - - /* Backup the new address */ -1: mov x4, x0 - - /* Update for this value, will overwrite x0 and x1 */ - _SYSCALL(break) - b.cs cerror - -#ifdef __PIC__ - adrp x2, :got:curbrk - ldr x3, [x2, #:got_lo12:curbrk] -#else - ldr x3, .Lcurbrk -#endif - - /* Store the new curbrk value */ - str x4, [x3] - - /* Return success */ - mov x0, #0 - ret - -#ifndef __PIC__ -.Lcurbrk: - .quad _C_LABEL(curbrk) -.Lminbrk: - .quad _C_LABEL(minbrk) -#endif -END(_brk) diff --git a/lib/libc/aarch64/sys/cerror.S b/lib/libc/aarch64/sys/cerror.S deleted file mode 100644 index 26c61bc..0000000 --- a/lib/libc/aarch64/sys/cerror.S +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * Copyright (c) 2014 Andrew Turner - * 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) - sub sp, sp, #16 - stp x0, lr, [sp] - bl _C_LABEL(__error) - ldp x1, lr, [sp] - str x1, [x0] - movn x0, #0 - movn x1, #0 - add sp, sp, #16 - ret -END(cerror) diff --git a/lib/libc/aarch64/sys/shmat.S b/lib/libc/aarch64/sys/shmat.S deleted file mode 100644 index c0fb34f..0000000 --- a/lib/libc/aarch64/sys/shmat.S +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * Copyright (c) 2014 The FreeBSD Foundation - * All rights reserved. - * - * This software was developed by Andrew Turner under - * sponsorship from the FreeBSD Foundation. - * - * 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" - -RSYSCALL(shmat) diff --git a/lib/libc/aarch64/sys/syscall.S b/lib/libc/aarch64/sys/syscall.S deleted file mode 100644 index 6314835..0000000 --- a/lib/libc/aarch64/sys/syscall.S +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * Copyright (c) 2014 The FreeBSD Foundation - * All rights reserved. - * - * This software was developed by Andrew Turner under - * sponsorship from the FreeBSD Foundation. - * - * 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" - -RSYSCALL(syscall) diff --git a/lib/libc/aarch64/sys/vfork.S b/lib/libc/aarch64/sys/vfork.S deleted file mode 100644 index daecd1f..0000000 --- a/lib/libc/aarch64/sys/vfork.S +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * Copyright (c) 2014 Andrew Turner - * 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" - -ENTRY(__sys_vfork) - WEAK_REFERENCE(__sys_vfork, vfork) - WEAK_REFERENCE(__sys_vfork, _vfork) - mov x2, lr - _SYSCALL(vfork) - b.cs cerror - sub x1, x1, #1 - and x0, x0, x1 - mov lr, x2 - ret -END(__sys_vfork) diff --git a/lib/libc/amd64/sys/Makefile.inc b/lib/libc/amd64/sys/Makefile.inc index 46ea955..8e0d614 100644 --- a/lib/libc/amd64/sys/Makefile.inc +++ b/lib/libc/amd64/sys/Makefile.inc @@ -11,3 +11,6 @@ MDASM= vfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \ 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/arm/SYS.h b/lib/libc/arm/SYS.h index 3254c45..ed1a045 100644 --- a/lib/libc/arm/SYS.h +++ b/lib/libc/arm/SYS.h @@ -62,7 +62,6 @@ #define _SYSCALL(x) \ _SYSCALL_NOERROR(x); \ - it cs; \ bcs PIC_SYM(CERROR, PLT) #define SYSCALL(x) \ @@ -73,7 +72,6 @@ .weak _C_LABEL(__CONCAT(_,x)); \ .set _C_LABEL(__CONCAT(_,x)),_C_LABEL(__CONCAT(__sys_,x)); \ SYSTRAP(x); \ - it cs; \ bcs PIC_SYM(CERROR, PLT); \ RET diff --git a/lib/libc/arm/aeabi/Makefile.inc b/lib/libc/arm/aeabi/Makefile.inc index fa0ec8e..b204a53 100644 --- a/lib/libc/arm/aeabi/Makefile.inc +++ b/lib/libc/arm/aeabi/Makefile.inc @@ -20,7 +20,7 @@ SRCS+= aeabi_vfp_double.S \ # libc. This causes issues when other parts of libc call these functions. # We work around this by including these functions in libc but mark them as # hidden so users of libc will not pick up these versions. -.PATH: ${LIBC_SRCTOP}/../../contrib/compiler-rt/lib/builtins/arm +.PATH: ${LIBC_SRCTOP}/../../contrib/compiler-rt/lib/arm SRCS+= aeabi_memcmp.S \ aeabi_memcpy.S \ diff --git a/lib/libc/arm/aeabi/aeabi_vfp_double.S b/lib/libc/arm/aeabi/aeabi_vfp_double.S index aae49f8..62100d2 100644 --- a/lib/libc/arm/aeabi/aeabi_vfp_double.S +++ b/lib/libc/arm/aeabi/aeabi_vfp_double.S @@ -66,7 +66,6 @@ AEABI_ENTRY(dcmpeq) LOAD_DREG(d1, r2, r3) vcmp.f64 d0, d1 vmrs APSR_nzcv, fpscr - ite ne movne r0, #0 moveq r0, #1 RET @@ -78,9 +77,8 @@ AEABI_ENTRY(dcmplt) LOAD_DREG(d1, r2, r3) vcmp.f64 d0, d1 vmrs APSR_nzcv, fpscr - ite cs movcs r0, #0 - movcc r0, #1 + movlt r0, #1 RET AEABI_END(dcmplt) @@ -90,7 +88,6 @@ AEABI_ENTRY(dcmple) LOAD_DREG(d1, r2, r3) vcmp.f64 d0, d1 vmrs APSR_nzcv, fpscr - ite hi movhi r0, #0 movls r0, #1 RET @@ -102,7 +99,6 @@ AEABI_ENTRY(dcmpge) LOAD_DREG(d1, r2, r3) vcmp.f64 d0, d1 vmrs APSR_nzcv, fpscr - ite lt movlt r0, #0 movge r0, #1 RET @@ -114,7 +110,6 @@ AEABI_ENTRY(dcmpgt) LOAD_DREG(d1, r2, r3) vcmp.f64 d0, d1 vmrs APSR_nzcv, fpscr - ite le movle r0, #0 movgt r0, #1 RET @@ -126,7 +121,6 @@ AEABI_ENTRY(dcmpun) LOAD_DREG(d1, r2, r3) vcmp.f64 d0, d1 vmrs APSR_nzcv, fpscr - ite vc movvc r0, #0 movvs r0, #1 RET diff --git a/lib/libc/arm/aeabi/aeabi_vfp_float.S b/lib/libc/arm/aeabi/aeabi_vfp_float.S index 7de8daf..c9a9a7e 100644 --- a/lib/libc/arm/aeabi/aeabi_vfp_float.S +++ b/lib/libc/arm/aeabi/aeabi_vfp_float.S @@ -62,7 +62,6 @@ AEABI_ENTRY(fcmpeq) LOAD_SREGS(s0, s1, r0, r1) vcmp.f32 s0, s1 vmrs APSR_nzcv, fpscr - ite ne movne r0, #0 moveq r0, #1 RET @@ -73,9 +72,8 @@ AEABI_ENTRY(fcmplt) LOAD_SREGS(s0, s1, r0, r1) vcmp.f32 s0, s1 vmrs APSR_nzcv, fpscr - ite cs movcs r0, #0 - movcc r0, #1 + movlt r0, #1 RET AEABI_END(fcmplt) @@ -84,7 +82,6 @@ AEABI_ENTRY(fcmple) LOAD_SREGS(s0, s1, r0, r1) vcmp.f32 s0, s1 vmrs APSR_nzcv, fpscr - ite hi movhi r0, #0 movls r0, #1 RET @@ -95,7 +92,6 @@ AEABI_ENTRY(fcmpge) LOAD_SREGS(s0, s1, r0, r1) vcmp.f32 s0, s1 vmrs APSR_nzcv, fpscr - ite lt movlt r0, #0 movge r0, #1 RET @@ -106,7 +102,6 @@ AEABI_ENTRY(fcmpgt) LOAD_SREGS(s0, s1, r0, r1) vcmp.f32 s0, s1 vmrs APSR_nzcv, fpscr - ite le movle r0, #0 movgt r0, #1 RET @@ -117,7 +112,6 @@ AEABI_ENTRY(fcmpun) LOAD_SREGS(s0, s1, r0, r1) vcmp.f32 s0, s1 vmrs APSR_nzcv, fpscr - ite vc movvc r0, #0 movvs r0, #1 RET diff --git a/lib/libc/arm/gen/Makefile.inc b/lib/libc/arm/gen/Makefile.inc index c0f5392..8efde09 100644 --- a/lib/libc/arm/gen/Makefile.inc +++ b/lib/libc/arm/gen/Makefile.inc @@ -2,10 +2,9 @@ # $FreeBSD$ SRCS+= _ctx_start.S _setjmp.S _set_tp.c alloca.S fabs.c \ - infinity.c ldexp.c makecontext.c \ + getcontextx.c infinity.c ldexp.c makecontext.c \ __aeabi_read_tp.S setjmp.S signalcontext.c sigsetjmp.S flt_rounds.c \ - arm_initfini.c \ - trivial-getcontextx.c + arm_initfini.c .if ${MACHINE_ARCH} == "armv6hf" SRCS+= fpgetmask_vfp.c fpgetround_vfp.c fpgetsticky_vfp.c fpsetmask_vfp.c \ diff --git a/lib/libc/arm/gen/_setjmp.S b/lib/libc/arm/gen/_setjmp.S index 3de9d99..387f8a9 100644 --- a/lib/libc/arm/gen/_setjmp.S +++ b/lib/libc/arm/gen/_setjmp.S @@ -85,13 +85,7 @@ ENTRY(_setjmp) add r0, r0, #(_JB_REG_R4 * 4) /* Store integer registers */ -#ifndef __thumb__ stmia r0, {r4-r14} -#else - stmia r0, {r4-r12} - str r13, [r0, #((_JB_REG_R13 - _JB_REG_R4) * 4)] - str r14, [r0, #((_JB_REG_R14 - _JB_REG_R4) * 4)] -#endif mov r0, #0x00000000 RET @@ -126,24 +120,15 @@ ENTRY(_longjmp) add r0, r0, #(_JB_REG_R4 * 4) /* Restore integer registers */ -#ifndef __thumb__ ldmia r0, {r4-r14} -#else - ldmia r0, {r4-r12} - ldr r13, [r0, #((_JB_REG_R13 - _JB_REG_R4) * 4)] - ldr r14, [r0, #((_JB_REG_R14 - _JB_REG_R4) * 4)] -#endif /* Validate sp and r14 */ teq sp, #0 - it ne teqne r14, #0 - it eq beq botch /* Set return value */ movs r0, r1 - it eq moveq r0, #0x00000001 RET @@ -152,7 +137,7 @@ botch: #if !defined(_STANDALONE) bl PIC_SYM(_C_LABEL(longjmperror), PLT) bl PIC_SYM(_C_LABEL(abort), PLT) -1: b 1b /* Cannot get here */ + b . - 8 /* Cannot get here */ #else b . #endif diff --git a/lib/libc/gen/trivial-getcontextx.c b/lib/libc/arm/gen/getcontextx.c index 54f8513..54f8513 100644 --- a/lib/libc/gen/trivial-getcontextx.c +++ b/lib/libc/arm/gen/getcontextx.c diff --git a/lib/libc/arm/gen/setjmp.S b/lib/libc/arm/gen/setjmp.S index 6269563..ad4ba38 100644 --- a/lib/libc/arm/gen/setjmp.S +++ b/lib/libc/arm/gen/setjmp.S @@ -90,13 +90,7 @@ ENTRY(setjmp) /* Store integer registers */ add r0, r0, #(_JB_REG_R4 * 4) -#ifndef __thumb__ stmia r0, {r4-r14} -#else - stmia r0, {r4-r12} - str r13, [r0, #((_JB_REG_R13 - _JB_REG_R4) * 4)] - str r14, [r0, #((_JB_REG_R14 - _JB_REG_R4) * 4)] -#endif mov r0, #0x00000000 RET @@ -139,24 +133,15 @@ ENTRY(__longjmp) add r0, r0, #(_JB_REG_R4 * 4) /* Restore integer registers */ -#ifndef __thumb__ ldmia r0, {r4-r14} -#else - ldmia r0, {r4-r12} - ldr r13, [r0, #((_JB_REG_R13 - _JB_REG_R4) * 4)] - ldr r14, [r0, #((_JB_REG_R14 - _JB_REG_R4) * 4)] -#endif /* Validate sp and r14 */ teq sp, #0 - it ne teqne r14, #0 - it eq beq .Lbotch /* Set return value */ movs r0, r1 - it eq moveq r0, #0x00000001 RET @@ -164,5 +149,5 @@ ENTRY(__longjmp) .Lbotch: bl PIC_SYM(_C_LABEL(longjmperror), PLT) bl PIC_SYM(_C_LABEL(abort), PLT) -1: b 1b /* Cannot get here */ + b . - 8 /* Cannot get here */ END(__longjmp) diff --git a/lib/libc/arm/string/ffs.S b/lib/libc/arm/string/ffs.S index 4567f6c..d3684ed 100644 --- a/lib/libc/arm/string/ffs.S +++ b/lib/libc/arm/string/ffs.S @@ -32,8 +32,6 @@ __FBSDID("$FreeBSD$"); -.syntax unified - /* * ffs - find first set bit, this algorithm isolates the first set * bit, then multiplies the number by 0x0450fbaf which leaves the top @@ -62,7 +60,7 @@ ENTRY(ffs) rsbne r0, r0, r0, lsl #16 /* r0 = X * 0x0450fbaf */ /* now lookup in table indexed on top 6 bits of r0 */ - ldrbne r0, [ r2, r0, lsr #26 ] + ldrneb r0, [ r2, r0, lsr #26 ] RET .text; diff --git a/lib/libc/arm/string/memcmp.S b/lib/libc/arm/string/memcmp.S index 6fd8130..63a00ef 100644 --- a/lib/libc/arm/string/memcmp.S +++ b/lib/libc/arm/string/memcmp.S @@ -66,8 +66,6 @@ __FBSDID("$FreeBSD$"); -.syntax unified - ENTRY(memcmp) mov ip, r0 #if defined(_KERNEL) && !defined(_STANDALONE) @@ -78,7 +76,7 @@ ENTRY(memcmp) /* Are both addresses aligned the same way? */ cmp r2, #0x00 - eorsne r3, ip, r1 + eornes r3, ip, r1 RETeq /* len == 0, or same addresses! */ tst r3, #0x03 subne r2, r2, #0x01 diff --git a/lib/libc/arm/string/memcpy_arm.S b/lib/libc/arm/string/memcpy_arm.S index 56fb703..eff1eb0 100644 --- a/lib/libc/arm/string/memcpy_arm.S +++ b/lib/libc/arm/string/memcpy_arm.S @@ -31,9 +31,6 @@ #include <machine/asm.h> __FBSDID("$FreeBSD$"); - -.syntax unified - /* * This is one fun bit of code ... * Some easy listening music is suggested while trying to understand this @@ -94,8 +91,8 @@ ENTRY(memcpy) bge .Lmemcpy_loop32 cmn r2, #0x10 - ldmiage r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */ - stmiage r0!, {r3, r4, r12, lr} + ldmgeia r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */ + stmgeia r0!, {r3, r4, r12, lr} subge r2, r2, #0x10 ldmia sp!, {r4} /* return r4 */ @@ -104,9 +101,9 @@ ENTRY(memcpy) /* blat 12 bytes at a time */ .Lmemcpy_loop12: - ldmiage r1!, {r3, r12, lr} - stmiage r0!, {r3, r12, lr} - subsge r2, r2, #0x0c + ldmgeia r1!, {r3, r12, lr} + stmgeia r0!, {r3, r12, lr} + subges r2, r2, #0x0c bge .Lmemcpy_loop12 .Lmemcpy_l12: @@ -116,26 +113,26 @@ ENTRY(memcpy) subs r2, r2, #4 ldrlt r3, [r1], #4 strlt r3, [r0], #4 - ldmiage r1!, {r3, r12} - stmiage r0!, {r3, r12} + ldmgeia r1!, {r3, r12} + stmgeia r0!, {r3, r12} subge r2, r2, #4 .Lmemcpy_l4: /* less than 4 bytes to go */ adds r2, r2, #4 #ifdef __APCS_26_ - ldmiaeq sp!, {r0, pc}^ /* done */ + ldmeqia sp!, {r0, pc}^ /* done */ #else - ldmiaeq sp!, {r0, pc} /* done */ + ldmeqia sp!, {r0, pc} /* done */ #endif /* copy the crud byte at a time */ cmp r2, #2 ldrb r3, [r1], #1 strb r3, [r0], #1 - ldrbge r3, [r1], #1 - strbge r3, [r0], #1 - ldrbgt r3, [r1], #1 - strbgt r3, [r0], #1 + ldrgeb r3, [r1], #1 + strgeb r3, [r0], #1 + ldrgtb r3, [r1], #1 + strgtb r3, [r0], #1 ldmia sp!, {r0, pc} /* erg - unaligned destination */ @@ -146,10 +143,10 @@ ENTRY(memcpy) /* align destination with byte copies */ ldrb r3, [r1], #1 strb r3, [r0], #1 - ldrbge r3, [r1], #1 - strbge r3, [r0], #1 - ldrbgt r3, [r1], #1 - strbgt r3, [r0], #1 + ldrgeb r3, [r1], #1 + strgeb r3, [r0], #1 + ldrgtb r3, [r1], #1 + strgtb r3, [r0], #1 subs r2, r2, r12 blt .Lmemcpy_l4 /* less the 4 bytes */ diff --git a/lib/libc/arm/string/memcpy_xscale.S b/lib/libc/arm/string/memcpy_xscale.S index a451de4..1f48cd9 100644 --- a/lib/libc/arm/string/memcpy_xscale.S +++ b/lib/libc/arm/string/memcpy_xscale.S @@ -38,8 +38,6 @@ #include <machine/asm.h> __FBSDID("$FreeBSD$"); -.syntax unified - /* LINTSTUB: Func: void *memcpy(void *dst, const void *src, size_t len) */ ENTRY(memcpy) pld [r1] @@ -54,12 +52,12 @@ ENTRY(memcpy) ldrb ip, [r1], #0x01 sub r2, r2, #0x01 strb ip, [r3], #0x01 - ldrble ip, [r1], #0x01 + ldrleb ip, [r1], #0x01 suble r2, r2, #0x01 - strble ip, [r3], #0x01 - ldrblt ip, [r1], #0x01 + strleb ip, [r3], #0x01 + ldrltb ip, [r1], #0x01 sublt r2, r2, #0x01 - strblt ip, [r3], #0x01 + strltb ip, [r3], #0x01 /* Destination buffer is now word aligned */ .Lmemcpy_wordaligned: @@ -136,7 +134,7 @@ ENTRY(memcpy) .Lmemcpy_w_lessthan128: adds r2, r2, #0x80 /* Adjust for extra sub */ - ldmfdeq sp!, {r4-r9} + ldmeqfd sp!, {r4-r9} bxeq lr /* Return now if done */ subs r2, r2, #0x20 blt .Lmemcpy_w_lessthan32 @@ -161,7 +159,7 @@ ENTRY(memcpy) .Lmemcpy_w_lessthan32: adds r2, r2, #0x20 /* Adjust for extra sub */ - ldmfdeq sp!, {r4-r9} + ldmeqfd sp!, {r4-r9} bxeq lr /* Return now if done */ and r4, r2, #0x18 @@ -197,11 +195,11 @@ ENTRY(memcpy) addlt r2, r2, #0x04 ldrb ip, [r1], #0x01 cmp r2, #0x02 - ldrbge r2, [r1], #0x01 + ldrgeb r2, [r1], #0x01 strb ip, [r3], #0x01 - ldrbgt ip, [r1] - strbge r2, [r3], #0x01 - strbgt ip, [r3] + ldrgtb ip, [r1] + strgeb r2, [r3], #0x01 + strgtb ip, [r3] bx lr @@ -255,7 +253,7 @@ ENTRY(memcpy) bge .Lmemcpy_bad1_loop16 adds r2, r2, #0x10 - ldmfdeq sp!, {r4-r7} + ldmeqfd sp!, {r4-r7} bxeq lr /* Return now if done */ subs r2, r2, #0x04 sublt r1, r1, #0x03 @@ -316,7 +314,7 @@ ENTRY(memcpy) bge .Lmemcpy_bad2_loop16 adds r2, r2, #0x10 - ldmfdeq sp!, {r4-r7} + ldmeqfd sp!, {r4-r7} bxeq lr /* Return now if done */ subs r2, r2, #0x04 sublt r1, r1, #0x02 @@ -377,7 +375,7 @@ ENTRY(memcpy) bge .Lmemcpy_bad3_loop16 adds r2, r2, #0x10 - ldmfdeq sp!, {r4-r7} + ldmeqfd sp!, {r4-r7} bxeq lr /* Return now if done */ subs r2, r2, #0x04 sublt r1, r1, #0x01 @@ -406,11 +404,11 @@ ENTRY(memcpy) bxeq lr ldrb ip, [r1], #0x01 cmp r2, #0x02 - ldrbge r2, [r1], #0x01 + ldrgeb r2, [r1], #0x01 strb ip, [r3], #0x01 - ldrbgt ip, [r1] - strbge r2, [r3], #0x01 - strbgt ip, [r3] + ldrgtb ip, [r1] + strgeb r2, [r3], #0x01 + strgtb ip, [r3] bx lr @@ -442,7 +440,7 @@ ENTRY(memcpy) ldrb ip, [r1], #0x01 1: subs r2, r2, #0x01 strb ip, [r3], #0x01 - ldrbne ip, [r1], #0x01 + ldrneb ip, [r1], #0x01 bne 1b bx lr diff --git a/lib/libc/arm/string/memmove.S b/lib/libc/arm/string/memmove.S index 94e5474..75a2744 100644 --- a/lib/libc/arm/string/memmove.S +++ b/lib/libc/arm/string/memmove.S @@ -32,8 +32,6 @@ #include <machine/asm.h> __FBSDID("$FreeBSD$"); -.syntax unified - #ifndef _BCOPY /* LINTSTUB: Func: void *memmove(void *, const void *, size_t) */ ENTRY(memmove) @@ -88,8 +86,8 @@ ENTRY(bcopy) bge .Lmemmove_floop32 cmn r2, #0x10 - ldmiage r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */ - stmiage r0!, {r3, r4, r12, lr} + ldmgeia r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */ + stmgeia r0!, {r3, r4, r12, lr} subge r2, r2, #0x10 ldmia sp!, {r4} /* return r4 */ @@ -98,9 +96,9 @@ ENTRY(bcopy) /* blat 12 bytes at a time */ .Lmemmove_floop12: - ldmiage r1!, {r3, r12, lr} - stmiage r0!, {r3, r12, lr} - subsge r2, r2, #0x0c + ldmgeia r1!, {r3, r12, lr} + stmgeia r0!, {r3, r12, lr} + subges r2, r2, #0x0c bge .Lmemmove_floop12 .Lmemmove_fl12: @@ -110,23 +108,23 @@ ENTRY(bcopy) subs r2, r2, #4 ldrlt r3, [r1], #4 strlt r3, [r0], #4 - ldmiage r1!, {r3, r12} - stmiage r0!, {r3, r12} + ldmgeia r1!, {r3, r12} + stmgeia r0!, {r3, r12} subge r2, r2, #4 .Lmemmove_fl4: /* less than 4 bytes to go */ adds r2, r2, #4 - ldmiaeq sp!, {r0, pc} /* done */ + ldmeqia sp!, {r0, pc} /* done */ /* copy the crud byte at a time */ cmp r2, #2 ldrb r3, [r1], #1 strb r3, [r0], #1 - ldrbge r3, [r1], #1 - strbge r3, [r0], #1 - ldrbgt r3, [r1], #1 - strbgt r3, [r0], #1 + ldrgeb r3, [r1], #1 + strgeb r3, [r0], #1 + ldrgtb r3, [r1], #1 + strgtb r3, [r0], #1 ldmia sp!, {r0, pc} /* erg - unaligned destination */ @@ -137,10 +135,10 @@ ENTRY(bcopy) /* align destination with byte copies */ ldrb r3, [r1], #1 strb r3, [r0], #1 - ldrbge r3, [r1], #1 - strbge r3, [r0], #1 - ldrbgt r3, [r1], #1 - strbgt r3, [r0], #1 + ldrgeb r3, [r1], #1 + strgeb r3, [r0], #1 + ldrgtb r3, [r1], #1 + strgtb r3, [r0], #1 subs r2, r2, r12 blt .Lmemmove_fl4 /* less the 4 bytes */ @@ -355,12 +353,12 @@ ENTRY(bcopy) .Lmemmove_bl32: cmn r2, #0x10 - ldmdbge r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */ - stmdbge r0!, {r3, r4, r12, lr} + ldmgedb r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */ + stmgedb r0!, {r3, r4, r12, lr} subge r2, r2, #0x10 adds r2, r2, #0x14 - ldmdbge r1!, {r3, r12, lr} /* blat a remaining 12 bytes */ - stmdbge r0!, {r3, r12, lr} + ldmgedb r1!, {r3, r12, lr} /* blat a remaining 12 bytes */ + stmgedb r0!, {r3, r12, lr} subge r2, r2, #0x0c ldmia sp!, {r4, lr} @@ -370,8 +368,8 @@ ENTRY(bcopy) subs r2, r2, #4 ldrlt r3, [r1, #-4]! strlt r3, [r0, #-4]! - ldmdbge r1!, {r3, r12} - stmdbge r0!, {r3, r12} + ldmgedb r1!, {r3, r12} + stmgedb r0!, {r3, r12} subge r2, r2, #4 .Lmemmove_bl4: @@ -383,10 +381,10 @@ ENTRY(bcopy) cmp r2, #2 ldrb r3, [r1, #-1]! strb r3, [r0, #-1]! - ldrbge r3, [r1, #-1]! - strbge r3, [r0, #-1]! - ldrbgt r3, [r1, #-1]! - strbgt r3, [r0, #-1]! + ldrgeb r3, [r1, #-1]! + strgeb r3, [r0, #-1]! + ldrgtb r3, [r1, #-1]! + strgtb r3, [r0, #-1]! RET /* erg - unaligned destination */ @@ -396,10 +394,10 @@ ENTRY(bcopy) /* align destination with byte copies */ ldrb r3, [r1, #-1]! strb r3, [r0, #-1]! - ldrbge r3, [r1, #-1]! - strbge r3, [r0, #-1]! - ldrbgt r3, [r1, #-1]! - strbgt r3, [r0, #-1]! + ldrgeb r3, [r1, #-1]! + strgeb r3, [r0, #-1]! + ldrgtb r3, [r1, #-1]! + strgtb r3, [r0, #-1]! subs r2, r2, r12 blt .Lmemmove_bl4 /* less than 4 bytes to go */ ands r12, r1, #3 diff --git a/lib/libc/arm/string/memset.S b/lib/libc/arm/string/memset.S index 66af33e..458f8f7 100644 --- a/lib/libc/arm/string/memset.S +++ b/lib/libc/arm/string/memset.S @@ -69,8 +69,6 @@ #include <machine/asm.h> __FBSDID("$FreeBSD$"); -.syntax unified - /* * memset: Sets a block of memory to the specified value * @@ -127,39 +125,39 @@ ENTRY(memset) .Lmemset_loop128: subs r1, r1, #0x80 #ifdef _ARM_ARCH_5E - strdge r2, [ip], #0x08 - strdge r2, [ip], #0x08 - strdge r2, [ip], #0x08 - strdge r2, [ip], #0x08 - strdge r2, [ip], #0x08 - strdge r2, [ip], #0x08 - strdge r2, [ip], #0x08 - strdge r2, [ip], #0x08 - strdge r2, [ip], #0x08 - strdge r2, [ip], #0x08 - strdge r2, [ip], #0x08 - strdge r2, [ip], #0x08 - strdge r2, [ip], #0x08 - strdge r2, [ip], #0x08 - strdge r2, [ip], #0x08 - strdge r2, [ip], #0x08 + strged r2, [ip], #0x08 + strged r2, [ip], #0x08 + strged r2, [ip], #0x08 + strged r2, [ip], #0x08 + strged r2, [ip], #0x08 + strged r2, [ip], #0x08 + strged r2, [ip], #0x08 + strged r2, [ip], #0x08 + strged r2, [ip], #0x08 + strged r2, [ip], #0x08 + strged r2, [ip], #0x08 + strged r2, [ip], #0x08 + strged r2, [ip], #0x08 + strged r2, [ip], #0x08 + strged r2, [ip], #0x08 + strged r2, [ip], #0x08 #else - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} + stmgeia ip!, {r2-r3} + stmgeia ip!, {r2-r3} + stmgeia ip!, {r2-r3} + stmgeia ip!, {r2-r3} + stmgeia ip!, {r2-r3} + stmgeia ip!, {r2-r3} + stmgeia ip!, {r2-r3} + stmgeia ip!, {r2-r3} + stmgeia ip!, {r2-r3} + stmgeia ip!, {r2-r3} + stmgeia ip!, {r2-r3} + stmgeia ip!, {r2-r3} + stmgeia ip!, {r2-r3} + stmgeia ip!, {r2-r3} + stmgeia ip!, {r2-r3} + stmgeia ip!, {r2-r3} #endif bgt .Lmemset_loop128 RETeq /* Zero length so just exit */ @@ -170,15 +168,15 @@ ENTRY(memset) .Lmemset_loop32: subs r1, r1, #0x20 #ifdef _ARM_ARCH_5E - strdge r2, [ip], #0x08 - strdge r2, [ip], #0x08 - strdge r2, [ip], #0x08 - strdge r2, [ip], #0x08 + strged r2, [ip], #0x08 + strged r2, [ip], #0x08 + strged r2, [ip], #0x08 + strged r2, [ip], #0x08 #else - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} + stmgeia ip!, {r2-r3} + stmgeia ip!, {r2-r3} + stmgeia ip!, {r2-r3} + stmgeia ip!, {r2-r3} #endif bgt .Lmemset_loop32 RETeq /* Zero length so just exit */ @@ -187,11 +185,11 @@ ENTRY(memset) /* Deal with 16 bytes or more */ #ifdef _ARM_ARCH_5E - strdge r2, [ip], #0x08 - strdge r2, [ip], #0x08 + strged r2, [ip], #0x08 + strged r2, [ip], #0x08 #else - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} + stmgeia ip!, {r2-r3} + stmgeia ip!, {r2-r3} #endif RETeq /* Zero length so just exit */ @@ -214,17 +212,17 @@ ENTRY(memset) #endif strb r3, [ip], #0x01 /* Set 1 byte */ - strbge r3, [ip], #0x01 /* Set another byte */ - strbgt r3, [ip] /* and a third */ + strgeb r3, [ip], #0x01 /* Set another byte */ + strgtb r3, [ip] /* and a third */ RET /* Exit */ .Lmemset_wordunaligned: rsb r2, r2, #0x004 strb r3, [ip], #0x01 /* Set 1 byte */ cmp r2, #0x02 - strbge r3, [ip], #0x01 /* Set another byte */ + strgeb r3, [ip], #0x01 /* Set another byte */ sub r1, r1, r2 - strbgt r3, [ip], #0x01 /* and a third */ + strgtb r3, [ip], #0x01 /* and a third */ cmp r1, #0x04 /* More than 4 bytes left? */ bge .Lmemset_wordaligned /* Yup */ @@ -233,8 +231,8 @@ ENTRY(memset) RETeq /* Zero length so exit */ strb r3, [ip], #0x01 /* Set 1 byte */ cmp r1, #0x02 - strbge r3, [ip], #0x01 /* Set another byte */ - strbgt r3, [ip] /* and a third */ + strgeb r3, [ip], #0x01 /* Set another byte */ + strgtb r3, [ip] /* and a third */ RET /* Exit */ #ifdef _BZERO END(bzero) diff --git a/lib/libc/arm/string/strlen.S b/lib/libc/arm/string/strlen.S index 7447710..3d7726f 100644 --- a/lib/libc/arm/string/strlen.S +++ b/lib/libc/arm/string/strlen.S @@ -27,8 +27,6 @@ #include <machine/asm.h> __FBSDID("$FreeBSD$"); -.syntax unified - ENTRY(strlen) mov r1, #0 /* Check that the pointer is aligned on 32 bits. */ @@ -55,23 +53,23 @@ ENTRY(strlen) addne r1, r1, #1 .Ldo_3: #ifndef __ARMEB__ - andsne r3, r2, #0x0000ff00 + andnes r3, r2, #0x0000ff00 #else - andsne r3, r2, #0x00ff0000 + andnes r3, r2, #0x00ff0000 #endif addne r1, r1, #1 .Ldo_2: #ifndef __ARMEB__ - andsne r3, r2, #0x00ff0000 + andnes r3, r2, #0x00ff0000 #else - andsne r3, r2, #0x0000ff00 + andnes r3, r2, #0x0000ff00 #endif addne r1, r1, #1 .Ldo_1: #ifndef __ARMEB__ - andsne r3, r2, #0xff000000 + andnes r3, r2, #0xff000000 #else - andsne r3, r2, #0x000000ff + andnes r3, r2, #0x000000ff #endif addne r1, r1, #1 bne .Loop diff --git a/lib/libc/arm/sys/Makefile.inc b/lib/libc/arm/sys/Makefile.inc index 60c2dc3..069aad3 100644 --- a/lib/libc/arm/sys/Makefile.inc +++ b/lib/libc/arm/sys/Makefile.inc @@ -1,6 +1,6 @@ # $FreeBSD$ -SRCS+= trivial-vdso_tc.c +SRCS+= __vdso_gettc.c MDASM= Ovfork.S brk.S cerror.S pipe.S ptrace.S sbrk.S shmat.S sigreturn.S syscall.S @@ -8,3 +8,6 @@ MDASM= Ovfork.S brk.S cerror.S pipe.S ptrace.S sbrk.S shmat.S sigreturn.S syscal NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o PSEUDO= _exit.o _getlogin.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/sys/trivial-vdso_tc.c b/lib/libc/arm/sys/__vdso_gettc.c index b99bbc4..b99bbc4 100644 --- a/lib/libc/sys/trivial-vdso_tc.c +++ b/lib/libc/arm/sys/__vdso_gettc.c diff --git a/lib/libc/arm/sys/brk.S b/lib/libc/arm/sys/brk.S index e5f8336..f3d8d87 100644 --- a/lib/libc/arm/sys/brk.S +++ b/lib/libc/arm/sys/brk.S @@ -53,10 +53,16 @@ _C_LABEL(minbrk): * Change the data segment size */ ENTRY(_brk) +#ifdef PIC /* Setup the GOT */ - GOT_INIT(r3, .Lgot, .L1) - GOT_GET(r1, r3, .Lminbrk) - + ldr r3, .Lgot + add r3, pc, r3 +.L1: + ldr r1, .Lminbrk + ldr r1, [r3, r1] +#else + ldr r1, .Lminbrk +#endif /* Get the minimum allowable brk address */ ldr r1, [r1] @@ -65,7 +71,6 @@ ENTRY(_brk) * if the address is below minbrk. */ cmp r0, r1 - it lt movlt r0, r1 mov r2, r0 SYSTRAP(break) @@ -85,7 +90,10 @@ ENTRY(_brk) RET .align 2 - GOT_INITSYM(.Lgot, .L1) +#ifdef PIC +.Lgot: + .word _GLOBAL_OFFSET_TABLE_ - (.L1+4) +#endif .Lminbrk: .word PIC_SYM(_C_LABEL(minbrk), GOT) .Lcurbrk: diff --git a/lib/libc/arm/sys/sbrk.S b/lib/libc/arm/sys/sbrk.S index 5cd9a03..7d22aa7 100644 --- a/lib/libc/arm/sys/sbrk.S +++ b/lib/libc/arm/sys/sbrk.S @@ -52,10 +52,16 @@ CURBRK: * Change the data segment size */ ENTRY(_sbrk) +#ifdef PIC /* Setup the GOT */ - GOT_INIT(r3, .Lgot, .L1) - GOT_GET(r2, r3, .Lcurbrk) - + ldr r3, .Lgot + add r3, pc, r3 +.L1: + ldr r2, .Lcurbrk + ldr r2, [r3, r2] +#else + ldr r2, .Lcurbrk +#endif /* Get the current brk address */ ldr r1, [r2] @@ -74,7 +80,10 @@ ENTRY(_sbrk) RET .align 0 - GOT_INITSYM(.Lgot, .L1) +#ifdef PIC +.Lgot: + .word _GLOBAL_OFFSET_TABLE_ - (.L1+4) +#endif .Lcurbrk: .word PIC_SYM(CURBRK, GOT) END(_sbrk) diff --git a/lib/libc/compat-43/creat.c b/lib/libc/compat-43/creat.c index 4545482..fc3be06 100644 --- a/lib/libc/compat-43/creat.c +++ b/lib/libc/compat-43/creat.c @@ -36,18 +36,11 @@ __FBSDID("$FreeBSD$"); #include "namespace.h" #include <fcntl.h> #include "un-namespace.h" -#include "libc_private.h" -__weak_reference(__creat, creat); -__weak_reference(__creat, _creat); - -#pragma weak creat int __creat(const char *path, mode_t mode) { - - return (((int (*)(int, const char *, int, ...)) - __libc_interposing[INTERPOS_openat])(AT_FDCWD, path, O_WRONLY | - O_CREAT | O_TRUNC, mode)); + return(_open(path, O_WRONLY|O_CREAT|O_TRUNC, mode)); } - +__weak_reference(__creat, creat); +__weak_reference(__creat, _creat); diff --git a/lib/libc/db/hash/hash.c b/lib/libc/db/hash/hash.c index e6da5fe..af80929 100644 --- a/lib/libc/db/hash/hash.c +++ b/lib/libc/db/hash/hash.c @@ -808,7 +808,7 @@ __expand_table(HTAB *hashp) hashp->DSIZE = dirsize << 1; } if ((hashp->dir[new_segnum] = - calloc(hashp->SGSIZE, sizeof(SEGMENT))) == NULL) + (SEGMENT)calloc(hashp->SGSIZE, sizeof(SEGMENT))) == NULL) return (-1); hashp->exsegs++; hashp->nsegs++; @@ -877,7 +877,7 @@ alloc_segs(HTAB *hashp, int nsegs) int save_errno; if ((hashp->dir = - calloc(hashp->DSIZE, sizeof(SEGMENT *))) == NULL) { + (SEGMENT *)calloc(hashp->DSIZE, sizeof(SEGMENT *))) == NULL) { save_errno = errno; (void)hdestroy(hashp); errno = save_errno; @@ -887,7 +887,8 @@ alloc_segs(HTAB *hashp, int nsegs) if (nsegs == 0) return (0); /* Allocate segments */ - if ((store = calloc(nsegs << hashp->SSHIFT, sizeof(SEGMENT))) == NULL) { + if ((store = (SEGMENT)calloc(nsegs << hashp->SSHIFT, + sizeof(SEGMENT))) == NULL) { save_errno = errno; (void)hdestroy(hashp); errno = save_errno; diff --git a/lib/libc/db/man/dbm.3 b/lib/libc/db/man/dbm.3 index eedf804..fabce8a 100644 --- a/lib/libc/db/man/dbm.3 +++ b/lib/libc/db/man/dbm.3 @@ -15,7 +15,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 19, 2015 +.Dd April 16, 2006 .Dt DBM 3 .Os .Sh NAME @@ -174,7 +174,9 @@ deletes the entry for The .Fn dbm_delete function -normally returns zero or returns -1 and sets +normally returns zero but returns 1 if there was no entry with +.Fa key +in the database or returns -1 and sets .Va errno if there were any errors. .Pp diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc index 2232b79..f64caf0 100644 --- a/lib/libc/gen/Makefile.inc +++ b/lib/libc/gen/Makefile.inc @@ -5,7 +5,6 @@ .PATH: ${LIBC_SRCTOP}/${LIBC_ARCH}/gen ${LIBC_SRCTOP}/gen SRCS+= __getosreldate.c \ - __pthread_mutex_init_calloc_cb_stub.c \ __xuname.c \ _once_stub.c \ _pthread_stubs.c \ diff --git a/lib/libc/gen/Symbol.map b/lib/libc/gen/Symbol.map index ee4d619..77413d6 100644 --- a/lib/libc/gen/Symbol.map +++ b/lib/libc/gen/Symbol.map @@ -487,7 +487,6 @@ FBSDprivate_1.0 { _rtld_atfork_post; _rtld_error; /* for private use */ _rtld_get_stack_prot; - _rtld_is_dlopened; _rtld_thread_init; /* for private use */ __elf_phdr_match_addr; _err; @@ -533,8 +532,6 @@ FBSDprivate_1.0 { _libc_sem_post_compat; _libc_sem_getvalue_compat; - __libc_tcdrain; - __elf_aux_vector; __pthread_map_stacks_exec; __fillcontextx; diff --git a/lib/libc/gen/__pthread_mutex_init_calloc_cb_stub.c b/lib/libc/gen/__pthread_mutex_init_calloc_cb_stub.c deleted file mode 100644 index 1c566ec..0000000 --- a/lib/libc/gen/__pthread_mutex_init_calloc_cb_stub.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <pthread.h> -#include "libc_private.h" - -int -_pthread_mutex_init_calloc_cb_stub(pthread_mutex_t *mutex, - void *(calloc_cb)(size_t, size_t)) -{ - - return (0); -} diff --git a/lib/libc/gen/_once_stub.c b/lib/libc/gen/_once_stub.c index c45565a..d2acc29 100644 --- a/lib/libc/gen/_once_stub.c +++ b/lib/libc/gen/_once_stub.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009 Hudson River Trading LLC + * Copyright (c) 2009 Advanced Computing Technologies LLC * Written by: John H. Baldwin <jhb@FreeBSD.org> * All rights reserved. * diff --git a/lib/libc/gen/_spinlock_stub.c b/lib/libc/gen/_spinlock_stub.c index 3decf8a..47bbfeb 100644 --- a/lib/libc/gen/_spinlock_stub.c +++ b/lib/libc/gen/_spinlock_stub.c @@ -33,48 +33,51 @@ __FBSDID("$FreeBSD$"); #include <stdio.h> #include "spinlock.h" -#include "libc_private.h" long _atomic_lock_stub(volatile long *); void _spinlock_stub(spinlock_t *); void _spinunlock_stub(spinlock_t *); void _spinlock_debug_stub(spinlock_t *, char *, int); +/* + * Declare weak definitions in case the application is not linked + * with libpthread. + */ __weak_reference(_atomic_lock_stub, _atomic_lock); +__weak_reference(_spinlock_stub, _spinlock); +__weak_reference(_spinunlock_stub, _spinunlock); +__weak_reference(_spinlock_debug_stub, _spinlock_debug); +/* + * This function is a stub for the _atomic_lock function in libpthread. + */ long _atomic_lock_stub(volatile long *lck __unused) { return (0L); } -__weak_reference(_spinlock, _spinlock_debug); -#pragma weak _spinlock -void -_spinlock(spinlock_t *lck) -{ - - ((void (*)(spinlock_t *lck))__libc_interposing[INTERPOS_spinlock]) - (lck); - -} -#pragma weak _spinunlock +/* + * This function is a stub for the spinlock function in libpthread. + */ void -_spinunlock(spinlock_t *lck) +_spinlock_stub(spinlock_t *lck __unused) { - - ((void (*)(spinlock_t *lck))__libc_interposing[INTERPOS_spinunlock]) - (lck); - } +/* + * This function is a stub for the spinunlock function in libpthread. + */ void -__libc_spinlock_stub(spinlock_t *lck __unused) +_spinunlock_stub(spinlock_t *lck __unused) { } +/* + * This function is a stub for the debug spinlock function in libpthread. + */ void -__libc_spinunlock_stub(spinlock_t *lck __unused) +_spinlock_debug_stub(spinlock_t *lck __unused, char *fname __unused, int lineno __unused) { } diff --git a/lib/libc/gen/cap_rights_get.3 b/lib/libc/gen/cap_rights_get.3 index a665465..f74d1f7a 100644 --- a/lib/libc/gen/cap_rights_get.3 +++ b/lib/libc/gen/cap_rights_get.3 @@ -100,10 +100,10 @@ argument points at an invalid address. .El .Sh SEE ALSO .Xr cap_rights_limit 2 , +.Xr cap_rights_init 3 , .Xr errno 2 , .Xr open 2 , .Xr assert 3 , -.Xr cap_rights_init 3 , .Xr err 3 , .Xr memcmp 3 , .Xr memset 3 , diff --git a/lib/libc/gen/directory.3 b/lib/libc/gen/directory.3 index f0d0f4b..1e864f8 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 May 6, 2015 +.Dd July 28, 2014 .Dt DIRECTORY 3 .Os .Sh NAME @@ -263,25 +263,8 @@ function appeared in function appeared in .Fx 10.0 . .Sh BUGS -The behaviour of +The invalidation of .Fn telldir -and -.Fn seekdir -is likely to be wrong if there are parallel unlinks happening -and the directory is larger than one page. -There is code to ensure that a +tokens when calling .Fn seekdir -to the location given by a -.Fn telldir -immediately before the last -.Fn readdir -will always set the correct location to return the same value as that last -.Fn readdir -performed. -This is enough for some applications which want to "push back the last entry read" E.g. Samba. -Seeks back to any other location, -other than the beginning of the directory, -may result in unexpected behaviour if deletes are present. -It is hoped that this situation will be resolved with changes to -.Fn getdirentries -and the VFS. +is non-standard. diff --git a/lib/libc/gen/disklabel.c b/lib/libc/gen/disklabel.c index 8780573..bd15a47 100644 --- a/lib/libc/gen/disklabel.c +++ b/lib/libc/gen/disklabel.c @@ -85,13 +85,10 @@ getdiskbyname(const char *name) cq++, cp++; *cq = '\0'; - if (cgetstr(buf, "ty", &cq) > 0) { - if (strcmp(cq, "removable") == 0) - dp->d_flags |= D_REMOVABLE; - else if (cq && strcmp(cq, "simulated") == 0) - dp->d_flags |= D_RAMDISK; - free(cq); - } + if (cgetstr(buf, "ty", &cq) > 0 && strcmp(cq, "removable") == 0) + dp->d_flags |= D_REMOVABLE; + else if (cq && strcmp(cq, "simulated") == 0) + dp->d_flags |= D_RAMDISK; if (cgetcap(buf, "sf", ':') != NULL) dp->d_flags |= D_BADSECT; @@ -103,10 +100,9 @@ getdiskbyname(const char *name) getnumdflt(dp->d_nsectors, "ns", 0); getnumdflt(dp->d_ncylinders, "nc", 0); - if (cgetstr(buf, "dt", &cq) > 0) { + if (cgetstr(buf, "dt", &cq) > 0) dp->d_type = gettype(cq, dktypenames); - free(cq); - } else + else getnumdflt(dp->d_type, "dt", 0); getnumdflt(dp->d_secpercyl, "sc", dp->d_nsectors * dp->d_ntracks); getnumdflt(dp->d_secperunit, "su", dp->d_secpercyl * dp->d_ncylinders); @@ -144,11 +140,8 @@ getdiskbyname(const char *name) pp->p_frag = 8; } getnumdflt(pp->p_fstype, ptype, 0); - if (pp->p_fstype == 0) - if (cgetstr(buf, ptype, &cq) >= 0) { - pp->p_fstype = gettype(cq, fstypenames); - free(cq); - } + if (pp->p_fstype == 0 && cgetstr(buf, ptype, &cq) > 0) + pp->p_fstype = gettype(cq, fstypenames); max = p; } } diff --git a/lib/libc/gen/dlfcn.c b/lib/libc/gen/dlfcn.c index 7d28797..ad24bb4 100644 --- a/lib/libc/gen/dlfcn.c +++ b/lib/libc/gen/dlfcn.c @@ -149,8 +149,10 @@ static void dl_init_phdr_info(void) { Elf_Auxinfo *auxp; + size_t phent; unsigned int i; + phent = 0; for (auxp = __elf_aux_vector; auxp->a_type != AT_NULL; auxp++) { switch (auxp->a_type) { case AT_BASE: @@ -163,6 +165,9 @@ dl_init_phdr_info(void) phdr_info.dlpi_phdr = (const Elf_Phdr *)auxp->a_un.a_ptr; break; + case AT_PHENT: + phent = auxp->a_un.a_val; + break; case AT_PHNUM: phdr_info.dlpi_phnum = (Elf_Half)auxp->a_un.a_val; break; @@ -228,10 +233,3 @@ _rtld_get_stack_prot(void) return (PROT_EXEC | PROT_READ | PROT_WRITE); } -#pragma weak _rtld_is_dlopened -int -_rtld_is_dlopened(void *arg) -{ - - return (0); -} diff --git a/lib/libc/gen/dlopen.3 b/lib/libc/gen/dlopen.3 index 1963528..089e631 100644 --- a/lib/libc/gen/dlopen.3 +++ b/lib/libc/gen/dlopen.3 @@ -32,7 +32,7 @@ .\" @(#) dlopen.3 1.6 90/01/31 SMI .\" $FreeBSD$ .\" -.Dd February 14, 2015 +.Dd December 21, 2011 .Dt DLOPEN 3 .Os .Sh NAME @@ -236,7 +236,7 @@ as follows, in the given order: The referencing object itself (or the object from which the call to .Fn dlsym is made), if that object was linked using the -.Fl Bsymbolic +.Fl Wsymbolic option to .Xr ld 1 . .It diff --git a/lib/libc/gen/fstab.c b/lib/libc/gen/fstab.c index c21ceb3..6a77abd 100644 --- a/lib/libc/gen/fstab.c +++ b/lib/libc/gen/fstab.c @@ -181,7 +181,7 @@ fstabscan(void) if (cp != NULL) _fs_fstab.fs_passno = atoi(cp); } - (void)strlcpy(subline, _fs_fstab.fs_mntops, sizeof(subline)); + strcpy(subline, _fs_fstab.fs_mntops); p = subline; for (typexx = 0, cp = strsep(&p, ","); cp; cp = strsep(&p, ",")) { diff --git a/lib/libc/gen/ftok.3 b/lib/libc/gen/ftok.3 index b819dbd..98f8bad 100644 --- a/lib/libc/gen/ftok.3 +++ b/lib/libc/gen/ftok.3 @@ -64,9 +64,9 @@ function will return -1 if .Fa path does not exist or if it cannot be accessed by the calling process. .Sh SEE ALSO -.Xr msgget 2 , .Xr semget 2 , -.Xr shmget 2 +.Xr shmget 2 , +.Xr msgget 2 .Sh HISTORY The .Fn ftok diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c index 1ca8334..7635fbc 100644 --- a/lib/libc/gen/fts.c +++ b/lib/libc/gen/fts.c @@ -905,13 +905,12 @@ fts_stat(FTS *sp, FTSENT *p, int follow, int dfd) if (ISSET(FTS_LOGICAL) || follow) { if (fstatat(dfd, path, sbp, 0)) { saved_errno = errno; - if (fstatat(dfd, path, sbp, AT_SYMLINK_NOFOLLOW)) { - p->fts_errno = saved_errno; - goto err; - } - errno = 0; - if (S_ISLNK(sbp->st_mode)) + if (!fstatat(dfd, path, sbp, AT_SYMLINK_NOFOLLOW)) { + errno = 0; return (FTS_SLNONE); + } + p->fts_errno = saved_errno; + goto err; } } else if (fstatat(dfd, path, sbp, AT_SYMLINK_NOFOLLOW)) { p->fts_errno = errno; diff --git a/lib/libc/gen/ftw.3 b/lib/libc/gen/ftw.3 index df8abab..ba8859b 100644 --- a/lib/libc/gen/ftw.3 +++ b/lib/libc/gen/ftw.3 @@ -87,9 +87,8 @@ A directory which cannot be read. The directory will not be descended into. .It Dv FTW_DP A directory being visited in post-order -.Po Fn nftw -only -.Pc . +.Fn ( nftw +only). .It Dv FTW_NS A file for which no .Xr stat 2 @@ -101,9 +100,8 @@ structure are undefined. A symbolic link. .It Dv FTW_SLN A symbolic link with a non-existent target -.Po Fn nftw -only -.Pc . +.Fn ( nftw +only). .El .Pp The diff --git a/lib/libc/gen/getcap.3 b/lib/libc/gen/getcap.3 index c3a9ce8..73826ae 100644 --- a/lib/libc/gen/getcap.3 +++ b/lib/libc/gen/getcap.3 @@ -137,10 +137,9 @@ It must be called before the call. If a sequential access is being performed (see below), it must be called before the first sequential access call -.Po Fn cgetfirst +.Fn ( cgetfirst or -.Fn cgetnext -.Pc , +.Fn cgetnext ) , or be directly preceded by a .Fn cgetclose call. diff --git a/lib/libc/gen/getgrent.c b/lib/libc/gen/getgrent.c index 1f4d7e9..f9480c3 100644 --- a/lib/libc/gen/getgrent.c +++ b/lib/libc/gen/getgrent.c @@ -896,7 +896,7 @@ files_group(void *retval, void *mdata, va_list ap) break; pos = ftello(st->fp); } - if (st->fp != NULL && !stayopen) { + if (!stayopen && st->fp != NULL) { fclose(st->fp); st->fp = NULL; } @@ -1173,10 +1173,8 @@ nis_group(void *retval, void *mdata, va_list ap) * terminator, alignment padding, and one (char *) * pointer for the member list terminator. */ - if (resultlen >= bufsize - _ALIGNBYTES - sizeof(char *)) { - free(result); + if (resultlen >= bufsize - _ALIGNBYTES - sizeof(char *)) goto erange; - } memcpy(buffer, result, resultlen); buffer[resultlen] = '\0'; free(result); @@ -1452,7 +1450,7 @@ docompat: pos = ftello(st->fp); } fin: - if (st->fp != NULL && !stayopen) { + if (!stayopen && st->fp != NULL) { fclose(st->fp); st->fp = NULL; } diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c index 09a6247..f729cdf 100644 --- a/lib/libc/gen/getpwent.c +++ b/lib/libc/gen/getpwent.c @@ -815,7 +815,7 @@ files_passwd(void *retval, void *mdata, va_list ap) size_t bufsize, namesize; uid_t uid; uint32_t store; - int rv, stayopen = 0, *errnop; + int rv, stayopen, *errnop; name = NULL; uid = (uid_t)-1; @@ -921,7 +921,7 @@ files_passwd(void *retval, void *mdata, va_list ap) errnop); } while (how == nss_lt_all && !(rv & NS_TERMINATE)); fin: - if (st->db != NULL && !stayopen) { + if (!stayopen && st->db != NULL) { (void)st->db->close(st->db); st->db = NULL; } @@ -1392,10 +1392,8 @@ nis_passwd(void *retval, void *mdata, va_list ap) continue; } } - if (resultlen >= bufsize) { - free(result); + if (resultlen >= bufsize) goto erange; - } memcpy(buffer, result, resultlen); buffer[resultlen] = '\0'; free(result); @@ -1942,7 +1940,7 @@ docompat: break; } fin: - if (st->db != NULL && !stayopen) { + if (!stayopen && st->db != NULL) { (void)st->db->close(st->db); st->db = NULL; } diff --git a/lib/libc/gen/getutxent.3 b/lib/libc/gen/getutxent.3 index 85c37b1..120f4a0 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 Mt ed@FreeBSD.org +.An Ed Schouten Aq Mt ed@FreeBSD.org diff --git a/lib/libc/gen/nice.3 b/lib/libc/gen/nice.3 index b04c8f4..9c39b78 100644 --- a/lib/libc/gen/nice.3 +++ b/lib/libc/gen/nice.3 @@ -28,7 +28,7 @@ .\" @(#)nice.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd February 28, 2015 +.Dd June 4, 1993 .Dt NICE 3 .Os .Sh NAME @@ -48,48 +48,20 @@ This interface is obsoleted by .Pp The .Fn nice -function adds -.Fa incr -to the scheduling priority of the process. +function obtains the scheduling priority of the process +from the system and sets it to the priority value specified in +.Fa incr . The priority is a value in the range -20 to 20. The default priority is 0; lower priorities cause more favorable scheduling. Only the super-user may lower priorities. .Pp Children inherit the priority of their parent processes via .Xr fork 2 . -.Sh RETURN VALUES -Upon successful completion, -.Fn nice -returns 0, and -.Va errno -is unchanged. -Otherwise, \-1 is returned, the process' nice value is not changed, and -.Va errno -is set to indicate the error. -.Sh ERRORS -The -.Fn nice -function will fail if: -.Bl -tag -width Er -.It Bq Er EPERM -The -.Fa incr -argument is negative and the caller does not have appropriate privileges. -.El .Sh SEE ALSO .Xr nice 1 , .Xr fork 2 , .Xr setpriority 2 , .Xr renice 8 -.Sh STANDARDS -The -.Fn nice -function conforms to -.St -p1003.1-2008 -except for the return value. -This implementation returns 0 upon successful completion but -the standard requires returning the new nice value, -which could be \-1. .Sh HISTORY A .Fn nice diff --git a/lib/libc/gen/nice.c b/lib/libc/gen/nice.c index ba9524b..e8375e8 100644 --- a/lib/libc/gen/nice.c +++ b/lib/libc/gen/nice.c @@ -43,20 +43,14 @@ __FBSDID("$FreeBSD$"); * Backwards compatible nice. */ int -nice(int incr) +nice(incr) + int incr; { - int saverrno, prio; + int prio; - saverrno = errno; errno = 0; prio = getpriority(PRIO_PROCESS, 0); - if (prio == -1 && errno != 0) + if (prio == -1 && errno) return (-1); - if (setpriority(PRIO_PROCESS, 0, prio + incr) == -1) { - if (errno == EACCES) - errno = EPERM; - return (-1); - } - errno = saverrno; - return (0); + return (setpriority(PRIO_PROCESS, 0, prio + incr)); } diff --git a/lib/libc/gen/nlist.c b/lib/libc/gen/nlist.c index ec878c5..bdadd55 100644 --- a/lib/libc/gen/nlist.c +++ b/lib/libc/gen/nlist.c @@ -47,10 +47,7 @@ __FBSDID("$FreeBSD$"); #include <unistd.h> #include "un-namespace.h" -/* There is no a.out support on arm64 */ -#ifndef __aarch64__ #define _NLIST_DO_AOUT -#endif #define _NLIST_DO_ELF #ifdef _NLIST_DO_ELF diff --git a/lib/libc/gen/pause.c b/lib/libc/gen/pause.c index ef48c1c..51706cf 100644 --- a/lib/libc/gen/pause.c +++ b/lib/libc/gen/pause.c @@ -33,10 +33,10 @@ static char sccsid[] = "@(#)pause.c 8.1 (Berkeley) 6/4/93"; #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include "namespace.h" #include <signal.h> #include <unistd.h> - -#include "libc_private.h" +#include "un-namespace.h" /* * Backwards compatible pause. @@ -46,10 +46,9 @@ __pause(void) { sigset_t oset; - if (sigprocmask(SIG_BLOCK, NULL, &oset) == -1) + if (_sigprocmask(SIG_BLOCK, NULL, &oset) == -1) return (-1); - return (sigsuspend(&oset)); + return (_sigsuspend(&oset)); } - __weak_reference(__pause, pause); __weak_reference(__pause, _pause); diff --git a/lib/libc/gen/posix_spawn.3 b/lib/libc/gen/posix_spawn.3 index 2c9131b..dd5bd2b 100644 --- a/lib/libc/gen/posix_spawn.3 +++ b/lib/libc/gen/posix_spawn.3 @@ -413,10 +413,6 @@ including trying to close a descriptor that is not open. .Xr execve 2 , .Xr fcntl 2 , .Xr open 2 , -.Xr sched_setparam 2 , -.Xr sched_setscheduler 2 , -.Xr setpgid 2 , -.Xr vfork 2 , .Xr posix_spawn_file_actions_addclose 3 , .Xr posix_spawn_file_actions_adddup2 3 , .Xr posix_spawn_file_actions_addopen 3 , @@ -435,7 +431,11 @@ including trying to close a descriptor that is not open. .Xr posix_spawnattr_setschedparam 3 , .Xr posix_spawnattr_setschedpolicy 3 , .Xr posix_spawnattr_setsigdefault 3 , -.Xr posix_spawnattr_setsigmask 3 +.Xr posix_spawnattr_setsigmask 3 , +.Xr sched_setparam 2 , +.Xr sched_setscheduler 2 , +.Xr setpgid 2 , +.Xr vfork 2 .Sh STANDARDS The .Fn posix_spawn @@ -457,4 +457,4 @@ and functions first appeared in .Fx 8.0 . .Sh AUTHORS -.An \&Ed Schouten Aq Mt 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 0b57999b..b28f396 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 Mt 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 380eed7..eda2a1d 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 Mt 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 2571f4a..b5995ce 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 Mt 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 cfc1b54..91b3e5c 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 Mt 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 5eef96e..a137200 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 Mt 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 5276de5..3e79d4b 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 Mt 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 a81c714..8878332 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 Mt 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 be15d9d..4f9c014 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 Mt 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 b4ec52c..388fe5a 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 Mt ed@FreeBSD.org +.An Ed Schouten Aq Mt ed@FreeBSD.org diff --git a/lib/libc/gen/raise.c b/lib/libc/gen/raise.c index 994fea5..b3d0aae 100644 --- a/lib/libc/gen/raise.c +++ b/lib/libc/gen/raise.c @@ -36,17 +36,11 @@ __FBSDID("$FreeBSD$"); #include <signal.h> #include <unistd.h> -#include "libc_private.h" - __weak_reference(__raise, raise); __weak_reference(__raise, _raise); int __raise(int s) { - long id; - - if (__sys_thr_self(&id) == -1) - return (-1); - return (__sys_thr_kill(id, s)); + return(kill(getpid(), s)); } diff --git a/lib/libc/gen/readdir.c b/lib/libc/gen/readdir.c index c6f5d3f..69f59d1 100644 --- a/lib/libc/gen/readdir.c +++ b/lib/libc/gen/readdir.c @@ -54,25 +54,19 @@ _readdir_unlocked(dirp, skip) int skip; { struct dirent *dp; - long initial_seek; - long initial_loc = 0; for (;;) { if (dirp->dd_loc >= dirp->dd_size) { if (dirp->dd_flags & __DTF_READALL) return (NULL); - initial_loc = dirp->dd_loc; - dirp->dd_flags &= ~__DTF_SKIPREAD; dirp->dd_loc = 0; } if (dirp->dd_loc == 0 && !(dirp->dd_flags & (__DTF_READALL | __DTF_SKIPREAD))) { - initial_seek = dirp->dd_seek; dirp->dd_size = _getdirentries(dirp->dd_fd, dirp->dd_buf, dirp->dd_len, &dirp->dd_seek); if (dirp->dd_size <= 0) return (NULL); - _fixtelldir(dirp, initial_seek, initial_loc); } dirp->dd_flags &= ~__DTF_SKIPREAD; dp = (struct dirent *)(dirp->dd_buf + dirp->dd_loc); diff --git a/lib/libc/gen/rewinddir.c b/lib/libc/gen/rewinddir.c index e157cd6..193f4b0 100644 --- a/lib/libc/gen/rewinddir.c +++ b/lib/libc/gen/rewinddir.c @@ -51,7 +51,6 @@ rewinddir(dirp) if (__isthreaded) _pthread_mutex_lock(&dirp->dd_lock); - dirp->dd_flags &= ~__DTF_SKIPREAD; /* current contents are invalid */ if (dirp->dd_flags & __DTF_READALL) _filldir(dirp, false); else { diff --git a/lib/libc/gen/scandir.3 b/lib/libc/gen/scandir.3 index aa8dea0..eaba754 100644 --- a/lib/libc/gen/scandir.3 +++ b/lib/libc/gen/scandir.3 @@ -92,7 +92,7 @@ by freeing each pointer in the array and then the array itself. .Pp The .Fn scandir_b -function behaves in the same way as +function behaves in the same way as .Fn scandir , but takes blocks as arguments instead of function pointers and calls .Fn qsort_b @@ -106,8 +106,8 @@ cannot allocate enough memory to hold all the data structures. .Xr directory 3 , .Xr malloc 3 , .Xr qsort 3 , -.Xr strcoll 3 , -.Xr dir 5 +.Xr dir 5 , +.Xr strcoll 3 .Sh HISTORY The .Fn scandir diff --git a/lib/libc/gen/sem_new.c b/lib/libc/gen/sem_new.c index c5dc7e7..3ee0272 100644 --- a/lib/libc/gen/sem_new.c +++ b/lib/libc/gen/sem_new.c @@ -439,10 +439,8 @@ _sem_post(sem_t *sem) do { count = sem->_kern._count; - if (USEM_COUNT(count) + 1 > SEM_VALUE_MAX) { - errno = EOVERFLOW; - return (-1); - } + if (USEM_COUNT(count) + 1 > SEM_VALUE_MAX) + return (EOVERFLOW); } while (!atomic_cmpset_rel_int(&sem->_kern._count, count, count + 1)); if (count & USEM_HAS_WAITERS) usem_wake(&sem->_kern); diff --git a/lib/libc/gen/sem_post.3 b/lib/libc/gen/sem_post.3 index dea8eb6..485d2fc 100644 --- a/lib/libc/gen/sem_post.3 +++ b/lib/libc/gen/sem_post.3 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 28, 2015 +.Dd February 15, 2000 .Dt SEM_POST 3 .Os .Sh NAME @@ -65,9 +65,6 @@ The .Fa sem argument points to an invalid semaphore. -.It Bq Er EOVERFLOW -The semaphore value would exceed -.Dv SEM_VALUE_MAX . .El .Sh SEE ALSO .Xr sem_getvalue 3 , diff --git a/lib/libc/gen/setmode.3 b/lib/libc/gen/setmode.3 index 684c2e1..5cab44a 100644 --- a/lib/libc/gen/setmode.3 +++ b/lib/libc/gen/setmode.3 @@ -28,7 +28,7 @@ .\" @(#)setmode.3 8.2 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd February 22, 2015 +.Dd April 28, 1995 .Dt SETMODE 3 .Os .Sh NAME @@ -99,20 +99,7 @@ The function may fail and set errno for any of the errors specified for the library routine -.Xr malloc 3 -or -.Xr strtol 3 . -In addition, -.Fn setmode -will fail and set -.Va errno -to: -.Bl -tag -width Er -.It Bq Er EINVAL -The -.Fa mode -argument does not represent a valid mode. -.El +.Xr malloc 3 . .Sh SEE ALSO .Xr chmod 1 , .Xr stat 2 , diff --git a/lib/libc/gen/setmode.c b/lib/libc/gen/setmode.c index 815cf14..3966fd0 100644 --- a/lib/libc/gen/setmode.c +++ b/lib/libc/gen/setmode.c @@ -39,11 +39,8 @@ __FBSDID("$FreeBSD$"); #include "namespace.h" #include <sys/types.h> #include <sys/stat.h> -#include <sys/sysctl.h> #include <ctype.h> -#include <errno.h> -#include <limits.h> #include <signal.h> #include <stddef.h> #include <stdlib.h> @@ -69,8 +66,7 @@ typedef struct bitcmd { #define CMD2_OBITS 0x08 #define CMD2_UBITS 0x10 -static mode_t getumask(void); -static BITCMD *addcmd(BITCMD *, mode_t, mode_t, mode_t, mode_t); +static BITCMD *addcmd(BITCMD *, int, int, int, u_int); static void compress_mode(BITCMD *); #ifdef SETMODE_DEBUG static void dumpmode(BITCMD *); @@ -155,37 +151,45 @@ common: if (set->cmd2 & CMD2_CLR) { BITCMD *newset; \ setlen += SET_LEN_INCR; \ newset = realloc(saveset, sizeof(BITCMD) * setlen); \ - if (newset == NULL) \ - goto out; \ + if (!newset) { \ + if (saveset) \ + free(saveset); \ + saveset = NULL; \ + return (NULL); \ + } \ set = newset + (set - saveset); \ saveset = newset; \ endset = newset + (setlen - 2); \ } \ - set = addcmd(set, (mode_t)(a), (mode_t)(b), (mode_t)(c), (d)) + set = addcmd(set, (a), (b), (c), (d)) #define STANDARD_BITS (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO) void * setmode(const char *p) { - int serrno; + int perm, who; char op, *ep; BITCMD *set, *saveset, *endset; - mode_t mask, perm, permXbits, who; + sigset_t sigset, sigoset; + mode_t mask; + int equalopdone=0, permXbits, setlen; long perml; - int equalopdone; - int setlen; - if (!*p) { - errno = EINVAL; + if (!*p) return (NULL); - } /* * Get a copy of the mask for the permissions that are mask relative. - * Flip the bits, we want what's not set. + * Flip the bits, we want what's not set. Since it's possible that + * the caller is opening files inside a signal handler, protect them + * as best we can. */ - mask = ~getumask(); + sigfillset(&sigset); + (void)_sigprocmask(SIG_BLOCK, &sigset, &sigoset); + (void)umask(mask = umask(0)); + mask = ~mask; + (void)_sigprocmask(SIG_SETMASK, &sigoset, NULL); setlen = SET_LEN + 2; @@ -199,17 +203,10 @@ setmode(const char *p) * or illegal bits. */ if (isdigit((unsigned char)*p)) { - errno = 0; perml = strtol(p, &ep, 8); - if (*ep) { - errno = EINVAL; - goto out; - } - if (errno == ERANGE && (perml == LONG_MAX || perml == LONG_MIN)) - goto out; - if (perml & ~(STANDARD_BITS|S_ISTXT)) { - errno = EINVAL; - goto out; + if (*ep || perml < 0 || perml & ~(STANDARD_BITS|S_ISTXT)) { + free(saveset); + return (NULL); } perm = (mode_t)perml; ADDCMD('=', (STANDARD_BITS|S_ISTXT), perm, mask); @@ -221,7 +218,6 @@ setmode(const char *p) * Build list of structures to set/clear/copy bits as described by * each clause of the symbolic mode. */ - equalopdone = 0; for (;;) { /* First, find out which bits might be modified. */ for (who = 0;; ++p) { @@ -244,8 +240,8 @@ setmode(const char *p) } getop: if ((op = *p++) != '+' && op != '-' && op != '=') { - errno = EINVAL; - goto out; + free(saveset); + return (NULL); } if (op == '=') equalopdone = 0; @@ -334,44 +330,10 @@ apply: if (!*p) dumpmode(saveset); #endif return (saveset); -out: - serrno = errno; - free(saveset); - errno = serrno; - return NULL; -} - -static mode_t -getumask(void) -{ - sigset_t sigset, sigoset; - size_t len; - mode_t mask; - u_short smask; - - /* - * First try requesting the umask without temporarily modifying it. - * Note that this does not work if the sysctl - * security.bsd.unprivileged_proc_debug is set to 0. - */ - len = sizeof(smask); - if (sysctl((int[4]){ CTL_KERN, KERN_PROC, KERN_PROC_UMASK, getpid() }, - 4, &smask, &len, NULL, 0) == 0) - return (smask); - - /* - * Since it's possible that the caller is opening files inside a signal - * handler, protect them as best we can. - */ - sigfillset(&sigset); - (void)_sigprocmask(SIG_BLOCK, &sigset, &sigoset); - (void)umask(mask = umask(0)); - (void)_sigprocmask(SIG_SETMASK, &sigoset, NULL); - return (mask); } static BITCMD * -addcmd(BITCMD *set, mode_t op, mode_t who, mode_t oparg, mode_t mask) +addcmd(BITCMD *set, int op, int who, int oparg, u_int mask) { switch (op) { case '=': diff --git a/lib/libc/gen/setproctitle.c b/lib/libc/gen/setproctitle.c index 9dff328..cd705fb 100644 --- a/lib/libc/gen/setproctitle.c +++ b/lib/libc/gen/setproctitle.c @@ -42,10 +42,9 @@ __FBSDID("$FreeBSD$"); * 1: old_ps_strings at the very top of the stack. * 2: old_ps_strings at SPARE_USRSPACE below the top of the stack. * 3: ps_strings at the very top of the stack. - * We only support a kernel providing #3 style ps_strings. - * - * For historical purposes, a definition of the old ps_strings structure - * and location is preserved below: + * This attempts to support a kernel built in the #2 and #3 era. + */ + struct old_ps_strings { char *old_ps_argvstr; int old_ps_nargvstr; @@ -54,7 +53,6 @@ struct old_ps_strings { }; #define OLD_PS_STRINGS ((struct old_ps_strings *) \ (USRSTACK - SPARE_USRSPACE - sizeof(struct old_ps_strings))) - */ #include <stdarg.h> @@ -138,38 +136,41 @@ setproctitle(const char *fmt, ...) ps_strings = (struct ps_strings *)ul_ps_strings; } - /* - * PS_STRINGS points to zeroed memory on a style #2 kernel. - * Should not happen. - */ - if (ps_strings->ps_argvstr == NULL) - return; - - /* style #3 */ - if (oargc == -1) { - /* Record our original args */ - oargc = ps_strings->ps_nargvstr; - oargv = ps_strings->ps_argvstr; - for (i = len = 0; i < oargc; i++) { - /* - * The program may have scribbled into its - * argv array, e.g., to remove some arguments. - * If that has happened, break out before - * trying to call strlen on a NULL pointer. - */ - if (oargv[i] == NULL) { - oargc = i; - break; + /* PS_STRINGS points to zeroed memory on a style #2 kernel */ + if (ps_strings->ps_argvstr) { + /* style #3 */ + if (oargc == -1) { + /* Record our original args */ + oargc = ps_strings->ps_nargvstr; + oargv = ps_strings->ps_argvstr; + for (i = len = 0; i < oargc; i++) { + /* + * The program may have scribbled into its + * argv array, e.g., to remove some arguments. + * If that has happened, break out before + * trying to call strlen on a NULL pointer. + */ + if (oargv[i] == NULL) { + oargc = i; + break; + } + snprintf(obuf + len, SPT_BUFSIZE - len, "%s%s", + len ? " " : "", oargv[i]); + if (len) + len++; + len += strlen(oargv[i]); + if (len >= SPT_BUFSIZE) + break; } - snprintf(obuf + len, SPT_BUFSIZE - len, "%s%s", - len != 0 ? " " : "", oargv[i]); - if (len != 0) - len++; - len += strlen(oargv[i]); - if (len >= SPT_BUFSIZE) - break; } + ps_strings->ps_nargvstr = nargc; + ps_strings->ps_argvstr = nargvp; + } else { + /* style #2 - we can only restore our first arg :-( */ + if (*obuf == '\0') + strncpy(obuf, OLD_PS_STRINGS->old_ps_argvstr, + SPT_BUFSIZE - 1); + OLD_PS_STRINGS->old_ps_nargvstr = 1; + OLD_PS_STRINGS->old_ps_argvstr = nargvp[0]; } - ps_strings->ps_nargvstr = nargc; - ps_strings->ps_argvstr = nargvp; } diff --git a/lib/libc/gen/sleep.3 b/lib/libc/gen/sleep.3 index 00e8f8d..ecfa237 100644 --- a/lib/libc/gen/sleep.3 +++ b/lib/libc/gen/sleep.3 @@ -33,7 +33,7 @@ .Os .Sh NAME .Nm sleep -.Nd suspend thread execution for an interval measured in seconds +.Nd suspend process execution for an interval measured in seconds .Sh LIBRARY .Lb libc .Sh SYNOPSIS @@ -43,11 +43,11 @@ .Sh DESCRIPTION The .Fn sleep -function suspends execution of the calling thread until either +function suspends execution of the calling process until either .Fa seconds -seconds have elapsed or a signal is delivered to the thread and its +seconds have elapsed or a signal is delivered to the process and its action is to invoke a signal-catching function or to terminate the -thread or process. +process. System activity may lengthen the sleep by an indeterminate amount. .Pp This function is implemented using diff --git a/lib/libc/gen/sleep.c b/lib/libc/gen/sleep.c index 6bb4ecd..b807c2d 100644 --- a/lib/libc/gen/sleep.c +++ b/lib/libc/gen/sleep.c @@ -40,8 +40,6 @@ __FBSDID("$FreeBSD$"); #include <unistd.h> #include "un-namespace.h" -#include "libc_private.h" - unsigned int __sleep(unsigned int seconds) { @@ -57,14 +55,12 @@ __sleep(unsigned int seconds) time_to_sleep.tv_sec = seconds; time_to_sleep.tv_nsec = 0; - if (((int (*)(const struct timespec *, struct timespec *)) - __libc_interposing[INTERPOS_nanosleep])( - &time_to_sleep, &time_remaining) != -1) + if (_nanosleep(&time_to_sleep, &time_remaining) != -1) return (0); if (errno != EINTR) return (seconds); /* best guess */ return (time_remaining.tv_sec + - (time_remaining.tv_nsec != 0)); /* round up */ + (time_remaining.tv_nsec != 0)); /* round up */ } __weak_reference(__sleep, sleep); diff --git a/lib/libc/gen/stringlist.c b/lib/libc/gen/stringlist.c index 236af17..a09a8e7 100644 --- a/lib/libc/gen/stringlist.c +++ b/lib/libc/gen/stringlist.c @@ -10,6 +10,8 @@ * 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. + * 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 diff --git a/lib/libc/sys/swapcontext.c b/lib/libc/gen/swapcontext.c index 0a8125e..c34cb23 100644 --- a/lib/libc/sys/swapcontext.c +++ b/lib/libc/gen/swapcontext.c @@ -1,11 +1,7 @@ /* * Copyright (c) 2001 Daniel M. Eischen <deischen@freebsd.org> - * Copyright (c) 2014 The FreeBSD Foundation. * All rights reserved. * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,20 +30,26 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/signal.h> #include <sys/ucontext.h> + #include <errno.h> #include <stddef.h> -#include "libc_private.h" -__weak_reference(__sys_swapcontext, __swapcontext); -__sym_compat(swapcontext, __impl_swapcontext, FBSD_1.0); -__weak_reference(swapcontext, __impl_swapcontext); -__sym_default(swapcontext, swapcontext, FBSD_1.2); +__weak_reference(__swapcontext, swapcontext); -#pragma weak swapcontext int -swapcontext(ucontext_t *oucp, const ucontext_t *ucp) +__swapcontext(ucontext_t *oucp, const ucontext_t *ucp) { + int ret; - return (((int (*)(ucontext_t *, const ucontext_t *)) - __libc_interposing[INTERPOS_swapcontext])(oucp, ucp)); + if ((oucp == NULL) || (ucp == NULL)) { + errno = EINVAL; + return (-1); + } + oucp->uc_flags &= ~UCF_SWAPPED; + ret = getcontext(oucp); + if ((ret == 0) && !(oucp->uc_flags & UCF_SWAPPED)) { + oucp->uc_flags |= UCF_SWAPPED; + ret = setcontext(ucp); + } + return (ret); } diff --git a/lib/libc/gen/syslog.c b/lib/libc/gen/syslog.c index 003f24d..3a5cafe 100644 --- a/lib/libc/gen/syslog.c +++ b/lib/libc/gen/syslog.c @@ -261,45 +261,26 @@ vsyslog(int pri, const char *fmt, va_list ap) connectlog(); /* - * If the send() fails, there are two likely scenarios: + * If the send() failed, there are two likely scenarios: * 1) syslogd was restarted * 2) /var/run/log is out of socket buffer space, which * in most cases means local DoS. - * If the error does not indicate a full buffer, we address - * case #1 by attempting to reconnect to /var/run/log[priv] - * and resending the message once. + * We attempt to reconnect to /var/run/log[priv] to take care of + * case #1 and keep send()ing data to cover case #2 + * to give syslogd a chance to empty its socket buffer. * - * If we are working with a privileged socket, the retry - * attempts end there, because we don't want to freeze a + * If we are working with a priveleged socket, then take + * only one attempt, because we don't want to freeze a * critical application like su(1) or sshd(8). * - * Otherwise, we address case #2 by repeatedly retrying the - * send() to give syslogd a chance to empty its socket buffer. */ if (send(LogFile, tbuf, cnt, 0) < 0) { if (errno != ENOBUFS) { - /* - * Scenario 1: syslogd was restarted - * reconnect and resend once - */ disconnectlog(); connectlog(); - if (send(LogFile, tbuf, cnt, 0) >= 0) { - THREAD_UNLOCK(); - return; - } - /* - * if the resend failed, fall through to - * possible scenario 2 - */ } - while (errno == ENOBUFS) { - /* - * Scenario 2: out of socket buffer space - * possible DoS, fail fast on a privileged - * socket - */ + do { if (status == CONNPRIV) break; _usleep(1); @@ -307,7 +288,7 @@ vsyslog(int pri, const char *fmt, va_list ap) THREAD_UNLOCK(); return; } - } + } while (errno == ENOBUFS); } else { THREAD_UNLOCK(); return; @@ -369,7 +350,7 @@ connectlog(void) SyslogAddr.sun_family = AF_UNIX; /* - * First try privileged socket. If no success, + * First try priveleged socket. If no success, * then try default socket. */ (void)strncpy(SyslogAddr.sun_path, _PATH_LOG_PRIV, diff --git a/lib/libc/gen/telldir.c b/lib/libc/gen/telldir.c index 19cd6ee..d72b500 100644 --- a/lib/libc/gen/telldir.c +++ b/lib/libc/gen/telldir.c @@ -101,22 +101,9 @@ _seekdir(dirp, loc) return; if (lp->loc_loc == dirp->dd_loc && lp->loc_seek == dirp->dd_seek) return; - - /* If it's within the same chunk of data, don't bother reloading. */ - if (lp->loc_seek == dirp->dd_seek) { - /* - * If we go back to 0 don't make the next readdir - * trigger a call to getdirentries(). - */ - if (lp->loc_loc == 0) - dirp->dd_flags |= __DTF_SKIPREAD; - dirp->dd_loc = lp->loc_loc; - return; - } (void) lseek(dirp->dd_fd, (off_t)lp->loc_seek, SEEK_SET); dirp->dd_seek = lp->loc_seek; dirp->dd_loc = 0; - dirp->dd_flags &= ~__DTF_SKIPREAD; /* current contents are invalid */ while (dirp->dd_loc < lp->loc_loc) { dp = _readdir_unlocked(dirp, 0); if (dp == NULL) @@ -125,30 +112,6 @@ _seekdir(dirp, loc) } /* - * After readdir returns the last entry in a block, a call to telldir - * returns a location that is after the end of that last entry. - * However, that location doesn't refer to a valid directory entry. - * Ideally, the call to telldir would return a location that refers to - * the first entry in the next block. That location is not known - * until the next block is read, so readdir calls this function after - * fetching a new block to fix any such telldir locations. - */ -void -_fixtelldir(DIR *dirp, long oldseek, long oldloc) -{ - struct ddloc *lp; - - lp = LIST_FIRST(&dirp->dd_td->td_locq); - if (lp != NULL) { - if (lp->loc_loc == oldloc && - lp->loc_seek == oldseek) { - lp->loc_seek = dirp->dd_seek; - lp->loc_loc = dirp->dd_loc; - } - } -} - -/* * Reclaim memory for telldir cookies which weren't used. */ void diff --git a/lib/libc/gen/telldir.h b/lib/libc/gen/telldir.h index bccabb1..04989bb 100644 --- a/lib/libc/gen/telldir.h +++ b/lib/libc/gen/telldir.h @@ -64,6 +64,5 @@ bool _filldir(DIR *, bool); struct dirent *_readdir_unlocked(DIR *, int); void _reclaim_telldir(DIR *); void _seekdir(DIR *, long); -void _fixtelldir(DIR *dirp, long oldseek, long oldloc); #endif diff --git a/lib/libc/gen/termios.c b/lib/libc/gen/termios.c index f8b7354..7e9f169 100644 --- a/lib/libc/gen/termios.c +++ b/lib/libc/gen/termios.c @@ -46,8 +46,6 @@ __FBSDID("$FreeBSD$"); #include <unistd.h> #include "un-namespace.h" -#include "libc_private.h" - int tcgetattr(int fd, struct termios *t) { @@ -210,23 +208,13 @@ tcsendbreak(int fd, int len __unused) } int -__libc_tcdrain(int fd) +__tcdrain(int fd) { - return (_ioctl(fd, TIOCDRAIN, 0)); } -#pragma weak tcdrain -int -tcdrain(int fd) -{ - - return (((int (*)(int)) - __libc_interposing[INTERPOS_tcdrain])(fd)); -} - -__weak_reference(__libc_tcdrain, __tcdrain); -__weak_reference(__libc_tcdrain, _tcdrain); +__weak_reference(__tcdrain, tcdrain); +__weak_reference(__tcdrain, _tcdrain); int tcflush(int fd, int which) diff --git a/lib/libc/gen/tls.c b/lib/libc/gen/tls.c index 58ebb55..5219418 100644 --- a/lib/libc/gen/tls.c +++ b/lib/libc/gen/tls.c @@ -65,14 +65,13 @@ void __libc_free_tls(void *tls, size_t tcbsize, size_t tcbalign); #if defined(__amd64__) #define TLS_TCB_ALIGN 16 #elif defined(__powerpc__) || defined(__i386__) || defined(__arm__) || \ - defined(__sparc64__) || defined(__mips__) || defined(__aarch64__) + defined(__sparc64__) || defined(__mips__) #define TLS_TCB_ALIGN sizeof(void *) #else #error TLS_TCB_ALIGN undefined for target architecture #endif -#if defined(__arm__) || defined(__mips__) || defined(__powerpc__) || \ - defined(__aarch64__) +#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.c b/lib/libc/gen/ttyname.c index 02aa158..a21b77f 100644 --- a/lib/libc/gen/ttyname.c +++ b/lib/libc/gen/ttyname.c @@ -65,7 +65,7 @@ ttyname_r(int fd, char *buf, size_t len) /* Must be a terminal. */ if (!isatty(fd)) - return (errno); + return (ENOTTY); /* Must have enough room */ if (len <= sizeof(_PATH_DEV)) return (ERANGE); @@ -73,7 +73,7 @@ ttyname_r(int fd, char *buf, size_t len) strcpy(buf, _PATH_DEV); used = strlen(buf); if (fdevname_r(fd, buf + used, len - used) == NULL) - return (errno == EINVAL ? ERANGE : errno); + return (ENOTTY); return (0); } diff --git a/lib/libc/gen/ulimit.c b/lib/libc/gen/ulimit.c index 2c090c0..e1bc020 100644 --- a/lib/libc/gen/ulimit.c +++ b/lib/libc/gen/ulimit.c @@ -40,7 +40,7 @@ ulimit(int cmd, ...) { struct rlimit limit; va_list ap; - rlim_t arg; + long arg; if (cmd == UL_GETFSIZE) { if (getrlimit(RLIMIT_FSIZE, &limit) == -1) @@ -53,16 +53,14 @@ ulimit(int cmd, ...) va_start(ap, cmd); arg = va_arg(ap, long); va_end(ap); - if (arg < 0) - arg = LONG_MAX; - if (arg > RLIM_INFINITY / 512) - arg = RLIM_INFINITY / 512; - limit.rlim_max = limit.rlim_cur = arg * 512; + limit.rlim_max = limit.rlim_cur = (rlim_t)arg * 512; /* The setrlimit() function sets errno to EPERM if needed. */ if (setrlimit(RLIMIT_FSIZE, &limit) == -1) return (-1); - return ((long)arg); + if (arg * 512 > LONG_MAX) + return (LONG_MAX); + return (arg); } else { errno = EINVAL; return (-1); diff --git a/lib/libc/gen/usleep.c b/lib/libc/gen/usleep.c index 7c35f6c..7d6559b 100644 --- a/lib/libc/gen/usleep.c +++ b/lib/libc/gen/usleep.c @@ -38,8 +38,6 @@ __FBSDID("$FreeBSD$"); #include <unistd.h> #include "un-namespace.h" -#include "libc_private.h" - int __usleep(useconds_t useconds) { @@ -47,8 +45,7 @@ __usleep(useconds_t useconds) time_to_sleep.tv_nsec = (useconds % 1000000) * 1000; time_to_sleep.tv_sec = useconds / 1000000; - return (((int (*)(const struct timespec *, struct timespec *)) - __libc_interposing[INTERPOS_nanosleep])(&time_to_sleep, NULL)); + return (_nanosleep(&time_to_sleep, NULL)); } __weak_reference(__usleep, usleep); diff --git a/lib/libc/gen/wait.c b/lib/libc/gen/wait.c index 46a3fdd..2169b9d 100644 --- a/lib/libc/gen/wait.c +++ b/lib/libc/gen/wait.c @@ -40,14 +40,10 @@ __FBSDID("$FreeBSD$"); #include <sys/resource.h> #include "un-namespace.h" -#include "libc_private.h" - pid_t __wait(int *istat) { - - return (((pid_t (*)(pid_t, int *, int, struct rusage *)) - __libc_interposing[INTERPOS_wait4])(WAIT_ANY, istat, 0, NULL)); + return (_wait4(WAIT_ANY, istat, 0, (struct rusage *)0)); } __weak_reference(__wait, wait); diff --git a/lib/libc/gen/wait3.c b/lib/libc/gen/wait3.c index 965effe..6098773 100644 --- a/lib/libc/gen/wait3.c +++ b/lib/libc/gen/wait3.c @@ -40,14 +40,11 @@ __FBSDID("$FreeBSD$"); #include <sys/resource.h> #include "un-namespace.h" -#include "libc_private.h" - pid_t -__wait3(int *istat, int options, struct rusage *rup) +wait3(istat, options, rup) + int *istat; + int options; + struct rusage *rup; { - - return (((pid_t (*)(pid_t, int *, int, struct rusage *)) - __libc_interposing[INTERPOS_wait4])(WAIT_ANY, istat, options, rup)); + return (_wait4(WAIT_ANY, istat, options, rup)); } - -__weak_reference(__wait3, wait3); diff --git a/lib/libc/gen/waitid.c b/lib/libc/gen/waitid.c index 17a2dd6..795b208 100644 --- a/lib/libc/gen/waitid.c +++ b/lib/libc/gen/waitid.c @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); #include <signal.h> #include <errno.h> #include "un-namespace.h" -#include "libc_private.h" int __waitid(idtype_t idtype, id_t id, siginfo_t *info, int flags) @@ -45,9 +44,7 @@ __waitid(idtype_t idtype, id_t id, siginfo_t *info, int flags) int status; pid_t ret; - ret = ((pid_t (*)(idtype_t, id_t, int *, int, struct __wrusage *, - siginfo_t *))__libc_interposing[INTERPOS_wait6])(idtype, id, - &status, flags, NULL, info); + ret = _wait6(idtype, id, &status, flags, NULL, info); /* * According to SUSv4, waitid() shall not return a PID when a diff --git a/lib/libc/gen/waitpid.c b/lib/libc/gen/waitpid.c index 5177591..b001837 100644 --- a/lib/libc/gen/waitpid.c +++ b/lib/libc/gen/waitpid.c @@ -40,14 +40,10 @@ __FBSDID("$FreeBSD$"); #include <sys/resource.h> #include "un-namespace.h" -#include "libc_private.h" - pid_t __waitpid(pid_t pid, int *istat, int options) { - - return (((pid_t (*)(pid_t, int *, int, struct rusage *)) - __libc_interposing[INTERPOS_wait4])(pid, istat, options, NULL)); + return (_wait4(pid, istat, options, (struct rusage *)0)); } __weak_reference(__waitpid, waitpid); diff --git a/lib/libc/gen/wordexp.c b/lib/libc/gen/wordexp.c index c7f4b1d..377caff 100644 --- a/lib/libc/gen/wordexp.c +++ b/lib/libc/gen/wordexp.c @@ -118,10 +118,8 @@ we_askshell(const char *words, wordexp_t *we, int flags) char *nstrings; /* Temporary for realloc() */ char **nwv; /* Temporary for realloc() */ sigset_t newsigblock, oldsigblock; - const char *ifs; serrno = errno; - ifs = getenv("IFS"); if (pipe2(pdes, O_CLOEXEC) < 0) return (WRDE_NOSPACE); /* XXX */ @@ -147,8 +145,7 @@ we_askshell(const char *words, wordexp_t *we, int flags) _fcntl(pdes[1], F_SETFD, 0)) < 0) _exit(1); execl(_PATH_BSHELL, "sh", flags & WRDE_UNDEF ? "-u" : "+u", - "-c", "IFS=$1;eval \"$2\";eval \"wordexp $3\"", "", - ifs != NULL ? ifs : " \t\n", + "-c", "eval \"$1\";eval \"wordexp $2\"", "", flags & WRDE_SHOWERR ? "" : "exec 2>/dev/null", words, (char *)NULL); _exit(1); diff --git a/lib/libc/i386/sys/Makefile.inc b/lib/libc/i386/sys/Makefile.inc index ebaa462..b56183c 100644 --- a/lib/libc/i386/sys/Makefile.inc +++ b/lib/libc/i386/sys/Makefile.inc @@ -15,6 +15,9 @@ MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \ 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 MAN+= i386_get_ioperm.2 i386_get_ldt.2 i386_vm86.2 MAN+= i386_set_watch.3 diff --git a/lib/libc/iconv/__iconv.c b/lib/libc/iconv/__iconv.c index 85170b7..c9bee3f 100644 --- a/lib/libc/iconv/__iconv.c +++ b/lib/libc/iconv/__iconv.c @@ -31,7 +31,7 @@ #include "iconv-internal.h" size_t -__iconv(iconv_t a, char **b, size_t *c, char **d, +__iconv(iconv_t a, const char **b, size_t *c, char **d, size_t *e, __uint32_t f, size_t *g) { return __bsd___iconv(a, b, c, d, e, f, g); diff --git a/lib/libc/iconv/bsd_iconv.c b/lib/libc/iconv/bsd_iconv.c index e032a5b..f764886 100644 --- a/lib/libc/iconv/bsd_iconv.c +++ b/lib/libc/iconv/bsd_iconv.c @@ -120,7 +120,7 @@ __bsd_iconv_close(iconv_t handle) } size_t -__bsd_iconv(iconv_t handle, char **in, size_t *szin, char **out, size_t *szout) +__bsd_iconv(iconv_t handle, const char **in, size_t *szin, char **out, size_t *szout) { size_t ret; int err; @@ -141,7 +141,7 @@ __bsd_iconv(iconv_t handle, char **in, size_t *szin, char **out, size_t *szout) } size_t -__bsd___iconv(iconv_t handle, char **in, size_t *szin, char **out, +__bsd___iconv(iconv_t handle, const char **in, size_t *szin, char **out, size_t *szout, uint32_t flags, size_t *invalids) { size_t ret; diff --git a/lib/libc/iconv/citrus_iconv.c b/lib/libc/iconv/citrus_iconv.c index 5994063..5c8bf49 100644 --- a/lib/libc/iconv/citrus_iconv.c +++ b/lib/libc/iconv/citrus_iconv.c @@ -278,9 +278,7 @@ _citrus_iconv_open(struct _citrus_iconv * __restrict * __restrict rcv, struct _citrus_iconv *cv = NULL; struct _citrus_iconv_shared *ci = NULL; char realdst[PATH_MAX], realsrc[PATH_MAX]; -#ifdef _PATH_ICONV char buf[PATH_MAX], path[PATH_MAX]; -#endif int ret; init_cache(); @@ -292,16 +290,10 @@ _citrus_iconv_open(struct _citrus_iconv * __restrict * __restrict rcv, dst = nl_langinfo(CODESET); /* resolve codeset name aliases */ -#ifdef _PATH_ICONV - snprintf(path, sizeof(path), "%s/%s", _PATH_ICONV, _CITRUS_ICONV_ALIAS); strlcpy(realsrc, _lookup_alias(path, src, buf, (size_t)PATH_MAX, _LOOKUP_CASE_IGNORE), (size_t)PATH_MAX); strlcpy(realdst, _lookup_alias(path, dst, buf, (size_t)PATH_MAX, _LOOKUP_CASE_IGNORE), (size_t)PATH_MAX); -#else - strlcpy(realsrc, src, (size_t)PATH_MAX); - strlcpy(realdst, dst, (size_t)PATH_MAX); -#endif /* sanity check */ if (strchr(realsrc, '/') != NULL || strchr(realdst, '/')) diff --git a/lib/libc/iconv/citrus_iconv.h b/lib/libc/iconv/citrus_iconv.h index 99604e9..ac14ac3 100644 --- a/lib/libc/iconv/citrus_iconv.h +++ b/lib/libc/iconv/citrus_iconv.h @@ -52,7 +52,7 @@ __END_DECLS */ static __inline int _citrus_iconv_convert(struct _citrus_iconv * __restrict cv, - char * __restrict * __restrict in, size_t * __restrict inbytes, + const char * __restrict * __restrict in, size_t * __restrict inbytes, char * __restrict * __restrict out, size_t * __restrict outbytes, uint32_t flags, size_t * __restrict nresults) { diff --git a/lib/libc/iconv/citrus_iconv_local.h b/lib/libc/iconv/citrus_iconv_local.h index 5392da1..12d2fa3 100644 --- a/lib/libc/iconv/citrus_iconv_local.h +++ b/lib/libc/iconv/citrus_iconv_local.h @@ -46,7 +46,7 @@ static void _citrus_##_m_##_iconv_uninit_shared \ (struct _citrus_iconv_shared *); \ static int _citrus_##_m_##_iconv_convert \ (struct _citrus_iconv * __restrict, \ - char * __restrict * __restrict, \ + const char * __restrict * __restrict, \ size_t * __restrict, \ char * __restrict * __restrict, \ size_t * __restrict outbytes, \ @@ -75,7 +75,7 @@ typedef void (*_citrus_iconv_uninit_shared_t) (struct _citrus_iconv_shared *); typedef int (*_citrus_iconv_convert_t) (struct _citrus_iconv * __restrict, - char *__restrict* __restrict, size_t * __restrict, + const char *__restrict* __restrict, size_t * __restrict, char * __restrict * __restrict, size_t * __restrict, uint32_t, size_t * __restrict); typedef int (*_citrus_iconv_init_context_t)(struct _citrus_iconv *); diff --git a/lib/libc/iconv/citrus_none.c b/lib/libc/iconv/citrus_none.c index 9ec4bd3..4f9b254 100644 --- a/lib/libc/iconv/citrus_none.c +++ b/lib/libc/iconv/citrus_none.c @@ -83,7 +83,7 @@ _citrus_NONE_stdenc_init_state(struct _citrus_stdenc * __restrict ce __unused, static int _citrus_NONE_stdenc_mbtocs(struct _citrus_stdenc * __restrict ce __unused, - _csid_t *csid, _index_t *idx, char **s, size_t n, + _csid_t *csid, _index_t *idx, const char **s, size_t n, void *ps __unused, size_t *nresult, struct iconv_hooks *hooks) { @@ -159,7 +159,7 @@ _citrus_NONE_stdenc_cstomb(struct _citrus_stdenc * __restrict ce __unused, static int _citrus_NONE_stdenc_mbtowc(struct _citrus_stdenc * __restrict ce __unused, - _wc_t * __restrict pwc, char ** __restrict s, size_t n, + _wc_t * __restrict pwc, const char ** __restrict s, size_t n, void * __restrict pspriv __unused, size_t * __restrict nresult, struct iconv_hooks *hooks) { diff --git a/lib/libc/iconv/citrus_prop.c b/lib/libc/iconv/citrus_prop.c index 642e423..28318de 100644 --- a/lib/libc/iconv/citrus_prop.c +++ b/lib/libc/iconv/citrus_prop.c @@ -293,10 +293,8 @@ done: } _memstream_ungetc(ms, ch); errnum = _citrus_prop_read_character_common(ms, &ch); - if (errnum != 0) { - free(s); + if (errnum != 0) return (errnum); - } s[n] = ch; ++n, --m; } diff --git a/lib/libc/iconv/citrus_stdenc.h b/lib/libc/iconv/citrus_stdenc.h index 50f4dff..28fa29d 100644 --- a/lib/libc/iconv/citrus_stdenc.h +++ b/lib/libc/iconv/citrus_stdenc.h @@ -69,7 +69,7 @@ _citrus_stdenc_init_state(struct _citrus_stdenc * __restrict ce, static __inline int _citrus_stdenc_mbtocs(struct _citrus_stdenc * __restrict ce, _citrus_csid_t * __restrict csid, _citrus_index_t * __restrict idx, - char ** __restrict s, size_t n, void * __restrict ps, + const char ** __restrict s, size_t n, void * __restrict ps, size_t * __restrict nresult, struct iconv_hooks *hooks) { diff --git a/lib/libc/iconv/citrus_stdenc_local.h b/lib/libc/iconv/citrus_stdenc_local.h index 141abff..7b627a0 100644 --- a/lib/libc/iconv/citrus_stdenc_local.h +++ b/lib/libc/iconv/citrus_stdenc_local.h @@ -55,7 +55,7 @@ static int _citrus_##_e_##_stdenc_mbtocs \ (struct _citrus_stdenc * __restrict, \ _citrus_csid_t * __restrict, \ _citrus_index_t * __restrict, \ - char ** __restrict, size_t, \ + const char ** __restrict, size_t, \ void * __restrict, size_t * __restrict, \ struct iconv_hooks *); \ static int _citrus_##_e_##_stdenc_cstomb \ @@ -66,7 +66,7 @@ static int _citrus_##_e_##_stdenc_cstomb \ static int _citrus_##_e_##_stdenc_mbtowc \ (struct _citrus_stdenc * __restrict, \ _citrus_wc_t * __restrict, \ - char ** __restrict, size_t, \ + const char ** __restrict, size_t, \ void * __restrict, size_t * __restrict, \ struct iconv_hooks *); \ static int _citrus_##_e_##_stdenc_wctomb \ @@ -106,7 +106,7 @@ typedef int (*_citrus_stdenc_init_state_t) typedef int (*_citrus_stdenc_mbtocs_t) (struct _citrus_stdenc * __restrict, _citrus_csid_t * __restrict, _citrus_index_t * __restrict, - char ** __restrict, size_t, + const char ** __restrict, size_t, void * __restrict, size_t * __restrict, struct iconv_hooks *); typedef int (*_citrus_stdenc_cstomb_t) @@ -116,7 +116,7 @@ typedef int (*_citrus_stdenc_cstomb_t) typedef int (*_citrus_stdenc_mbtowc_t) (struct _citrus_stdenc * __restrict, _citrus_wc_t * __restrict, - char ** __restrict, size_t, + const char ** __restrict, size_t, void * __restrict, size_t * __restrict, struct iconv_hooks *); typedef int (*_citrus_stdenc_wctomb_t) diff --git a/lib/libc/iconv/citrus_stdenc_template.h b/lib/libc/iconv/citrus_stdenc_template.h index 9a05fa7..21bc5cc 100644 --- a/lib/libc/iconv/citrus_stdenc_template.h +++ b/lib/libc/iconv/citrus_stdenc_template.h @@ -112,7 +112,7 @@ _FUNCNAME(stdenc_init_state)(struct _citrus_stdenc * __restrict ce, static int _FUNCNAME(stdenc_mbtocs)(struct _citrus_stdenc * __restrict ce, _citrus_csid_t * __restrict csid, _citrus_index_t * __restrict idx, - char ** __restrict s, size_t n, void * __restrict ps, + const char ** __restrict s, size_t n, void * __restrict ps, size_t * __restrict nresult, struct iconv_hooks *hooks) { wchar_t wc; @@ -151,7 +151,7 @@ _FUNCNAME(stdenc_cstomb)(struct _citrus_stdenc * __restrict ce, static int _FUNCNAME(stdenc_mbtowc)(struct _citrus_stdenc * __restrict ce, - _citrus_wc_t * __restrict wc, char ** __restrict s, size_t n, + _citrus_wc_t * __restrict wc, const char ** __restrict s, size_t n, void * __restrict ps, size_t * __restrict nresult, struct iconv_hooks *hooks) { diff --git a/lib/libc/iconv/iconv-internal.h b/lib/libc/iconv/iconv-internal.h index 9937f09..9a6b3d9 100644 --- a/lib/libc/iconv/iconv-internal.h +++ b/lib/libc/iconv/iconv-internal.h @@ -29,11 +29,11 @@ /* * Interal prototypes for our back-end functions. */ -size_t __bsd___iconv(iconv_t, char **, size_t *, char **, +size_t __bsd___iconv(iconv_t, const char **, size_t *, char **, size_t *, __uint32_t, size_t *); void __bsd___iconv_free_list(char **, size_t); int __bsd___iconv_get_list(char ***, size_t *, __iconv_bool); -size_t __bsd_iconv(iconv_t, char ** __restrict, +size_t __bsd_iconv(iconv_t, const char ** __restrict, size_t * __restrict, char ** __restrict, size_t * __restrict); const char *__bsd_iconv_canonicalize(const char *); diff --git a/lib/libc/iconv/iconv.3 b/lib/libc/iconv/iconv.3 index 1a4f8c3..6692c47 100644 --- a/lib/libc/iconv/iconv.3 +++ b/lib/libc/iconv/iconv.3 @@ -48,7 +48,7 @@ .Ft size_t .Fn iconv "iconv_t cd" "char ** restrict src" "size_t * restrict srcleft" "char ** restrict dst" "size_t * restrict dstleft" .Ft size_t -.Fn __iconv "iconv_t cd" "char ** restrict src" "size_t * restrict srcleft" "char ** restrict dst" "size_t * restrict dstleft" "uint32_t flags" "size_t * invalids" +.Fn __iconv "iconv_t cd" "const char ** restrict src" "size_t * restrict srcleft" "char ** restrict dst" "size_t * restrict dstleft" "uint32_t flags" "size_t invalids" .Sh DESCRIPTION The .Fn iconv_open @@ -176,8 +176,8 @@ may be .Dv NULL . In this case, the shift sequence for the destination switching to the initial state is discarded. -.El .Pp +.El The .Fn __iconv function works just like diff --git a/lib/libc/iconv/iconv.c b/lib/libc/iconv/iconv.c index 4bd9620..d13c1df 100644 --- a/lib/libc/iconv/iconv.c +++ b/lib/libc/iconv/iconv.c @@ -31,7 +31,7 @@ #include "iconv-internal.h" size_t -iconv(iconv_t a, char ** __restrict b, +iconv(iconv_t a, const char ** __restrict b, size_t * __restrict c, char ** __restrict d, size_t * __restrict e) { diff --git a/lib/libc/iconv/iconv_compat.c b/lib/libc/iconv/iconv_compat.c index ded2499..dea968f 100644 --- a/lib/libc/iconv/iconv_compat.c +++ b/lib/libc/iconv/iconv_compat.c @@ -37,7 +37,7 @@ #include "iconv-internal.h" size_t -__iconv_compat(iconv_t a, char ** b, size_t * c, char ** d, +__iconv_compat(iconv_t a, const char ** b, size_t * c, char ** d, size_t * e, __uint32_t f, size_t *g) { return __bsd___iconv(a, b, c, d, e, f, g); @@ -56,7 +56,7 @@ __iconv_get_list_compat(char ***a, size_t *b, __iconv_bool c) } size_t -iconv_compat(iconv_t a, char ** __restrict b, +iconv_compat(iconv_t a, const char ** __restrict b, size_t * __restrict c, char ** __restrict d, size_t * __restrict e) { diff --git a/lib/libc/iconv/iconvlist.3 b/lib/libc/iconv/iconvlist.3 index b1a6e05..bef609b 100644 --- a/lib/libc/iconv/iconvlist.3 +++ b/lib/libc/iconv/iconvlist.3 @@ -78,9 +78,9 @@ If an error occurs, will be NULL when calling .Fn do_one . .Sh SEE ALSO -.Xr __iconv_free_list 3 , +.Xr iconv 3 , .Xr __iconv_get_list 3 , -.Xr iconv 3 +.Xr __iconv_free_list 3 .Sh STANDARDS The .Nm diff --git a/lib/libc/include/compat.h b/lib/libc/include/compat.h index b20fac5..7694540 100644 --- a/lib/libc/include/compat.h +++ b/lib/libc/include/compat.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009 Hudson River Trading LLC + * Copyright (c) 2009 Advanced Computing Technologies LLC * Written by: John H. Baldwin <jhb@FreeBSD.org> * All rights reserved. * @@ -44,12 +44,5 @@ __sym_compat(shmctl, freebsd7_shmctl, FBSD_1.0); #undef __sym_compat -#define __weak_reference(sym,alias) \ - .weak alias;.equ alias,sym - -__weak_reference(__sys_fcntl,__fcntl_compat) - -#undef __weak_reference - #endif /* __LIBC_COMPAT_H__ */ diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h index a670d63..40a5f72 100644 --- a/lib/libc/include/libc_private.h +++ b/lib/libc/include/libc_private.h @@ -95,9 +95,6 @@ do { \ _SPINUNLOCK(&__stdio_thread_lock); \ } while (0) -void __libc_spinlock_stub(struct _spinlock *); -void __libc_spinunlock_stub(struct _spinlock *); - /* * Indexes into the pthread jump table. * @@ -176,57 +173,6 @@ typedef pthread_func_t pthread_func_entry_t[2]; extern pthread_func_entry_t __thr_jtable[]; -void __set_error_selector(int *(*arg)(void)); -int _pthread_mutex_init_calloc_cb_stub(pthread_mutex_t *mutex, - void *(calloc_cb)(__size_t, __size_t)); - -typedef int (*interpos_func_t)(void); -interpos_func_t *__libc_interposing_slot(int interposno); -extern interpos_func_t __libc_interposing[] __hidden; - -enum { - INTERPOS_accept, - INTERPOS_accept4, - INTERPOS_aio_suspend, - INTERPOS_close, - INTERPOS_connect, - INTERPOS_fcntl, - INTERPOS_fsync, - INTERPOS_fork, - INTERPOS_msync, - INTERPOS_nanosleep, - INTERPOS_openat, - INTERPOS_poll, - INTERPOS_pselect, - INTERPOS_recvfrom, - INTERPOS_recvmsg, - INTERPOS_select, - INTERPOS_sendmsg, - INTERPOS_sendto, - INTERPOS_setcontext, - INTERPOS_sigaction, - INTERPOS_sigprocmask, - INTERPOS_sigsuspend, - INTERPOS_sigwait, - INTERPOS_sigtimedwait, - INTERPOS_sigwaitinfo, - INTERPOS_swapcontext, - INTERPOS_system, - INTERPOS_tcdrain, - INTERPOS_read, - INTERPOS_readv, - INTERPOS_wait4, - INTERPOS_write, - INTERPOS_writev, - INTERPOS__pthread_mutex_init_calloc_cb, - INTERPOS_spinlock, - INTERPOS_spinunlock, - INTERPOS_kevent, - INTERPOS_wait6, - INTERPOS_ppoll, - INTERPOS_MAX -}; - /* * yplib internal interfaces */ @@ -269,8 +215,6 @@ void _malloc_thread_cleanup(void); void _malloc_prefork(void); void _malloc_postfork(void); -void _malloc_first_thread(void); - /* * Function to clean up streams, called from abort() and exit(). */ @@ -278,96 +222,35 @@ extern void (*__cleanup)(void) __hidden; /* * Get kern.osreldate to detect ABI revisions. Explicitly - * ignores value of $OSVERSION and caches result. + * ignores value of $OSVERSION and caches result. Prototypes + * for the wrapped "new" pad-less syscalls are here for now. */ -int __getosreldate(void); +extern int __getosreldate(void); #include <sys/_types.h> -#include <sys/_sigset.h> +/* Without pad */ +extern __off_t __sys_lseek(int, __off_t, int); +extern int __sys_ftruncate(int, __off_t); +extern int __sys_truncate(const char *, __off_t); +extern __ssize_t __sys_pread(int, void *, __size_t, __off_t); +extern __ssize_t __sys_pwrite(int, const void *, __size_t, __off_t); +extern void * __sys_mmap(void *, __size_t, int, int, int, __off_t); + +/* With pad */ +extern __off_t __sys_freebsd6_lseek(int, int, __off_t, int); +extern int __sys_freebsd6_ftruncate(int, int, __off_t); +extern int __sys_freebsd6_truncate(const char *, int, __off_t); +extern __ssize_t __sys_freebsd6_pread(int, void *, __size_t, int, __off_t); +extern __ssize_t __sys_freebsd6_pwrite(int, const void *, __size_t, int, __off_t); +extern void * __sys_freebsd6_mmap(void *, __size_t, int, int, int, int, __off_t); + +/* Without back-compat translation */ +extern int __sys_fcntl(int, int, ...); -struct aiocb; -struct fd_set; -struct iovec; -struct kevent; -struct msghdr; -struct pollfd; -struct rusage; -struct sigaction; -struct sockaddr; struct timespec; struct timeval; struct timezone; -struct __siginfo; -struct __ucontext; -struct __wrusage; -enum idtype; -int __sys_aio_suspend(const struct aiocb * const[], int, - const struct timespec *); -int __sys_accept(int, struct sockaddr *, __socklen_t *); -int __sys_accept4(int, struct sockaddr *, __socklen_t *, int); -int __sys_clock_gettime(__clockid_t, struct timespec *ts); -int __sys_close(int); -int __sys_connect(int, const struct sockaddr *, __socklen_t); -int __sys_fcntl(int, int, ...); -int __sys_fsync(int); -__pid_t __sys_fork(void); -int __sys_ftruncate(int, __off_t); -int __sys_gettimeofday(struct timeval *, struct timezone *); -int __sys_kevent(int, const struct kevent *, int, struct kevent *, - int, const struct timespec *); -__off_t __sys_lseek(int, __off_t, int); -void *__sys_mmap(void *, __size_t, int, int, int, __off_t); -int __sys_msync(void *, __size_t, int); -int __sys_nanosleep(const struct timespec *, struct timespec *); -int __sys_open(const char *, int, ...); -int __sys_openat(int, const char *, int, ...); -int __sys_pselect(int, struct fd_set *, struct fd_set *, - struct fd_set *, const struct timespec *, - const __sigset_t *); -int __sys_poll(struct pollfd *, unsigned, int); -int __sys_ppoll(struct pollfd *, unsigned, const struct timespec *, - const __sigset_t *); -__ssize_t __sys_pread(int, void *, __size_t, __off_t); -__ssize_t __sys_pwrite(int, const void *, __size_t, __off_t); -__ssize_t __sys_read(int, void *, __size_t); -__ssize_t __sys_readv(int, const struct iovec *, int); -__ssize_t __sys_recv(int, void *, __size_t, int); -__ssize_t __sys_recvfrom(int, void *, __size_t, int, struct sockaddr *, - __socklen_t *); -__ssize_t __sys_recvmsg(int, struct msghdr *, int); -int __sys_select(int, struct fd_set *, struct fd_set *, - struct fd_set *, struct timeval *); -__ssize_t __sys_sendmsg(int, const struct msghdr *, int); -__ssize_t __sys_sendto(int, const void *, __size_t, int, - const struct sockaddr *, __socklen_t); -int __sys_setcontext(const struct __ucontext *); -int __sys_sigaction(int, const struct sigaction *, - struct sigaction *); -int __sys_sigprocmask(int, const __sigset_t *, __sigset_t *); -int __sys_sigsuspend(const __sigset_t *); -int __sys_sigtimedwait(const __sigset_t *, struct __siginfo *, - const struct timespec *); -int __sys_sigwait(const __sigset_t *, int *); -int __sys_sigwaitinfo(const __sigset_t *, struct __siginfo *); -int __sys_swapcontext(struct __ucontext *, - const struct __ucontext *); -int __sys_thr_kill(long, int); -int __sys_thr_self(long *); -int __sys_truncate(const char *, __off_t); -__pid_t __sys_wait4(__pid_t, int *, int, struct rusage *); -__pid_t __sys_wait6(enum idtype, __id_t, int *, int, - struct __wrusage *, struct __siginfo *); -__ssize_t __sys_write(int, const void *, __size_t); -__ssize_t __sys_writev(int, const struct iovec *, int); - -int __libc_sigwait(const __sigset_t * __restrict, - int * restrict sig); -int __libc_system(const char *); -int __libc_tcdrain(int); -int __fcntl_compat(int fd, int cmd, ...); - -int __sys_futimens(int fd, const struct timespec *times) __hidden; -int __sys_utimensat(int fd, const char *path, - const struct timespec *times, int flag) __hidden; +int __sys_gettimeofday(struct timeval *, struct timezone *); +int __sys_clock_gettime(__clockid_t, struct timespec *ts); /* execve() with PATH processing to implement posix_spawnp() */ int _execvpe(const char *, char * const *, char * const *); diff --git a/lib/libc/locale/cXXrtomb_iconv.h b/lib/libc/locale/cXXrtomb_iconv.h index d6e7ce0..0ea553b 100644 --- a/lib/libc/locale/cXXrtomb_iconv.h +++ b/lib/libc/locale/cXXrtomb_iconv.h @@ -57,7 +57,8 @@ cXXrtomb_l(char * __restrict s, charXX_t c, mbstate_t * __restrict ps, { _ConversionState *cs; struct _citrus_iconv *handle; - char *src, *dst; + const char *src; + char *dst; size_t srcleft, dstleft, invlen; int err; diff --git a/lib/libc/locale/digittoint.3 b/lib/libc/locale/digittoint.3 index 6670abe..4a7f2e2 100644 --- a/lib/libc/locale/digittoint.3 +++ b/lib/libc/locale/digittoint.3 @@ -64,5 +64,5 @@ the function will return 0. .Sh SEE ALSO .Xr ctype 3 , .Xr isdigit 3 , -.Xr isxdigit 3 , +.Xr isxdigit 3, .Xr xlocale 3 diff --git a/lib/libc/locale/duplocale.3 b/lib/libc/locale/duplocale.3 index bc0c4bc..f2e8215 100644 --- a/lib/libc/locale/duplocale.3 +++ b/lib/libc/locale/duplocale.3 @@ -36,7 +36,7 @@ .Sh LIBRARY .Lb libc .Sh SYNOPSIS -.In locale.h +.In xlocale.h .Ft locale_t .Fn duplocale "locale_t locale" .Sh DESCRIPTION diff --git a/lib/libc/locale/freelocale.3 b/lib/libc/locale/freelocale.3 index 0df80e7..86f4809 100644 --- a/lib/libc/locale/freelocale.3 +++ b/lib/libc/locale/freelocale.3 @@ -38,7 +38,7 @@ or .Sh LIBRARY .Lb libc .Sh SYNOPSIS -.In locale.h +.In xlocale.h .Ft int .Fn freelocale "locale_t locale" .Sh DESCRIPTION diff --git a/lib/libc/locale/mbrtocXX_iconv.h b/lib/libc/locale/mbrtocXX_iconv.h index 9eb6f68..ac85a5a 100644 --- a/lib/libc/locale/mbrtocXX_iconv.h +++ b/lib/libc/locale/mbrtocXX_iconv.h @@ -99,7 +99,8 @@ mbrtocXX_l(charXX_t * __restrict pc, const char * __restrict s, size_t n, /* Convert as few characters to the dst buffer as possible. */ for (i = 0; ; i++) { - char *src, *dst; + const char *src; + char *dst; size_t srcleft, dstleft, invlen; int err; diff --git a/lib/libc/locale/newlocale.3 b/lib/libc/locale/newlocale.3 index c7414be..a639c37 100644 --- a/lib/libc/locale/newlocale.3 +++ b/lib/libc/locale/newlocale.3 @@ -35,7 +35,7 @@ .Sh LIBRARY .Lb libc .Sh SYNOPSIS -.In locale.h +.In xlocale .Ft locale_t .Fn newlocale "int mask" "const char * locale" "locale_t base" .Sh DESCRIPTION diff --git a/lib/libc/locale/none.c b/lib/libc/locale/none.c index cacfd73..75adffa 100644 --- a/lib/libc/locale/none.c +++ b/lib/libc/locale/none.c @@ -209,7 +209,7 @@ struct xlocale_ctype __xlocale_global_ctype = { 256 /* __mb_sb_limit */ }; -struct xlocale_ctype __xlocale_C_ctype = { +const struct xlocale_ctype __xlocale_C_ctype = { {{0}, "C"}, (_RuneLocale*)&_DefaultRuneLocale, _none_mbrtowc, diff --git a/lib/libc/locale/querylocale.3 b/lib/libc/locale/querylocale.3 index d1bb688..f90d626 100644 --- a/lib/libc/locale/querylocale.3 +++ b/lib/libc/locale/querylocale.3 @@ -36,7 +36,7 @@ .Sh LIBRARY .Lb libc .Sh SYNOPSIS -.In locale.h +.In xlocale.h .Ft const char * .Fn querylocale "int mask" "locale_t locale" .Sh DESCRIPTION diff --git a/lib/libc/locale/uselocale.3 b/lib/libc/locale/uselocale.3 index 96d0008..df29a62 100644 --- a/lib/libc/locale/uselocale.3 +++ b/lib/libc/locale/uselocale.3 @@ -36,7 +36,7 @@ .Sh LIBRARY .Lb libc .Sh SYNOPSIS -.In locale.h +.In xlocale.h .Ft locale_t .Fn uselocale "locale_t locale" .Sh DESCRIPTION diff --git a/lib/libc/locale/xlocale.3 b/lib/libc/locale/xlocale.3 index da217c6..d467a10 100644 --- a/lib/libc/locale/xlocale.3 +++ b/lib/libc/locale/xlocale.3 @@ -71,7 +71,7 @@ function. .Xr localeconv 3 , .Xr newlocale 3 , .Xr querylocale 3 , -.Xr uselocale 3 +.Xr uselocale 3 , .Sh CONVENIENCE FUNCTIONS The xlocale API includes a number of .Fa _l diff --git a/lib/libc/mips/gen/Makefile.inc b/lib/libc/mips/gen/Makefile.inc index a186fda..9d9cc7a 100644 --- a/lib/libc/mips/gen/Makefile.inc +++ b/lib/libc/mips/gen/Makefile.inc @@ -6,6 +6,5 @@ SRCS+= infinity.c fabs.c ldexp.c # SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \ # fpsetround.c fpsetsticky.c -SRCS+= _ctx_start.S _set_tp.c _setjmp.S makecontext.c \ - setjmp.S signalcontext.c sigsetjmp.S \ - trivial-getcontextx.c +SRCS+= _ctx_start.S _set_tp.c _setjmp.S getcontextx.c makecontext.c \ + setjmp.S signalcontext.c sigsetjmp.S diff --git a/lib/libc/mips/gen/_setjmp.S b/lib/libc/mips/gen/_setjmp.S index 0f7a75a..3918407 100644 --- a/lib/libc/mips/gen/_setjmp.S +++ b/lib/libc/mips/gen/_setjmp.S @@ -61,16 +61,9 @@ __FBSDID("$FreeBSD$"); LEAF(_setjmp) REG_PROLOGUE - REG_LI v0, _JB_MAGIC__SETJMP # sigcontext magic number + REG_LI v0, _JB_MAGIC__SETJMP REG_S v0, (_JB_MAGIC * SZREG)(a0) REG_S ra, (_JB_REG_RA * SZREG)(a0) - /* - * From "MIPSpro N32 ABI Handbook", Table 2-1: - * Registers s0..s7 are callee-saved. - * The sp register is callee-saved. - * The fp (or s8) register is callee-saved. - * The gp register is callee-saved (for n32/n64). - */ REG_S s0, (_JB_REG_S0 * SZREG)(a0) REG_S s1, (_JB_REG_S1 * SZREG)(a0) REG_S s2, (_JB_REG_S2 * SZREG)(a0) @@ -79,41 +72,11 @@ LEAF(_setjmp) REG_S s5, (_JB_REG_S5 * SZREG)(a0) REG_S s6, (_JB_REG_S6 * SZREG)(a0) REG_S s7, (_JB_REG_S7 * SZREG)(a0) - REG_S sp, (_JB_REG_SP * SZREG)(a0) REG_S s8, (_JB_REG_S8 * SZREG)(a0) #if defined(__mips_n32) || defined(__mips_n64) REG_S gp, (_JB_REG_GP * SZREG)(a0) # newabi gp is callee-saved #endif - /* - * From "MIPSpro N32 ABI Handbook", Table 2-1: - * In N32, FP registers F20, F22, F24, F26, F28, F30 are callee-saved. - * In N64, FP registers F24 .. F31 are callee-saved. - * In O32, FP registers F20 .. F23 are callee-saved. - */ -#ifndef SOFTFLOAT - cfc1 v0, $31 # too bad can't check if FP used -#if defined(__mips_n64) || defined(__mips_n32) - FP_S $f30, (_JB_FPREG_F30 * SZREG)(a0) - FP_S $f28, (_JB_FPREG_F28 * SZREG)(a0) - FP_S $f26, (_JB_FPREG_F26 * SZREG)(a0) - FP_S $f24, (_JB_FPREG_F24 * SZREG)(a0) -#endif -#if defined(__mips_n32) || defined(__mips_o32) || defined(__mips_o64) - FP_S $f22, (_JB_FPREG_F22 * SZREG)(a0) - FP_S $f20, (_JB_FPREG_F20 * SZREG)(a0) -#endif -#if defined(__mips_o32) || defined(__mips_o64) - FP_S $f21, (_JB_FPREG_F21 * SZREG)(a0) - FP_S $f23, (_JB_FPREG_F23 * SZREG)(a0) -#endif -#if defined(__mips_n64) - FP_S $f25, (_JB_FPREG_F25 * SZREG)(a0) - FP_S $f27, (_JB_FPREG_F27 * SZREG)(a0) - FP_S $f29, (_JB_FPREG_F29 * SZREG)(a0) - FP_S $f31, (_JB_FPREG_F31 * SZREG)(a0) -#endif - INT_S v0, (_JB_FPREG_FCSR * SZREG)(a0) -#endif /* ! SOFTFLOAT */ + REG_S sp, (_JB_REG_SP * SZREG)(a0) REG_EPILOGUE j ra @@ -131,13 +94,6 @@ LEAF(_longjmp) REG_LI t0, _JB_MAGIC__SETJMP bne v0, t0, botch # jump if error PTR_ADDU sp, sp, CALLFRAME_SIZ # does not matter, sanity - /* - * From "MIPSpro N32 ABI Handbook", Table 2-1: - * Registers s0..s7 are callee-saved. - * The sp register is callee-saved. - * The fp (or s8) register is callee-saved. - * The gp register is callee-saved (for n32/n64). - */ REG_L s0, (_JB_REG_S0 * SZREG)(a0) REG_L s1, (_JB_REG_S1 * SZREG)(a0) REG_L s2, (_JB_REG_S2 * SZREG)(a0) @@ -146,42 +102,11 @@ LEAF(_longjmp) REG_L s5, (_JB_REG_S5 * SZREG)(a0) REG_L s6, (_JB_REG_S6 * SZREG)(a0) REG_L s7, (_JB_REG_S7 * SZREG)(a0) - REG_L sp, (_JB_REG_SP * SZREG)(a0) - REG_L s8, (_JB_REG_S8 * SZREG)(a0) #if defined(__mips_n32) || defined(__mips_n64) REG_L gp, (_JB_REG_GP * SZREG)(a0) #endif -#ifndef SOFTFLOAT - # get fpu status - INT_L v0, (_JB_FPREG_FCSR * SZREG)(a0) - ctc1 v0, $31 - /* - * From "MIPSpro N32 ABI Handbook", Table 2-1: - * In N32, FP registers F20, F22, F24, F26, F28, F30 are callee-saved. - * In N64, FP registers F24 .. F31 are callee-saved. - * In O32, FP registers F20 .. F23 are callee-saved. - */ -#if defined(__mips_n64) || defined(__mips_n32) - FP_L $f30, (_JB_FPREG_F30 * SZREG)(a0) - FP_L $f28, (_JB_FPREG_F28 * SZREG)(a0) - FP_L $f26, (_JB_FPREG_F26 * SZREG)(a0) - FP_L $f24, (_JB_FPREG_F24 * SZREG)(a0) -#endif -#if defined(__mips_n32) || defined(__mips_o32) || defined(__mips_o64) - FP_L $f22, (_JB_FPREG_F22 * SZREG)(a0) - FP_L $f20, (_JB_FPREG_F20 * SZREG)(a0) -#endif -#if defined(__mips_o32) || defined(__mips_o64) - FP_L $f21, (_JB_FPREG_F21 * SZREG)(a0) - FP_L $f23, (_JB_FPREG_F23 * SZREG)(a0) -#endif -#if defined(__mips_n64) - FP_L $f25, (_JB_FPREG_F25 * SZREG)(a0) - FP_L $f27, (_JB_FPREG_F27 * SZREG)(a0) - FP_L $f29, (_JB_FPREG_F29 * SZREG)(a0) - FP_L $f31, (_JB_FPREG_F31 * SZREG)(a0) -#endif -#endif /* ! SOFTFLOAT */ + REG_L sp, (_JB_REG_SP * SZREG)(a0) + REG_L s8, (_JB_REG_S8 * SZREG)(a0) REG_EPILOGUE move v0, a1 # get return value in 1st arg diff --git a/lib/libc/mips/gen/getcontextx.c b/lib/libc/mips/gen/getcontextx.c new file mode 100644 index 0000000..54f8513 --- /dev/null +++ b/lib/libc/mips/gen/getcontextx.c @@ -0,0 +1,76 @@ +/* + * 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/mips/gen/setjmp.S b/lib/libc/mips/gen/setjmp.S index 9c9e8b8..deeb892 100644 --- a/lib/libc/mips/gen/setjmp.S +++ b/lib/libc/mips/gen/setjmp.S @@ -86,13 +86,6 @@ NESTED(setjmp, SETJMP_FRAME_SIZE, ra) REG_LI v0, _JB_MAGIC_SETJMP REG_S v0, (_JB_MAGIC * SZREG)(a0) REG_S ra, (_JB_REG_RA * SZREG)(a0) - /* - * From "MIPSpro N32 ABI Handbook", Table 2-1: - * Registers s0..s7 are callee-saved. - * The sp register is callee-saved. - * The fp (or s8) register is callee-saved. - * The gp register is callee-saved (for n32/n64). - */ REG_S s0, (_JB_REG_S0 * SZREG)(a0) REG_S s1, (_JB_REG_S1 * SZREG)(a0) REG_S s2, (_JB_REG_S2 * SZREG)(a0) @@ -106,36 +99,6 @@ NESTED(setjmp, SETJMP_FRAME_SIZE, ra) #if defined(__mips_n32) || defined(__mips_n64) REG_S gp, (_JB_REG_GP * SZREG)(a0) #endif -#ifndef SOFTFLOAT - /* - * From "MIPSpro N32 ABI Handbook", Table 2-1: - * In N32, FP registers F20, F22, F24, F26, F28, F30 are callee-saved. - * In N64, FP registers F24 .. F31 are callee-saved. - * In O32, FP registers F20 .. F23 are callee-saved. - */ - cfc1 v0, $31 - INT_S v0, (_JB_FPREG_FCSR * SZREG)(a0) -#if defined(__mips_o32) || defined(__mips_o64) || defined(__mips_n32) - FP_S $f20, (_JB_FPREG_F20 * SZREG)(a0) - FP_S $f22, (_JB_FPREG_F22 * SZREG)(a0) -#endif -#if defined(__mips_o32) || defined(__mips_o64) - FP_S $f21, (_JB_FPREG_F21 * SZREG)(a0) - FP_S $f23, (_JB_FPREG_F23 * SZREG)(a0) -#endif -#if defined(__mips_n32) || defined(__mips_n64) - FP_S $f24, (_JB_FPREG_F24 * SZREG)(a0) - FP_S $f26, (_JB_FPREG_F26 * SZREG)(a0) - FP_S $f28, (_JB_FPREG_F28 * SZREG)(a0) - FP_S $f30, (_JB_FPREG_F30 * SZREG)(a0) -#endif -#if defined(__mips_n64) - FP_S $f25, (_JB_FPREG_F25 * SZREG)(a0) - FP_S $f27, (_JB_FPREG_F27 * SZREG)(a0) - FP_S $f29, (_JB_FPREG_F29 * SZREG)(a0) - FP_S $f31, (_JB_FPREG_F31 * SZREG)(a0) -#endif -#endif /* ! SOFTFLOAT */ move v0, zero jr ra @@ -170,13 +133,6 @@ NESTED(longjmp, LONGJMP_FRAME_SIZE, ra) REG_L a1, (CALLFRAME_SIZ + SZREG)(sp) # restore return value REG_L ra, (_JB_REG_RA * SZREG)(a0) - /* - * From "MIPSpro N32 ABI Handbook", Table 2-1: - * Registers s0..s7 are callee-saved. - * The sp register is callee-saved. - * The fp (or s8) register is callee-saved. - * The gp register is callee-saved (for n32/n64). - */ REG_L s0, (_JB_REG_S0 * SZREG)(a0) REG_L s1, (_JB_REG_S1 * SZREG)(a0) REG_L s2, (_JB_REG_S2 * SZREG)(a0) @@ -190,36 +146,6 @@ NESTED(longjmp, LONGJMP_FRAME_SIZE, ra) #if defined(__mips_n32) || defined(__mips_n64) REG_L gp, (_JB_REG_GP * SZREG)(a0) #endif -#ifndef SOFTFLOAT - /* - * From "MIPSpro N32 ABI Handbook", Table 2-1: - * In N32, FP registers F20, F22, F24, F26, F28, F30 are callee-saved. - * In N64, FP registers F23 .. F31 are callee-saved. - * In O32, FP registers F20 .. F23 are callee-saved. - */ - INT_L v0, (_JB_FPREG_FCSR * SZREG)(a0) - ctc1 v0, $31 -#if defined(__mips_n64) || defined(__mips_n32) - FP_L $f30, (_JB_FPREG_F30 * SZREG)(a0) - FP_L $f28, (_JB_FPREG_F28 * SZREG)(a0) - FP_L $f26, (_JB_FPREG_F26 * SZREG)(a0) - FP_L $f24, (_JB_FPREG_F24 * SZREG)(a0) -#endif -#if defined(__mips_n32) || defined(__mips_o32) || defined(__mips_o64) - FP_L $f22, (_JB_FPREG_F22 * SZREG)(a0) - FP_L $f20, (_JB_FPREG_F20 * SZREG)(a0) -#endif -#if defined(__mips_o32) || defined(__mips_o64) - FP_L $f21, (_JB_FPREG_F21 * SZREG)(a0) - FP_L $f23, (_JB_FPREG_F23 * SZREG)(a0) -#endif -#if defined(__mips_n64) - FP_L $f25, (_JB_FPREG_F25 * SZREG)(a0) - FP_L $f27, (_JB_FPREG_F27 * SZREG)(a0) - FP_L $f29, (_JB_FPREG_F29 * SZREG)(a0) - FP_L $f31, (_JB_FPREG_F31 * SZREG)(a0) -#endif -#endif /* ! SOFTFLOAT */ move v0, a1 j ra diff --git a/lib/libc/mips/gen/sigsetjmp.S b/lib/libc/mips/gen/sigsetjmp.S index 41c47f2..7705c29 100644 --- a/lib/libc/mips/gen/sigsetjmp.S +++ b/lib/libc/mips/gen/sigsetjmp.S @@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$"); LEAF(sigsetjmp) PIC_PROLOGUE(sigsetjmp) - bne a1, zero, 1f # do saving of signal mask? + bne a1, 0x0, 1f # do saving of signal mask? PIC_TAILCALL(_setjmp) 1: PIC_TAILCALL(setjmp) diff --git a/lib/libc/mips/sys/Makefile.inc b/lib/libc/mips/sys/Makefile.inc index 460e69b..c754f36 100644 --- a/lib/libc/mips/sys/Makefile.inc +++ b/lib/libc/mips/sys/Makefile.inc @@ -1,11 +1,15 @@ # $FreeBSD$ -SRCS+= trivial-vdso_tc.c +SRCS+= __vdso_gettc.c MDASM= Ovfork.S brk.S cerror.S exect.S \ fork.S pipe.S ptrace.S sbrk.S syscall.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 +NOASM= break.o exit.o ftruncate.o getlogin.o lseek.o mmap.o \ + openbsd_poll.o pread.o pwrite.o sstk.o truncate.o vfork.o yield.o PSEUDO= _exit.o _getlogin.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/aarch64/gen/flt_rounds.c b/lib/libc/mips/sys/__vdso_gettc.c index 6f8eeeb..b99bbc4 100644 --- a/lib/libc/aarch64/gen/flt_rounds.c +++ b/lib/libc/mips/sys/__vdso_gettc.c @@ -1,6 +1,5 @@ /*- - * Copyright (c) 2012 Ian Lepore <freebsd@damnhippie.dyndns.org> - * All rights reserved. + * 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 @@ -28,22 +27,22 @@ __FBSDID("$FreeBSD$"); #include <sys/types.h> +#include <sys/time.h> +#include <sys/vdso.h> +#include <errno.h> -#include <fenv.h> -#include <float.h> +#pragma weak __vdso_gettc +u_int +__vdso_gettc(const struct vdso_timehands *th) +{ -static int map[] = { - 1, /* round to nearest */ - 2, /* round to positive infinity */ - 3, /* round to negative infinity */ - 0 /* round to zero */ -}; + return (0); +} +#pragma weak __vdso_gettimekeep int -__flt_rounds(void) +__vdso_gettimekeep(struct vdso_timekeep **tk) { - uint64_t fpcr; - asm volatile("mrs %0, fpcr" : "=r" (fpcr)); - return map[(fpcr >> 22) & 3]; + return (ENOSYS); } diff --git a/lib/libc/net/Symbol.map b/lib/libc/net/Symbol.map index 01d3bcb..2eddc47 100644 --- a/lib/libc/net/Symbol.map +++ b/lib/libc/net/Symbol.map @@ -124,7 +124,6 @@ FBSD_1.0 { in6addr_nodelocal_allnodes; in6addr_linklocal_allnodes; sctp_getaddrlen; - sctp_getassocid; sctp_bindx; sctp_connectx; sctp_peeloff; diff --git a/lib/libc/net/base64.c b/lib/libc/net/base64.c index 8a9c59e..4335030 100644 --- a/lib/libc/net/base64.c +++ b/lib/libc/net/base64.c @@ -193,10 +193,12 @@ b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize) { */ int -b64_pton(const char *src, u_char *target, size_t targsize) +b64_pton(src, target, targsize) + char const *src; + u_char *target; + size_t targsize; { int tarindex, state, ch; - u_char nextbyte; char *pos; state = 0; @@ -224,28 +226,22 @@ b64_pton(const char *src, u_char *target, size_t targsize) break; case 1: if (target) { - if ((size_t)tarindex >= targsize) + if ((size_t)tarindex + 1 >= targsize) return (-1); target[tarindex] |= (pos - Base64) >> 4; - nextbyte = ((pos - Base64) & 0x0f) << 4; - if ((size_t)tarindex + 1 < targsize) - target[tarindex + 1] = nextbyte; - else if (nextbyte) - return (-1); + target[tarindex+1] = ((pos - Base64) & 0x0f) + << 4 ; } tarindex++; state = 2; break; case 2: if (target) { - if ((size_t)tarindex >= targsize) + if ((size_t)tarindex + 1 >= targsize) return (-1); target[tarindex] |= (pos - Base64) >> 2; - nextbyte = ((pos - Base64) & 0x03) << 6; - if ((size_t)tarindex + 1 < targsize) - target[tarindex + 1] = nextbyte; - else if (nextbyte) - return (-1); + target[tarindex+1] = ((pos - Base64) & 0x03) + << 6; } tarindex++; state = 3; @@ -303,8 +299,7 @@ b64_pton(const char *src, u_char *target, size_t targsize) * zeros. If we don't check them, they become a * subliminal channel. */ - if (target && (size_t)tarindex < targsize && - target[tarindex] != 0) + if (target && target[tarindex] != 0) return (-1); } } else { diff --git a/lib/libc/net/eui64.c b/lib/libc/net/eui64.c index bb3077f..d9ed76c 100644 --- a/lib/libc/net/eui64.c +++ b/lib/libc/net/eui64.c @@ -132,7 +132,6 @@ eui64_line(const char *l, struct eui64 *e, char *hostname, size_t len) goto bad; } - free(linehead); return (0); bad: diff --git a/lib/libc/net/getaddrinfo.3 b/lib/libc/net/getaddrinfo.3 index 570fc2e..5d03aab 100644 --- a/lib/libc/net/getaddrinfo.3 +++ b/lib/libc/net/getaddrinfo.3 @@ -237,8 +237,8 @@ pointer in each .Li addrinfo structure until a null pointer is encountered. The three members -.Fa ai_family , -.Fa ai_socktype , +.Fa ai_family, +.Fa ai_socktype, and .Fa ai_protocol in each returned diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c index 17c9b65..c50374e 100644 --- a/lib/libc/net/getaddrinfo.c +++ b/lib/libc/net/getaddrinfo.c @@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$"); #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> diff --git a/lib/libc/net/getifaddrs.3 b/lib/libc/net/getifaddrs.3 index b0b17bb..ff3f774 100644 --- a/lib/libc/net/getifaddrs.3 +++ b/lib/libc/net/getifaddrs.3 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 25, 2014 +.Dd May 21, 2013 .Dt GETIFADDRS 3 .Os .Sh NAME @@ -110,17 +110,19 @@ if one exists, otherwise it is NULL. .Pp The .Li ifa_data -field references address family specific data -in a pointer to the -.Fa struct if_data -(as defined in include file -.In net/if.h ) . +field references address family specific data. For .Dv AF_LINK -addresses, -it contains various interface attributes and statistics. -For all other address families, -it contains per-address interface statistics. +addresses it contains a pointer to the +.Fa struct if_data +(as defined in include file +.In net/if.h ) +which contains various interface attributes and statistics. +For all other address families, it contains a pointer to the +.Fa struct ifa_data +(as defined in include file +.In net/if.h ) +which contains per-address interface statistics. .Pp The data returned by .Fn getifaddrs diff --git a/lib/libc/net/ip6opt.c b/lib/libc/net/ip6opt.c index 2f0c51d..a467758 100644 --- a/lib/libc/net/ip6opt.c +++ b/lib/libc/net/ip6opt.c @@ -419,7 +419,7 @@ inet6_opt_append(void *extbuf, socklen_t extlen, int offset, u_int8_t type, * The option data length must have a value between 0 and 255, * inclusive, and is the length of the option data that follows. */ - if (len > 255 || len < 0 ) + if (len < 0 || len > 255) return(-1); /* diff --git a/lib/libc/net/name6.c b/lib/libc/net/name6.c index 89effe6..97880a2 100644 --- a/lib/libc/net/name6.c +++ b/lib/libc/net/name6.c @@ -94,6 +94,7 @@ __FBSDID("$FreeBSD$"); #include <netinet/in.h> #ifdef INET6 #include <net/if.h> +#include <net/if_var.h> #include <sys/sysctl.h> #include <sys/ioctl.h> #include <netinet6/in6_var.h> /* XXX */ diff --git a/lib/libc/net/nsdispatch.c b/lib/libc/net/nsdispatch.c index 4de1df3..c23315c 100644 --- a/lib/libc/net/nsdispatch.c +++ b/lib/libc/net/nsdispatch.c @@ -132,17 +132,14 @@ static void *nss_cache_cycle_prevention_func = NULL; #endif /* - * We keep track of nsdispatch() nesting depth in dispatch_depth. When a - * fallback method is invoked from nsdispatch(), we temporarily set - * fallback_depth to the current dispatch depth plus one. Subsequent - * calls at that exact depth will run in fallback mode (restricted to the - * same source as the call that was handled by the fallback method), while - * calls below that depth will be handled normally, allowing fallback - * methods to perform arbitrary lookups. + * When this is set to 1, nsdispatch won't use nsswitch.conf + * but will consult the 'defaults' source list only. + * NOTE: nested fallbacks (when nsdispatch calls fallback functions, + * which in turn calls nsdispatch, which should call fallback + * function) are not supported */ struct fb_state { - int dispatch_depth; - int fallback_depth; + int fb_dispatch; }; static void fb_endstate(void *); NSS_TLS_HANDLING(fb); @@ -616,7 +613,6 @@ _nsdispatch(void *retval, const ns_dtab disp_tab[], const char *database, void *mdata; int isthreaded, serrno, i, result, srclistsize; struct fb_state *st; - int saved_depth; #ifdef NS_CACHING nss_cache_data cache_data; @@ -648,8 +644,7 @@ _nsdispatch(void *retval, const ns_dtab disp_tab[], const char *database, result = NS_UNAVAIL; goto fin; } - ++st->dispatch_depth; - if (st->dispatch_depth > st->fallback_depth) { + if (st->fb_dispatch == 0) { dbt = vector_search(&database, _nsmap, _nsmapsize, sizeof(*_nsmap), string_compare); fb_method = nss_method_lookup(NSSRC_FALLBACK, database, @@ -718,13 +713,12 @@ _nsdispatch(void *retval, const ns_dtab disp_tab[], const char *database, break; } else { if (fb_method != NULL) { - saved_depth = st->fallback_depth; - st->fallback_depth = st->dispatch_depth + 1; + st->fb_dispatch = 1; va_start(ap, defaults); result = fb_method(retval, (void *)srclist[i].name, ap); va_end(ap); - st->fallback_depth = saved_depth; + st->fb_dispatch = 0; } else nss_log(LOG_DEBUG, "%s, %s, %s, not found, " "and no fallback provided", @@ -756,7 +750,6 @@ _nsdispatch(void *retval, const ns_dtab disp_tab[], const char *database, if (isthreaded) (void)_pthread_rwlock_unlock(&nss_lock); - --st->dispatch_depth; fin: errno = serrno; return (result); diff --git a/lib/libc/net/recv.c b/lib/libc/net/recv.c index 6a584ca..f71d478 100644 --- a/lib/libc/net/recv.c +++ b/lib/libc/net/recv.c @@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$"); #include <sys/types.h> #include <sys/socket.h> -#include "libc_private.h" #include <stddef.h> @@ -49,8 +48,5 @@ recv(s, buf, len, flags) * POSIX says recv() shall be a cancellation point, so call the * cancellation-enabled recvfrom() and not _recvfrom(). */ - return (((ssize_t (*)(int, void *, size_t, int, - struct sockaddr *, socklen_t *)) - __libc_interposing[INTERPOS_recvfrom])(s, buf, len, flags, - NULL, NULL)); + return (recvfrom(s, buf, len, flags, NULL, 0)); } diff --git a/lib/libc/net/sctp_recvmsg.3 b/lib/libc/net/sctp_recvmsg.3 index 945797d..e3ced9c 100644 --- a/lib/libc/net/sctp_recvmsg.3 +++ b/lib/libc/net/sctp_recvmsg.3 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 23, 2015 +.Dd August 13, 2007 .Dt SCTP_RECVMSG 3 .Os .Sh NAME @@ -98,13 +98,13 @@ receive buffer, then the argument will .Em not have the -.Dv MSG_EOR +.Dv MSG_EOF flag applied. If the message is a complete message then the .Fa flags argument will have -.Dv MSG_EOR +.Dv MSG_EOF set. Locally detected errors are indicated by a return value of -1 with @@ -282,12 +282,12 @@ This typically means that the socket is not connected and is a one-to-one style socket. .El .Sh SEE ALSO -.Xr getsockopt 2 , .Xr recv 2 , .Xr select 2 , -.Xr setsockopt 2 , .Xr socket 2 , .Xr write 2 , +.Xr getsockopt 2 , +.Xr setsockopt 2 , .Xr sctp_send 3 , .Xr sctp_sendmsg 3 , .Xr sendmsg 3 , diff --git a/lib/libc/net/sctp_send.3 b/lib/libc/net/sctp_send.3 index 9c7f833..37b0b71 100644 --- a/lib/libc/net/sctp_send.3 +++ b/lib/libc/net/sctp_send.3 @@ -337,7 +337,7 @@ is not connected and is a one-to-one style socket. .Xr select 2 , .Xr sendmsg 2 , .Xr socket 2 , -.Xr write 2 , +.Xr write 2 .Xr sctp_connectx 3 , .Xr sctp_recvmsg 3 , .Xr sctp_sendmsg 3 , diff --git a/lib/libc/net/sctp_sys_calls.c b/lib/libc/net/sctp_sys_calls.c index f07aa43..91527c3 100644 --- a/lib/libc/net/sctp_sys_calls.c +++ b/lib/libc/net/sctp_sys_calls.c @@ -383,9 +383,6 @@ sctp_opt_info(int sd, sctp_assoc_t id, int opt, void *arg, socklen_t * size) case SCTP_PR_ASSOC_STATUS: ((struct sctp_prstatus *)arg)->sprstat_assoc_id = id; break; - case SCTP_MAX_CWND: - ((struct sctp_assoc_value *)arg)->assoc_id = id; - break; default: break; } @@ -600,7 +597,6 @@ sctp_sendmsg(int s, msg.msg_iovlen = 1; msg.msg_control = cmsgbuf; msg.msg_controllen = CMSG_SPACE(sizeof(struct sctp_sndrcvinfo)); - msg.msg_flags = 0; cmsg = (struct cmsghdr *)cmsgbuf; cmsg->cmsg_level = IPPROTO_SCTP; cmsg->cmsg_type = SCTP_SNDRCV; @@ -667,7 +663,6 @@ sctp_send(int sd, const void *data, size_t len, msg.msg_iovlen = 1; msg.msg_control = cmsgbuf; msg.msg_controllen = CMSG_SPACE(sizeof(struct sctp_sndrcvinfo)); - msg.msg_flags = 0; cmsg = (struct cmsghdr *)cmsgbuf; cmsg->cmsg_level = IPPROTO_SCTP; cmsg->cmsg_type = SCTP_SNDRCV; @@ -825,6 +820,7 @@ sctp_recvmsg(int s, errno = EINVAL; return (-1); } + msg.msg_flags = 0; iov.iov_base = dbuf; iov.iov_len = len; msg.msg_name = (caddr_t)from; @@ -836,7 +832,6 @@ sctp_recvmsg(int s, msg.msg_iovlen = 1; msg.msg_control = cmsgbuf; msg.msg_controllen = sizeof(cmsgbuf); - msg.msg_flags = 0; sz = recvmsg(s, &msg, *msg_flags); *msg_flags = msg.msg_flags; if (sz <= 0) { @@ -891,7 +886,7 @@ sctp_recvv(int sd, struct sctp_rcvinfo *rcvinfo; struct sctp_nxtinfo *nxtinfo; - if (((info != NULL) && (infolen == NULL)) || + if (((info != NULL) && (infolen == NULL)) | ((info == NULL) && (infolen != NULL) && (*infolen != 0)) || ((info != NULL) && (infotype == NULL))) { errno = EINVAL; @@ -910,7 +905,6 @@ sctp_recvv(int sd, msg.msg_iovlen = iovlen; msg.msg_control = cmsgbuf; msg.msg_controllen = sizeof(cmsgbuf); - msg.msg_flags = 0; ret = recvmsg(sd, &msg, *flags); *flags = msg.msg_flags; if ((ret > 0) && diff --git a/lib/libc/net/send.c b/lib/libc/net/send.c index c44f4b9..93cdfda 100644 --- a/lib/libc/net/send.c +++ b/lib/libc/net/send.c @@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$"); #include <sys/types.h> #include <sys/socket.h> -#include "libc_private.h" #include <stddef.h> @@ -49,8 +48,5 @@ send(s, msg, len, flags) * POSIX says send() shall be a cancellation point, so call the * cancellation-enabled sendto() and not _sendto(). */ - return (((ssize_t (*)(int, const void *, size_t, int, - const struct sockaddr *, socklen_t)) - __libc_interposing[INTERPOS_sendto])(s, msg, len, flags, - NULL, 0)); + return (sendto(s, msg, len, flags, NULL, 0)); } diff --git a/lib/libc/nls/catopen.3 b/lib/libc/nls/catopen.3 index 7744b0b..7a16ee5 100644 --- a/lib/libc/nls/catopen.3 +++ b/lib/libc/nls/catopen.3 @@ -94,7 +94,7 @@ An empty string is substituted for undefined values. Path names templates defined in .Ev NLSPATH are separated by colons -.Pq Sq \&: . +.No ( Sq \&: ) . A leading or two adjacent colons is equivalent to specifying %N. .Pp diff --git a/lib/libc/nls/msgcat.c b/lib/libc/nls/msgcat.c index 0cba460..2859916 100644 --- a/lib/libc/nls/msgcat.c +++ b/lib/libc/nls/msgcat.c @@ -83,7 +83,6 @@ __FBSDID("$FreeBSD$"); np->name = strdup(n); \ np->path = NULL; \ np->catd = NLERR; \ - np->refcount = 0; \ np->lang = (l == NULL) ? NULL : \ strdup(l); \ np->caterrno = e; \ diff --git a/lib/libc/posix1e/acl_calc_mask.c b/lib/libc/posix1e/acl_calc_mask.c index 56215b9..a2d1527 100644 --- a/lib/libc/posix1e/acl_calc_mask.c +++ b/lib/libc/posix1e/acl_calc_mask.c @@ -104,7 +104,6 @@ acl_calc_mask(acl_t *acl_p) /* if no mask exists, check acl_cnt... */ if (acl_int_new->acl_cnt == ACL_MAX_ENTRIES) { errno = ENOMEM; - acl_free(acl_new); return (-1); } /* ...and add the mask entry */ diff --git a/lib/libc/posix1e/acl_set_flagset_np.3 b/lib/libc/posix1e/acl_set_flagset_np.3 index 685680d..2230c48 100644 --- a/lib/libc/posix1e/acl_set_flagset_np.3 +++ b/lib/libc/posix1e/acl_set_flagset_np.3 @@ -64,9 +64,9 @@ ACL is already branded as POSIX.1e. .Sh SEE ALSO .Xr acl 3 , .Xr acl_add_flag_np 3 , +.Xr acl_get_brand_np 3 , .Xr acl_clear_flags_np 3 , .Xr acl_delete_flag_np 3 , -.Xr acl_get_brand_np 3 , .Xr acl_get_flagset_np 3 , .Xr posix1e 3 .Sh STANDARDS diff --git a/lib/libc/aarch64/gen/_set_tp.c b/lib/libc/posix1e/acl_size.c index a587b2e..27ad651 100644 --- a/lib/libc/aarch64/gen/_set_tp.c +++ b/lib/libc/posix1e/acl_size.c @@ -1,5 +1,5 @@ -/*- - * Copyright (c) 2014 Andrew Turner +/* + * Copyright (c) 2001-2002 Chris D. Faulhaber * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * 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 + * ARE DISCLAIMED. IN NO EVENT SHALL 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) @@ -27,16 +27,17 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#include <string.h> #include <sys/types.h> +#include "namespace.h" +#include <sys/acl.h> +#include "un-namespace.h" -#include <machine/sysarch.h> +#include <errno.h> -#include <stdlib.h> - -void -_set_tp(void *tp) +ssize_t +acl_size(acl_t acl) { - asm volatile("msr tpidr_el0, %0" : : "r"(tp)); + errno = ENOSYS; + return (-1); } diff --git a/lib/libc/posix1e/acl_strip.c b/lib/libc/posix1e/acl_strip.c index 85dfb47..ae37b38 100644 --- a/lib/libc/posix1e/acl_strip.c +++ b/lib/libc/posix1e/acl_strip.c @@ -82,10 +82,8 @@ _posix1e_acl_strip_np(const acl_t aclp, int recalculate_mask) have_mask_entry = 0; acl_new = acl_init(ACL_MAX_ENTRIES); - if (acl_new == NULL) { - acl_free(acl_old); + if (acl_new == NULL) return (NULL); - } tag = ACL_UNDEFINED_TAG; /* only save the default user/group/other entries */ @@ -96,16 +94,16 @@ _posix1e_acl_strip_np(const acl_t aclp, int recalculate_mask) assert(_entry_brand(entry) == ACL_BRAND_POSIX); if (acl_get_tag_type(entry, &tag) == -1) - goto fail; + return (NULL); switch(tag) { case ACL_USER_OBJ: case ACL_GROUP_OBJ: case ACL_OTHER: if (acl_get_tag_type(entry, &tag) == -1) - goto fail; + return (NULL); if (acl_get_permset(entry, &perm) == -1) - goto fail; + return (NULL); if (acl_create_entry(&acl_new, &entry_new) == -1) return (NULL); if (acl_set_tag_type(entry_new, tag) == -1) @@ -122,10 +120,6 @@ _posix1e_acl_strip_np(const acl_t aclp, int recalculate_mask) default: break; } -fail: - acl_free(acl_new); - acl_free(acl_old); - return (NULL); } assert(_acl_brand(acl_new) == ACL_BRAND_POSIX); diff --git a/lib/libc/powerpc/Makefile.inc b/lib/libc/powerpc/Makefile.inc index 42982671..f378780 100644 --- a/lib/libc/powerpc/Makefile.inc +++ b/lib/libc/powerpc/Makefile.inc @@ -1,6 +1,6 @@ # $FreeBSD$ -SRCS+= trivial-vdso_tc.c +SRCS+= __vdso_gettc.c # Long double is 64-bits MDSRCS+=machdep_ldisd.c diff --git a/lib/libc/powerpc/gen/Makefile.inc b/lib/libc/powerpc/gen/Makefile.inc index 2a00ba3..81c6a69 100644 --- a/lib/libc/powerpc/gen/Makefile.inc +++ b/lib/libc/powerpc/gen/Makefile.inc @@ -1,11 +1,9 @@ # $FreeBSD$ SRCS += _ctx_start.S eabi.S fabs.S flt_rounds.c fpgetmask.c fpgetround.c \ - fpgetsticky.c fpsetmask.c fpsetround.c \ + fpgetsticky.c fpsetmask.c fpsetround.c getcontextx.c \ infinity.c ldexp.c makecontext.c _setjmp.S \ setjmp.S sigsetjmp.S signalcontext.c syncicache.c \ - _set_tp.c \ - trivial-getcontextx.c - + _set_tp.c diff --git a/lib/libc/powerpc/gen/_set_tp.c b/lib/libc/powerpc/gen/_set_tp.c index aa1150a..5a89698 100644 --- a/lib/libc/powerpc/gen/_set_tp.c +++ b/lib/libc/powerpc/gen/_set_tp.c @@ -29,6 +29,7 @@ void _set_tp(void *tpval) { + register void *tp __asm__("r2"); - __asm __volatile("mr 2,%0" :: "r"((char*)tpval + 0x7008)); + __asm __volatile("mr %0,%1" : "=r"(tp) : "r"((char*)tpval + 0x7008)); } diff --git a/lib/libc/powerpc/gen/_setjmp.S b/lib/libc/powerpc/gen/_setjmp.S index 663a8b6..e28386c 100644 --- a/lib/libc/powerpc/gen/_setjmp.S +++ b/lib/libc/powerpc/gen/_setjmp.S @@ -56,54 +56,12 @@ ENTRY(_setjmp) mr %r10,%r1 mr %r9,%r2 stmw %r9,20(%r3) - - /* FPRs */ - stfd %f14,112+0*8(%r3) - stfd %f15,112+1*8(%r3) - stfd %f16,112+2*8(%r3) - stfd %f17,112+3*8(%r3) - stfd %f18,112+4*8(%r3) - stfd %f19,112+5*8(%r3) - stfd %f20,112+6*8(%r3) - stfd %f21,112+7*8(%r3) - stfd %f22,112+8*8(%r3) - stfd %f23,112+9*8(%r3) - stfd %f24,112+10*8(%r3) - stfd %f25,112+11*8(%r3) - stfd %f26,112+12*8(%r3) - stfd %f27,112+13*8(%r3) - stfd %f28,112+14*8(%r3) - stfd %f29,112+15*8(%r3) - stfd %f30,112+16*8(%r3) - stfd %f31,112+17*8(%r3) - li %r3,0 blr END(_setjmp) ENTRY(_longjmp) lmw %r9,20(%r3) - - /* FPRs */ - lfd %f14,112+0*8(%r3) - lfd %f15,112+1*8(%r3) - lfd %f16,112+2*8(%r3) - lfd %f17,112+3*8(%r3) - lfd %f18,112+4*8(%r3) - lfd %f19,112+5*8(%r3) - lfd %f20,112+6*8(%r3) - lfd %f21,112+7*8(%r3) - lfd %f22,112+8*8(%r3) - lfd %f23,112+9*8(%r3) - lfd %f24,112+10*8(%r3) - lfd %f25,112+11*8(%r3) - lfd %f26,112+12*8(%r3) - lfd %f27,112+13*8(%r3) - lfd %f28,112+14*8(%r3) - lfd %f29,112+15*8(%r3) - lfd %f30,112+16*8(%r3) - lfd %f31,112+17*8(%r3) - mtlr %r11 mtcr %r12 mr %r1,%r10 diff --git a/lib/libc/powerpc/gen/getcontextx.c b/lib/libc/powerpc/gen/getcontextx.c new file mode 100644 index 0000000..54f8513 --- /dev/null +++ b/lib/libc/powerpc/gen/getcontextx.c @@ -0,0 +1,76 @@ +/* + * 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/powerpc/gen/setjmp.S b/lib/libc/powerpc/gen/setjmp.S index ef7cb7e..9325fc2 100644 --- a/lib/libc/powerpc/gen/setjmp.S +++ b/lib/libc/powerpc/gen/setjmp.S @@ -66,27 +66,6 @@ ENTRY(setjmp) mr %r10,%r1 /* r10 <- stackptr */ mr %r9,%r2 /* r9 <- global ptr */ stmw %r9,20(%r6) - - /* FPRs */ - stfd %f14,112+0*8(%r6) - stfd %f15,112+1*8(%r6) - stfd %f16,112+2*8(%r6) - stfd %f17,112+3*8(%r6) - stfd %f18,112+4*8(%r6) - stfd %f19,112+5*8(%r6) - stfd %f20,112+6*8(%r6) - stfd %f21,112+7*8(%r6) - stfd %f22,112+8*8(%r6) - stfd %f23,112+9*8(%r6) - stfd %f24,112+10*8(%r6) - stfd %f25,112+11*8(%r6) - stfd %f26,112+12*8(%r6) - stfd %f27,112+13*8(%r6) - stfd %f28,112+14*8(%r6) - stfd %f29,112+15*8(%r6) - stfd %f30,112+16*8(%r6) - stfd %f31,112+17*8(%r6) - li %r3,0 /* return (0) */ blr END(setjmp) @@ -94,27 +73,6 @@ END(setjmp) WEAK_REFERENCE(CNAME(__longjmp), longjmp) ENTRY(__longjmp) lmw %r9,20(%r3) /* restore regs */ - - /* FPRs */ - lfd %f14,112+0*8(%r3) - lfd %f15,112+1*8(%r3) - lfd %f16,112+2*8(%r3) - lfd %f17,112+3*8(%r3) - lfd %f18,112+4*8(%r3) - lfd %f19,112+5*8(%r3) - lfd %f20,112+6*8(%r3) - lfd %f21,112+7*8(%r3) - lfd %f22,112+8*8(%r3) - lfd %f23,112+9*8(%r3) - lfd %f24,112+10*8(%r3) - lfd %f25,112+11*8(%r3) - lfd %f26,112+12*8(%r3) - lfd %f27,112+13*8(%r3) - lfd %f28,112+14*8(%r3) - lfd %f29,112+15*8(%r3) - lfd %f30,112+16*8(%r3) - lfd %f31,112+17*8(%r3) - mr %r6,%r4 /* save val param */ mtlr %r11 /* r11 -> link reg */ mtcr %r12 /* r12 -> condition reg */ diff --git a/lib/libc/powerpc/gen/sigsetjmp.S b/lib/libc/powerpc/gen/sigsetjmp.S index 9c75f4f..c67afc6 100644 --- a/lib/libc/powerpc/gen/sigsetjmp.S +++ b/lib/libc/powerpc/gen/sigsetjmp.S @@ -71,54 +71,12 @@ ENTRY(sigsetjmp) mr %r10,%r1 mr %r9,%r2 stmw %r9,20(%r6) - - /* FPRs */ - stfd %f14,112+0*8(%r6) - stfd %f15,112+1*8(%r6) - stfd %f16,112+2*8(%r6) - stfd %f17,112+3*8(%r6) - stfd %f18,112+4*8(%r6) - stfd %f19,112+5*8(%r6) - stfd %f20,112+6*8(%r6) - stfd %f21,112+7*8(%r6) - stfd %f22,112+8*8(%r6) - stfd %f23,112+9*8(%r6) - stfd %f24,112+10*8(%r6) - stfd %f25,112+11*8(%r6) - stfd %f26,112+12*8(%r6) - stfd %f27,112+13*8(%r6) - stfd %f28,112+14*8(%r6) - stfd %f29,112+15*8(%r6) - stfd %f30,112+16*8(%r6) - stfd %f31,112+17*8(%r6) - li %r3,0 blr END(sigsetjmp) ENTRY(siglongjmp) lmw %r9,20(%r3) - - /* FPRs */ - lfd %f14,112+0*8(%r3) - lfd %f15,112+1*8(%r3) - lfd %f16,112+2*8(%r3) - lfd %f17,112+3*8(%r3) - lfd %f18,112+4*8(%r3) - lfd %f19,112+5*8(%r3) - lfd %f20,112+6*8(%r3) - lfd %f21,112+7*8(%r3) - lfd %f22,112+8*8(%r3) - lfd %f23,112+9*8(%r3) - lfd %f24,112+10*8(%r3) - lfd %f25,112+11*8(%r3) - lfd %f26,112+12*8(%r3) - lfd %f27,112+13*8(%r3) - lfd %f28,112+14*8(%r3) - lfd %f29,112+15*8(%r3) - lfd %f30,112+16*8(%r3) - lfd %f31,112+17*8(%r3) - lwz %r7,0(%r3) mr %r6,%r4 mtlr %r11 diff --git a/lib/libc/powerpc/sys/Makefile.inc b/lib/libc/powerpc/sys/Makefile.inc index 98ec888..ad98ba1 100644 --- a/lib/libc/powerpc/sys/Makefile.inc +++ b/lib/libc/powerpc/sys/Makefile.inc @@ -6,3 +6,6 @@ MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.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/aarch64/sys/sigreturn.S b/lib/libc/powerpc/sys/__vdso_gettc.c index 21ec1e4..b99bbc4 100644 --- a/lib/libc/aarch64/sys/sigreturn.S +++ b/lib/libc/powerpc/sys/__vdso_gettc.c @@ -1,9 +1,5 @@ /*- - * Copyright (c) 2014 The FreeBSD Foundation - * All rights reserved. - * - * This software was developed by Andrew Turner under - * sponsorship from the FreeBSD Foundation. + * 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 @@ -27,9 +23,26 @@ * SUCH DAMAGE. */ -#include <machine/asm.h> +#include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#include "SYS.h" +#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) +{ -RSYSCALL(sigreturn) + return (ENOSYS); +} diff --git a/lib/libc/powerpc64/Makefile.inc b/lib/libc/powerpc64/Makefile.inc index 8e9bcc5..2a080f6 100644 --- a/lib/libc/powerpc64/Makefile.inc +++ b/lib/libc/powerpc64/Makefile.inc @@ -1,6 +1,6 @@ # $FreeBSD$ -SRCS+= trivial-vdso_tc.c +SRCS+= __vdso_gettc.c # Long double is 64-bits MDSRCS+=machdep_ldisd.c diff --git a/lib/libc/powerpc64/gen/Makefile.inc b/lib/libc/powerpc64/gen/Makefile.inc index 864fb9e..79a2746 100644 --- a/lib/libc/powerpc64/gen/Makefile.inc +++ b/lib/libc/powerpc64/gen/Makefile.inc @@ -1,10 +1,9 @@ # $FreeBSD$ SRCS += _ctx_start.S fabs.S flt_rounds.c fpgetmask.c fpgetround.c \ - fpgetsticky.c fpsetmask.c fpsetround.c \ + fpgetsticky.c fpsetmask.c fpsetround.c getcontextx.c \ infinity.c ldexp.c makecontext.c _setjmp.S \ setjmp.S sigsetjmp.S signalcontext.c syncicache.c \ - _set_tp.c \ - trivial-getcontextx.c + _set_tp.c diff --git a/lib/libc/powerpc64/gen/_set_tp.c b/lib/libc/powerpc64/gen/_set_tp.c index 32137e5..9adb6a5 100644 --- a/lib/libc/powerpc64/gen/_set_tp.c +++ b/lib/libc/powerpc64/gen/_set_tp.c @@ -29,6 +29,7 @@ void _set_tp(void *tpval) { + register void *tp __asm__("r13"); - __asm __volatile("mr 13,%0" :: "r"((char*)tpval + 0x7010)); + __asm __volatile("mr %0,%1" : "=r"(tp) : "r"((char*)tpval + 0x7010)); } diff --git a/lib/libc/powerpc64/gen/_setjmp.S b/lib/libc/powerpc64/gen/_setjmp.S index f7689ae..207c4f7 100644 --- a/lib/libc/powerpc64/gen/_setjmp.S +++ b/lib/libc/powerpc64/gen/_setjmp.S @@ -56,41 +56,23 @@ ENTRY(_setjmp) mr %r10,%r1 mr %r9,%r2 std %r9,40 + 0*8(%r3) - stfd %f14,40 + 23*8(%r3) std %r10,40 + 1*8(%r3) - stfd %f15,40 + 24*8(%r3) std %r11,40 + 2*8(%r3) - stfd %f16,40 + 25*8(%r3) std %r12,40 + 3*8(%r3) - stfd %f17,40 + 26*8(%r3) std %r13,40 + 4*8(%r3) - stfd %f18,40 + 27*8(%r3) std %r14,40 + 5*8(%r3) - stfd %f19,40 + 28*8(%r3) std %r15,40 + 6*8(%r3) - stfd %f20,40 + 29*8(%r3) std %r16,40 + 7*8(%r3) - stfd %f21,40 + 30*8(%r3) std %r17,40 + 8*8(%r3) - stfd %f22,40 + 31*8(%r3) std %r18,40 + 9*8(%r3) - stfd %f23,40 + 32*8(%r3) std %r19,40 + 10*8(%r3) - stfd %f24,40 + 33*8(%r3) std %r20,40 + 11*8(%r3) - stfd %f25,40 + 34*8(%r3) std %r21,40 + 12*8(%r3) - stfd %f26,40 + 35*8(%r3) std %r22,40 + 13*8(%r3) - stfd %f27,40 + 36*8(%r3) std %r23,40 + 14*8(%r3) - stfd %f28,40 + 37*8(%r3) std %r24,40 + 15*8(%r3) - stfd %f29,40 + 38*8(%r3) std %r25,40 + 16*8(%r3) - stfd %f30,40 + 39*8(%r3) std %r26,40 + 17*8(%r3) - stfd %f31,40 + 40*8(%r3) std %r27,40 + 18*8(%r3) std %r28,40 + 19*8(%r3) std %r29,40 + 20*8(%r3) @@ -102,41 +84,23 @@ END(_setjmp) ENTRY(_longjmp) ld %r9,40 + 0*8(%r3) - lfd %f14,40 + 23*8(%r3) ld %r10,40 + 1*8(%r3) - lfd %f15,40 + 24*8(%r3) ld %r11,40 + 2*8(%r3) - lfd %f16,40 + 25*8(%r3) ld %r12,40 + 3*8(%r3) - lfd %f17,40 + 26*8(%r3) ld %r14,40 + 5*8(%r3) - lfd %f18,40 + 27*8(%r3) ld %r15,40 + 6*8(%r3) - lfd %f19,40 + 28*8(%r3) ld %r16,40 + 7*8(%r3) - lfd %f20,40 + 29*8(%r3) ld %r17,40 + 8*8(%r3) - lfd %f21,40 + 30*8(%r3) ld %r18,40 + 9*8(%r3) - lfd %f22,40 + 31*8(%r3) ld %r19,40 + 10*8(%r3) - lfd %f23,40 + 32*8(%r3) ld %r20,40 + 11*8(%r3) - lfd %f24,40 + 33*8(%r3) ld %r21,40 + 12*8(%r3) - lfd %f25,40 + 34*8(%r3) ld %r22,40 + 13*8(%r3) - lfd %f26,40 + 35*8(%r3) ld %r23,40 + 14*8(%r3) - lfd %f27,40 + 36*8(%r3) ld %r24,40 + 15*8(%r3) - lfd %f28,40 + 37*8(%r3) ld %r25,40 + 16*8(%r3) - lfd %f29,40 + 38*8(%r3) ld %r26,40 + 17*8(%r3) - lfd %f30,40 + 39*8(%r3) ld %r27,40 + 18*8(%r3) - lfd %f31,40 + 40*8(%r3) ld %r28,40 + 19*8(%r3) ld %r29,40 + 20*8(%r3) ld %r30,40 + 21*8(%r3) diff --git a/lib/libc/powerpc64/gen/getcontextx.c b/lib/libc/powerpc64/gen/getcontextx.c new file mode 100644 index 0000000..54f8513 --- /dev/null +++ b/lib/libc/powerpc64/gen/getcontextx.c @@ -0,0 +1,76 @@ +/* + * 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/powerpc64/gen/setjmp.S b/lib/libc/powerpc64/gen/setjmp.S index 5eb395e..1495466 100644 --- a/lib/libc/powerpc64/gen/setjmp.S +++ b/lib/libc/powerpc64/gen/setjmp.S @@ -67,49 +67,29 @@ ENTRY(setjmp) mr %r9,%r2 /* r9 <- global ptr */ std %r9,40 + 0*8(%r6) - stfd %f14,40 + 23*8(%r6) std %r10,40 + 1*8(%r6) - stfd %f15,40 + 24*8(%r6) std %r11,40 + 2*8(%r6) - stfd %f16,40 + 25*8(%r6) std %r12,40 + 3*8(%r6) - stfd %f17,40 + 26*8(%r6) std %r13,40 + 4*8(%r6) - stfd %f18,40 + 27*8(%r6) std %r14,40 + 5*8(%r6) - stfd %f19,40 + 28*8(%r6) std %r15,40 + 6*8(%r6) - stfd %f20,40 + 29*8(%r6) std %r16,40 + 7*8(%r6) - stfd %f21,40 + 30*8(%r6) std %r17,40 + 8*8(%r6) - stfd %f22,40 + 31*8(%r6) std %r18,40 + 9*8(%r6) - stfd %f23,40 + 32*8(%r6) std %r19,40 + 10*8(%r6) - stfd %f24,40 + 33*8(%r6) std %r20,40 + 11*8(%r6) - stfd %f25,40 + 34*8(%r6) std %r21,40 + 12*8(%r6) - stfd %f26,40 + 35*8(%r6) std %r22,40 + 13*8(%r6) - stfd %f27,40 + 36*8(%r6) std %r23,40 + 14*8(%r6) - stfd %f28,40 + 37*8(%r6) std %r24,40 + 15*8(%r6) - stfd %f29,40 + 38*8(%r6) std %r25,40 + 16*8(%r6) - stfd %f30,40 + 39*8(%r6) std %r26,40 + 17*8(%r6) - stfd %f31,40 + 40*8(%r6) std %r27,40 + 18*8(%r6) std %r28,40 + 19*8(%r6) std %r29,40 + 20*8(%r6) std %r30,40 + 21*8(%r6) std %r31,40 + 22*8(%r6) - /* XXX Altivec regs */ - li %r3,0 /* return (0) */ blr END(setjmp) @@ -117,41 +97,23 @@ END(setjmp) WEAK_REFERENCE(__longjmp, longjmp) ENTRY(__longjmp) ld %r9,40 + 0*8(%r3) - lfd %f14,40 + 23*8(%r3) ld %r10,40 + 1*8(%r3) - lfd %f15,40 + 24*8(%r3) ld %r11,40 + 2*8(%r3) - lfd %f16,40 + 25*8(%r3) ld %r12,40 + 3*8(%r3) - lfd %f17,40 + 26*8(%r3) ld %r14,40 + 5*8(%r3) - lfd %f18,40 + 27*8(%r3) ld %r15,40 + 6*8(%r3) - lfd %f19,40 + 28*8(%r3) ld %r16,40 + 7*8(%r3) - lfd %f20,40 + 29*8(%r3) ld %r17,40 + 8*8(%r3) - lfd %f21,40 + 30*8(%r3) ld %r18,40 + 9*8(%r3) - lfd %f22,40 + 31*8(%r3) ld %r19,40 + 10*8(%r3) - lfd %f23,40 + 32*8(%r3) ld %r20,40 + 11*8(%r3) - lfd %f24,40 + 33*8(%r3) ld %r21,40 + 12*8(%r3) - lfd %f25,40 + 34*8(%r3) ld %r22,40 + 13*8(%r3) - lfd %f26,40 + 35*8(%r3) ld %r23,40 + 14*8(%r3) - lfd %f27,40 + 36*8(%r3) ld %r24,40 + 15*8(%r3) - lfd %f28,40 + 37*8(%r3) ld %r25,40 + 16*8(%r3) - lfd %f29,40 + 38*8(%r3) ld %r26,40 + 17*8(%r3) - lfd %f30,40 + 39*8(%r3) ld %r27,40 + 18*8(%r3) - lfd %f31,40 + 40*8(%r3) ld %r28,40 + 19*8(%r3) ld %r29,40 + 20*8(%r3) ld %r30,40 + 21*8(%r3) diff --git a/lib/libc/powerpc64/gen/sigsetjmp.S b/lib/libc/powerpc64/gen/sigsetjmp.S index c0648a6..5cfd684 100644 --- a/lib/libc/powerpc64/gen/sigsetjmp.S +++ b/lib/libc/powerpc64/gen/sigsetjmp.S @@ -72,41 +72,23 @@ ENTRY(sigsetjmp) mr %r9,%r2 std %r9,40 + 0*8(%r6) - stfd %f14,40 + 23*8(%r6) std %r10,40 + 1*8(%r6) - stfd %f15,40 + 24*8(%r6) std %r11,40 + 2*8(%r6) - stfd %f16,40 + 25*8(%r6) std %r12,40 + 3*8(%r6) - stfd %f17,40 + 26*8(%r6) std %r13,40 + 4*8(%r6) - stfd %f18,40 + 27*8(%r6) std %r14,40 + 5*8(%r6) - stfd %f19,40 + 28*8(%r6) std %r15,40 + 6*8(%r6) - stfd %f20,40 + 29*8(%r6) std %r16,40 + 7*8(%r6) - stfd %f21,40 + 30*8(%r6) std %r17,40 + 8*8(%r6) - stfd %f22,40 + 31*8(%r6) std %r18,40 + 9*8(%r6) - stfd %f23,40 + 32*8(%r6) std %r19,40 + 10*8(%r6) - stfd %f24,40 + 33*8(%r6) std %r20,40 + 11*8(%r6) - stfd %f25,40 + 34*8(%r6) std %r21,40 + 12*8(%r6) - stfd %f26,40 + 35*8(%r6) std %r22,40 + 13*8(%r6) - stfd %f27,40 + 36*8(%r6) std %r23,40 + 14*8(%r6) - stfd %f28,40 + 37*8(%r6) std %r24,40 + 15*8(%r6) - stfd %f29,40 + 38*8(%r6) std %r25,40 + 16*8(%r6) - stfd %f30,40 + 39*8(%r6) std %r26,40 + 17*8(%r6) - stfd %f31,40 + 40*8(%r6) std %r27,40 + 18*8(%r6) std %r28,40 + 19*8(%r6) std %r29,40 + 20*8(%r6) @@ -119,41 +101,23 @@ END(sigsetjmp) ENTRY(siglongjmp) ld %r9,40 + 0*8(%r3) - lfd %f14,40 + 23*8(%r3) ld %r10,40 + 1*8(%r3) - lfd %f15,40 + 24*8(%r3) ld %r11,40 + 2*8(%r3) - lfd %f16,40 + 25*8(%r3) ld %r12,40 + 3*8(%r3) - lfd %f17,40 + 26*8(%r3) ld %r14,40 + 5*8(%r3) - lfd %f18,40 + 27*8(%r3) ld %r15,40 + 6*8(%r3) - lfd %f19,40 + 28*8(%r3) ld %r16,40 + 7*8(%r3) - lfd %f20,40 + 29*8(%r3) ld %r17,40 + 8*8(%r3) - lfd %f21,40 + 30*8(%r3) ld %r18,40 + 9*8(%r3) - lfd %f22,40 + 31*8(%r3) ld %r19,40 + 10*8(%r3) - lfd %f23,40 + 32*8(%r3) ld %r20,40 + 11*8(%r3) - lfd %f24,40 + 33*8(%r3) ld %r21,40 + 12*8(%r3) - lfd %f25,40 + 34*8(%r3) ld %r22,40 + 13*8(%r3) - lfd %f26,40 + 35*8(%r3) ld %r23,40 + 14*8(%r3) - lfd %f27,40 + 36*8(%r3) ld %r24,40 + 15*8(%r3) - lfd %f28,40 + 37*8(%r3) ld %r25,40 + 16*8(%r3) - lfd %f29,40 + 38*8(%r3) ld %r26,40 + 17*8(%r3) - lfd %f30,40 + 39*8(%r3) ld %r27,40 + 18*8(%r3) - lfd %f31,40 + 40*8(%r3) ld %r28,40 + 19*8(%r3) ld %r29,40 + 20*8(%r3) ld %r30,40 + 21*8(%r3) diff --git a/lib/libc/powerpc64/sys/Makefile.inc b/lib/libc/powerpc64/sys/Makefile.inc index 98ec888..ad98ba1 100644 --- a/lib/libc/powerpc64/sys/Makefile.inc +++ b/lib/libc/powerpc64/sys/Makefile.inc @@ -6,3 +6,6 @@ MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.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/powerpc64/sys/__vdso_gettc.c b/lib/libc/powerpc64/sys/__vdso_gettc.c new file mode 100644 index 0000000..b99bbc4 --- /dev/null +++ b/lib/libc/powerpc64/sys/__vdso_gettc.c @@ -0,0 +1,48 @@ +/*- + * 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/regex/engine.c b/lib/libc/regex/engine.c index 436370d..589bb9d 100644 --- a/lib/libc/regex/engine.c +++ b/lib/libc/regex/engine.c @@ -157,7 +157,7 @@ matcher(struct re_guts *g, int i; struct match mv; struct match *m = &mv; - const char *dp = NULL; + const char *dp; const sopno gf = g->firststate+1; /* +1 for OEND */ const sopno gl = g->laststate; const char *start; @@ -244,7 +244,7 @@ matcher(struct re_guts *g, ZAPSTATE(&m->mbs); /* Adjust start according to moffset, to speed things up */ - if (dp != NULL && g->moffset > -1) + if (g->moffset > -1) start = ((dp - g->moffset) < start) ? start : dp - g->moffset; SP("mloop", m->st, *start); diff --git a/lib/libc/regex/re_format.7 b/lib/libc/regex/re_format.7 index b3f9561..05b1494 100644 --- a/lib/libc/regex/re_format.7 +++ b/lib/libc/regex/re_format.7 @@ -314,10 +314,10 @@ 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 +The additional word delimiters .Ql \e< and -.Ql \e> +.Ql \e> are provided to ease compatibility with traditional .Xr svr4 4 systems but are not portable and should be avoided. @@ -392,12 +392,10 @@ and .Ql ?\& are ordinary characters, and their functionality can be expressed using bounds -.Po -.Ql {1,} +.No ( Ql {1,} or .Ql {0,1} -respectively -.Pc . +respectively). Also note that .Ql x+ in modern REs is equivalent to diff --git a/lib/libc/regex/regcomp.c b/lib/libc/regex/regcomp.c index 2f2d827..a01bb95 100644 --- a/lib/libc/regex/regcomp.c +++ b/lib/libc/regex/regcomp.c @@ -192,7 +192,6 @@ regcomp(regex_t * __restrict preg, struct parse *p = &pa; int i; size_t len; - size_t maxlen; #ifdef REDEBUG # define GOODFLAGS(f) (f) #else @@ -214,23 +213,7 @@ regcomp(regex_t * __restrict preg, g = (struct re_guts *)malloc(sizeof(struct re_guts)); if (g == NULL) return(REG_ESPACE); - /* - * Limit the pattern space to avoid a 32-bit overflow on buffer - * extension. Also avoid any signed overflow in case of conversion - * so make the real limit based on a 31-bit overflow. - * - * Likely not applicable on 64-bit systems but handle the case - * generically (who are we to stop people from using ~715MB+ - * patterns?). - */ - maxlen = ((size_t)-1 >> 1) / sizeof(sop) * 2 / 3; - if (len >= maxlen) { - free((char *)g); - return(REG_ESPACE); - } p->ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */ - assert(p->ssize >= len); - p->strip = (sop *)malloc(p->ssize * sizeof(sop)); p->slen = 0; if (p->strip == NULL) { @@ -1422,8 +1405,8 @@ static void findmust(struct parse *p, struct re_guts *g) { sop *scan; - sop *start = NULL; - sop *newstart = NULL; + sop *start; + sop *newstart; sopno newlen; sop s; char *cp; @@ -1726,17 +1709,15 @@ computematchjumps(struct parse *p, struct re_guts *g) if (p->error != 0) return; - pmatches = (int*) malloc(g->mlen * sizeof(int)); + pmatches = (int*) malloc(g->mlen * sizeof(unsigned int)); if (pmatches == NULL) { g->matchjump = NULL; return; } - g->matchjump = (int*) malloc(g->mlen * sizeof(int)); - if (g->matchjump == NULL) { /* Not a fatal error */ - free(pmatches); + g->matchjump = (int*) malloc(g->mlen * sizeof(unsigned int)); + if (g->matchjump == NULL) /* Not a fatal error */ return; - } /* Set maximum possible jump for each character in the pattern */ for (mindex = 0; mindex < g->mlen; mindex++) diff --git a/lib/libc/regex/regex.3 b/lib/libc/regex/regex.3 index 6df2f09..ea1ba25 100644 --- a/lib/libc/regex/regex.3 +++ b/lib/libc/regex/regex.3 @@ -420,12 +420,10 @@ it should have been the result from the most recent using that .Ft regex_t . The -.Po -.Fn regerror +.Fn ( regerror may be able to supply a more detailed message using information from the -.Ft regex_t . -.Pc +.Ft regex_t . ) The .Fn regerror function diff --git a/lib/libc/rpc/clnt_dg.c b/lib/libc/rpc/clnt_dg.c index cebbaf9..5feab88 100644 --- a/lib/libc/rpc/clnt_dg.c +++ b/lib/libc/rpc/clnt_dg.c @@ -327,7 +327,7 @@ clnt_dg_call(cl, proc, xargs, argsp, xresults, resultsp, utimeout) struct sockaddr *sa; sigset_t mask; sigset_t newmask; - socklen_t salen; + socklen_t inlen, salen; ssize_t recvlen = 0; int kin_len, n, rpc_lock_value; u_int32_t xid; @@ -520,6 +520,7 @@ get_reply: goto call_again_same_xid; } } + inlen = (socklen_t)recvlen; /* * now decode and validate the response diff --git a/lib/libc/rpc/crypt_client.c b/lib/libc/rpc/crypt_client.c index 5290021..4e5c793 100644 --- a/lib/libc/rpc/crypt_client.c +++ b/lib/libc/rpc/crypt_client.c @@ -64,7 +64,6 @@ _des_crypt_call(buf, len, dparms) } if (nconf == NULL) { warnx("getnetconfig: %s", nc_sperror()); - endnetconfig(localhandle); return(DESERR_HWERROR); } clnt = clnt_tp_create(NULL, CRYPT_PROG, CRYPT_VERS, nconf); diff --git a/lib/libc/rpc/rpc.3 b/lib/libc/rpc/rpc.3 index 988b5f1..4fa3e2c 100644 --- a/lib/libc/rpc/rpc.3 +++ b/lib/libc/rpc/rpc.3 @@ -504,6 +504,7 @@ pages on which they are described: .Sh SEE ALSO .Xr getnetconfig 3 , .Xr getnetpath 3 , +.Xr rpcbind 3 , .Xr rpc_clnt_auth 3 , .Xr rpc_clnt_calls 3 , .Xr rpc_clnt_create 3 , @@ -512,6 +513,5 @@ pages on which they are described: .Xr rpc_svc_err 3 , .Xr rpc_svc_reg 3 , .Xr rpc_xdr 3 , -.Xr rpcbind 3 , .Xr xdr 3 , .Xr netconfig 5 diff --git a/lib/libc/rpc/rpc_soc.c b/lib/libc/rpc/rpc_soc.c index febc597..d7702f5 100644 --- a/lib/libc/rpc/rpc_soc.c +++ b/lib/libc/rpc/rpc_soc.c @@ -462,10 +462,12 @@ clntunix_create(raddr, prog, vers, sockp, sendsz, recvsz) u_int recvsz; { struct netbuf *svcaddr; + struct netconfig *nconf; CLIENT *cl; int len; cl = NULL; + nconf = NULL; svcaddr = NULL; if ((raddr->sun_len == 0) || ((svcaddr = malloc(sizeof(struct netbuf))) == NULL ) || diff --git a/lib/libc/rpc/rpc_svc_reg.3 b/lib/libc/rpc/rpc_svc_reg.3 index 81a749a..aed2ba1 100644 --- a/lib/libc/rpc/rpc_svc_reg.3 +++ b/lib/libc/rpc/rpc_svc_reg.3 @@ -176,8 +176,8 @@ Service implementors usually do not need this routine. .Sh SEE ALSO .Xr select 2 , .Xr rpc 3 , +.Xr rpcbind 3 , .Xr rpc_svc_calls 3 , .Xr rpc_svc_create 3 , .Xr rpc_svc_err 3 , -.Xr rpcbind 3 , .Xr rpcbind 8 diff --git a/lib/libc/rpc/rpcbind.3 b/lib/libc/rpc/rpcbind.3 index 3bf8be9..0b716ca 100644 --- a/lib/libc/rpc/rpcbind.3 +++ b/lib/libc/rpc/rpcbind.3 @@ -25,7 +25,7 @@ .Ft bool_t .Fn rpcb_gettime "const char *host" "time_t * timep" .Ft "enum clnt_stat" -.Fn rpcb_rmtcall "const struct netconfig *netconf" "const char *host" "const rpcprog_t prognum" "const rpcvers_t versnum" "const rpcproc_t procnum" "const xdrproc_t inproc" "const caddr_t in" "const xdrproc_t outproc" "const caddr_t out" "const struct timeval tout" "const struct netbuf *svcaddr" +.Fn rpcb_rmtcall "const struct netconfig *netconf" "const char *host" "const rpcprog_t prognum, const rpcvers_t versnum" "const rpcproc_t procnum, const xdrproc_t inproc" "const caddr_t in" "const xdrproc_t outproc" "const caddr_t out" "const struct timeval tout, const struct netbuf *svcaddr" .Ft bool_t .Fn rpcb_set "const rpcprog_t prognum" "const rpcvers_t versnum" "const struct netconfig *netconf" "const struct netbuf *svcaddr" .Ft bool_t diff --git a/lib/libc/rpc/svc_vc.c b/lib/libc/rpc/svc_vc.c index aa45396..f830425 100644 --- a/lib/libc/rpc/svc_vc.c +++ b/lib/libc/rpc/svc_vc.c @@ -128,7 +128,7 @@ svc_vc_create(fd, sendsize, recvsize) u_int sendsize; u_int recvsize; { - SVCXPRT *xprt = NULL; + SVCXPRT *xprt; struct cf_rendezvous *r = NULL; struct __rpc_sockinfo si; struct sockaddr_storage sslocal; diff --git a/lib/libc/sparc64/Makefile.inc b/lib/libc/sparc64/Makefile.inc index 74fb7cd..af23ae4 100644 --- a/lib/libc/sparc64/Makefile.inc +++ b/lib/libc/sparc64/Makefile.inc @@ -5,7 +5,7 @@ .include "fpu/Makefile.inc" -SRCS+= trivial-vdso_tc.c +SRCS+= __vdso_gettc.c # Long double is quad precision GDTOASRCS+=strtorQ.c diff --git a/lib/libc/sparc64/gen/Makefile.inc b/lib/libc/sparc64/gen/Makefile.inc index 5442a33..d3fbfe4 100644 --- a/lib/libc/sparc64/gen/Makefile.inc +++ b/lib/libc/sparc64/gen/Makefile.inc @@ -2,6 +2,5 @@ SRCS+= _ctx_start.S _setjmp.S fabs.S fixunsdfsi.S flt_rounds.c fpgetmask.c \ fpgetround.c fpgetsticky.c fpsetmask.c fpsetround.c \ - infinity.c ldexp.c makecontext.c \ - signalcontext.c setjmp.S sigsetjmp.S _set_tp.c \ - trivial-getcontextx.c + getcontextx.c infinity.c ldexp.c makecontext.c \ + signalcontext.c setjmp.S sigsetjmp.S _set_tp.c diff --git a/lib/libc/sparc64/gen/getcontextx.c b/lib/libc/sparc64/gen/getcontextx.c new file mode 100644 index 0000000..54f8513 --- /dev/null +++ b/lib/libc/sparc64/gen/getcontextx.c @@ -0,0 +1,76 @@ +/* + * 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/sparc64/sys/Makefile.inc b/lib/libc/sparc64/sys/Makefile.inc index a62aac2..031af19 100644 --- a/lib/libc/sparc64/sys/Makefile.inc +++ b/lib/libc/sparc64/sys/Makefile.inc @@ -12,9 +12,12 @@ SRCS+= __sparc_sigtramp_setup.c \ CFLAGS+= -I${LIBC_SRCTOP}/sparc64/fpu -MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S sigaction1.S +MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S sigaction.S # Don't generate default code for these syscalls: NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.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/sparc64/sys/__vdso_gettc.c b/lib/libc/sparc64/sys/__vdso_gettc.c new file mode 100644 index 0000000..b99bbc4 --- /dev/null +++ b/lib/libc/sparc64/sys/__vdso_gettc.c @@ -0,0 +1,48 @@ +/*- + * 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/sparc64/sys/sigaction1.S b/lib/libc/sparc64/sys/sigaction.S index 219a238..7d32f97 100644 --- a/lib/libc/sparc64/sys/sigaction1.S +++ b/lib/libc/sparc64/sys/sigaction.S @@ -29,8 +29,7 @@ __FBSDID("$FreeBSD$"); #include "SYS.h" - WEAK_REFERENCE(__sys_sigaction, _sigaction) -ENTRY(__sys_sigaction) +_SYSENTRY(sigaction) PIC_PROLOGUE(%o3, %o4) SET(sigcode_installed, %o4, %o3) lduw [%o3], %o4 @@ -45,6 +44,6 @@ ENTRY(__sys_sigaction) 1: _SYSCALL(sigaction) retl nop -END(__sys_sigaction) +_SYSEND(sigaction) .comm sigcode_installed, 4, 4 diff --git a/lib/libc/stdio/fflush.c b/lib/libc/stdio/fflush.c index 123167a..ef9b45b 100644 --- a/lib/libc/stdio/fflush.c +++ b/lib/libc/stdio/fflush.c @@ -124,13 +124,11 @@ __sflush(FILE *fp) t = _swrite(fp, (char *)p, n); if (t <= 0) { /* Reset _p and _w. */ - if (p > fp->_p) { - /* Some was written. */ + 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->_p += n; + if ((fp->_flags & (__SLBF | __SNBF)) == 0) + fp->_w -= n; fp->_flags |= __SERR; return (EOF); } diff --git a/lib/libc/stdio/flags.c b/lib/libc/stdio/flags.c index 9eed6d7..b7552a4 100644 --- a/lib/libc/stdio/flags.c +++ b/lib/libc/stdio/flags.c @@ -97,10 +97,6 @@ __sflags(const char *mode, int *optr) /* set close-on-exec */ o |= O_CLOEXEC; break; - case 'v': - /* verify */ - o |= O_VERIFY; - break; default: known = 0; break; diff --git a/lib/libc/stdio/open_memstream.3 b/lib/libc/stdio/open_memstream.3 index e01952b..117dcb2 100644 --- a/lib/libc/stdio/open_memstream.3 +++ b/lib/libc/stdio/open_memstream.3 @@ -1,4 +1,4 @@ -.\" Copyright (c) 2013 Hudson River Trading LLC +.\" Copyright (c) 2013 Advanced Computing Technologies LLC .\" Written by: John H. Baldwin <jhb@FreeBSD.org> .\" All rights reserved. .\" diff --git a/lib/libc/stdio/open_memstream.c b/lib/libc/stdio/open_memstream.c index baa71e4..aa50822 100644 --- a/lib/libc/stdio/open_memstream.c +++ b/lib/libc/stdio/open_memstream.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013 Hudson River Trading LLC + * Copyright (c) 2013 Advanced Computing Technologies LLC * Written by: John H. Baldwin <jhb@FreeBSD.org> * All rights reserved. * diff --git a/lib/libc/stdio/open_wmemstream.c b/lib/libc/stdio/open_wmemstream.c index 299e3d8..cf2968a 100644 --- a/lib/libc/stdio/open_wmemstream.c +++ b/lib/libc/stdio/open_wmemstream.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013 Hudson River Trading LLC + * Copyright (c) 2013 Advanced Computing Technologies LLC * Written by: John H. Baldwin <jhb@FreeBSD.org> * All rights reserved. * diff --git a/lib/libc/stdio/xprintf_float.c b/lib/libc/stdio/xprintf_float.c index ad17eb2..b719aac 100644 --- a/lib/libc/stdio/xprintf_float.c +++ b/lib/libc/stdio/xprintf_float.c @@ -168,6 +168,7 @@ __printf_render_float(struct __printf_io *io, const struct printf_info *pi, cons int realsz; /* field size expanded by dprec, sign, etc */ int dprec; /* a copy of prec if [diouxX], 0 otherwise */ char ox[2]; /* space for 0x; ox[1] is either x, X, or \0 */ + int prsize; /* max size of printed field */ int ret; /* return value accumulator */ char *decimal_point; /* locale specific decimal point */ int n2; /* XXX: for PRINTANDPAD */ @@ -343,6 +344,8 @@ here: if (ox[1]) realsz += 2; + prsize = pi->width > realsz ? pi->width : realsz; + /* right-adjusting blank padding */ if (pi->pad != '0' && pi->left == 0) ret += __printf_pad(io, pi->width - realsz, 0); diff --git a/lib/libc/stdlib/Makefile.inc b/lib/libc/stdlib/Makefile.inc index 7cee03a..57205a7 100644 --- a/lib/libc/stdlib/Makefile.inc +++ b/lib/libc/stdlib/Makefile.inc @@ -10,8 +10,7 @@ MISRCS+=_Exit.c a64l.c abort.c abs.c atexit.c atof.c atoi.c atol.c atoll.c \ insque.c l64a.c labs.c ldiv.c llabs.c lldiv.c lsearch.c \ merge.c mergesort_b.c ptsname.c qsort.c qsort_r.c quick_exit.c \ radixsort.c rand.c \ - random.c reallocarray.c reallocf.c realpath.c remque.c strfmon.c \ - strtoimax.c \ + random.c reallocf.c realpath.c remque.c strfmon.c strtoimax.c \ strtol.c strtoll.c strtoq.c strtoul.c strtonum.c strtoull.c \ strtoumax.c strtouq.c system.c tdelete.c tfind.c tsearch.c twalk.c @@ -26,7 +25,7 @@ MAN+= a64l.3 abort.3 abs.3 alloca.3 atexit.3 atof.3 \ hcreate.3 imaxabs.3 imaxdiv.3 insque.3 labs.3 ldiv.3 llabs.3 lldiv.3 \ lsearch.3 memory.3 ptsname.3 qsort.3 \ quick_exit.3 \ - radixsort.3 rand.3 random.3 reallocarray.3 reallocf.3 \ + radixsort.3 rand.3 random.3 reallocf.3 \ realpath.3 strfmon.3 strtod.3 strtol.3 strtonum.3 strtoul.3 system.3 \ tsearch.3 diff --git a/lib/libc/stdlib/Symbol.map b/lib/libc/stdlib/Symbol.map index 782023e..8355f9a 100644 --- a/lib/libc/stdlib/Symbol.map +++ b/lib/libc/stdlib/Symbol.map @@ -113,11 +113,9 @@ FBSD_1.4 { hcreate_r; hdestroy_r; hsearch_r; - reallocarray; }; FBSDprivate_1.0 { __system; _system; - __libc_system; }; diff --git a/lib/libc/stdlib/atexit.3 b/lib/libc/stdlib/atexit.3 index 3cdc59f..68f4e8f 100644 --- a/lib/libc/stdlib/atexit.3 +++ b/lib/libc/stdlib/atexit.3 @@ -88,12 +88,12 @@ The existing list of functions is unmodified. .It Bq Er ENOSYS The .Fn atexit_b -function was called by a program that did not supply a +function was called by a program that did not supply a .Fn _Block_copy implementation. .El .Sh SEE ALSO -.Xr at_quick_exit 3 , +.Xr at_quick_exit 3 .Xr exit 3 .Sh STANDARDS The diff --git a/lib/libc/stdlib/exit.3 b/lib/libc/stdlib/exit.3 index 7d657c9..07ce0d7 100644 --- a/lib/libc/stdlib/exit.3 +++ b/lib/libc/stdlib/exit.3 @@ -117,8 +117,8 @@ never return. .Sh SEE ALSO .Xr _exit 2 , .Xr wait 2 , -.Xr at_quick_exit 3 , .Xr atexit 3 , +.Xr at_quick_exit 3 , .Xr intro 3 , .Xr quick_exit 3 , .Xr sysexits 3 , diff --git a/lib/libc/stdlib/jemalloc/Symbol.map b/lib/libc/stdlib/jemalloc/Symbol.map index 132664a..35a5dad 100644 --- a/lib/libc/stdlib/jemalloc/Symbol.map +++ b/lib/libc/stdlib/jemalloc/Symbol.map @@ -55,5 +55,4 @@ FBSDprivate_1.0 { _malloc_thread_cleanup; _malloc_prefork; _malloc_postfork; - _malloc_first_thread; }; diff --git a/lib/libc/stdlib/qsort.c b/lib/libc/stdlib/qsort.c index e97ea92..93e22cd 100644 --- a/lib/libc/stdlib/qsort.c +++ b/lib/libc/stdlib/qsort.c @@ -41,55 +41,47 @@ typedef int cmp_t(void *, const void *, const void *); typedef int cmp_t(const void *, const void *); #endif static inline char *med3(char *, char *, char *, cmp_t *, void *); -static inline void swapfunc(char *, char *, int, int, int); +static inline void swapfunc(char *, char *, int, int); -#define MIN(a, b) ((a) < (b) ? a : b) +#define min(a, b) (a) < (b) ? a : b /* * Qsort routine from Bentley & McIlroy's "Engineering a Sort Function". */ -#define swapcode(TYPE, parmi, parmj, n) { \ - long i = (n) / sizeof (TYPE); \ - TYPE *pi = (TYPE *) (parmi); \ - TYPE *pj = (TYPE *) (parmj); \ +#define swapcode(TYPE, parmi, parmj, n) { \ + long i = (n) / sizeof (TYPE); \ + TYPE *pi = (TYPE *) (parmi); \ + TYPE *pj = (TYPE *) (parmj); \ do { \ TYPE t = *pi; \ *pi++ = *pj; \ *pj++ = t; \ - } while (--i > 0); \ + } while (--i > 0); \ } -#define SWAPINIT(TYPE, a, es) swaptype_ ## TYPE = \ - ((char *)a - (char *)0) % sizeof(TYPE) || \ - es % sizeof(TYPE) ? 2 : es == sizeof(TYPE) ? 0 : 1; +#define SWAPINIT(a, es) swaptype = ((char *)a - (char *)0) % sizeof(long) || \ + es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1; static inline void -swapfunc(a, b, n, swaptype_long, swaptype_int) +swapfunc(a, b, n, swaptype) char *a, *b; - int n, swaptype_long, swaptype_int; + int n, swaptype; { - if (swaptype_long <= 1) + if(swaptype <= 1) swapcode(long, a, b, n) - else if (swaptype_int <= 1) - swapcode(int, a, b, n) else swapcode(char, a, b, n) } -#define swap(a, b) \ - if (swaptype_long == 0) { \ +#define swap(a, b) \ + if (swaptype == 0) { \ long t = *(long *)(a); \ *(long *)(a) = *(long *)(b); \ *(long *)(b) = t; \ - } else if (swaptype_int == 0) { \ - int t = *(int *)(a); \ - *(int *)(a) = *(int *)(b); \ - *(int *)(b) = t; \ } else \ - swapfunc(a, b, es, swaptype_long, swaptype_int) + swapfunc(a, b, es, swaptype) -#define vecswap(a, b, n) \ - if ((n) > 0) swapfunc(a, b, n, swaptype_long, swaptype_int) +#define vecswap(a, b, n) if ((n) > 0) swapfunc(a, b, n, swaptype) #ifdef I_AM_QSORT_R #define CMP(t, x, y) (cmp((t), (x), (y))) @@ -106,14 +98,14 @@ __unused { return CMP(thunk, a, b) < 0 ? (CMP(thunk, b, c) < 0 ? b : (CMP(thunk, a, c) < 0 ? c : a )) - :(CMP(thunk, b, c) > 0 ? b : (CMP(thunk, a, c) < 0 ? a : c )); + :(CMP(thunk, b, c) > 0 ? b : (CMP(thunk, a, c) < 0 ? a : c )); } #ifdef I_AM_QSORT_R void qsort_r(void *a, size_t n, size_t es, void *thunk, cmp_t *cmp) #else -#define thunk NULL +#define thunk NULL void qsort(void *a, size_t n, size_t es, cmp_t *cmp) #endif @@ -121,10 +113,9 @@ qsort(void *a, size_t n, size_t es, cmp_t *cmp) char *pa, *pb, *pc, *pd, *pl, *pm, *pn; size_t d, r; int cmp_result; - int swaptype_long, swaptype_int, swap_cnt; + int swaptype, swap_cnt; -loop: SWAPINIT(long, a, es); - SWAPINIT(int, a, es); +loop: SWAPINIT(a, es); swap_cnt = 0; if (n < 7) { for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es) @@ -184,9 +175,9 @@ loop: SWAPINIT(long, a, es); } pn = (char *)a + n * es; - r = MIN(pa - (char *)a, pb - pa); + r = min(pa - (char *)a, pb - pa); vecswap(a, pb - r, r); - r = MIN(pd - pc, pn - pd - es); + r = min(pd - pc, pn - pd - es); vecswap(pb, pn - r, r); if ((r = pb - pa) > es) #ifdef I_AM_QSORT_R diff --git a/lib/libc/stdlib/quick_exit.3 b/lib/libc/stdlib/quick_exit.3 index 7bbd2f3..f2ea379 100644 --- a/lib/libc/stdlib/quick_exit.3 +++ b/lib/libc/stdlib/quick_exit.3 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 13, 2014 +.Dd December 7, 2011 .Dt QUICK_EXIT 3 .Os .Sh NAME @@ -35,7 +35,7 @@ .Sh SYNOPSIS .In stdlib.h .Ft _Noreturn void -.Fn quick_exit "int status" +.Fn quick_exit "void" .Sh DESCRIPTION The .Fn quick_exit diff --git a/lib/libc/stdlib/random.3 b/lib/libc/stdlib/random.3 index 254be0a..dc8e961 100644 --- a/lib/libc/stdlib/random.3 +++ b/lib/libc/stdlib/random.3 @@ -54,8 +54,9 @@ .Fn setstate "char *state" .Sh DESCRIPTION .Bf -symbolic -The functions described in this manual page are not secure. -Applications which require unpredictable random numbers should use +The functions described in this manual page are not cryptographically +secure. +Cryptographic applications should use .Xr arc4random 3 instead. .Ef diff --git a/lib/libc/stdlib/reallocarray.3 b/lib/libc/stdlib/reallocarray.3 deleted file mode 100644 index 8e714f4..0000000 --- a/lib/libc/stdlib/reallocarray.3 +++ /dev/null @@ -1,142 +0,0 @@ -.\" Copyright (c) 1980, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" 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. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd May 1, 2015 -.Dt REALLOCARRAY 3 -.Os -.Sh NAME -.Nm reallocarray -.Nd memory reallocation function -.Sh LIBRARY -.Lb libc -.Sh SYNOPSIS -.In stdlib.h -.Ft void * -.Fn reallocarray "void *ptr" "size_t nmemb" "size_t size" -.Sh DESCRIPTION -The -.Fn reallocarray -function is similar to the -.Fn realloc -function -except it operates on -.Fa nmemb -members of size -.Fa size -and checks for integer overflow in the calculation -.Fa nmemb -* -.Fa size . -.Sh RETURN VALUES -The -.Fn reallocarray -function returns a pointer to the allocated space; otherwise, a -.Dv NULL -pointer is returned and -.Va errno -is set to -.Er ENOMEM . -.Sh EXAMPLES -Consider -.Fn reallocarray -when there is multiplication in the -.Fa size -argument of -.Fn malloc -or -.Fn realloc . -For example, avoid this common idiom as it may lead to integer overflow: -.Bd -literal -offset indent -if ((p = malloc(num * size)) == NULL) - err(1, "malloc"); -.Ed -.Pp -A drop-in replacement is the -.Ox -extension -.Fn reallocarray : -.Bd -literal -offset indent -if ((p = reallocarray(NULL, num, size)) == NULL) - err(1, "reallocarray"); -.Ed -.Pp -When using -.Fn realloc , -be careful to avoid the following idiom: -.Bd -literal -offset indent -size += 50; -if ((p = realloc(p, size)) == NULL) - return (NULL); -.Ed -.Pp -Do not adjust the variable describing how much memory has been allocated -until the allocation has been successful. -This can cause aberrant program behavior if the incorrect size value is used. -In most cases, the above sample will also result in a leak of memory. -As stated earlier, a return value of -.Dv NULL -indicates that the old object still remains allocated. -Better code looks like this: -.Bd -literal -offset indent -newsize = size + 50; -if ((newp = realloc(p, newsize)) == NULL) { - free(p); - p = NULL; - size = 0; - return (NULL); -} -p = newp; -size = newsize; -.Ed -.Pp -As with -.Fn malloc , -it is important to ensure the new size value will not overflow; -i.e. avoid allocations like the following: -.Bd -literal -offset indent -if ((newp = realloc(p, num * size)) == NULL) { - ... -.Ed -.Pp -Instead, use -.Fn reallocarray : -.Bd -literal -offset indent -if ((newp = reallocarray(p, num, size)) == NULL) { - ... -.Ed -.Sh SEE ALSO -.Xr realloc 3 -.Sh HISTORY -The -.Fn reallocarray -function first appeared in -.Ox 5.6 -and -.Fx 11.0 . diff --git a/lib/libc/stdlib/reallocarray.c b/lib/libc/stdlib/reallocarray.c deleted file mode 100644 index e1e9b7c..0000000 --- a/lib/libc/stdlib/reallocarray.c +++ /dev/null @@ -1,42 +0,0 @@ -/* $OpenBSD: reallocarray.c,v 1.2 2014/12/08 03:45:00 bcook Exp $ */ -/* - * Copyright (c) 2008 Otto Moerbeek <otto@drijf.net> - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <errno.h> -#include <stdint.h> -#include <stdlib.h> - -/* - * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX - * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW - */ -#define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4)) - -void * -reallocarray(void *optr, size_t nmemb, size_t size) -{ - - if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && - nmemb > 0 && SIZE_MAX / nmemb < size) { - errno = ENOMEM; - return (NULL); - } - return (realloc(optr, size * nmemb)); -} diff --git a/lib/libc/stdlib/system.c b/lib/libc/stdlib/system.c index bd9ea5a..e018e6f 100644 --- a/lib/libc/stdlib/system.c +++ b/lib/libc/stdlib/system.c @@ -46,17 +46,8 @@ __FBSDID("$FreeBSD$"); #include "un-namespace.h" #include "libc_private.h" -#pragma weak system int -system(const char *command) -{ - - return (((int (*)(const char *)) - __libc_interposing[INTERPOS_system])(command)); -} - -int -__libc_system(const char *command) +__system(const char *command) { pid_t pid, savedpid; int pstat; @@ -104,5 +95,5 @@ __libc_system(const char *command) return(pid == -1 ? -1 : pstat); } -__weak_reference(__libc_system, __system); -__weak_reference(__libc_system, _system); +__weak_reference(__system, system); +__weak_reference(__system, _system); diff --git a/lib/libc/stdlib/tdelete.c b/lib/libc/stdlib/tdelete.c index bef187e..c83afb8 100644 --- a/lib/libc/stdlib/tdelete.c +++ b/lib/libc/stdlib/tdelete.c @@ -14,7 +14,7 @@ #include <sys/cdefs.h> #if 0 #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: tdelete.c,v 1.6 2012/06/25 22:32:45 abs Exp $"); +__RCSID("$NetBSD: tdelete.c,v 1.2 1999/09/16 11:45:37 lukem Exp $"); #endif /* LIBC_SCCS and not lint */ #endif __FBSDID("$FreeBSD$"); @@ -25,9 +25,9 @@ __FBSDID("$FreeBSD$"); /* - * find a node with given key + * delete node with given key * - * vkey: key to be found + * vkey: key to be deleted * vrootp: address of the root of the tree * compar: function to carry out node comparisons */ @@ -65,8 +65,7 @@ tdelete(const void * __restrict vkey, void ** __restrict vrootp, q->rlink = (*rootp)->rlink; } } - if (p != *rootp) - free(*rootp); /* D4: Free node */ + free(*rootp); /* D4: Free node */ *rootp = q; /* link parent to new node */ return p; } diff --git a/lib/libc/string/strlcat.c b/lib/libc/string/strlcat.c index f5ed6c6..2d13be7 100644 --- a/lib/libc/string/strlcat.c +++ b/lib/libc/string/strlcat.c @@ -1,7 +1,7 @@ -/* $OpenBSD: strlcat.c,v 1.15 2015/03/02 21:41:08 millert Exp $ */ +/* $OpenBSD: strlcat.c,v 1.13 2005/08/08 08:05:37 espie Exp $ */ /* - * Copyright (c) 1998, 2015 Todd C. Miller <Todd.Miller@courtesan.com> + * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -23,36 +23,36 @@ __FBSDID("$FreeBSD$"); #include <string.h> /* - * Appends src to string dst of size dsize (unlike strncat, dsize is the - * full size of dst, not space left). At most dsize-1 characters - * will be copied. Always NUL terminates (unless dsize <= strlen(dst)). - * Returns strlen(src) + MIN(dsize, strlen(initial dst)). - * If retval >= dsize, truncation occurred. + * Appends src to string dst of size siz (unlike strncat, siz is the + * full size of dst, not space left). At most siz-1 characters + * will be copied. Always NUL terminates (unless siz <= strlen(dst)). + * Returns strlen(src) + MIN(siz, strlen(initial dst)). + * If retval >= siz, truncation occurred. */ size_t -strlcat(char * __restrict dst, const char * __restrict src, size_t dsize) +strlcat(char * __restrict dst, const char * __restrict src, size_t siz) { - const char *odst = dst; - const char *osrc = src; - size_t n = dsize; + char *d = dst; + const char *s = src; + size_t n = siz; size_t dlen; - /* Find the end of dst and adjust bytes left but don't go past end. */ - while (n-- != 0 && *dst != '\0') - dst++; - dlen = dst - odst; - n = dsize - dlen; + /* Find the end of dst and adjust bytes left but don't go past end */ + while (n-- != 0 && *d != '\0') + d++; + dlen = d - dst; + n = siz - dlen; - if (n-- == 0) - return(dlen + strlen(src)); - while (*src != '\0') { - if (n != 0) { - *dst++ = *src; + if (n == 0) + return(dlen + strlen(s)); + while (*s != '\0') { + if (n != 1) { + *d++ = *s; n--; } - src++; + s++; } - *dst = '\0'; + *d = '\0'; - return(dlen + (src - osrc)); /* count does not include NUL */ + return(dlen + (s - src)); /* count does not include NUL */ } diff --git a/lib/libc/string/strlcpy.c b/lib/libc/string/strlcpy.c index 019d231..451b6df 100644 --- a/lib/libc/string/strlcpy.c +++ b/lib/libc/string/strlcpy.c @@ -1,7 +1,7 @@ -/* $OpenBSD: strlcpy.c,v 1.12 2015/01/15 03:54:12 millert Exp $ */ +/* $OpenBSD: strlcpy.c,v 1.11 2006/05/05 15:27:38 millert Exp $ */ /* - * Copyright (c) 1998, 2015 Todd C. Miller <Todd.Miller@courtesan.com> + * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -23,31 +23,32 @@ __FBSDID("$FreeBSD$"); #include <string.h> /* - * Copy string src to buffer dst of size dsize. At most dsize-1 - * chars will be copied. Always NUL terminates (unless dsize == 0). - * Returns strlen(src); if retval >= dsize, truncation occurred. + * Copy src to string dst of size siz. At most siz-1 characters + * will be copied. Always NUL terminates (unless siz == 0). + * Returns strlen(src); if retval >= siz, truncation occurred. */ size_t -strlcpy(char * __restrict dst, const char * __restrict src, size_t dsize) +strlcpy(char * __restrict dst, const char * __restrict src, size_t siz) { - const char *osrc = src; - size_t nleft = dsize; + char *d = dst; + const char *s = src; + size_t n = siz; - /* Copy as many bytes as will fit. */ - if (nleft != 0) { - while (--nleft != 0) { - if ((*dst++ = *src++) == '\0') + /* Copy as many bytes as will fit */ + if (n != 0) { + while (--n != 0) { + if ((*d++ = *s++) == '\0') break; } } - /* Not enough room in dst, add NUL and traverse rest of src. */ - if (nleft == 0) { - if (dsize != 0) - *dst = '\0'; /* NUL-terminate dst */ - while (*src++) + /* Not enough room in dst, add NUL and traverse rest of src */ + if (n == 0) { + if (siz != 0) + *d = '\0'; /* NUL-terminate dst */ + while (*s++) ; } - return(src - osrc - 1); /* count does not include NUL */ + return(s - src - 1); /* count does not include NUL */ } diff --git a/lib/libc/string/strspn.3 b/lib/libc/string/strspn.3 index 4a8e3f4..542b190 100644 --- a/lib/libc/string/strspn.3 +++ b/lib/libc/string/strspn.3 @@ -71,7 +71,7 @@ spans the initial part of the null-terminated string .Fa s as long as the characters from .Fa s -.Sy do not +.Sy do not occur in the null-terminated string .Fa charset .Po it spans the diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index 5162563..c14b351 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -20,62 +20,17 @@ NOASM+= clock_gettime.o gettimeofday.o PSEUDO+= _clock_gettime.o _gettimeofday.o # Sources common to both syscall interfaces: -SRCS+= \ - stack_protector.c \ - stack_protector_compat.c \ - __error.c \ - interposing_table.c - -SRCS+= futimens.c utimensat.c -NOASM+= futimens.o utimensat.o -PSEUDO+= _futimens.o _utimensat.o - -INTERPOSED = \ - accept \ - accept4 \ - aio_suspend \ - close \ - connect \ - fcntl \ - fsync \ - fork \ - kevent \ - msync \ - nanosleep \ - open \ - openat \ - poll \ - ppoll \ - pselect \ - read \ - readv \ - recvfrom \ - recvmsg \ - select \ - sendmsg \ - sendto \ - setcontext \ - sigprocmask \ - sigsuspend \ - sigtimedwait \ - sigwait \ - sigwaitinfo \ - swapcontext \ - wait4 \ - wait6 \ - write \ - writev - -.if ${MACHINE_CPUARCH} == "sparc64" -SRCS+= sigaction.c -NOASM+= sigaction.o -.else -INTERPOSED+= sigaction +SRCS+= stack_protector.c stack_protector_compat.c __error.c +.if ${MK_SYSCALL_COMPAT} != "no" +SYSCALL_COMPAT_SRCS= fcntl.c ftruncate.c lseek.c mmap.c pread.c \ + pwrite.c truncate.c +SRCS+= ${SYSCALL_COMPAT_SRCS} +NOASM+= ${SYSCALL_COMPAT_SRCS:S/.c/.o/} +PSEUDO+= _fcntl.o .endif - -SRCS+= ${INTERPOSED:S/$/.c/} -NOASM+= ${INTERPOSED:S/$/.o/} -PSEUDO+= ${INTERPOSED:C/^.*$/_&.o/} +SRCS+= sigwait.c +NOASM+= sigwait.o +PSEUDO+= _sigwait.o # Add machine dependent asm sources: SRCS+=${MDASM} @@ -311,7 +266,6 @@ MAN+= sctp_generic_recvmsg.2 \ umask.2 \ undelete.2 \ unlink.2 \ - utimensat.2 \ utimes.2 \ utrace.2 \ uuidgen.2 \ @@ -444,7 +398,6 @@ MLINKS+=timer_settime.2 timer_getoverrun.2 \ timer_settime.2 timer_gettime.2 MLINKS+=truncate.2 ftruncate.2 MLINKS+=unlink.2 unlinkat.2 -MLINKS+=utimensat.2 futimens.2 MLINKS+=utimes.2 futimes.2 \ utimes.2 futimesat.2 \ utimes.2 lutimes.2 diff --git a/lib/libc/sys/Symbol.map b/lib/libc/sys/Symbol.map index 194aa5b..448bcce 100644 --- a/lib/libc/sys/Symbol.map +++ b/lib/libc/sys/Symbol.map @@ -245,6 +245,7 @@ FBSD_1.0 { setaudit; setaudit_addr; setauid; + setcontext; setegid; seteuid; setgid; @@ -285,6 +286,7 @@ FBSD_1.0 { __stack_chk_guard; stat; statfs; + swapcontext; swapoff; swapon; symlink; @@ -349,6 +351,7 @@ FBSD_1.1 { mkfifoat; mknodat; msgctl; + openat; readlinkat; renameat; setfib; @@ -397,9 +400,7 @@ FBSD_1.3 { }; FBSD_1.4 { - futimens; ppoll; - utimensat; }; FBSDprivate_1.0 { @@ -1047,9 +1048,7 @@ FBSDprivate_1.0 { __sys_write; _writev; __sys_writev; - __set_error_selector; + __error_unthreaded; nlm_syscall; gssd_syscall; - __libc_interposing_slot; - __libc_sigwait; }; diff --git a/lib/libc/sys/__error.c b/lib/libc/sys/__error.c index 28cc31d..c3f59f8 100644 --- a/lib/libc/sys/__error.c +++ b/lib/libc/sys/__error.c @@ -32,25 +32,14 @@ __FBSDID("$FreeBSD$"); extern int errno; -static int * -__error_unthreaded(void) -{ - - return (&errno); -} - -static int *(*__error_selector)(void) = __error_unthreaded; - -void -__set_error_selector(int *(*arg)(void)) -{ - - __error_selector = arg; -} +/* + * Declare a weak reference in case the application is not linked + * with libpthread. + */ +__weak_reference(__error_unthreaded, __error); int * -__error(void) +__error_unthreaded(void) { - - return (__error_selector()); + return(&errno); } diff --git a/lib/libc/sys/accept.c b/lib/libc/sys/accept.c deleted file mode 100644 index 38e32f2..0000000 --- a/lib/libc/sys/accept.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/syscall.h> -#include <sys/socket.h> -#include "libc_private.h" - -__weak_reference(__sys_accept, __accept); - -#pragma weak accept -int -accept(int s, struct sockaddr *addr, socklen_t *addrlen) -{ - - return (((int (*)(int, struct sockaddr *, socklen_t *)) - __libc_interposing[INTERPOS_accept])(s, addr, addrlen)); -} diff --git a/lib/libc/sys/accept4.c b/lib/libc/sys/accept4.c deleted file mode 100644 index 2907b04..0000000 --- a/lib/libc/sys/accept4.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/syscall.h> -#include <sys/socket.h> -#include "libc_private.h" - -__weak_reference(__sys_accept4, __accept4); - -#pragma weak accept4 -int -accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags) -{ - - return (((int (*)(int, struct sockaddr *, socklen_t *, int)) - __libc_interposing[INTERPOS_accept4])(s, addr, addrlen, flags)); -} diff --git a/lib/libc/sys/access.2 b/lib/libc/sys/access.2 index c70e7a2..46bf948 100644 --- a/lib/libc/sys/access.2 +++ b/lib/libc/sys/access.2 @@ -136,7 +136,7 @@ and .Fn access , .Fn eaccess , or -.Fn faccessat +.Fn faccessat will fail if: .Bl -tag -width Er .It Bq Er EINVAL diff --git a/lib/libc/sys/aio_suspend.c b/lib/libc/sys/aio_suspend.c deleted file mode 100644 index 020edf8..0000000 --- a/lib/libc/sys/aio_suspend.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/aio.h> -#include "libc_private.h" - -__weak_reference(__sys_aio_suspend, __aio_suspend); - -#pragma weak aio_suspend -int -aio_suspend(const struct aiocb * const iocbs[], int niocb, - const struct timespec *timeout) -{ - - return (((int (*)(const struct aiocb * const[], int, - const struct timespec *)) - __libc_interposing[INTERPOS_aio_suspend])(iocbs, niocb, timeout)); -} diff --git a/lib/libc/sys/cap_ioctls_limit.2 b/lib/libc/sys/cap_ioctls_limit.2 index 39f117f..2d1eef9 100644 --- a/lib/libc/sys/cap_ioctls_limit.2 +++ b/lib/libc/sys/cap_ioctls_limit.2 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 6, 2015 +.Dd March 27, 2014 .Dt CAP_IOCTLS_LIMIT 2 .Os .Sh NAME @@ -61,8 +61,6 @@ argument specifies the number of elements in the array. There can be up to .Va 256 elements in the array. -Including an element that has been previously revoked will generate an error. -After a successful call only those listed in the array may be used. .Pp The list of allowed ioctl commands for a given file descriptor can be obtained with the @@ -94,7 +92,7 @@ system call was never called for this file descriptor), the .Fn cap_ioctls_get system call will return .Dv CAP_IOCTLS_ALL -and will not modify the buffer pointed to by the +and won't modify the buffer pointed to by the .Fa cmds argument. .Sh RETURN VALUES diff --git a/lib/libc/sys/close.c b/lib/libc/sys/close.c deleted file mode 100644 index 02e74c6..0000000 --- a/lib/libc/sys/close.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/fcntl.h> -#include "libc_private.h" - -__weak_reference(__sys_close, __close); - -#pragma weak close -int -close(int fd) -{ - - return (((int (*)(int))__libc_interposing[INTERPOS_close])(fd)); -} diff --git a/lib/libc/sys/closefrom.2 b/lib/libc/sys/closefrom.2 index a0b5fc2..ffaa001 100644 --- a/lib/libc/sys/closefrom.2 +++ b/lib/libc/sys/closefrom.2 @@ -1,4 +1,4 @@ -.\" Copyright (c) 2009 Hudson River Trading LLC +.\" Copyright (c) 2009 Advanced Computing Technologies LLC .\" Written by: John H. Baldwin <jhb@FreeBSD.org> .\" All rights reserved. .\" diff --git a/lib/libc/sys/connect.c b/lib/libc/sys/connect.c deleted file mode 100644 index 7969142..0000000 --- a/lib/libc/sys/connect.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/syscall.h> -#include <sys/socket.h> -#include "libc_private.h" - -__weak_reference(__sys_connect, __connect); - -#pragma weak connect -int -connect(int s, const struct sockaddr *addr, socklen_t addrlen) -{ - - return (((int (*)(int, const struct sockaddr *, socklen_t)) - __libc_interposing[INTERPOS_connect])(s, addr, addrlen)); -} diff --git a/lib/libc/sys/cpuset.2 b/lib/libc/sys/cpuset.2 index 8349566..0c32b42 100644 --- a/lib/libc/sys/cpuset.2 +++ b/lib/libc/sys/cpuset.2 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 8, 2015 +.Dd February 14, 2014 .Dt CPUSET 2 .Os .Sh NAME @@ -101,7 +101,6 @@ argument may have the following values: .It Dv CPU_WHICH_JAIL Ta "id is jid (jail id)" .It Dv CPU_WHICH_CPUSET Ta "id is a cpusetid_t (cpuset id)" .It Dv CPU_WHICH_IRQ Ta "id is an irq number" -.It Dv CPU_WHICH_DOMAIN Ta "id is a NUMA domain" .El .Pp An diff --git a/lib/libc/sys/fcntl.c b/lib/libc/sys/fcntl.c index e85574a..480cc40 100644 --- a/lib/libc/sys/fcntl.c +++ b/lib/libc/sys/fcntl.c @@ -3,12 +3,6 @@ * Authors: Doug Rabson <dfr@rabson.org> * Developed with Red Inc: Alfred Perlstein <alfred@freebsd.org> * - * Copyright (c) 2014-2015 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -40,17 +34,56 @@ __FBSDID("$FreeBSD$"); #include <sys/syscall.h> #include "libc_private.h" -#pragma weak fcntl +__weak_reference(__fcntl_compat, fcntl); + int -fcntl(int fd, int cmd, ...) +__fcntl_compat(int fd, int cmd, ...) { va_list args; long arg; + struct __oflock ofl; + struct flock *flp; + int res; va_start(args, cmd); arg = va_arg(args, long); va_end(args); - return (((int (*)(int, int, ...)) - __libc_interposing[INTERPOS_fcntl])(fd, cmd, arg)); + if (__getosreldate() >= 800028) { + return (__sys_fcntl(fd, cmd, arg)); + } else { + if (cmd == F_GETLK || cmd == F_SETLK || cmd == F_SETLKW) { + /* + * Convert new-style struct flock (which + * includes l_sysid) to old-style. + */ + flp = (struct flock *) (uintptr_t) arg; + ofl.l_start = flp->l_start; + ofl.l_len = flp->l_len; + ofl.l_pid = flp->l_pid; + ofl.l_type = flp->l_type; + ofl.l_whence = flp->l_whence; + + switch (cmd) { + case F_GETLK: + res = __sys_fcntl(fd, F_OGETLK, &ofl); + if (res >= 0) { + flp->l_start = ofl.l_start; + flp->l_len = ofl.l_len; + flp->l_pid = ofl.l_pid; + flp->l_type = ofl.l_type; + flp->l_whence = ofl.l_whence; + flp->l_sysid = 0; + } + return (res); + + case F_SETLK: + return (__sys_fcntl(fd, F_OSETLK, &ofl)); + + case F_SETLKW: + return (__sys_fcntl(fd, F_OSETLKW, &ofl)); + } + } + return (__sys_fcntl(fd, cmd, arg)); + } } diff --git a/lib/libc/sys/fork.2 b/lib/libc/sys/fork.2 index 4fda74d..1ad2052f 100644 --- a/lib/libc/sys/fork.2 +++ b/lib/libc/sys/fork.2 @@ -28,7 +28,7 @@ .\" @(#)fork.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd May 1, 2015 +.Dd May 31, 2013 .Dt FORK 2 .Os .Sh NAME @@ -53,10 +53,7 @@ The child process has a unique process ID. The child process has a different parent process ID (i.e., the process ID of the parent process). .It -The child process has its own copy of the parent's descriptors, -except for descriptors returned by -.Xr kqueue 2 , -which are not inherited from the parent process. +The child process has its own copy of the parent's descriptors. These descriptors reference the same underlying objects, so that, for instance, file pointers in file objects are shared between the child and the parent, so that an diff --git a/lib/libc/sys/fork.c b/lib/libc/sys/fork.c deleted file mode 100644 index 695540a..0000000 --- a/lib/libc/sys/fork.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <unistd.h> -#include "libc_private.h" - -__weak_reference(__sys_fork, __fork); - -#pragma weak fork -pid_t -fork(void) -{ - - return (((pid_t (*)(void))__libc_interposing[INTERPOS_fork])()); -} diff --git a/lib/libc/sys/fsync.c b/lib/libc/sys/fsync.c deleted file mode 100644 index 3fff428..0000000 --- a/lib/libc/sys/fsync.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/fcntl.h> -#include "libc_private.h" - -__weak_reference(__sys_fsync, __fsync); - -int -fsync(int fd) -{ - - return (((int (*)(int))__libc_interposing[INTERPOS_fsync])(fd)); -} diff --git a/lib/libc/aarch64/gen/sigsetjmp.S b/lib/libc/sys/ftruncate.c index 8a13c9f..78b5a36 100644 --- a/lib/libc/aarch64/gen/sigsetjmp.S +++ b/lib/libc/sys/ftruncate.c @@ -1,9 +1,6 @@ -/*- - * Copyright (c) 2014 The FreeBSD Foundation - * All rights reserved. - * - * This software was developed by Andrew Turner under - * sponsorship from the FreeBSD Foundation. +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -13,11 +10,14 @@ * 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. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * 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 AUTHOR OR CONTRIBUTORS BE LIABLE + * 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) @@ -27,27 +27,29 @@ * SUCH DAMAGE. */ -#include <machine/asm.h> +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)ftruncate.c 8.1 (Berkeley) 6/17/93"; +#endif /* LIBC_SCCS and not lint */ +#include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#include <machine/setjmp.h> - -ENTRY(sigsetjmp) - cmp x1, #0 - b.eq _C_LABEL(_setjmp) - b _C_LABEL(setjmp) -END(sigsetjmp) +#include <sys/types.h> +#include <sys/syscall.h> +#include <unistd.h> +#include "libc_private.h" -ENTRY(siglongjmp) - /* Load the _setjmp magic */ - ldr x2, .Lmagic - ldr x3, [x0] +/* + * This function provides 64-bit offset padding that + * is not supplied by GCC 1.X but is supplied by GCC 2.X. + */ +int +ftruncate(fd, length) + int fd; + off_t length; +{ - /* Check the magic */ - cmp x2, x3 - b.eq _C_LABEL(_longjmp) - b _C_LABEL(longjmp) -.Lmagic: - .align 3 - .quad _JB_MAGIC__SETJMP -END(siglongjmp) + if (__getosreldate() >= 700051) + return(__sys_ftruncate(fd, length)); + else + return(__sys_freebsd6_ftruncate(fd, 0, length)); +} diff --git a/lib/libc/sys/futimens.c b/lib/libc/sys/futimens.c deleted file mode 100644 index 2014cc5..0000000 --- a/lib/libc/sys/futimens.c +++ /dev/null @@ -1,97 +0,0 @@ -/*- - * Copyright (c) 2015 Jilles Tjoelker - * 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 "namespace.h" -#include <sys/stat.h> - -#include <errno.h> -#include <fcntl.h> -#include <time.h> -#include "un-namespace.h" - -#include "libc_private.h" - -int -futimens(int fd, const struct timespec times[2]) -{ - struct timeval now, tv[2], *tvp; - struct stat sb; - - if (__getosreldate() >= 1100056) - return (__sys_futimens(fd, times)); - - if (times == NULL || (times[0].tv_nsec == UTIME_NOW && - times[1].tv_nsec == UTIME_NOW)) - tvp = NULL; - else if (times[0].tv_nsec == UTIME_OMIT && - times[1].tv_nsec == UTIME_OMIT) - return (0); - else { - if ((times[0].tv_nsec < 0 || times[0].tv_nsec > 999999999) && - times[0].tv_nsec != UTIME_NOW && - times[0].tv_nsec != UTIME_OMIT) { - errno = EINVAL; - return (-1); - } - if ((times[1].tv_nsec < 0 || times[1].tv_nsec > 999999999) && - times[1].tv_nsec != UTIME_NOW && - times[1].tv_nsec != UTIME_OMIT) { - errno = EINVAL; - return (-1); - } - tv[0].tv_sec = times[0].tv_sec; - tv[0].tv_usec = times[0].tv_nsec / 1000; - tv[1].tv_sec = times[1].tv_sec; - tv[1].tv_usec = times[1].tv_nsec / 1000; - tvp = tv; - if (times[0].tv_nsec == UTIME_OMIT || - times[1].tv_nsec == UTIME_OMIT) { - if (_fstat(fd, &sb) == -1) - return (-1); - if (times[0].tv_nsec == UTIME_OMIT) { - tv[0].tv_sec = sb.st_atim.tv_sec; - tv[0].tv_usec = sb.st_atim.tv_nsec / 1000; - } - if (times[1].tv_nsec == UTIME_OMIT) { - tv[1].tv_sec = sb.st_mtim.tv_sec; - tv[1].tv_usec = sb.st_mtim.tv_nsec / 1000; - } - } - if (times[0].tv_nsec == UTIME_NOW || - times[1].tv_nsec == UTIME_NOW) { - if (gettimeofday(&now, NULL) == -1) - return (-1); - if (times[0].tv_nsec == UTIME_NOW) - tv[0] = now; - if (times[1].tv_nsec == UTIME_NOW) - tv[1] = now; - } - } - return (futimes(fd, tvp)); -} diff --git a/lib/libc/sys/getdirentries.2 b/lib/libc/sys/getdirentries.2 index ab60ed2..3fe1632 100644 --- a/lib/libc/sys/getdirentries.2 +++ b/lib/libc/sys/getdirentries.2 @@ -134,9 +134,8 @@ The current position pointer should only be set to a value returned by .Xr lseek 2 , a value returned in the location pointed to by .Fa basep -.Po Fn getdirentries -only -.Pc +.Fn ( getdirentries +only) or zero. .Sh RETURN VALUES If successful, the number of bytes actually transferred is returned. diff --git a/lib/libc/sys/getrlimit.2 b/lib/libc/sys/getrlimit.2 index 5fdd58b..1f84bfb 100644 --- a/lib/libc/sys/getrlimit.2 +++ b/lib/libc/sys/getrlimit.2 @@ -194,8 +194,8 @@ raised the maximum limit value, and the caller is not the super-user. .Xr csh 1 , .Xr quota 1 , .Xr quotactl 2 , -.Xr sigaction 2 , .Xr sigaltstack 2 , +.Xr sigaction 2 , .Xr sysctl 3 , .Xr ulimit 3 .Sh HISTORY diff --git a/lib/libc/sys/interposing_table.c b/lib/libc/sys/interposing_table.c deleted file mode 100644 index 08dfbb1..0000000 --- a/lib/libc/sys/interposing_table.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include "libc_private.h" - -#define SLOT(a, b) \ - [INTERPOS_##a] = (interpos_func_t)b -interpos_func_t __libc_interposing[INTERPOS_MAX] = { - SLOT(accept, __sys_accept), - SLOT(accept4, __sys_accept4), - SLOT(aio_suspend, __sys_aio_suspend), - SLOT(close, __sys_close), - SLOT(connect, __sys_connect), - SLOT(fcntl, __sys_fcntl), - SLOT(fsync, __sys_fsync), - SLOT(fork, __sys_fork), - SLOT(msync, __sys_msync), - SLOT(nanosleep, __sys_nanosleep), - SLOT(openat, __sys_openat), - SLOT(poll, __sys_poll), - SLOT(pselect, __sys_pselect), - SLOT(read, __sys_read), - SLOT(readv, __sys_readv), - SLOT(recvfrom, __sys_recvfrom), - SLOT(recvmsg, __sys_recvmsg), - SLOT(select, __sys_select), - SLOT(sendmsg, __sys_sendmsg), - SLOT(sendto, __sys_sendto), - SLOT(setcontext, __sys_setcontext), - SLOT(sigaction, __sys_sigaction), - SLOT(sigprocmask, __sys_sigprocmask), - SLOT(sigsuspend, __sys_sigsuspend), - SLOT(sigwait, __libc_sigwait), - SLOT(sigtimedwait, __sys_sigtimedwait), - SLOT(sigwaitinfo, __sys_sigwaitinfo), - SLOT(swapcontext, __sys_swapcontext), - SLOT(system, __libc_system), - SLOT(tcdrain, __libc_tcdrain), - SLOT(wait4, __sys_wait4), - SLOT(write, __sys_write), - SLOT(writev, __sys_writev), - SLOT(_pthread_mutex_init_calloc_cb, _pthread_mutex_init_calloc_cb_stub), - SLOT(spinlock, __libc_spinlock_stub), - SLOT(spinunlock, __libc_spinunlock_stub), - SLOT(kevent, __sys_kevent), - SLOT(wait6, __sys_wait6), - SLOT(ppoll, __sys_ppoll), -}; -#undef SLOT - -interpos_func_t * -__libc_interposing_slot(int interposno) -{ - - return (&__libc_interposing[interposno]); -} diff --git a/lib/libc/sys/kevent.c b/lib/libc/sys/kevent.c deleted file mode 100644 index 5f84ef8..0000000 --- a/lib/libc/sys/kevent.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2015 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/event.h> -#include <sys/time.h> -#include "libc_private.h" - -__weak_reference(__sys_kevent, __kevent); - -#pragma weak kevent -int -kevent(int kq, const struct kevent *changelist, int nchanges, - struct kevent *eventlist, int nevents, const struct timespec *timeout) -{ - - return (((int (*)(int, const struct kevent *, int, - struct kevent *, int, const struct timespec *)) - __libc_interposing[INTERPOS_kevent])(kq, changelist, nchanges, - eventlist, nevents, timeout)); -} diff --git a/lib/libc/sys/kqueue.2 b/lib/libc/sys/kqueue.2 index c5e8caf..9a7cc23 100644 --- a/lib/libc/sys/kqueue.2 +++ b/lib/libc/sys/kqueue.2 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 29, 2015 +.Dd July 18, 2014 .Dt KQUEUE 2 .Os .Sh NAME @@ -41,7 +41,7 @@ .Fn kqueue "void" .Ft int .Fn kevent "int kq" "const struct kevent *changelist" "int nchanges" "struct kevent *eventlist" "int nevents" "const struct timespec *timeout" -.Fn EV_SET "kev" ident filter flags fflags data udata +.Fn EV_SET "&kev" ident filter flags fflags data udata .Sh DESCRIPTION The .Fn kqueue @@ -162,56 +162,56 @@ struct kevent { The fields of .Fa struct kevent are: -.Bl -tag -width "Fa filter" -.It Fa ident +.Bl -tag -width XXXfilter +.It ident Value used to identify this event. The exact interpretation is determined by the attached filter, but often is a file descriptor. -.It Fa filter +.It filter Identifies the kernel filter used to process this event. The pre-defined system filters are described below. -.It Fa flags +.It flags Actions to perform on the event. -.It Fa fflags +.It fflags Filter-specific flags. -.It Fa data +.It data Filter-specific data value. -.It Fa udata +.It udata Opaque user-defined value passed through the kernel unchanged. .El .Pp The .Va flags field can contain the following values: -.Bl -tag -width EV_DISPATCH -.It Dv EV_ADD +.Bl -tag -width XXXEV_ONESHOT +.It EV_ADD Adds the event to the kqueue. Re-adding an existing event will modify the parameters of the original event, and not result in a duplicate entry. Adding an event automatically enables it, unless overridden by the EV_DISABLE flag. -.It Dv EV_ENABLE +.It EV_ENABLE Permit .Fn kevent to return the event if it is triggered. -.It Dv EV_DISABLE +.It EV_DISABLE Disable the event so .Fn kevent will not return it. The filter itself is not disabled. -.It Dv EV_DISPATCH +.It EV_DISPATCH Disable the event source immediately after delivery of an event. See .Dv EV_DISABLE above. -.It Dv EV_DELETE +.It EV_DELETE Removes the event from the kqueue. Events which are attached to file descriptors are automatically deleted on the last close of the descriptor. -.It Dv EV_RECEIPT +.It EV_RECEIPT This flag is useful for making bulk changes to a kqueue without draining any pending events. When passed as input, it forces @@ -220,20 +220,20 @@ to always be returned. When a filter is successfully added the .Va data field will be zero. -.It Dv EV_ONESHOT +.It EV_ONESHOT Causes the event to return only the first occurrence of the filter being triggered. After the user retrieves the event from the kqueue, it is deleted. -.It Dv EV_CLEAR +.It EV_CLEAR After the event is retrieved by the user, its state is reset. This is useful for filters which report state transitions instead of the current state. Note that some filters may automatically set this flag internally. -.It Dv EV_EOF +.It EV_EOF Filters may set this flag to indicate filter-specific EOF condition. -.It Dv EV_ERROR +.It EV_ERROR See .Sx RETURN VALUES below. @@ -245,8 +245,8 @@ Arguments may be passed to and from the filter via the and .Va data fields in the kevent structure. -.Bl -tag -width "Dv EVFILT_PROCDESC" -.It Dv EVFILT_READ +.Bl -tag -width EVFILT_PROCDESC +.It EVFILT_READ Takes a descriptor as the identifier, and returns whenever there is data available to read. The behavior of the filter is slightly different depending @@ -265,7 +265,7 @@ subject to the value of the socket buffer. This may be overridden with a per-filter low water mark at the time the filter is added by setting the -.Dv NOTE_LOWAT +NOTE_LOWAT flag in .Va fflags , and specifying the new low water mark in @@ -275,9 +275,7 @@ On return, contains the number of bytes of protocol data available to read. .Pp If the read direction of the socket has shutdown, then the filter -also sets -.Dv EV_EOF -in +also sets EV_EOF in .Va flags , and returns the socket error (if any) in .Va fflags . @@ -293,13 +291,9 @@ Returns when the there is data to read; .Va data contains the number of bytes available. .Pp -When the last writer disconnects, the filter will set -.Dv EV_EOF -in +When the last writer disconnects, the filter will set EV_EOF in .Va flags . -This may be cleared by passing in -.Dv EV_CLEAR , -at which point the +This may be cleared by passing in EV_CLEAR, at which point the filter will resume waiting for data to become available before returning. .It "BPF devices" @@ -310,7 +304,7 @@ enabled and there is any data to read; .Va data contains the number of bytes available. .El -.It Dv EVFILT_WRITE +.It EVFILT_WRITE Takes a descriptor as the identifier, and returns whenever it is possible to write to the descriptor. For sockets, pipes @@ -318,30 +312,23 @@ and fifos, .Va data will contain the amount of space remaining in the write buffer. The filter will set EV_EOF when the reader disconnects, and for -the fifo case, this may be cleared by use of -.Dv EV_CLEAR . +the fifo case, this may be cleared by use of EV_CLEAR. Note that this filter is not supported for vnodes or BPF devices. .Pp For sockets, the low water mark and socket error handling is -identical to the -.Dv EVFILT_READ -case. -.It Dv EVFILT_AIO +identical to the EVFILT_READ case. +.It EVFILT_AIO The sigevent portion of the AIO request is filled in, with .Va sigev_notify_kqueue containing the descriptor of the kqueue that the event should be attached to, .Va sigev_notify_kevent_flags -containing the kevent flags which should be -.Dv EV_ONESHOT , -.Dv EV_CLEAR -or -.Dv EV_DISPATCH , +containing the kevent flags which should be EV_ONESHOT, EV_CLEAR or +EV_DISPATCH, .Va sigev_value containing the udata value, and .Va sigev_notify -set to -.Dv SIGEV_KEVENT . +set to SIGEV_KEVENT. When the .Fn aio_* system call is made, the event will be registered @@ -352,30 +339,29 @@ argument set to the returned by the .Fn aio_* system call. -The filter returns under the same conditions as -.Fn aio_error . -.It Dv EVFILT_VNODE +The filter returns under the same conditions as aio_error. +.It EVFILT_VNODE Takes a file descriptor as the identifier and the events to watch for in .Va fflags , and returns when one or more of the requested events occurs on the descriptor. The events to monitor are: -.Bl -tag -width "Dv NOTE_RENAME" -.It Dv NOTE_DELETE +.Bl -tag -width XXNOTE_RENAME +.It NOTE_DELETE The .Fn unlink system call was called on the file referenced by the descriptor. -.It Dv NOTE_WRITE +.It NOTE_WRITE A write occurred on the file referenced by the descriptor. -.It Dv NOTE_EXTEND +.It NOTE_EXTEND The file referenced by the descriptor was extended. -.It Dv NOTE_ATTRIB +.It NOTE_ATTRIB The file referenced by the descriptor had its attributes changed. -.It Dv NOTE_LINK +.It NOTE_LINK The link count on the file changed. -.It Dv NOTE_RENAME +.It NOTE_RENAME The file referenced by the descriptor was renamed. -.It Dv NOTE_REVOKE +.It NOTE_REVOKE Access to the file was revoked via .Xr revoke 2 or the underlying file system was unmounted. @@ -384,26 +370,26 @@ or the underlying file system was unmounted. On return, .Va fflags contains the events which triggered the filter. -.It Dv EVFILT_PROC +.It EVFILT_PROC Takes the process ID to monitor as the identifier and the events to watch for in .Va fflags , and returns when the process performs one or more of the requested events. If a process can normally see another process, it can attach an event to it. The events to monitor are: -.Bl -tag -width "Dv NOTE_TRACKERR" -.It Dv NOTE_EXIT +.Bl -tag -width XXNOTE_TRACKERR +.It NOTE_EXIT The process has exited. The exit status will be stored in .Va data . -.It Dv NOTE_FORK +.It NOTE_FORK The process has called .Fn fork . -.It Dv NOTE_EXEC +.It NOTE_EXEC The process has executed a new process via .Xr execve 2 or a similar call. -.It Dv NOTE_TRACK +.It NOTE_TRACK Follow a process across .Fn fork calls. @@ -411,28 +397,22 @@ The parent process registers a new kevent to monitor the child process using the same .Va fflags as the original event. -The child process will signal an event with -.Dv NOTE_CHILD -set in +The child process will signal an event with NOTE_CHILD set in .Va fflags and the parent PID in .Va data . .Pp If the parent process fails to register a new kevent .Pq usually due to resource limitations , -it will signal an event with -.Dv NOTE_TRACKERR -set in +it will signal an event with NOTE_TRACKERR set in .Va fflags , -and the child process will not signal a -.Dv NOTE_CHILD -event. +and the child process will not signal a NOTE_CHILD event. .El .Pp On return, .Va fflags contains the events which triggered the filter. -.It Dv EVFILT_PROCDESC +.It EVFILT_PROCDESC Takes the process descriptor created by .Xr pdfork 2 to monitor as the identifier and the events to watch for in @@ -440,8 +420,8 @@ to monitor as the identifier and the events to watch for in and returns when the associated process performs one or more of the requested events. The events to monitor are: -.Bl -tag -width "Dv NOTE_EXIT" -.It Dv NOTE_EXIT +.Bl -tag -width XXNOTE_EXIT +.It NOTE_EXIT The process has exited. The exit status will be stored in .Va data . @@ -450,7 +430,7 @@ The exit status will be stored in On return, .Va fflags contains the events which triggered the filter. -.It Dv EVFILT_SIGNAL +.It EVFILT_SIGNAL Takes the signal number to monitor as the identifier and returns when the given signal is delivered to the process. This coexists with the @@ -460,9 +440,7 @@ and facilities, and has a lower precedence. The filter will record all attempts to deliver a signal to a process, even if the signal has -been marked as -.Dv SIG_IGN , -except for the +been marked as SIG_IGN, except for the .Dv SIGCHLD signal, which, if ignored, won't be recorded by the filter. Event notification happens after normal @@ -470,18 +448,14 @@ signal delivery processing. .Va data returns the number of times the signal has occurred since the last call to .Fn kevent . -This filter automatically sets the -.Dv EV_CLEAR -flag internally. -.It Dv EVFILT_TIMER +This filter automatically sets the EV_CLEAR flag internally. +.It EVFILT_TIMER Establishes an arbitrary timer identified by .Va ident . When adding a timer, .Va data specifies the timeout period. -The timer will be periodic unless -.Dv EV_ONESHOT -is specified. +The timer will be periodic unless EV_ONESHOT is specified. On return, .Va data contains the number of times the timeout has expired since the last call to @@ -491,7 +465,7 @@ There is a system wide limit on the number of timers which is controlled by the .Va kern.kq_calloutmax sysctl. -.Bl -tag -width "Dv NOTE_USECONDS" +.Bl -tag -width XXNOTE_USECONDS .It Dv NOTE_SECONDS .Va data is in seconds. @@ -519,7 +493,7 @@ user level code. The lower 24 bits of the .Va fflags may be used for user defined flags and manipulated using the following: -.Bl -tag -width "Dv NOTE_FFLAGSMASK" +.Bl -tag -width XXNOTE_FFLAGSMASK .It Dv NOTE_FFNOP Ignore the input .Va fflags . @@ -541,7 +515,7 @@ User defined flag mask for .El .Pp A user event is triggered for output with the following: -.Bl -tag -width "Dv NOTE_FFLAGSMASK" +.Bl -tag -width XXNOTE_FFLAGSMASK .It Dv NOTE_TRIGGER Cause the event to be triggered. .El @@ -550,16 +524,6 @@ On return, .Va fflags contains the users defined flags in the lower 24 bits. .El -.Sh CANCELLATION BEHAVIOUR -If -.Fa nevents -is non-zero, i.e. the function is potentially blocking, the call -is a cancellation point. -Otherwise, i.e. if -.Fa nevents -is zero, the call is not cancellable. -Cancellation can only occur before any changes are made to the kqueue, -or when the call was blocked and no changes to the queue were requested. .Sh RETURN VALUES The .Fn kqueue @@ -630,8 +594,6 @@ The specified descriptor is invalid. .It Bq Er EINTR A signal was delivered before the timeout expired and before any events were placed on the kqueue for return. -.It Bq Er EINTR -A cancellation request was delivered to the thread, but not yet handled. .It Bq Er EINVAL The specified time limit or filter is invalid. .It Bq Er ENOENT @@ -646,14 +608,6 @@ sysctl. .It Bq Er ESRCH The specified process to attach to does not exist. .El -.Pp -When -.Fn kevent -call fails with -.Er EINTR -error, all changes in the -.Fa changelist -have been applied. .Sh SEE ALSO .Xr aio_error 2 , .Xr aio_read 2 , @@ -663,7 +617,6 @@ have been applied. .Xr select 2 , .Xr sigaction 2 , .Xr write 2 , -.Xr pthread_setcancelstate 3 , .Xr signal 3 .Sh HISTORY The diff --git a/lib/libc/sys/lseek.c b/lib/libc/sys/lseek.c new file mode 100644 index 0000000..a086be1 --- /dev/null +++ b/lib/libc/sys/lseek.c @@ -0,0 +1,56 @@ +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)lseek.c 8.1 (Berkeley) 6/17/93"; +#endif /* LIBC_SCCS and not lint */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <sys/types.h> +#include <sys/syscall.h> +#include <unistd.h> +#include "libc_private.h" + +/* + * This function provides 64-bit offset padding that + * is not supplied by GCC 1.X but is supplied by GCC 2.X. + */ +off_t +lseek(fd, offset, whence) + int fd; + off_t offset; + int whence; +{ + + if (__getosreldate() >= 700051) + return(__sys_lseek(fd, offset, whence)); + else + return(__sys_freebsd6_lseek(fd, 0, offset, whence)); +} diff --git a/lib/libc/sys/mmap.2 b/lib/libc/sys/mmap.2 index c818342..7380a7f 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 February 18, 2015 +.Dd September 17, 2014 .Dt MMAP 2 .Os .Sh NAME @@ -160,7 +160,7 @@ is specified, must be a multiple of the pagesize. If .Dv MAP_EXCL -is not specified, a successful +is not specified, a successfull .Dv MAP_FIXED request replaces any previous mappings for the process' pages in the range from @@ -225,7 +225,7 @@ it. You can test file fragmentation by observing the KB/t (kilobytes per transfer) results from an .Dq Li iostat 1 -while reading a large file sequentially, e.g.,\& using +while reading a large file sequentially, e.g.\& using .Dq Li dd if=filename of=/dev/null bs=32k . .Pp The @@ -448,3 +448,17 @@ was specified and insufficient memory was available. .Xr munmap 2 , .Xr getpagesize 3 , .Xr getpagesizes 3 +.Sh BUGS +The +.Fa len +argument +is limited to the maximum file size or available userland address +space. +Files may not be able to be made more than 1TB large on 32 bit systems +due to file systems restrictions and bugs, but address space is far more +restrictive. +Larger files may be possible on 64 bit systems. +.Pp +The previous documented limit of 2GB was a documentation bug. +That limit has not existed since +.Fx 2.2 . diff --git a/lib/libc/sys/mmap.c b/lib/libc/sys/mmap.c new file mode 100644 index 0000000..0fa03ba --- /dev/null +++ b/lib/libc/sys/mmap.c @@ -0,0 +1,56 @@ +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)mmap.c 8.1 (Berkeley) 6/17/93"; +#endif /* LIBC_SCCS and not lint */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <sys/types.h> +#include <sys/mman.h> +#include <sys/syscall.h> +#include <unistd.h> +#include "libc_private.h" + +/* + * This function provides 64-bit offset padding that + * is not supplied by GCC 1.X but is supplied by GCC 2.X. + */ +void * +mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset) +{ + + if (__getosreldate() >= 700051) { + return (__sys_mmap(addr, len, prot, flags, fd, offset)); + } else { + return (__sys_freebsd6_mmap(addr, len, prot, flags, fd, 0, + offset)); + } +} diff --git a/lib/libc/sys/mount.2 b/lib/libc/sys/mount.2 index 881d830..57ad428 100644 --- a/lib/libc/sys/mount.2 +++ b/lib/libc/sys/mount.2 @@ -28,7 +28,7 @@ .\" @(#)mount.2 8.3 (Berkeley) 5/24/95 .\" $FreeBSD$ .\" -.Dd April 13, 2015 +.Dd January 26, 2010 .Dt MOUNT 2 .Os .Sh NAME @@ -86,7 +86,7 @@ containing .Fa niov elements. The following options are required by all file systems: -.Bl -column fstype -offset indent +.Bl -item -offset indent -compact .It .Li fstype Ta file system type name (e.g., Dq Li procfs ) .It @@ -351,6 +351,11 @@ The argument points outside the process's allocated address space. .El +.Pp +A +.Em ufs +mount can also fail if the maximum number of file systems are currently +mounted. .Sh SEE ALSO .Xr lsvfs 1 , .Xr mksnap_ffs 8 , diff --git a/lib/libc/sys/msync.c b/lib/libc/sys/msync.c deleted file mode 100644 index 3c6879f..0000000 --- a/lib/libc/sys/msync.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/fcntl.h> -#include "libc_private.h" - -__weak_reference(__sys_msync, __msync); - -#pragma weak msync -int -msync(void *addr, size_t len, int flags) -{ - - return (((int (*)(void *, size_t, int)) - __libc_interposing[INTERPOS_msync])(addr, len, flags)); -} diff --git a/lib/libc/sys/nanosleep.c b/lib/libc/sys/nanosleep.c deleted file mode 100644 index 412b05e..0000000 --- a/lib/libc/sys/nanosleep.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <time.h> -#include "libc_private.h" - -__weak_reference(__sys_nanosleep, __nanosleep); - -#pragma weak nanosleep -int -nanosleep(const struct timespec *rqtp, struct timespec *rmtp) -{ - - return (((int (*)(const struct timespec *, struct timespec *)) - __libc_interposing[INTERPOS_nanosleep])(rqtp, rmtp)); -} diff --git a/lib/libc/sys/open.2 b/lib/libc/sys/open.2 index acd376c..41a6c64 100644 --- a/lib/libc/sys/open.2 +++ b/lib/libc/sys/open.2 @@ -28,7 +28,7 @@ .\" @(#)open.2 8.2 (Berkeley) 11/16/93 .\" $FreeBSD$ .\" -.Dd April 2, 2015 +.Dd February 7, 2013 .Dt OPEN 2 .Os .Sh NAME @@ -115,8 +115,8 @@ O_DIRECT eliminate or reduce cache effects O_FSYNC synchronous writes O_SYNC synchronous writes O_NOFOLLOW do not follow symlinks -O_NOCTTY ignored -O_TTY_INIT ignored +O_NOCTTY don't assign controlling terminal +O_TTY_INIT restore default terminal attributes O_DIRECTORY error if file is not a directory O_CLOEXEC set FD_CLOEXEC upon open .Ed diff --git a/lib/libc/sys/open.c b/lib/libc/sys/open.c deleted file mode 100644 index e0273c6..0000000 --- a/lib/libc/sys/open.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/fcntl.h> -#include <stdarg.h> -#include "libc_private.h" - -__weak_reference(__sys_open, __open); - -#pragma weak open -int -open(const char *path, int flags, ...) -{ - va_list ap; - int mode; - - if ((flags & O_CREAT) != 0) { - va_start(ap, flags); - mode = va_arg(ap, int); - va_end(ap); - } else { - mode = 0; - } - return (((int (*)(int, const char *, int, ...)) - __libc_interposing[INTERPOS_openat])(AT_FDCWD, path, flags, mode)); -} diff --git a/lib/libc/sys/openat.c b/lib/libc/sys/openat.c deleted file mode 100644 index 1bd12ea..0000000 --- a/lib/libc/sys/openat.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/fcntl.h> -#include <stdarg.h> -#include "libc_private.h" - -__weak_reference(__sys_openat, __openat); -__sym_compat(openat, __impl_openat, FBSD_1.1); -__weak_reference(openat, __impl_openat); -__sym_default(openat, openat, FBSD_1.2); - -#pragma weak openat -int -openat(int fd, const char *path, int flags, ...) -{ - va_list ap; - int mode; - - if ((flags & O_CREAT) != 0) { - va_start(ap, flags); - mode = va_arg(ap, int); - va_end(ap); - } else { - mode = 0; - } - return (((int (*)(int, const char *, int, ...)) - __libc_interposing[INTERPOS_openat])(fd, path, flags, mode)); -} diff --git a/lib/libc/sys/poll.2 b/lib/libc/sys/poll.2 index dbd641f..a1c7ada 100644 --- a/lib/libc/sys/poll.2 +++ b/lib/libc/sys/poll.2 @@ -148,8 +148,8 @@ is zero, then will return without blocking. .Pp The -.Fn ppoll -system call, unlike +.Fn ppoll +system call, unlike .Fn poll , is used to safely wait until either a set of file descriptors becomes ready or until a signal is caught. @@ -174,12 +174,13 @@ used by A null pointer may be passed to indicate that .Fn ppoll should wait indefinitely. -Finally, +Finally, .Fa newsigmask specifies a signal mask which is set while waiting for input. -When +When .Fn ppoll returns, the original signal mask is restored. +.Pp .Bd -literal struct timespec { time_t tv_sec; /* seconds */ @@ -246,11 +247,11 @@ The specified time limit is invalid. One of its components is negative or too la .Xr write 2 .Sh STANDARDS The -.Fn poll +.Fn poll function conforms to .St -p1003.1-2001 . The -.Fn ppoll +.Fn ppoll is not specified by POSIX. .Sh HISTORY The @@ -261,8 +262,8 @@ This manual page and the core of the implementation was taken from .Nx . The .Fn ppoll -function first appeared in -.Fx 11.0 +function first appeared in +.Fx 11.0 .Sh BUGS The distinction between some of the fields in the .Fa events diff --git a/lib/libc/sys/poll.c b/lib/libc/sys/poll.c deleted file mode 100644 index 43c17d2..0000000 --- a/lib/libc/sys/poll.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/poll.h> -#include "libc_private.h" - -__weak_reference(__sys_poll, __poll); - -#pragma weak poll -int -poll(struct pollfd pfd[], nfds_t nfds, int timeout) -{ - - return (((int (*)(struct pollfd *, nfds_t, int)) - __libc_interposing[INTERPOS_poll])(pfd, nfds, timeout)); -} diff --git a/lib/libc/sys/posix_openpt.2 b/lib/libc/sys/posix_openpt.2 index b7e345c..916e75a 100644 --- a/lib/libc/sys/posix_openpt.2 +++ b/lib/libc/sys/posix_openpt.2 @@ -110,8 +110,8 @@ is not valid. Out of pseudo-terminal resources. .El .Sh SEE ALSO -.Xr ptsname 3 , .Xr pts 4 , +.Xr ptsname 3 , .Xr tty 4 .Sh STANDARDS The @@ -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 Mt ed@FreeBSD.org +.An Ed Schouten Aq Mt ed@FreeBSD.org diff --git a/lib/libc/sys/ppoll.c b/lib/libc/sys/ppoll.c deleted file mode 100644 index f62fd19..0000000 --- a/lib/libc/sys/ppoll.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2015 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/poll.h> -#include "libc_private.h" - -__weak_reference(__sys_ppoll, __ppoll); - -#pragma weak ppoll -int -ppoll(struct pollfd pfd[], nfds_t nfds, const struct timespec *__restrict - timeout, const sigset_t *__restrict newsigmask) -{ - - return (((int (*)(struct pollfd *, nfds_t, const struct timespec *, - const sigset_t *)) __libc_interposing[INTERPOS_ppoll])(pfd, nfds, - timeout, newsigmask)); -} diff --git a/lib/libc/aarch64/sys/sbrk.S b/lib/libc/sys/pread.c index db9d7e1..7566566 100644 --- a/lib/libc/aarch64/sys/sbrk.S +++ b/lib/libc/sys/pread.c @@ -1,9 +1,6 @@ -/*- - * Copyright (c) 2014 The FreeBSD Foundation - * All rights reserved. - * - * This software was developed by Andrew Turner under - * sponsorship from the FreeBSD Foundation. +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -13,11 +10,14 @@ * 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. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * 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 AUTHOR OR CONTRIBUTORS BE LIABLE + * 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) @@ -27,53 +27,31 @@ * SUCH DAMAGE. */ -#include <machine/asm.h> +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)mmap.c 8.1 (Berkeley) 6/17/93"; +#endif /* LIBC_SCCS and not lint */ +#include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#include "SYS.h" - - .data - .align 3 - .global _C_LABEL(curbrk) - .type _C_LABEL(curbrk),#object -_C_LABEL(curbrk): - .quad _C_LABEL(_end) +#include <sys/types.h> +#include <sys/syscall.h> +#include <unistd.h> +#include "libc_private.h" - .text /* - * void *sbrk(intptr_t incr); + * This function provides 64-bit offset padding that + * is not supplied by GCC 1.X but is supplied by GCC 2.X. */ -ENTRY(_sbrk) - WEAK_REFERENCE(_sbrk, sbrk) - - /* Load the address of curbrk */ -#ifdef __PIC__ - adrp x2, :got:curbrk - ldr x3, [x2, #:got_lo12:curbrk] -#else - ldr x3, .Lcurbrk -#endif - - /* Get the current brk address */ - ldr x2, [x3] - - /* Calculate the new value */ - add x0, x2, x0 - mov x4, x0 - - /* Update for this value, will overwrite x0 and x1 */ - _SYSCALL(break) - b.cs cerror - - /* Load the old value to return */ - ldr x0, [x3] - - /* Store the new curbrk value */ - str x4, [x3] - - ret -#ifndef __PIC__ -.Lcurbrk: - .quad _C_LABEL(curbrk) -#endif -END(_sbrk) +ssize_t +pread(fd, buf, nbyte, offset) + int fd; + void *buf; + size_t nbyte; + off_t offset; +{ + + if (__getosreldate() >= 700051) + return (__sys_pread(fd, buf, nbyte, offset)); + else + return (__sys_freebsd6_pread(fd, buf, nbyte, 0, offset)); +} diff --git a/lib/libc/sys/procctl.2 b/lib/libc/sys/procctl.2 index 76a3cef..6ad0590 100644 --- a/lib/libc/sys/procctl.2 +++ b/lib/libc/sys/procctl.2 @@ -1,11 +1,7 @@ -.\" Copyright (c) 2013 Hudson River Trading LLC +.\" Copyright (c) 2013 Advanced Computing Technologies LLC .\" Written by: John H. Baldwin <jhb@FreeBSD.org> .\" All rights reserved. .\" -.\" Copyright (c) 2014 The FreeBSD Foundation -.\" Portions of this documentation were written by Konstantin Belousov -.\" under sponsorship from the FreeBSD Foundation. -.\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: @@ -29,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 29, 2014 +.Dd September 19, 2013 .Dt PROCCTL 2 .Os .Sh NAME @@ -71,7 +67,7 @@ The control request to perform is specified by the .Fa cmd argument. The following commands are supported: -.Bl -tag -width "Dv PROC_REAP_GETPIDS" +.Bl -tag -width "Dv PROC_SPROTECT" .It Dv PROC_SPROTECT Set process protection state. This is used to mark a process as protected from being killed if the system @@ -99,237 +95,7 @@ When used with mark all future child processes of each selected process as protected. Future child processes will also mark all of their future child processes. .El -.It Dv PROC_REAP_ACQUIRE -Acquires the reaper status for the current process. -The status means that children orphaned by the reaper's descendants -that were forked after the acquisition of the status are reparented to the -reaper. -After the system initialization, -.Xr init 8 -is the default reaper. -.It Dv PROC_REAP_RELEASE -Releases the reaper state for the current process. -The reaper of the current process becomes the new reaper of the -current process's descendants. -.It Dv PROC_REAP_STATUS -Provides the information about the reaper of the specified process, -or the process itself when it is a reaper. -The -.Fa data -argument must point to a -.Vt procctl_reaper_status -structure which is filled in by the syscall on successful return. -.Bd -literal -struct procctl_reaper_status { - u_int rs_flags; - u_int rs_children; - u_int rs_descendants; - pid_t rs_reaper; - pid_t rs_pid; -}; -.Ed -The -.Fa rs_flags -may have the following flags returned: -.Bl -tag -width "Dv REAPER_STATUS_REALINIT" -.It Dv REAPER_STATUS_OWNED -The specified process has acquired the reaper status and has not -released it. -When the flag is returned, the specified process -.Fa id , -pid, identifies the reaper, otherwise the -.Fa rs_reaper -field of the structure is set to the pid of the reaper -for the specified process id. -.It Dv REAPER_STATUS_REALINIT -The specified process is the root of the reaper tree, i.e. -.Xr init 8 . -.El -.Pp -The -.Fa rs_children -field returns the number of children of the reaper. -The -.Fa rs_descendants -field returns the total number of descendants of the reaper(s), -not counting descendants of the reaper in the subtree. -The -.Fa rs_reaper -field returns the reaper pid. -The -.Fa rs_pid -returns the pid of one reaper child if there are any descendants. -.It Dv PROC_REAP_GETPIDS -Queries the list of descendants of the reaper of the specified process. -The request takes a pointer to a -.Vt procctl_reaper_pids -structure in the -.Fa data -parameter. -.Bd -literal -struct procctl_reaper_pids { - u_int rp_count; - struct procctl_reaper_pidinfo *rp_pids; -}; -.Ed -When called, the -.Fa rp_pids -field must point to an array of -.Vt procctl_reaper_pidinfo -structures, to be filled in on return, -and the -.Fa rp_count -field must specify the size of the array, -into which no more than -.Fa rp_count -elements will be filled in by the kernel. -.Pp -The -.Vt "struct procctl_reaper_pidinfo" -structure provides some information about one of the reaper's descendants. -Note that for a descendant that is not a child, it may be incorrectly -identified because of a race in which the original child process exited -and the exited process's pid was reused for an unrelated process. -.Bd -literal -struct procctl_reaper_pidinfo { - pid_t pi_pid; - pid_t pi_subtree; - u_int pi_flags; -}; -.Ed -The -.Fa pi_pid -field is the process id of the descendant. -The -.Fa pi_subtree -field provides the pid of the child of the reaper, which is the (grand-)parent -of the process. -The -.Fa pi_flags -field returns the following flags, further describing the descendant: -.Bl -tag -width "Dv REAPER_PIDINFO_VALID" -.It Dv REAPER_PIDINFO_VALID -Set to indicate that the -.Vt procctl_reaper_pidinfo -structure was filled in by the kernel. -Zero-filling the -.Fa rp_pids -array and testing the -.Dv REAPER_PIDINFO_VALID -flag allows the caller to detect the end -of the returned array. -.It Dv REAPER_PIDINFO_CHILD -The -.Fa pi_pid -field identifies the direct child of the reaper. -.El -.It Dv PROC_REAP_KILL -Request to deliver a signal to some subset of the descendants of the reaper. -The -.Fa data -parameter must point to a -.Vt procctl_reaper_kill -structure, which is used both for parameters and status return. -.Bd -literal -struct procctl_reaper_kill { - int rk_sig; - u_int rk_flags; - pid_t rk_subtree; - u_int rk_killed; - pid_t rk_fpid; -}; -.Ed -The -.Fa rk_sig -field specifies the signal to be delivered. -Zero is not a valid signal number, unlike -.Xr kill 2 . -The -.Fa rk_flags -field further directs the operation. -It is or-ed from the following flags: -.Bl -tag -width "Dv REAPER_KILL_CHILDREN" -.It Dv REAPER_KILL_CHILDREN -Deliver the specified signal only to direct children of the reaper. -.It Dv REAPER_KILL_SUBTREE -Deliver the specified signal only to descendants that were forked by -the direct child with pid specified in the -.Fa rk_subtree -field. -.El -If neither the -.Dv REAPER_KILL_CHILDREN -nor the -.Dv REAPER_KILL_SUBTREE -flags are specified, all current descendants of the reaper are signalled. -.Pp -If a signal was delivered to any process, the return value from the request -is zero. -In this case, the -.Fa rk_killed -field identifies the number of processes signalled. -The -.Fa rk_fpid -field is set to the pid of the first process for which signal -delivery failed, e.g. due to the permission problems. -If no such process exist, the -.Fa rk_fpid -field is set to -1. -.It Dv PROC_TRACE_CTL -Enable or disable tracing of the specified process(es), according to the -value of the integer argument. -Tracing includes attachment to the process using -.Xr ptrace 2 -and -.Xr ktrace 2 , -debugging sysctls, -.Xr hwpmc 4 , -.Xr dtrace 1 -and core dumping. -Possible values for the -.Fa data -argument are: -.Bl -tag -width "Dv PROC_TRACE_CTL_DISABLE_EXEC" -.It Dv PROC_TRACE_CTL_ENABLE -Enable tracing, after it was disabled by -.Dv PROC_TRACE_CTL_DISABLE . -Only allowed for self. -.It Dv PROC_TRACE_CTL_DISABLE -Disable tracing for the specified process. -Tracing is re-enabled when the process changes the executing -program with -.Xr execve 2 -syscall. -A child inherits the trace settings from the parent on -.Xr fork 2 . -.It Dv PROC_TRACE_CTL_DISABLE_EXEC -Same as -.Dv PROC_TRACE_CTL_DISABLE , -but the setting persist for the process even after -.Xr execve 2 . -.El -.It Dv PROC_TRACE_STATUS -Returns the current tracing status for the specified process in -the integer variable pointed to by -.Fa data . -If tracing is disabled, -.Fa data -is set to -1. -If tracing is enabled, but no debugger is attached by -.Xr ptrace 2 -syscall, -.Fa data -is set to 0. -If a debugger is attached, -.Fa data -is set to the pid of the debugger process. .El -.Sh NOTES -Disabling tracing on a process should not be considered a security -feature, as it is bypassable both by the kernel and privileged processes, -and via other system mechanisms. -As such, it should not be relied on to reliably protect cryptographic -keying material or other confidential data. .Sh RETURN VALUES If an error occurs, a value of -1 is returned and .Va errno @@ -343,7 +109,7 @@ will fail if: .It Bq Er EFAULT The .Fa arg -parameter points outside the process's allocated address space. +points outside the process's allocated address space. .It Bq Er EINVAL The .Fa cmd @@ -366,71 +132,11 @@ An invalid operation or flag was passed in for a .Dv PROC_SPROTECT command. -.It Bq Er EPERM -The -.Fa idtype -argument is not equal to -.Dv P_PID , -or -.Fa id -is not equal to the pid of the calling process, for -.Dv PROC_REAP_ACQUIRE -or -.Dv PROC_REAP_RELEASE -requests. -.It Bq Er EINVAL -Invalid or undefined flags were passed to a -.Dv PROC_REAP_KILL -request. -.It Bq Er EINVAL -An invalid or zero signal number was requested for a -.Dv PROC_REAP_KILL -request. -.It Bq Er EINVAL -The -.Dv PROC_REAP_RELEASE -request was issued by the -.Xr init 8 -process. -.It Bq Er EBUSY -The -.Dv PROC_REAP_ACQUIRE -request was issued by a process that had already acquired reaper status -and has not yet released it. -.It Bq Er EBUSY -The -.Dv PROC_TRACE_CTL -request was issued for a process already being traced. -.It Bq Er EPERM -The -.Dv PROC_TRACE_CTL -request to re-enable tracing of the process ( -.Dv PROC_TRACE_CTL_ENABLE ) , -or to disable persistence of the -.Dv PROC_TRACE_CTL_DISABLE -on -.Xr execve 2 -was issued for a non-current process. -.It Bq Er EINVAL -The value of the integer -.Fa data -parameter for the -.Dv PROC_TRACE_CTL -request is invalid. .El .Sh SEE ALSO -.Xr dtrace 1 , -.Xr kill 2 , -.Xr ktrace 2 , -.Xr ptrace 2 , -.Xr wait 2 , -.Xr hwpmc 4 , -.Xr init 8 +.Xr ptrace 2 .Sh HISTORY The .Fn procctl function appeared in .Fx 10.0 . -The reaper facility is based on a similar feature of Linux and -DragonflyBSD, and first appeared in -.Fx 10.2 . diff --git a/lib/libc/sys/pselect.c b/lib/libc/sys/pselect.c deleted file mode 100644 index a623a7d..0000000 --- a/lib/libc/sys/pselect.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/select.h> -#include "libc_private.h" - -__weak_reference(__sys_pselect, __pselect); - -#pragma weak pselect -int -pselect(int n, fd_set *rs, fd_set *ws, fd_set *es, const struct timespec *t, - const sigset_t *s) -{ - - return (((int (*)(int, fd_set *, fd_set *, fd_set *, - const struct timespec *, const sigset_t *)) - __libc_interposing[INTERPOS_pselect])(n, rs, ws, es, t, s)); -} diff --git a/lib/libc/sys/pwrite.c b/lib/libc/sys/pwrite.c new file mode 100644 index 0000000..d17ed29 --- /dev/null +++ b/lib/libc/sys/pwrite.c @@ -0,0 +1,56 @@ +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)mmap.c 8.1 (Berkeley) 6/17/93"; +#endif /* LIBC_SCCS and not lint */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <sys/types.h> +#include <sys/syscall.h> +#include <unistd.h> +#include "libc_private.h" + +/* + * This function provides 64-bit offset padding that + * is not supplied by GCC 1.X but is supplied by GCC 2.X. + */ +ssize_t +pwrite(fd, buf, nbyte, offset) + int fd; + const void *buf; + size_t nbyte; + off_t offset; +{ + if (__getosreldate() >= 700051) + return (__sys_pwrite(fd, buf, nbyte, offset)); + else + return (__sys_freebsd6_pwrite(fd, buf, nbyte, 0, offset)); +} diff --git a/lib/libc/sys/read.c b/lib/libc/sys/read.c deleted file mode 100644 index ab30189..0000000 --- a/lib/libc/sys/read.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/syscall.h> -#include <unistd.h> -#include "libc_private.h" - -__weak_reference(__sys_read, __read); - -#pragma weak read -ssize_t -read(int fd, void *buf, size_t nbytes) -{ - - return (((ssize_t (*)(int, void *, size_t)) - __libc_interposing[INTERPOS_read])(fd, buf, nbytes)); -} diff --git a/lib/libc/sys/readv.c b/lib/libc/sys/readv.c deleted file mode 100644 index 8c82040..0000000 --- a/lib/libc/sys/readv.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/syscall.h> -#include <unistd.h> -#include "libc_private.h" - -__weak_reference(__sys_readv, __readv); - -#pragma weak readv -ssize_t -readv(int fd, const struct iovec *iov, int iovcnt) -{ - - return (((ssize_t (*)(int, const struct iovec *, int)) - __libc_interposing[INTERPOS_readv])(fd, iov, iovcnt)); -} diff --git a/lib/libc/sys/recvfrom.c b/lib/libc/sys/recvfrom.c deleted file mode 100644 index aa6ef3f..0000000 --- a/lib/libc/sys/recvfrom.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/syscall.h> -#include <sys/socket.h> -#include "libc_private.h" - -__weak_reference(__sys_recvfrom, __recvfrom); - -#pragma weak recvfrom -ssize_t -recvfrom(int s, void *buf, size_t len, int flags, - struct sockaddr * __restrict from, socklen_t * __restrict fromlen) -{ - - return (((ssize_t (*)(int, void *, size_t, int, - struct sockaddr *, socklen_t *)) - __libc_interposing[INTERPOS_recvfrom])(s, buf, len, flags, - from, fromlen)); -} diff --git a/lib/libc/sys/recvmsg.c b/lib/libc/sys/recvmsg.c deleted file mode 100644 index 282ede9..0000000 --- a/lib/libc/sys/recvmsg.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/syscall.h> -#include <sys/socket.h> -#include "libc_private.h" - -__weak_reference(__sys_recvmsg, __recvmsg); - -#pragma weak recvmsg -ssize_t -recvmsg(int s, struct msghdr *msg, int flags) -{ - - return (((int (*)(int, struct msghdr *, int)) - __libc_interposing[INTERPOS_recvmsg])(s, msg, flags)); -} diff --git a/lib/libc/sys/revoke.2 b/lib/libc/sys/revoke.2 index 482cbf6..57abdbb 100644 --- a/lib/libc/sys/revoke.2 +++ b/lib/libc/sys/revoke.2 @@ -97,8 +97,8 @@ operation on the named file. The caller is neither the owner of the file nor the super user. .El .Sh SEE ALSO -.Xr revoke 1 , -.Xr close 2 +.Xr close 2 , +.Xr revoke 1 .Sh HISTORY The .Fn revoke diff --git a/lib/libc/sys/sched_setscheduler.2 b/lib/libc/sys/sched_setscheduler.2 index b84c1a1..3e7c42b 100644 --- a/lib/libc/sys/sched_setscheduler.2 +++ b/lib/libc/sys/sched_setscheduler.2 @@ -151,9 +151,9 @@ argument is invalid, or one or more of the parameters contained in is outside the valid range for the specified scheduling policy. .El .Sh SEE ALSO +.Xr sched_getparam 2 , .Xr sched_get_priority_max 2 , .Xr sched_get_priority_min 2 , -.Xr sched_getparam 2 , .Xr sched_rr_get_interval 2 , .Xr sched_setparam 2 , .Xr sched_yield 2 diff --git a/lib/libc/sys/select.c b/lib/libc/sys/select.c deleted file mode 100644 index 3990496..0000000 --- a/lib/libc/sys/select.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/select.h> -#include "libc_private.h" - -__weak_reference(__sys_select, __select); - -#pragma weak select -int -select(int n, fd_set *rs, fd_set *ws, fd_set *es, struct timeval *t) -{ - - return (((int (*)(int, fd_set *, fd_set *, fd_set *, struct timeval *)) - __libc_interposing[INTERPOS_select])(n, rs, ws, es, t)); -} diff --git a/lib/libc/sys/sendmsg.c b/lib/libc/sys/sendmsg.c deleted file mode 100644 index 7944643..0000000 --- a/lib/libc/sys/sendmsg.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/syscall.h> -#include <sys/socket.h> -#include "libc_private.h" - -__weak_reference(__sys_sendmsg, __sendmsg); - -#pragma weak sendmsg -ssize_t -sendmsg(int s, const struct msghdr *msg, int flags) -{ - - return (((int (*)(int, const struct msghdr *, int)) - __libc_interposing[INTERPOS_sendmsg])(s, msg, flags)); -} diff --git a/lib/libc/sys/sendto.c b/lib/libc/sys/sendto.c deleted file mode 100644 index ecf98ee..0000000 --- a/lib/libc/sys/sendto.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/syscall.h> -#include <sys/socket.h> -#include "libc_private.h" - -__weak_reference(__sys_sendto, __sendto); - -#pragma weak sendto -ssize_t -sendto(int s, const void *msg, size_t len, int flags, - const struct sockaddr *to, socklen_t tolen) -{ - - return (((ssize_t (*)(int, const void *, size_t, int, - const struct sockaddr *, socklen_t)) - __libc_interposing[INTERPOS_sendto])(s, msg, len, flags, - to, tolen)); -} diff --git a/lib/libc/sys/setcontext.c b/lib/libc/sys/setcontext.c deleted file mode 100644 index 31b888f..0000000 --- a/lib/libc/sys/setcontext.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <ucontext.h> -#include "libc_private.h" - -__weak_reference(__sys_setcontext, __setcontext); -__sym_compat(setcontext, __impl_setcontext, FBSD_1.0); -__weak_reference(setcontext, __impl_setcontext); -__sym_default(setcontext, setcontext, FBSD_1.2); - -#pragma weak setcontext -int -setcontext(const ucontext_t *uc) -{ - - return (((int (*)(const ucontext_t *)) - __libc_interposing[INTERPOS_setcontext])(uc)); -} diff --git a/lib/libc/sys/setresuid.2 b/lib/libc/sys/setresuid.2 index 602166f..08d07f3 100644 --- a/lib/libc/sys/setresuid.2 +++ b/lib/libc/sys/setresuid.2 @@ -19,7 +19,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 7, 2015 +.Dd April 13, 2001 .Dt SETRESUID 2 .Os .Sh NAME @@ -90,5 +90,10 @@ was invalid. .Xr setregid 2 , .Xr setreuid 2 , .Xr setuid 2 +.Sh STANDARDS +These system calls are not available on many platforms. +They exist in +.Fx +to support Linux binaries linked against GNU libc2. .Sh HISTORY These functions first appeared in HP-UX. diff --git a/lib/libc/sys/sigaction.c b/lib/libc/sys/sigaction.c deleted file mode 100644 index 7645538..0000000 --- a/lib/libc/sys/sigaction.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <signal.h> -#include "libc_private.h" - -__weak_reference(__sys_sigaction, __sigaction); - -#pragma weak sigaction -int -sigaction(int sig, const struct sigaction *act, struct sigaction *oact) -{ - - return (((int (*)(int, const struct sigaction *, struct sigaction *)) - __libc_interposing[INTERPOS_sigaction])(sig, act, oact)); -} diff --git a/lib/libc/sys/sigprocmask.c b/lib/libc/sys/sigprocmask.c deleted file mode 100644 index 40dba95..0000000 --- a/lib/libc/sys/sigprocmask.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <signal.h> -#include "libc_private.h" - -__weak_reference(__sys_sigprocmask, __sigprocmask); - -#pragma weak sigprocmask -int -sigprocmask(int how, const sigset_t *set, sigset_t *oset) -{ - - return (((int (*)(int, const sigset_t *, sigset_t *)) - __libc_interposing[INTERPOS_sigprocmask])(how, set, oset)); -} diff --git a/lib/libc/sys/sigsuspend.c b/lib/libc/sys/sigsuspend.c deleted file mode 100644 index 6e47368..0000000 --- a/lib/libc/sys/sigsuspend.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <signal.h> -#include "libc_private.h" - -__weak_reference(__sys_sigsuspend, __sigsuspend); - -#pragma weak sigsuspend -int -sigsuspend(const sigset_t *set) -{ - - return (((int (*)(const sigset_t *)) - __libc_interposing[INTERPOS_sigsuspend])(set)); -} diff --git a/lib/libc/sys/sigtimedwait.c b/lib/libc/sys/sigtimedwait.c deleted file mode 100644 index 4e06719..0000000 --- a/lib/libc/sys/sigtimedwait.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <signal.h> -#include "libc_private.h" - -__weak_reference(__sys_sigtimedwait, __sigtimedwait); - -#pragma weak sigtimedwait -int -sigtimedwait(const sigset_t * __restrict set, siginfo_t * __restrict info, - const struct timespec * __restrict t) -{ - - return (((int (*)(const sigset_t *, siginfo_t *, - const struct timespec *)) - __libc_interposing[INTERPOS_sigtimedwait])(set, info, t)); -} diff --git a/lib/libc/sys/sigwait.c b/lib/libc/sys/sigwait.c index b21cabd..2fdffdd 100644 --- a/lib/libc/sys/sigwait.c +++ b/lib/libc/sys/sigwait.c @@ -28,21 +28,13 @@ __FBSDID("$FreeBSD$"); #include <errno.h> #include <signal.h> -#include "libc_private.h" -__weak_reference(__libc_sigwait, __sigwait); +int __sys_sigwait(const sigset_t * restrict, int * restrict); -#pragma weak sigwait -int -sigwait(const sigset_t *set, int *sig) -{ - - return (((int (*)(const sigset_t *, int *)) - __libc_interposing[INTERPOS_sigwait])(set, sig)); -} +__weak_reference(__sigwait, sigwait); int -__libc_sigwait(const sigset_t *set, int *sig) +__sigwait(const sigset_t * restrict set, int * restrict sig) { int ret; diff --git a/lib/libc/sys/sigwaitinfo.2 b/lib/libc/sys/sigwaitinfo.2 index b497592..9109759 100644 --- a/lib/libc/sys/sigwaitinfo.2 +++ b/lib/libc/sys/sigwaitinfo.2 @@ -172,8 +172,8 @@ system calls fail if: .Bl -tag -width Er .It Bq Er EINTR The wait was interrupted by an unblocked, caught signal. -.El .Pp +.El The .Fn sigtimedwait system call may also fail if: diff --git a/lib/libc/sys/sigwaitinfo.c b/lib/libc/sys/sigwaitinfo.c deleted file mode 100644 index b9cdc79..0000000 --- a/lib/libc/sys/sigwaitinfo.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <signal.h> -#include "libc_private.h" - -__weak_reference(__sys_sigwaitinfo, __sigwaitinfo); - -#pragma weak sigwaitinfo -int -sigwaitinfo(const sigset_t * __restrict set, siginfo_t * __restrict info) -{ - - return (((int (*)(const sigset_t *, siginfo_t *)) - __libc_interposing[INTERPOS_sigwaitinfo])(set, info)); -} diff --git a/lib/libc/sys/socketpair.2 b/lib/libc/sys/socketpair.2 index b15553a..d3a47eb 100644 --- a/lib/libc/sys/socketpair.2 +++ b/lib/libc/sys/socketpair.2 @@ -28,7 +28,7 @@ .\" @(#)socketpair.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd May 4, 2015 +.Dd September 11, 2013 .Dt SOCKETPAIR 2 .Os .Sh NAME @@ -40,13 +40,13 @@ .In sys/types.h .In sys/socket.h .Ft int -.Fn socketpair "int domain" "int type" "int protocol" "int *sv" +.Fn socketpair "int fd" "int type" "int protocol" "int *sv" .Sh DESCRIPTION The .Fn socketpair system call creates an unnamed pair of connected sockets in -the specified communications -.Fa domain , +the specified domain +.Fa fd , of the specified .Fa type , and using the optionally specified diff --git a/lib/libc/sys/truncate.2 b/lib/libc/sys/truncate.2 index 0734464..f06c1eb 100644 --- a/lib/libc/sys/truncate.2 +++ b/lib/libc/sys/truncate.2 @@ -28,7 +28,7 @@ .\" @(#)truncate.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd May 4, 2015 +.Dd December 13, 2006 .Dt TRUNCATE 2 .Os .Sh NAME @@ -60,18 +60,9 @@ is lost. If the file was smaller than this size, it will be extended as if by writing bytes with the value zero. -.Pp -The -.Fn ftruncate -system call causes the file or shared memory object backing the file descriptor -.Fa fd -to be truncated or extended to -.Fa length -bytes in size. -The file descriptor must be a valid file descriptor open for writing. -The file position pointer associated with the file descriptor -.Fa fd -will not be modified. +With +.Fn ftruncate , +the file must be open for writing. .Sh RETURN VALUES .Rv -std If the file to be modified is not a directory or @@ -138,7 +129,7 @@ is not a valid descriptor. The .Fa fd argument -references a file descriptor that is not a regular file or shared memory object. +references a socket, not a file. .It Bq Er EINVAL The .Fa fd @@ -147,14 +138,11 @@ is not open for writing. .El .Sh SEE ALSO .Xr chflags 2 , -.Xr open 2 , -.Xr shm_open 2 +.Xr open 2 .Sh HISTORY The .Fn truncate -and -.Fn ftruncate -system calls appeared in +system call appeared in .Bx 4.2 . .Sh BUGS These calls should be generalized to allow ranges diff --git a/lib/libc/aarch64/sys/pipe.S b/lib/libc/sys/truncate.c index 6b1cf24..375c9d9 100644 --- a/lib/libc/aarch64/sys/pipe.S +++ b/lib/libc/sys/truncate.c @@ -1,9 +1,6 @@ -/*- - * Copyright (c) 2014 The FreeBSD Foundation - * All rights reserved. - * - * This software was developed by Andrew Turner under - * sponsorship from the FreeBSD Foundation. +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -13,11 +10,14 @@ * 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. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * 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 AUTHOR OR CONTRIBUTORS BE LIABLE + * 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) @@ -27,26 +27,29 @@ * SUCH DAMAGE. */ -#include <machine/asm.h> +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)truncate.c 8.1 (Berkeley) 6/17/93"; +#endif /* LIBC_SCCS and not lint */ +#include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#include "SYS.h" - -ENTRY(__sys_pipe) - WEAK_REFERENCE(__sys_pipe, pipe) - - /* Backup the pointer passed to us */ - mov x2, x0 +#include <sys/types.h> +#include <sys/syscall.h> +#include <unistd.h> +#include "libc_private.h" - /* Make the syscall */ - _SYSCALL(pipe) - b.cs cerror - - /* Store the result */ - str w0, [x2, #0] - str w1, [x2, #4] +/* + * This function provides 64-bit offset padding that + * is not supplied by GCC 1.X but is supplied by GCC 2.X. + */ +int +truncate(path, length) + const char *path; + off_t length; +{ - /* Return */ - mov x0, #0 - ret -END(__sys_pipe) + if (__getosreldate() >= 700051) + return(__sys_truncate(path, length)); + else + return(__sys_freebsd6_truncate(path, 0, length)); +} diff --git a/lib/libc/sys/utimensat.2 b/lib/libc/sys/utimensat.2 deleted file mode 100644 index 0f397c6..0000000 --- a/lib/libc/sys/utimensat.2 +++ /dev/null @@ -1,292 +0,0 @@ -.\" $NetBSD: utimes.2,v 1.13 1999/03/22 19:45:11 garbled Exp $ -.\" -.\" Copyright (c) 1990, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" Copyright (c) 2012, Jilles Tjoelker -.\" -.\" 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. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" @(#)utimes.2 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD$ -.\" -.Dd January 23, 2015 -.Dt UTIMENSAT 2 -.Os -.Sh NAME -.Nm futimens , -.Nm utimensat -.Nd set file access and modification times -.Sh LIBRARY -.Lb libc -.Sh SYNOPSIS -.In sys/stat.h -.Ft int -.Fn futimens "int fd" "const struct timespec times[2]" -.Ft int -.Fo utimensat -.Fa "int fd" -.Fa "const char *path" -.Fa "const struct timespec times[2]" -.Fa "int flag" -.Fc -.Sh DESCRIPTION -The access and modification times of the file named by -.Fa path -or referenced by -.Fa fd -are changed as specified by the argument -.Fa times . -The inode-change-time of the file is set to the current time. -.Pp -If -.Fa path -specifies a relative path, -it is relative to the current working directory if -.Fa fd -is -.Dv AT_FDCWD -and otherwise relative to the directory associated with the file descriptor -.Fa fd . -.Pp -The -.Va tv_nsec -field of a -.Vt timespec -structure -can be set to the special value -.Dv UTIME_NOW -to set the current time, or to -.Dv UTIME_OMIT -to leave the time unchanged. -In either case, the -.Va tv_sec -field is ignored. -.Pp -If -.Fa times -is -.No non- Ns Dv NULL , -it is assumed to point to an array of two timespec structures. -The access time is set to the value of the first element, and the -modification time is set to the value of the second element. -For file systems that support file birth (creation) times (such as -.Dv UFS2 ) , -the birth time will be set to the value of the second element -if the second element is older than the currently set birth time. -To set both a birth time and a modification time, -two calls are required; the first to set the birth time -and the second to set the (presumably newer) modification time. -Ideally a new system call will be added that allows the setting -of all three times at once. -If -.Fa times -is -.Dv NULL , -this is equivalent to passing -a pointer to an array of two timespec structures -with both -.Va tv_nsec -fields set to -.Dv UTIME_NOW . -.Pp -If both -.Va tv_nsec -fields are -.Dv UTIME_OMIT , -the timestamps remain unchanged and -no permissions are needed for the file itself, -although search permissions may be required for the path prefix. -The call may or may not succeed if the named file does not exist. -.Pp -If both -.Va tv_nsec -fields are -.Dv UTIME_NOW , -the caller must be the owner of the file, have permission to -write the file, or be the super-user. -.Pp -For all other values of the timestamps, -the caller must be the owner of the file or be the super-user. -.Pp -The values for the -.Fa flag -argument of the -.Fn utimensat -system call -are constructed by a bitwise-inclusive OR of flags from the following list, -defined in -.In fcntl.h : -.Bl -tag -width indent -.It Dv AT_SYMLINK_NOFOLLOW -If -.Fa path -names a symbolic link, the symbolic link's times are changed. -By default, -.Fn utimensat -changes the times of the file referenced by the symbolic link. -.El -.Sh RETURN VALUES -.Rv -std -.Sh COMPATIBILITY -If the running kernel does not support this system call, -a wrapper emulates it using -.Xr fstatat 2 , -.Xr futimesat 2 -and -.Xr lutimes 2 . -As a result, timestamps will be rounded down to the nearest microsecond, -.Dv UTIME_OMIT -is not atomic and -.Dv AT_SYMLINK_NOFOLLOW -is not available with a path relative to a file descriptor. -.Sh ERRORS -These system calls will fail if: -.Bl -tag -width Er -.It Bq Er EACCES -The -.Fa times -argument is -.Dv NULL , -or both -.Va tv_nsec -values are -.Dv UTIME_NOW , -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 -nor are both -.Va tv_nsec -values -.Dv UTIME_NOW , -nor are both -.Va tv_nsec -values -.Dv UTIME_OMIT -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 -.Xr chflags 2 -manual page for more information. -.It Bq Er EROFS -The file system containing the file is mounted read-only. -.El -.Pp -The -.Fn futimens -system call -will fail if: -.Bl -tag -width Er -.It Bq Er EBADF -The -.Fa fd -argument -does not refer to a valid descriptor. -.El -.Pp -The -.Fn utimensat -system call -will fail if: -.Bl -tag -width Er -.It Bq Er EACCES -Search permission is denied for a component of the path prefix. -.It Bq Er EBADF -The -.Fa path -argument does not specify an absolute path and the -.Fa fd -argument is neither -.Dv AT_FDCWD -nor a valid file descriptor. -.It Bq Er EFAULT -The -.Fa path -argument -points outside the process's allocated address space. -.It Bq Er ELOOP -Too many symbolic links were encountered in translating the pathname. -.It Bq Er ENAMETOOLONG -A component of a pathname exceeded -.Dv NAME_MAX -characters, or an entire path name exceeded -.Dv PATH_MAX -characters. -.It Bq Er ENOENT -The named file does not exist. -.It Bq Er ENOTDIR -A component of the path prefix is not a directory. -.It Bq Er ENOTDIR -The -.Fa path -argument is not an absolute path and -.Fa fd -is neither -.Dv AT_FDCWD -nor a file descriptor associated with a directory. -.It Bq Er ENOTSUP -The running kernel does not support this system call and -.Dv AT_SYMLINK_NOFOLLOW -is used with a path relative to a file descriptor. -.El -.Sh SEE ALSO -.Xr chflags 2 , -.Xr stat 2 , -.Xr symlink 2 , -.Xr utimes 2 , -.Xr utime 3 , -.Xr symlink 7 -.Sh STANDARDS -The -.Fn futimens -and -.Fn utimensat -system calls are expected to conform to -.St -p1003.1-2008 . -.Sh HISTORY -The -.Fn futimens -and -.Fn utimensat -system calls appeared in -.Fx 11.0 . diff --git a/lib/libc/sys/utimensat.c b/lib/libc/sys/utimensat.c deleted file mode 100644 index 67d19cb..0000000 --- a/lib/libc/sys/utimensat.c +++ /dev/null @@ -1,109 +0,0 @@ -/*- - * Copyright (c) 2015 Jilles Tjoelker - * 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 "namespace.h" -#include <sys/stat.h> - -#include <errno.h> -#include <fcntl.h> -#include <time.h> -#include "un-namespace.h" - -#include "libc_private.h" - -int -utimensat(int fd, const char *path, const struct timespec times[2], int flag) -{ - struct timeval now, tv[2], *tvp; - struct stat sb; - - if (__getosreldate() >= 1100056) - return (__sys_utimensat(fd, path, times, flag)); - - if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0) { - errno = EINVAL; - return (-1); - } - if (times == NULL || (times[0].tv_nsec == UTIME_NOW && - times[1].tv_nsec == UTIME_NOW)) - tvp = NULL; - else if (times[0].tv_nsec == UTIME_OMIT && - times[1].tv_nsec == UTIME_OMIT) - return (0); - else { - if ((times[0].tv_nsec < 0 || times[0].tv_nsec > 999999999) && - times[0].tv_nsec != UTIME_NOW && - times[0].tv_nsec != UTIME_OMIT) { - errno = EINVAL; - return (-1); - } - if ((times[1].tv_nsec < 0 || times[1].tv_nsec > 999999999) && - times[1].tv_nsec != UTIME_NOW && - times[1].tv_nsec != UTIME_OMIT) { - errno = EINVAL; - return (-1); - } - tv[0].tv_sec = times[0].tv_sec; - tv[0].tv_usec = times[0].tv_nsec / 1000; - tv[1].tv_sec = times[1].tv_sec; - tv[1].tv_usec = times[1].tv_nsec / 1000; - tvp = tv; - if (times[0].tv_nsec == UTIME_OMIT || - times[1].tv_nsec == UTIME_OMIT) { - if (fstatat(fd, path, &sb, flag) == -1) - return (-1); - if (times[0].tv_nsec == UTIME_OMIT) { - tv[0].tv_sec = sb.st_atim.tv_sec; - tv[0].tv_usec = sb.st_atim.tv_nsec / 1000; - } - if (times[1].tv_nsec == UTIME_OMIT) { - tv[1].tv_sec = sb.st_mtim.tv_sec; - tv[1].tv_usec = sb.st_mtim.tv_nsec / 1000; - } - } - if (times[0].tv_nsec == UTIME_NOW || - times[1].tv_nsec == UTIME_NOW) { - if (gettimeofday(&now, NULL) == -1) - return (-1); - if (times[0].tv_nsec == UTIME_NOW) - tv[0] = now; - if (times[1].tv_nsec == UTIME_NOW) - tv[1] = now; - } - } - if ((flag & AT_SYMLINK_NOFOLLOW) == 0) - return (futimesat(fd, path, tvp)); - else if ((flag & AT_SYMLINK_NOFOLLOW) != 0 && - (fd == AT_FDCWD || path[0] == '/')) - return (lutimes(path, tvp)); - else { - errno = ENOTSUP; - return (-1); - } -} diff --git a/lib/libc/sys/vfork.2 b/lib/libc/sys/vfork.2 index 0518262..1cfaa61 100644 --- a/lib/libc/sys/vfork.2 +++ b/lib/libc/sys/vfork.2 @@ -28,7 +28,7 @@ .\" @(#)vfork.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd April 6, 2015 +.Dd November 13, 2009 .Dt VFORK 2 .Os .Sh NAME @@ -100,8 +100,8 @@ since buffered data would then be flushed twice.) Same as for .Xr fork 2 . .Sh SEE ALSO -.Xr _exit 2 , .Xr execve 2 , +.Xr _exit 2 , .Xr fork 2 , .Xr rfork 2 , .Xr sigaction 2 , @@ -111,7 +111,7 @@ Same as for The .Fn vfork system call appeared in -.Bx 3 . +.Bx 2.9 . .Sh BUGS To avoid a possible deadlock situation, processes that are children in the middle diff --git a/lib/libc/sys/wait4.c b/lib/libc/sys/wait4.c deleted file mode 100644 index a5dbd0f..0000000 --- a/lib/libc/sys/wait4.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/wait.h> -#include "libc_private.h" - -__weak_reference(__sys_wait4, __wait4); - -#pragma weak wait4 -pid_t -wait4(pid_t pid, int *status, int options, struct rusage *ru) -{ - - return (((pid_t (*)(pid_t, int *, int, struct rusage *)) - __libc_interposing[INTERPOS_wait4])(pid, status, options, ru)); -} diff --git a/lib/libc/sys/wait6.c b/lib/libc/sys/wait6.c deleted file mode 100644 index d280a76..0000000 --- a/lib/libc/sys/wait6.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2015 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/wait.h> -#include <signal.h> -#include "libc_private.h" - -__weak_reference(__sys_wait6, __wait6); - -#pragma weak wait6 -pid_t -wait6(idtype_t idtype, id_t id, int *status, int options, struct __wrusage *ru, - siginfo_t *infop) -{ - - return (((pid_t (*)(idtype_t, id_t, int *, int, struct __wrusage *, - siginfo_t *))__libc_interposing[INTERPOS_wait6])(idtype, id, - status, options, ru, infop)); -} diff --git a/lib/libc/sys/write.c b/lib/libc/sys/write.c deleted file mode 100644 index ffb1aa5..0000000 --- a/lib/libc/sys/write.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/syscall.h> -#include <unistd.h> -#include "libc_private.h" - -__weak_reference(__sys_write, __write); - -#pragma weak write -ssize_t -write(int fd, const void *buf, size_t nbytes) -{ - - return (((ssize_t (*)(int, const void *, size_t)) - __libc_interposing[INTERPOS_write])(fd, buf, nbytes)); -} diff --git a/lib/libc/sys/writev.c b/lib/libc/sys/writev.c deleted file mode 100644 index 6be74b3..0000000 --- a/lib/libc/sys/writev.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2014 The FreeBSD Foundation. - * All rights reserved. - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice(s), this list of conditions and the following disclaimer as - * the first lines of this file unmodified other than the possible - * addition of one or more copyright notices. - * 2. Redistributions in binary form must reproduce the above copyright - * notice(s), this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/syscall.h> -#include <unistd.h> -#include "libc_private.h" - -__weak_reference(__sys_writev, __writev); - -#pragma weak writev -ssize_t -writev(int fd, const struct iovec *iov, int iovcnt) -{ - - return (((ssize_t (*)(int, const struct iovec *, int)) - __libc_interposing[INTERPOS_writev])(fd, iov, iovcnt)); -} diff --git a/lib/libc/tests/c063/Makefile b/lib/libc/tests/c063/Makefile index 5f4e1ca..b743165 100644 --- a/lib/libc/tests/c063/Makefile +++ b/lib/libc/tests/c063/Makefile @@ -2,26 +2,23 @@ TESTSDIR= ${TESTSBASE}/lib/libc/c063 -#TODO: t_o_search +#TODO: t_o_search, t_utimensat -NETBSD_ATF_TESTS_C= faccessat -NETBSD_ATF_TESTS_C+= fchmodat -NETBSD_ATF_TESTS_C+= fchownat -NETBSD_ATF_TESTS_C+= fexecve -NETBSD_ATF_TESTS_C+= fstatat -NETBSD_ATF_TESTS_C+= linkat -NETBSD_ATF_TESTS_C+= mkdirat -NETBSD_ATF_TESTS_C+= mkfifoat -NETBSD_ATF_TESTS_C+= mknodat -NETBSD_ATF_TESTS_C+= openat -NETBSD_ATF_TESTS_C+= readlinkat -NETBSD_ATF_TESTS_C+= renameat -NETBSD_ATF_TESTS_C+= symlinkat -NETBSD_ATF_TESTS_C+= unlinkat -NETBSD_ATF_TESTS_C+= utimensat +NETBSD_ATF_TESTS_C= t_faccessat +NETBSD_ATF_TESTS_C+= t_fchmodat +NETBSD_ATF_TESTS_C+= t_fchownat +NETBSD_ATF_TESTS_C+= t_fexecve +NETBSD_ATF_TESTS_C+= t_fstatat +NETBSD_ATF_TESTS_C+= t_linkat +NETBSD_ATF_TESTS_C+= t_mkdirat +NETBSD_ATF_TESTS_C+= t_mkfifoat +NETBSD_ATF_TESTS_C+= t_mknodat +NETBSD_ATF_TESTS_C+= t_openat +NETBSD_ATF_TESTS_C+= t_readlinkat +NETBSD_ATF_TESTS_C+= t_renameat +NETBSD_ATF_TESTS_C+= t_symlinkat +NETBSD_ATF_TESTS_C+= t_unlinkat CFLAGS+= -D_INCOMPLETE_XOPEN_C063 -.include "../Makefile.netbsd-tests" - .include <bsd.test.mk> diff --git a/lib/libc/tests/db/Makefile b/lib/libc/tests/db/Makefile index ed1d6ca..323a9f0 100644 --- a/lib/libc/tests/db/Makefile +++ b/lib/libc/tests/db/Makefile @@ -11,7 +11,6 @@ FILESDIR= ${TESTSDIR} FILES= README NETBSD_ATF_TESTS_SH+= db_test -ATF_TESTS_SH_SED_db_test= -e 's,/bin/csh,/bin/cat,g' .include "../Makefile.netbsd-tests" diff --git a/lib/libc/tests/hash/Makefile b/lib/libc/tests/hash/Makefile index 52fd569..df9d6d9 100644 --- a/lib/libc/tests/hash/Makefile +++ b/lib/libc/tests/hash/Makefile @@ -1,14 +1,8 @@ # $FreeBSD$ -.include <src.opts.mk> - TESTSDIR= ${TESTSBASE}/lib/libc/hash -NETBSD_ATF_TESTS_C= - -.if ${MK_OPENSSL} != "no" -NETBSD_ATF_TESTS_C+= sha2_test -.endif +NETBSD_ATF_TESTS_C= sha2_test NETBSD_ATF_TESTS_SH= hash_test diff --git a/lib/libc/tests/ssp/Makefile b/lib/libc/tests/ssp/Makefile index 7bc8660..cf767ce 100644 --- a/lib/libc/tests/ssp/Makefile +++ b/lib/libc/tests/ssp/Makefile @@ -26,11 +26,7 @@ PROGS+= h_getcwd PROGS+= h_memcpy PROGS+= h_memmove PROGS+= h_memset -# This testcase doesn't run properly when not compiled with -fsantize=bounds -# with clang, which is currently contingent on a compiler_rt update -.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} < 30500 PROGS+= h_raw -.endif PROGS+= h_read PROGS+= h_readlink PROGS+= h_snprintf diff --git a/lib/libc/tests/sys/Makefile b/lib/libc/tests/sys/Makefile index 5e457fd..89431bc 100644 --- a/lib/libc/tests/sys/Makefile +++ b/lib/libc/tests/sys/Makefile @@ -12,9 +12,7 @@ NETBSD_ATF_TESTS_C+= clock_gettime_test NETBSD_ATF_TESTS_C+= connect_test NETBSD_ATF_TESTS_C+= dup_test NETBSD_ATF_TESTS_C+= fsync_test -.if ${MACHINE} != "arm64" # ARM64TODO: Missing makecontext NETBSD_ATF_TESTS_C+= getcontext_test -.endif NETBSD_ATF_TESTS_C+= getgroups_test NETBSD_ATF_TESTS_C+= getitimer_test NETBSD_ATF_TESTS_C+= getlogin_test diff --git a/lib/libc/xdr/xdr_float.c b/lib/libc/xdr/xdr_float.c index 1d3bb61..1135806 100644 --- a/lib/libc/xdr/xdr_float.c +++ b/lib/libc/xdr/xdr_float.c @@ -64,8 +64,7 @@ __FBSDID("$FreeBSD$"); #if defined(__m68k__) || defined(__sparc__) || defined(__i386__) || \ defined(__mips__) || defined(__ns32k__) || defined(__alpha__) || \ defined(__arm__) || defined(__ppc__) || \ - defined(__arm26__) || defined(__sparc64__) || defined(__amd64__) || \ - defined(__aarch64__) + defined(__arm26__) || defined(__sparc64__) || defined(__amd64__) #include <machine/endian.h> #define IEEEFP #endif |