summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorgjb <gjb@FreeBSD.org>2016-04-04 23:55:32 +0000
committergjb <gjb@FreeBSD.org>2016-04-04 23:55:32 +0000
commit1dc4c40e3b35564cb2e787ad968e6b4a9fb7eb0f (patch)
treea027fe5a27446f32854d6a07b34b5f2a992bf283 /lib
parent3669a0dced7e344be71d234ffc3a71530ef0ae08 (diff)
parent589cedfe0cde2b49d5f47fc240de37c8bf307abd (diff)
downloadFreeBSD-src-1dc4c40e3b35564cb2e787ad968e6b4a9fb7eb0f.zip
FreeBSD-src-1dc4c40e3b35564cb2e787ad968e6b4a9fb7eb0f.tar.gz
MFH
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'lib')
-rw-r--r--lib/clang/libllvmsupport/Makefile1
-rw-r--r--lib/csu/powerpc64/Makefile3
-rw-r--r--lib/libc/Makefile3
-rw-r--r--lib/libc/aarch64/Symbol.map2
-rw-r--r--lib/libc/amd64/Symbol.map2
-rw-r--r--lib/libc/arm/Symbol.map3
-rw-r--r--lib/libc/db/mpool/Makefile.inc5
-rw-r--r--lib/libc/gen/Makefile.inc6
-rw-r--r--lib/libc/i386/Symbol.map2
-rw-r--r--lib/libc/iconv/Makefile.inc6
-rw-r--r--lib/libc/locale/euc.c6
-rw-r--r--lib/libc/locale/mskanji.c2
-rw-r--r--lib/libc/mips/Symbol.map3
-rw-r--r--lib/libc/net/Makefile.inc1
-rw-r--r--lib/libc/posix1e/Makefile.inc4
-rw-r--r--lib/libc/powerpc/Symbol.map3
-rw-r--r--lib/libc/powerpc64/Symbol.map3
-rw-r--r--lib/libc/riscv/Symbol.map2
-rw-r--r--lib/libc/secure/Makefile.inc7
-rw-r--r--lib/libc/sparc64/Symbol.map3
-rw-r--r--lib/libc/stdio/open_memstream.34
-rw-r--r--lib/libc/stdtime/Makefile.inc1
-rw-r--r--lib/libc/sys/aio_return.24
-rw-r--r--lib/libc/sys/aio_waitcomplete.24
-rw-r--r--lib/libc/sys/ktrace.24
-rw-r--r--lib/libc/sys/modfind.22
-rw-r--r--lib/libc/sys/ptrace.22
-rw-r--r--lib/libc/tests/ssp/Makefile2
-rw-r--r--lib/libclang_rt/asan_dynamic/Makefile1
-rw-r--r--lib/libcxxrt/Makefile5
-rw-r--r--lib/libdevinfo/Makefile2
-rw-r--r--lib/libfetch/fetch.328
-rw-r--r--lib/libkvm/kvm_amd64.c2
-rw-r--r--lib/libstand/Makefile2
-rw-r--r--lib/libstand/bootp.c8
-rw-r--r--lib/libstand/bootp.h1
-rw-r--r--lib/libstand/bswap.c57
-rw-r--r--lib/libstand/globals.c3
-rw-r--r--lib/libstand/net.h1
-rw-r--r--lib/libstand/stand.h5
-rw-r--r--lib/libsysdecode/errno.c2
-rw-r--r--lib/libthr/Makefile2
-rw-r--r--lib/libthr/thread/thr_fork.c6
-rw-r--r--lib/libthr/thread/thr_init.c26
-rw-r--r--lib/libthr/thread/thr_mutex.c75
-rw-r--r--lib/libthr/thread/thr_private.h11
-rw-r--r--lib/libthr/thread/thr_pshared.c14
-rw-r--r--lib/libthr/thread/thr_pspinlock.c107
-rw-r--r--lib/libthr/thread/thr_rtld.c1
-rw-r--r--lib/libxo/Makefile2
-rw-r--r--lib/libxo/tests/Makefile9
-rw-r--r--lib/libxo/xo_config.h247
-rw-r--r--lib/libz/Makefile1
-rw-r--r--lib/msun/arm/Makefile.inc2
-rw-r--r--lib/ncurses/ncurses/Makefile6
55 files changed, 499 insertions, 217 deletions
diff --git a/lib/clang/libllvmsupport/Makefile b/lib/clang/libllvmsupport/Makefile
index c828073..cc6c688 100644
--- a/lib/clang/libllvmsupport/Makefile
+++ b/lib/clang/libllvmsupport/Makefile
@@ -113,4 +113,3 @@ SRCS+= StringPool.cpp
# Ugly hack to work around CLOCK_PROCESS_CPUTIME_ID not being properly defined
# between r239347 and r245428.
CXXFLAGS.Process.cpp= -DCLOCK_PROCESS_CPUTIME_ID=15
-CXXFLAGS+= ${CXXFLAGS.${.IMPSRC:T}}
diff --git a/lib/csu/powerpc64/Makefile b/lib/csu/powerpc64/Makefile
index 09b643e..a97ef1e 100644
--- a/lib/csu/powerpc64/Makefile
+++ b/lib/csu/powerpc64/Makefile
@@ -13,8 +13,11 @@ CFLAGS+= -I${.CURDIR}/../common \
# clang doesn't support -mlongcall, and testing shows a clang linked with a
# clang-built csu segfaults, this must currently be compiled with gcc. Once
# clang supports -mlongcall, or we get a fixed ld, this can be revisited.
+.include <bsd.compiler.mk>
+.if ${COMPILER_TYPE} != "gcc"
CC:= gcc
COMPILER_TYPE:= gcc
+.endif
FILES= ${OBJS}
FILESMODE= ${LIBMODE}
diff --git a/lib/libc/Makefile b/lib/libc/Makefile
index 17b9720..3b72a1b 100644
--- a/lib/libc/Makefile
+++ b/lib/libc/Makefile
@@ -6,6 +6,9 @@ SHLIBDIR?= /lib
.include <src.opts.mk>
+# Force building of libc_pic.a
+MK_TOOLCHAIN= yes
+
LIBC_SRCTOP?= ${.CURDIR}
# Pick the current architecture directory for libc. In general, this is
diff --git a/lib/libc/aarch64/Symbol.map b/lib/libc/aarch64/Symbol.map
index 84c38d8..0c00ec2 100644
--- a/lib/libc/aarch64/Symbol.map
+++ b/lib/libc/aarch64/Symbol.map
@@ -36,7 +36,5 @@ FBSD_1.0 {
FBSDprivate_1.0 {
_set_tp;
_end;
- curbrk;
- minbrk;
__makecontext;
};
diff --git a/lib/libc/amd64/Symbol.map b/lib/libc/amd64/Symbol.map
index bbf6113..5354d66 100644
--- a/lib/libc/amd64/Symbol.map
+++ b/lib/libc/amd64/Symbol.map
@@ -63,8 +63,6 @@ FBSDprivate_1.0 {
__signalcontext;
signalcontext;
__siglongjmp;
- .curbrk;
- .minbrk;
_brk;
_end;
__sys_vfork;
diff --git a/lib/libc/arm/Symbol.map b/lib/libc/arm/Symbol.map
index cf65492..3c5c80f 100644
--- a/lib/libc/arm/Symbol.map
+++ b/lib/libc/arm/Symbol.map
@@ -29,7 +29,6 @@ FBSD_1.0 {
ntohs;
vfork;
brk;
- cerror; /* XXX - Should this be .cerror (see sys/cerror.S)? */
sbrk;
};
@@ -60,8 +59,6 @@ FBSDprivate_1.0 {
_vfork;
_brk;
_end;
- curbrk;
- minbrk;
_sbrk;
/* softfloat */
diff --git a/lib/libc/db/mpool/Makefile.inc b/lib/libc/db/mpool/Makefile.inc
index bab7e6d..76ec0eb 100644
--- a/lib/libc/db/mpool/Makefile.inc
+++ b/lib/libc/db/mpool/Makefile.inc
@@ -3,4 +3,7 @@
.PATH: ${LIBC_SRCTOP}/db/mpool
-SRCS+= mpool.c mpool-compat.c
+SRCS+= mpool.c
+.if ${MK_SYMVER} == yes
+SRCS+= mpool-compat.c
+.endif
diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc
index 7de8ce3..a68f5c7 100644
--- a/lib/libc/gen/Makefile.inc
+++ b/lib/libc/gen/Makefile.inc
@@ -49,7 +49,6 @@ SRCS+= __getosreldate.c \
fstab.c \
ftok.c \
fts.c \
- fts-compat.c \
ftw.c \
getbootfile.c \
getbsize.c \
@@ -137,7 +136,6 @@ SRCS+= __getosreldate.c \
ualarm.c \
ulimit.c \
uname.c \
- unvis-compat.c \
usleep.c \
utime.c \
utxdb.c \
@@ -147,6 +145,10 @@ SRCS+= __getosreldate.c \
waitpid.c \
waitid.c \
wordexp.c
+.if ${MK_SYMVER} == yes
+SRCS+= fts-compat.c \
+ unvis-compat.c
+.endif
.PATH: ${LIBC_SRCTOP}/../../contrib/libc-pwcache
SRCS+= pwcache.c pwcache.h
diff --git a/lib/libc/i386/Symbol.map b/lib/libc/i386/Symbol.map
index 78be4c4..20dbc3e 100644
--- a/lib/libc/i386/Symbol.map
+++ b/lib/libc/i386/Symbol.map
@@ -64,6 +64,4 @@ FBSDprivate_1.0 {
_vfork;
_end;
_brk;
- .curbrk;
- .minbrk;
};
diff --git a/lib/libc/iconv/Makefile.inc b/lib/libc/iconv/Makefile.inc
index 5442f79..3b24737 100644
--- a/lib/libc/iconv/Makefile.inc
+++ b/lib/libc/iconv/Makefile.inc
@@ -14,7 +14,11 @@ SRCS+= citrus_bcs.c citrus_bcs_strtol.c citrus_bcs_strtoul.c \
citrus_esdb.c citrus_hash.c citrus_iconv.c citrus_lookup.c \
citrus_lookup_factory.c citrus_mapper.c citrus_memstream.c \
citrus_mmap.c citrus_module.c citrus_none.c citrus_pivot_factory.c \
- citrus_prop.c citrus_stdenc.c bsd_iconv.c iconv_compat.c
+ citrus_prop.c citrus_stdenc.c bsd_iconv.c
+.if ${MK_SYMVER} == yes
+SRCS+= iconv_compat.c
+.endif
+
SYM_MAPS+= ${LIBC_SRCTOP}/iconv/Symbol.map
.if ${MK_ICONV} == yes
diff --git a/lib/libc/locale/euc.c b/lib/libc/locale/euc.c
index c2a2e3b..2fe4046 100644
--- a/lib/libc/locale/euc.c
+++ b/lib/libc/locale/euc.c
@@ -132,7 +132,7 @@ _EUC_CN_init(struct xlocale_ctype *l, _RuneLocale *rl)
l->runes = rl;
l->__mb_cur_max = 4;
- l->__mb_sb_limit = 256;
+ l->__mb_sb_limit = 128;
return (0);
}
@@ -226,7 +226,7 @@ _EUC_JP_init(struct xlocale_ctype *l, _RuneLocale *rl)
l->runes = rl;
l->__mb_cur_max = 3;
- l->__mb_sb_limit = 196;
+ l->__mb_sb_limit = 128;
return (0);
}
@@ -273,7 +273,7 @@ _EUC_TW_init(struct xlocale_ctype *l, _RuneLocale *rl)
l->runes = rl;
l->__mb_cur_max = 4;
- l->__mb_sb_limit = 256;
+ l->__mb_sb_limit = 128;
return (0);
}
diff --git a/lib/libc/locale/mskanji.c b/lib/libc/locale/mskanji.c
index dc2d0e1..c7da4b5 100644
--- a/lib/libc/locale/mskanji.c
+++ b/lib/libc/locale/mskanji.c
@@ -83,7 +83,7 @@ _MSKanji_init(struct xlocale_ctype *l, _RuneLocale *rl)
l->__mbsinit = _MSKanji_mbsinit;
l->runes = rl;
l->__mb_cur_max = 2;
- l->__mb_sb_limit = 256;
+ l->__mb_sb_limit = 224;
return (0);
}
diff --git a/lib/libc/mips/Symbol.map b/lib/libc/mips/Symbol.map
index d7fbd0a..3868080 100644
--- a/lib/libc/mips/Symbol.map
+++ b/lib/libc/mips/Symbol.map
@@ -28,7 +28,6 @@ FBSD_1.0 {
ntohs;
vfork;
brk;
- cerror; /* XXX - Should this be .cerror (see sys/cerror.S)? */
sbrk;
};
@@ -52,8 +51,6 @@ FBSDprivate_1.0 {
__sys_vfork;
_vfork;
_end;
- __curbrk;
- minbrk;
_brk;
_sbrk;
diff --git a/lib/libc/net/Makefile.inc b/lib/libc/net/Makefile.inc
index 6f51f08..304c465 100644
--- a/lib/libc/net/Makefile.inc
+++ b/lib/libc/net/Makefile.inc
@@ -35,7 +35,6 @@ YFLAGS+=-p_nsyy
LFLAGS+=-P_nsyy
CFLAGS.nslexer.c= -DYY_BUF_SIZE=1024
-CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
MAN+= byteorder.3 ethers.3 eui64.3 \
getaddrinfo.3 gai_strerror.3 gethostbyname.3 \
diff --git a/lib/libc/posix1e/Makefile.inc b/lib/libc/posix1e/Makefile.inc
index 2cc4158..85fed32 100644
--- a/lib/libc/posix1e/Makefile.inc
+++ b/lib/libc/posix1e/Makefile.inc
@@ -11,7 +11,6 @@ subr_acl_nfs4.c: ${LIBC_SRCTOP}/../../sys/kern/subr_acl_nfs4.c
SRCS+= acl_branding.c \
acl_calc_mask.c \
acl_copy.c \
- acl_compat.c \
acl_delete.c \
acl_delete_entry.c \
acl_entry.c \
@@ -36,6 +35,9 @@ SRCS+= acl_branding.c \
mac_get.c \
mac_set.c \
subr_acl_nfs4.c
+.if ${MK_SYMVER} == yes
+SRCS+= acl_compat.c
+.endif
SYM_MAPS+=${LIBC_SRCTOP}/posix1e/Symbol.map
diff --git a/lib/libc/powerpc/Symbol.map b/lib/libc/powerpc/Symbol.map
index 10b7c57..f695c81 100644
--- a/lib/libc/powerpc/Symbol.map
+++ b/lib/libc/powerpc/Symbol.map
@@ -56,7 +56,4 @@ FBSDprivate_1.0 {
__signalcontext;
__syncicache;
_end;
- .curbrk;
- .minbrk;
- .cerror;
};
diff --git a/lib/libc/powerpc64/Symbol.map b/lib/libc/powerpc64/Symbol.map
index 018a193..c429e84 100644
--- a/lib/libc/powerpc64/Symbol.map
+++ b/lib/libc/powerpc64/Symbol.map
@@ -52,7 +52,4 @@ FBSDprivate_1.0 {
__signalcontext;
__syncicache;
_end;
- _curbrk;
- _minbrk;
- _cerror;
};
diff --git a/lib/libc/riscv/Symbol.map b/lib/libc/riscv/Symbol.map
index 84c38d8..0c00ec2 100644
--- a/lib/libc/riscv/Symbol.map
+++ b/lib/libc/riscv/Symbol.map
@@ -36,7 +36,5 @@ FBSD_1.0 {
FBSDprivate_1.0 {
_set_tp;
_end;
- curbrk;
- minbrk;
__makecontext;
};
diff --git a/lib/libc/secure/Makefile.inc b/lib/libc/secure/Makefile.inc
index 6f18bde..e2e75c7 100644
--- a/lib/libc/secure/Makefile.inc
+++ b/lib/libc/secure/Makefile.inc
@@ -5,8 +5,9 @@
.PATH: ${LIBC_SRCTOP}/secure
# Sources common to both syscall interfaces:
-SRCS+= \
- stack_protector.c \
- stack_protector_compat.c
+SRCS+= stack_protector.c
+.if ${MK_SYMVER} == yes
+SRCS+= stack_protector_compat.c
+.endif
SYM_MAPS+= ${LIBC_SRCTOP}/secure/Symbol.map
diff --git a/lib/libc/sparc64/Symbol.map b/lib/libc/sparc64/Symbol.map
index 4f90486..1dc3d15 100644
--- a/lib/libc/sparc64/Symbol.map
+++ b/lib/libc/sparc64/Symbol.map
@@ -80,11 +80,8 @@ FBSDprivate_1.0 {
signalcontext;
__signalcontext;
__siglongjmp;
- .curbrk;
- .minbrk;
__sys_brk;
_brk;
- .cerror;
__sys_exect;
_exect;
_end;
diff --git a/lib/libc/stdio/open_memstream.3 b/lib/libc/stdio/open_memstream.3
index 1a0cb07..8e2c1e9 100644
--- a/lib/libc/stdio/open_memstream.3
+++ b/lib/libc/stdio/open_memstream.3
@@ -144,8 +144,8 @@ Memory for the stream or buffer could not be allocated.
.Xr fopen 3 ,
.Xr free 3 ,
.Xr fseek 3 ,
-.Xr sbuf 3 ,
-.Xr stdio 3
+.Xr stdio 3 ,
+.Xr sbuf 9
.Sh STANDARDS
The
.Fn open_memstream
diff --git a/lib/libc/stdtime/Makefile.inc b/lib/libc/stdtime/Makefile.inc
index 3220cc9..9b53ba5 100644
--- a/lib/libc/stdtime/Makefile.inc
+++ b/lib/libc/stdtime/Makefile.inc
@@ -12,7 +12,6 @@ SYM_MAPS+= ${LIBC_SRCTOP}/stdtime/Symbol.map
CFLAGS+= -I${LIBC_SRCTOP}/../../contrib/tzcode/stdtime -I${LIBC_SRCTOP}/stdtime
CFLAGS.localtime.c= -fwrapv
-CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
MAN+= ctime.3 strftime.3 strptime.3 time2posix.3
MAN+= tzfile.5
diff --git a/lib/libc/sys/aio_return.2 b/lib/libc/sys/aio_return.2
index 2ef6c25..df55873 100644
--- a/lib/libc/sys/aio_return.2
+++ b/lib/libc/sys/aio_return.2
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd October 7, 2006
+.Dd March 21, 2016
.Dt AIO_RETURN 2
.Os
.Sh NAME
@@ -34,7 +34,7 @@
.Lb libc
.Sh SYNOPSIS
.In aio.h
-.Ft int
+.Ft ssize_t
.Fn aio_return "struct aiocb *iocb"
.Sh DESCRIPTION
The
diff --git a/lib/libc/sys/aio_waitcomplete.2 b/lib/libc/sys/aio_waitcomplete.2
index 885b3d7..66e7208 100644
--- a/lib/libc/sys/aio_waitcomplete.2
+++ b/lib/libc/sys/aio_waitcomplete.2
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd January 19, 2000
+.Dd March 21, 2016
.Dt AIO_WAITCOMPLETE 2
.Os
.Sh NAME
@@ -34,7 +34,7 @@
.Lb libc
.Sh SYNOPSIS
.In aio.h
-.Ft int
+.Ft ssize_t
.Fn aio_waitcomplete "struct aiocb **iocbp" "struct timespec *timeout"
.Sh DESCRIPTION
The
diff --git a/lib/libc/sys/ktrace.2 b/lib/libc/sys/ktrace.2
index 4e5d92a..b02a672 100644
--- a/lib/libc/sys/ktrace.2
+++ b/lib/libc/sys/ktrace.2
@@ -28,7 +28,7 @@
.\" @(#)ktrace.2 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd October 10, 2011
+.Dd March 31, 2016
.Dt KTRACE 2
.Os
.Sh NAME
@@ -94,6 +94,8 @@ generate much output).
.It KTRFAC_PROCCTOR Ta "Trace process construction."
.It KTRFAC_PROCDTOR Ta "Trace process destruction."
.It KTRFAC_CAPFAIL Ta "Trace capability failures."
+.It KTRFAC_FAULT Ta "Trace page faults."
+.It KTRFAC_FAULTEND Ta "Trace the end of page faults."
.It KTRFAC_INHERIT Ta "Inherit tracing to future children."
.El
.Pp
diff --git a/lib/libc/sys/modfind.2 b/lib/libc/sys/modfind.2
index 3f48579..38d09c4 100644
--- a/lib/libc/sys/modfind.2
+++ b/lib/libc/sys/modfind.2
@@ -49,7 +49,7 @@ The
.Fn modfind
system call
returns the modid of the kernel module referenced by
-.Fa file .
+.Fa modname .
Upon error,
.Fn modfind
returns -1 and sets
diff --git a/lib/libc/sys/ptrace.2 b/lib/libc/sys/ptrace.2
index 786f457..10ad660 100644
--- a/lib/libc/sys/ptrace.2
+++ b/lib/libc/sys/ptrace.2
@@ -103,7 +103,7 @@ be ignored.
If the child was created by
.Xr vfork 2
system call or
-.Xr rfork(2)
+.Xr rfork 2
call with the
.Dv RFMEM
flag specified, the debugging events are reported to the parent
diff --git a/lib/libc/tests/ssp/Makefile b/lib/libc/tests/ssp/Makefile
index 09adf97..11ccca9 100644
--- a/lib/libc/tests/ssp/Makefile
+++ b/lib/libc/tests/ssp/Makefile
@@ -36,7 +36,7 @@ PROGS+= h_memset
#
# sanitizer is not tested or supported for ARM right now. sbruno
.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
-.if ${COMPILER_TYPE} == "clang"
+.if ${COMPILER_TYPE} == "clang" && ${MK_TOOLCHAIN} == "yes"
.if ${COMPILER_VERSION} < 30500 || 30700 <= ${COMPILER_VERSION}
PROGS+= h_raw
.endif
diff --git a/lib/libclang_rt/asan_dynamic/Makefile b/lib/libclang_rt/asan_dynamic/Makefile
index 8be3903..8bd44e7 100644
--- a/lib/libclang_rt/asan_dynamic/Makefile
+++ b/lib/libclang_rt/asan_dynamic/Makefile
@@ -101,4 +101,3 @@ CXXFLAGS.ubsan_handlers_cxx.cc= -frtti
CXXFLAGS.ubsan_type_hash.cc= -frtti
CXXFLAGS.ubsan_type_hash_itanium.cc= -frtti
CXXFLAGS.ubsan_type_hash_win.cc= -frtti
-CXXFLAGS+= ${CXXFLAGS.${.IMPSRC:T}}
diff --git a/lib/libcxxrt/Makefile b/lib/libcxxrt/Makefile
index 8f3d9c5..15420a6 100644
--- a/lib/libcxxrt/Makefile
+++ b/lib/libcxxrt/Makefile
@@ -21,7 +21,10 @@ SRCS+= libelftc_dem_gnu3.c\
guard.cc
WARNS= 0
-CFLAGS+= -I${SRCDIR}
+CFLAGS+= -I${SRCDIR} -nostdinc++
+.if empty(CXXFLAGS:M-std=*)
+CXXFLAGS+= -std=c++11
+.endif
VERSION_MAP= ${.CURDIR}/Version.map
.include <bsd.lib.mk>
diff --git a/lib/libdevinfo/Makefile b/lib/libdevinfo/Makefile
index 6c0927e..4849c7a 100644
--- a/lib/libdevinfo/Makefile
+++ b/lib/libdevinfo/Makefile
@@ -6,6 +6,8 @@ SRCS= devinfo.c
INCS= devinfo.h
MAN= devinfo.3
+SHLIB_MAJOR= 6
+
WARNS?= 3
.include <bsd.lib.mk>
diff --git a/lib/libfetch/fetch.3 b/lib/libfetch/fetch.3
index 0ad9166..e04917e 100644
--- a/lib/libfetch/fetch.3
+++ b/lib/libfetch/fetch.3
@@ -1,6 +1,6 @@
.\"-
.\" Copyright (c) 1998-2013 Dag-Erling Smørgrav
-.\" Copyright (c) 2013 Michael Gmelin <freebsd@grem.de>
+.\" Copyright (c) 2013-2016 Michael Gmelin <freebsd@grem.de>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -26,7 +26,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd November 29, 2015
+.Dd March 18, 2016
.Dt FETCH 3
.Os
.Sh NAME
@@ -396,8 +396,15 @@ is currently unimplemented.
.Sh HTTPS SCHEME
Based on HTTP SCHEME.
By default the peer is verified using the CA bundle located in
-.Pa /etc/ssl/cert.pem .
-The file may contain multiple CA certificates.
+.Pa /usr/local/etc/ssl/cert.pem .
+If this file does not exist,
+.Pa /etc/ssl/cert.pem
+is used instead.
+If neither file exists, and
+.Ev SSL_CA_CERT_PATH
+has not been set,
+OpenSSL's default CA cert and path settings apply.
+The certificate bundle can contain multiple CA certificates.
A common source of a current CA bundle is
.Pa \%security/ca_root_nss .
.Pp
@@ -428,10 +435,11 @@ Client certificate based authentication is supported.
The environment variable
.Ev SSL_CLIENT_CERT_FILE
should be set to point to a file containing key and client certificate
-to be used in PEM format. In case the key is stored in a separate
-file, the environment variable
+to be used in PEM format.
+When a PEM-format key is in a separate file from the client certificate,
+the environment variable
.Ev SSL_CLIENT_KEY_FILE
-can be set to point to the key in PEM format.
+can be set to point to the key file.
In case the key uses a password, the user will be prompted on standard
input (see
.Xr PEM 3 ) .
@@ -531,7 +539,7 @@ Invalid URL
.El
.Pp
The accompanying error message includes a protocol-specific error code
-and message, e.g.\& "File is not available (404 Not Found)"
+and message, like "File is not available (404 Not Found)"
.Sh ENVIRONMENT
.Bl -tag -width ".Ev FETCH_BIND_ADDRESS"
.It Ev FETCH_BIND_ADDRESS
@@ -648,8 +656,7 @@ for compatibility.
Allow SSL version 3 when negotiating the connection (not recommended).
.It Ev SSL_CA_CERT_FILE
CA certificate bundle containing trusted CA certificates.
-Default value:
-.Pa /etc/ssl/cert.pem .
+Default value: See HTTPS SCHEME above.
.It Ev SSL_CA_CERT_PATH
Path containing trusted CA hashes.
.It Ev SSL_CLIENT_CERT_FILE
@@ -717,7 +724,6 @@ SSL_CA_CERT_FILE=/path/to/myca.pem
.Ed
.Sh SEE ALSO
.Xr fetch 1 ,
-.Xr ftpio 3 ,
.Xr ip 4
.Rs
.%A J. Postel
diff --git a/lib/libkvm/kvm_amd64.c b/lib/libkvm/kvm_amd64.c
index 1ba17f1..70789f4 100644
--- a/lib/libkvm/kvm_amd64.c
+++ b/lib/libkvm/kvm_amd64.c
@@ -227,7 +227,7 @@ _amd64_vatop(kvm_t *kd, kvaddr_t va, off_t *pa)
/*
* No next-level page table; pdpe describes one 1GB page.
*/
- a = (pde & AMD64_PG_1GB_FRAME) + (va & AMD64_PDPMASK);
+ a = (pdpe & AMD64_PG_1GB_FRAME) + (va & AMD64_PDPMASK);
s = _kvm_pa2off(kd, a, pa);
if (s == 0) {
_kvm_err(kd, kd->program,
diff --git a/lib/libstand/Makefile b/lib/libstand/Makefile
index 835b535..0ebcaf1 100644
--- a/lib/libstand/Makefile
+++ b/lib/libstand/Makefile
@@ -26,7 +26,7 @@ WARNS?= 0
CFLAGS+= -I${LIBSTAND_SRC}
# standalone components and stuff we have modified locally
-SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
+SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c environment.c getopt.c gets.c \
globals.c pager.c printf.c strdup.c strerror.c strtol.c strtoul.c random.c \
sbrk.c twiddle.c zalloc.c zalloc_malloc.c
diff --git a/lib/libstand/bootp.c b/lib/libstand/bootp.c
index 1af7bd5..f3bc816 100644
--- a/lib/libstand/bootp.c
+++ b/lib/libstand/bootp.c
@@ -39,6 +39,7 @@
__FBSDID("$FreeBSD$");
#include <sys/types.h>
+#include <sys/endian.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
@@ -393,6 +394,13 @@ vend_rfc1048(cp, len)
val = (const char *)cp;
strlcpy(hostname, val, sizeof(hostname));
}
+ if (tag == TAG_INTF_MTU) {
+ if ((val = getenv("dhcp.interface-mtu")) != NULL) {
+ intf_mtu = (u_int)strtoul(val, NULL, 0);
+ } else {
+ intf_mtu = be16dec(cp);
+ }
+ }
#ifdef SUPPORT_DHCP
if (tag == TAG_DHCP_MSGTYPE) {
if(*cp != expected_dhcpmsgtype)
diff --git a/lib/libstand/bootp.h b/lib/libstand/bootp.h
index ed9101f..47e5649 100644
--- a/lib/libstand/bootp.h
+++ b/lib/libstand/bootp.h
@@ -91,6 +91,7 @@ struct bootp {
#define TAG_DOMAINNAME ((unsigned char) 15)
#define TAG_SWAPSERVER ((unsigned char) 16)
#define TAG_ROOTPATH ((unsigned char) 17)
+#define TAG_INTF_MTU ((unsigned char) 26)
#ifdef SUPPORT_DHCP
#define TAG_REQ_ADDR ((unsigned char) 50)
diff --git a/lib/libstand/bswap.c b/lib/libstand/bswap.c
deleted file mode 100644
index 308edda..0000000
--- a/lib/libstand/bswap.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Written by Manuel Bouyer <bouyer@netbsd.org>.
- * Public domain.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$NetBSD: bswap32.c,v 1.1 1997/10/09 15:42:33 bouyer Exp $";
-static char *rcsid = "$NetBSD: bswap64.c,v 1.3 2009/03/16 05:59:21 cegger Exp $";
-#endif
-
-#include <sys/types.h>
-
-#undef bswap32
-#undef bswap64
-
-u_int32_t bswap32(u_int32_t x);
-u_int64_t bswap64(u_int64_t x);
-
-u_int32_t
-bswap32(u_int32_t x)
-{
- return ((x << 24) & 0xff000000 ) |
- ((x << 8) & 0x00ff0000 ) |
- ((x >> 8) & 0x0000ff00 ) |
- ((x >> 24) & 0x000000ff );
-}
-
-u_int64_t
-bswap64(u_int64_t x)
-{
-#ifdef __LP64__
- /*
- * Assume we have wide enough registers to do it without touching
- * memory.
- */
- return ( (x << 56) & 0xff00000000000000UL ) |
- ( (x << 40) & 0x00ff000000000000UL ) |
- ( (x << 24) & 0x0000ff0000000000UL ) |
- ( (x << 8) & 0x000000ff00000000UL ) |
- ( (x >> 8) & 0x00000000ff000000UL ) |
- ( (x >> 24) & 0x0000000000ff0000UL ) |
- ( (x >> 40) & 0x000000000000ff00UL ) |
- ( (x >> 56) & 0x00000000000000ffUL );
-#else
- /*
- * Split the operation in two 32bit steps.
- */
- u_int32_t tl, th;
-
- th = bswap32((u_int32_t)(x & 0x00000000ffffffffULL));
- tl = bswap32((u_int32_t)((x >> 32) & 0x00000000ffffffffULL));
- return ((u_int64_t)th << 32) | tl;
-#endif
-}
diff --git a/lib/libstand/globals.c b/lib/libstand/globals.c
index 0310823..f2c6240 100644
--- a/lib/libstand/globals.c
+++ b/lib/libstand/globals.c
@@ -30,7 +30,8 @@ struct in_addr myip; /* my ip address */
struct in_addr nameip; /* DNS server ip address */
struct in_addr rootip; /* root ip address */
struct in_addr swapip; /* swap ip address */
-struct in_addr gateip; /* swap ip address */
+struct in_addr gateip; /* gateway ip address */
n_long netmask = 0xffffff00; /* subnet or net mask */
+u_int intf_mtu; /* interface mtu from bootp/dhcp */
int errno; /* our old friend */
diff --git a/lib/libstand/net.h b/lib/libstand/net.h
index 94f2aab..ce7df49 100644
--- a/lib/libstand/net.h
+++ b/lib/libstand/net.h
@@ -83,6 +83,7 @@ extern struct in_addr swapip;
extern struct in_addr gateip;
extern struct in_addr nameip;
extern n_long netmask;
+extern u_int intf_mtu;
extern int debug; /* defined in the machdep sources */
diff --git a/lib/libstand/stand.h b/lib/libstand/stand.h
index 22ee319..a841523 100644
--- a/lib/libstand/stand.h
+++ b/lib/libstand/stand.h
@@ -335,11 +335,6 @@ static __inline quad_t qmin(quad_t a, quad_t b) { return (a < b ? a : b); }
static __inline u_long ulmax(u_long a, u_long b) { return (a > b ? a : b); }
static __inline u_long ulmin(u_long a, u_long b) { return (a < b ? a : b); }
-/* swaps (undocumented, useful?) */
-#ifdef __i386__
-extern u_int32_t bswap32(u_int32_t x);
-extern u_int64_t bswap64(u_int64_t x);
-#endif
/* null functions for device/filesystem switches (undocumented) */
extern int nodev(void);
diff --git a/lib/libsysdecode/errno.c b/lib/libsysdecode/errno.c
index 1e863bb..c21d216 100644
--- a/lib/libsysdecode/errno.c
+++ b/lib/libsysdecode/errno.c
@@ -56,7 +56,7 @@ static int bsd_to_linux_errno[ELAST + 1] = {
#endif
#if defined(__aarch64__) || defined(__amd64__)
-#include <compat/cloudabi/cloudabi_syscalldefs.h>
+#include <contrib/cloudabi/cloudabi_types_common.h>
static const int cloudabi_errno_table[] = {
[CLOUDABI_E2BIG] = E2BIG,
diff --git a/lib/libthr/Makefile b/lib/libthr/Makefile
index 7a080e0..517a30f 100644
--- a/lib/libthr/Makefile
+++ b/lib/libthr/Makefile
@@ -39,7 +39,7 @@ SYMBOL_MAPS=${.CURDIR}/pthread.map
MAN= libthr.3
-# enable extra internal consistancy checks
+# enable extra internal consistency checks
CFLAGS+=-D_PTHREADS_INVARIANTS
PRECIOUSLIB=
diff --git a/lib/libthr/thread/thr_fork.c b/lib/libthr/thread/thr_fork.c
index 7256b68..531e09c 100644
--- a/lib/libthr/thread/thr_fork.c
+++ b/lib/libthr/thread/thr_fork.c
@@ -168,6 +168,7 @@ __thr_fork(void)
if (_thr_isthreaded() != 0) {
was_threaded = 1;
_malloc_prefork();
+ __thr_pshared_atfork_pre();
_rtld_atfork_pre(rtld_locks);
} else {
was_threaded = 0;
@@ -202,8 +203,10 @@ __thr_fork(void)
_thr_signal_postfork_child();
- if (was_threaded)
+ if (was_threaded) {
_rtld_atfork_post(rtld_locks);
+ __thr_pshared_atfork_post();
+ }
_thr_setthreaded(0);
/* reinitalize library. */
@@ -236,6 +239,7 @@ __thr_fork(void)
if (was_threaded) {
_rtld_atfork_post(rtld_locks);
+ __thr_pshared_atfork_post();
_malloc_postfork();
}
diff --git a/lib/libthr/thread/thr_init.c b/lib/libthr/thread/thr_init.c
index 3c81299..c9f30ab 100644
--- a/lib/libthr/thread/thr_init.c
+++ b/lib/libthr/thread/thr_init.c
@@ -108,7 +108,6 @@ struct pthread_cond_attr _pthread_condattr_default = {
.c_clockid = CLOCK_REALTIME
};
-pid_t _thr_pid;
int _thr_is_smp = 0;
size_t _thr_guard_default;
size_t _thr_stack_default = THR_STACK_DEFAULT;
@@ -305,7 +304,7 @@ _thread_init_hack(void)
void
_libpthread_init(struct pthread *curthread)
{
- int fd, first, dlopened;
+ int first, dlopened;
/* Check if this function has already been called: */
if ((_thr_initial != NULL) && (curthread == NULL))
@@ -321,27 +320,6 @@ _libpthread_init(struct pthread *curthread)
memcpy(__thr_jtable, jmp_table, sizeof(jmp_table));
__thr_interpose_libc();
- /*
- * Check for the special case of this process running as
- * or in place of init as pid = 1:
- */
- if ((_thr_pid = getpid()) == 1) {
- /*
- * Setup a new session for this process which is
- * assumed to be running as root.
- */
- if (setsid() == -1)
- PANIC("Can't set session ID");
- if (revoke(_PATH_CONSOLE) != 0)
- PANIC("Can't revoke console");
- if ((fd = __sys_openat(AT_FDCWD, _PATH_CONSOLE, O_RDWR)) < 0)
- PANIC("Can't open console");
- if (setlogin("root") == -1)
- PANIC("Can't set login to root");
- if (_ioctl(fd, TIOCSCTTY, (char *) NULL) == -1)
- PANIC("Can't set controlling terminal");
- }
-
/* Initialize pthread private data. */
init_private();
@@ -466,7 +444,6 @@ init_private(void)
_thr_once_init();
_thr_spinlock_init();
_thr_list_init();
- __thr_pshared_init();
_thr_wake_addr_init();
_sleepq_init();
_single_thread = NULL;
@@ -477,6 +454,7 @@ init_private(void)
* e.g. after a fork().
*/
if (init_once == 0) {
+ __thr_pshared_init();
/* Find the stack top */
mib[0] = CTL_KERN;
mib[1] = KERN_USRSTACK;
diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c
index 30a8be2..865e4cf 100644
--- a/lib/libthr/thread/thr_mutex.c
+++ b/lib/libthr/thread/thr_mutex.c
@@ -38,6 +38,7 @@
* $FreeBSD$
*/
+#include <stdbool.h>
#include "namespace.h"
#include <stdlib.h>
#include <errno.h>
@@ -124,8 +125,14 @@ mutex_assert_is_owned(struct pthread_mutex *m)
{
#if defined(_PTHREADS_INVARIANTS)
- if (__predict_false(m->m_qe.tqe_prev == NULL))
- PANIC("mutex is not on list");
+ if (__predict_false(m->m_qe.tqe_prev == NULL)) {
+ char msg[128];
+ snprintf(msg, sizeof(msg),
+ "mutex %p own %#x %#x is not on list %p %p",
+ m, m->m_lock.m_owner, m->m_owner, m->m_qe.tqe_prev,
+ m->m_qe.tqe_next);
+ PANIC(msg);
+ }
#endif
}
@@ -135,8 +142,14 @@ mutex_assert_not_owned(struct pthread_mutex *m)
#if defined(_PTHREADS_INVARIANTS)
if (__predict_false(m->m_qe.tqe_prev != NULL ||
- m->m_qe.tqe_next != NULL))
- PANIC("mutex is on list");
+ m->m_qe.tqe_next != NULL)) {
+ char msg[128];
+ snprintf(msg, sizeof(msg),
+ "mutex %p own %#x %#x is on list %p %p",
+ m, m->m_lock.m_owner, m->m_owner, m->m_qe.tqe_prev,
+ m->m_qe.tqe_next);
+ PANIC(msg);
+ }
#endif
}
@@ -252,6 +265,51 @@ set_inherited_priority(struct pthread *curthread, struct pthread_mutex *m)
m->m_lock.m_ceilings[1] = -1;
}
+static void
+shared_mutex_init(struct pthread_mutex *pmtx, const struct
+ pthread_mutex_attr *mutex_attr)
+{
+ static const struct pthread_mutex_attr foobar_mutex_attr = {
+ .m_type = PTHREAD_MUTEX_DEFAULT,
+ .m_protocol = PTHREAD_PRIO_NONE,
+ .m_ceiling = 0,
+ .m_pshared = PTHREAD_PROCESS_SHARED
+ };
+ bool done;
+
+ /*
+ * Hack to allow multiple pthread_mutex_init() calls on the
+ * same process-shared mutex. We rely on kernel allocating
+ * zeroed offpage for the mutex, i.e. the
+ * PMUTEX_INITSTAGE_ALLOC value must be zero.
+ */
+ for (done = false; !done;) {
+ switch (pmtx->m_ps) {
+ case PMUTEX_INITSTAGE_DONE:
+ atomic_thread_fence_acq();
+ done = true;
+ break;
+ case PMUTEX_INITSTAGE_ALLOC:
+ if (atomic_cmpset_int(&pmtx->m_ps,
+ PMUTEX_INITSTAGE_ALLOC, PMUTEX_INITSTAGE_BUSY)) {
+ if (mutex_attr == NULL)
+ mutex_attr = &foobar_mutex_attr;
+ mutex_init_body(pmtx, mutex_attr);
+ atomic_store_rel_int(&pmtx->m_ps,
+ PMUTEX_INITSTAGE_DONE);
+ done = true;
+ }
+ break;
+ case PMUTEX_INITSTAGE_BUSY:
+ _pthread_yield();
+ break;
+ default:
+ PANIC("corrupted offpage");
+ break;
+ }
+ }
+}
+
int
__pthread_mutex_init(pthread_mutex_t *mutex,
const pthread_mutexattr_t *mutex_attr)
@@ -273,7 +331,7 @@ __pthread_mutex_init(pthread_mutex_t *mutex,
if (pmtx == NULL)
return (EFAULT);
*mutex = THR_PSHARED_PTR;
- mutex_init_body(pmtx, *mutex_attr);
+ shared_mutex_init(pmtx, *mutex_attr);
return (0);
}
@@ -414,6 +472,7 @@ check_and_init_mutex(pthread_mutex_t *mutex, struct pthread_mutex **m)
*m = __thr_pshared_offpage(mutex, 0);
if (*m == NULL)
ret = EINVAL;
+ shared_mutex_init(*m, NULL);
} else if (__predict_false(*m <= THR_MUTEX_DESTROYED)) {
if (*m == THR_MUTEX_DESTROYED) {
ret = EINVAL;
@@ -576,6 +635,7 @@ _pthread_mutex_unlock(pthread_mutex_t *mutex)
mp = __thr_pshared_offpage(mutex, 0);
if (mp == NULL)
return (EINVAL);
+ shared_mutex_init(mp, NULL);
} else {
mp = *mutex;
}
@@ -803,6 +863,7 @@ _pthread_mutex_getprioceiling(pthread_mutex_t *mutex,
m = __thr_pshared_offpage(mutex, 0);
if (m == NULL)
return (EINVAL);
+ shared_mutex_init(m, NULL);
} else {
m = *mutex;
if (m <= THR_MUTEX_DESTROYED)
@@ -827,6 +888,7 @@ _pthread_mutex_setprioceiling(pthread_mutex_t *mutex,
m = __thr_pshared_offpage(mutex, 0);
if (m == NULL)
return (EINVAL);
+ shared_mutex_init(m, NULL);
} else {
m = *mutex;
if (m <= THR_MUTEX_DESTROYED)
@@ -930,12 +992,13 @@ __pthread_mutex_setyieldloops_np(pthread_mutex_t *mutex, int count)
int
_pthread_mutex_isowned_np(pthread_mutex_t *mutex)
{
- struct pthread_mutex *m;
+ struct pthread_mutex *m;
if (*mutex == THR_PSHARED_PTR) {
m = __thr_pshared_offpage(mutex, 0);
if (m == NULL)
return (0);
+ shared_mutex_init(m, NULL);
} else {
m = *mutex;
if (m <= THR_MUTEX_DESTROYED)
diff --git a/lib/libthr/thread/thr_private.h b/lib/libthr/thread/thr_private.h
index 31f8e6c..f35d3cd 100644
--- a/lib/libthr/thread/thr_private.h
+++ b/lib/libthr/thread/thr_private.h
@@ -146,6 +146,13 @@ TAILQ_HEAD(mutex_queue, pthread_mutex);
#define MAX_DEFER_WAITERS 50
+/*
+ * Values for pthread_mutex m_ps indicator.
+ */
+#define PMUTEX_INITSTAGE_ALLOC 0
+#define PMUTEX_INITSTAGE_BUSY 1
+#define PMUTEX_INITSTAGE_DONE 2
+
struct pthread_mutex {
/*
* Lock for accesses to this structure.
@@ -156,6 +163,7 @@ struct pthread_mutex {
int m_count;
int m_spinloops;
int m_yieldloops;
+ int m_ps; /* pshared init stage */
/*
* Link for all mutexes a thread currently owns, of the same
* prio type.
@@ -717,7 +725,6 @@ extern struct pthread_cond_attr _pthread_condattr_default __hidden;
extern struct pthread_prio _thr_priorities[] __hidden;
-extern pid_t _thr_pid __hidden;
extern int _thr_is_smp __hidden;
extern size_t _thr_guard_default __hidden;
@@ -952,6 +959,8 @@ void _tcb_dtor(struct tcb *);
void __thr_pshared_init(void) __hidden;
void *__thr_pshared_offpage(void *key, int doalloc) __hidden;
void __thr_pshared_destroy(void *key) __hidden;
+void __thr_pshared_atfork_pre(void) __hidden;
+void __thr_pshared_atfork_post(void) __hidden;
__END_DECLS
diff --git a/lib/libthr/thread/thr_pshared.c b/lib/libthr/thread/thr_pshared.c
index e8ccf1c..8371478 100644
--- a/lib/libthr/thread/thr_pshared.c
+++ b/lib/libthr/thread/thr_pshared.c
@@ -252,3 +252,17 @@ __thr_pshared_destroy(void *key)
pshared_clean(key, val);
pshared_gc(curthread);
}
+
+void
+__thr_pshared_atfork_pre(void)
+{
+
+ _thr_rwl_rdlock(&pshared_lock);
+}
+
+void
+__thr_pshared_atfork_post(void)
+{
+
+ _thr_rwl_unlock(&pshared_lock);
+}
diff --git a/lib/libthr/thread/thr_pspinlock.c b/lib/libthr/thread/thr_pspinlock.c
index 9e1f96e..1c9b412 100644
--- a/lib/libthr/thread/thr_pspinlock.c
+++ b/lib/libthr/thread/thr_pspinlock.c
@@ -1,7 +1,11 @@
/*-
* Copyright (c) 2003 David Xu <davidxu@freebsd.org>
+ * Copyright (c) 2016 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:
@@ -46,93 +50,100 @@ int
_pthread_spin_init(pthread_spinlock_t *lock, int pshared)
{
struct pthread_spinlock *lck;
- int ret;
- if (lock == NULL || pshared != PTHREAD_PROCESS_PRIVATE)
- ret = EINVAL;
- else if ((lck = malloc(sizeof(struct pthread_spinlock))) == NULL)
- ret = ENOMEM;
- else {
- _thr_umutex_init(&lck->s_lock);
+ if (lock == NULL)
+ return (EINVAL);
+ if (pshared == PTHREAD_PROCESS_PRIVATE) {
+ lck = malloc(sizeof(struct pthread_spinlock));
+ if (lck == NULL)
+ return (ENOMEM);
*lock = lck;
- ret = 0;
+ } else if (pshared == PTHREAD_PROCESS_SHARED) {
+ lck = __thr_pshared_offpage(lock, 1);
+ if (lck == NULL)
+ return (EFAULT);
+ *lock = THR_PSHARED_PTR;
+ } else {
+ return (EINVAL);
}
-
- return (ret);
+ _thr_umutex_init(&lck->s_lock);
+ return (0);
}
int
_pthread_spin_destroy(pthread_spinlock_t *lock)
{
+ void *l;
int ret;
- if (lock == NULL || *lock == NULL)
+ if (lock == NULL || *lock == NULL) {
ret = EINVAL;
- else {
+ } else if (*lock == THR_PSHARED_PTR) {
+ l = __thr_pshared_offpage(lock, 0);
+ if (l != NULL)
+ __thr_pshared_destroy(l);
+ ret = 0;
+ } else {
free(*lock);
*lock = NULL;
ret = 0;
}
-
return (ret);
}
int
_pthread_spin_trylock(pthread_spinlock_t *lock)
{
- struct pthread *curthread = _get_curthread();
struct pthread_spinlock *lck;
- int ret;
- if (lock == NULL || (lck = *lock) == NULL)
- ret = EINVAL;
- else
- ret = THR_UMUTEX_TRYLOCK(curthread, &lck->s_lock);
- return (ret);
+ if (lock == NULL || *lock == NULL)
+ return (EINVAL);
+ lck = *lock == THR_PSHARED_PTR ? __thr_pshared_offpage(lock, 0) : *lock;
+ if (lck == NULL)
+ return (EINVAL);
+ return (THR_UMUTEX_TRYLOCK(_get_curthread(), &lck->s_lock));
}
int
_pthread_spin_lock(pthread_spinlock_t *lock)
{
- struct pthread *curthread = _get_curthread();
+ struct pthread *curthread;
struct pthread_spinlock *lck;
- int ret, count;
-
- if (lock == NULL || (lck = *lock) == NULL)
- ret = EINVAL;
- else {
- count = SPIN_COUNT;
- while ((ret = THR_UMUTEX_TRYLOCK(curthread, &lck->s_lock)) != 0) {
- while (lck->s_lock.m_owner) {
- if (!_thr_is_smp) {
+ int count;
+
+ if (lock == NULL)
+ return (EINVAL);
+ lck = *lock == THR_PSHARED_PTR ? __thr_pshared_offpage(lock, 0) : *lock;
+ if (lck == NULL)
+ return (EINVAL);
+
+ curthread = _get_curthread();
+ count = SPIN_COUNT;
+ while (THR_UMUTEX_TRYLOCK(curthread, &lck->s_lock) != 0) {
+ while (lck->s_lock.m_owner) {
+ if (!_thr_is_smp) {
+ _pthread_yield();
+ } else {
+ CPU_SPINWAIT;
+ if (--count <= 0) {
+ count = SPIN_COUNT;
_pthread_yield();
- } else {
- CPU_SPINWAIT;
-
- if (--count <= 0) {
- count = SPIN_COUNT;
- _pthread_yield();
- }
}
}
}
- ret = 0;
}
-
- return (ret);
+ return (0);
}
int
_pthread_spin_unlock(pthread_spinlock_t *lock)
{
- struct pthread *curthread = _get_curthread();
struct pthread_spinlock *lck;
- int ret;
- if (lock == NULL || (lck = *lock) == NULL)
- ret = EINVAL;
- else {
- ret = THR_UMUTEX_UNLOCK(curthread, &lck->s_lock);
- }
- return (ret);
+ if (lock == NULL)
+ return (EINVAL);
+ lck = *lock == THR_PSHARED_PTR ? __thr_pshared_offpage(lock, 0) : *lock;
+ if (lck == NULL)
+ return (EINVAL);
+ return (THR_UMUTEX_UNLOCK(_get_curthread(), &lck->s_lock));
}
diff --git a/lib/libthr/thread/thr_rtld.c b/lib/libthr/thread/thr_rtld.c
index cb20098..6c407d1 100644
--- a/lib/libthr/thread/thr_rtld.c
+++ b/lib/libthr/thread/thr_rtld.c
@@ -227,6 +227,7 @@ _thr_rtld_init(void)
_rtld_atfork_post(NULL);
_malloc_prefork();
_malloc_postfork();
+ getpid();
syscall(SYS_getpid);
/* mask signals, also force to resolve __sys_sigprocmask PLT */
diff --git a/lib/libxo/Makefile b/lib/libxo/Makefile
index 2f3f167..040db75 100644
--- a/lib/libxo/Makefile
+++ b/lib/libxo/Makefile
@@ -14,7 +14,7 @@ SHLIB_MAJOR=0
SRCS= libxo.c xo_encoder.c xo_syslog.c
-CFLAGS+=-I${LIBXOSRC}/libxo
+CFLAGS+=-I${LIBXOSRC}/libxo -I${.CURDIR}
CFLAGS+=-DXO_ENCODERDIR=\"/usr/lib/libxo/encoder\"
INCS= xo.h xo_encoder.h
diff --git a/lib/libxo/tests/Makefile b/lib/libxo/tests/Makefile
index 43f2e9d..de59ada 100644
--- a/lib/libxo/tests/Makefile
+++ b/lib/libxo/tests/Makefile
@@ -244,10 +244,15 @@ PROGS+= test_09
PROGS+= test_10
PROGS+= test_11
-CFLAGS+= -I${LIBXOSRC}/libxo
+CFLAGS+= -I${LIBXOSRC}/libxo -I${.CURDIR:H}
-LIBADD= xo
+LIBADD= xo util
SUBDIR+= encoder
+.if ${MACHINE} == "host"
+# make it easy to test without install
+TESTSDIR= ${.OBJDIR}
+.endif
+
.include <bsd.test.mk>
diff --git a/lib/libxo/xo_config.h b/lib/libxo/xo_config.h
new file mode 100644
index 0000000..9177962
--- /dev/null
+++ b/lib/libxo/xo_config.h
@@ -0,0 +1,247 @@
+/* libxo/xo_config.h. Generated from xo_config.h.in by configure. */
+/* libxo/xo_config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+ systems. This function is required for `alloca.c' support on those systems.
+ */
+/* #undef CRAY_STACKSEG_END */
+
+/* Define to 1 if using `alloca.c'. */
+/* #undef C_ALLOCA */
+
+/* Define to 1 if you have `alloca', as a function or macro. */
+#define HAVE_ALLOCA 1
+
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+ */
+/* #undef HAVE_ALLOCA_H */
+
+/* Define to 1 if you have the `asprintf' function. */
+#define HAVE_ASPRINTF 1
+
+/* Define to 1 if you have the `bzero' function. */
+#define HAVE_BZERO 1
+
+/* Define to 1 if you have the `ctime' function. */
+#define HAVE_CTIME 1
+
+/* Define to 1 if you have the <ctype.h> header file. */
+#define HAVE_CTYPE_H 1
+
+/* Define to 1 if you have the declaration of `__isthreaded', and to 0 if you
+ don't. */
+#define HAVE_DECL___ISTHREADED 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the `dlfunc' function. */
+#define HAVE_DLFUNC 1
+
+/* Define to 1 if you have the <errno.h> header file. */
+#define HAVE_ERRNO_H 1
+
+/* Define to 1 if you have the `fdopen' function. */
+#define HAVE_FDOPEN 1
+
+/* Define to 1 if you have the `flock' function. */
+#define HAVE_FLOCK 1
+
+/* Define to 1 if you have the `getpass' function. */
+#define HAVE_GETPASS 1
+
+/* Define to 1 if you have the `getprogname' function. */
+#define HAVE_GETPROGNAME 1
+
+/* Define to 1 if you have the `getrusage' function. */
+#define HAVE_GETRUSAGE 1
+
+/* gettext(3) */
+/* #undef HAVE_GETTEXT */
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#define HAVE_GETTIMEOFDAY 1
+
+/* humanize_number(3) */
+#define HAVE_HUMANIZE_NUMBER 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `crypto' library (-lcrypto). */
+#define HAVE_LIBCRYPTO 1
+
+/* Define to 1 if you have the `m' library (-lm). */
+#define HAVE_LIBM 1
+
+/* Define to 1 if you have the <libutil.h> header file. */
+#define HAVE_LIBUTIL_H 1
+
+/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
+ to 0 otherwise. */
+#define HAVE_MALLOC 1
+
+/* Define to 1 if you have the `memmove' function. */
+#define HAVE_MEMMOVE 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Support printflike */
+/* #undef HAVE_PRINTFLIKE */
+
+/* Define to 1 if your system has a GNU libc compatible `realloc' function,
+ and to 0 otherwise. */
+#define HAVE_REALLOC 1
+
+/* Define to 1 if you have the `srand' function. */
+#define HAVE_SRAND 1
+
+/* Define to 1 if you have the `sranddev' function. */
+#define HAVE_SRANDDEV 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdio_ext.h> header file. */
+/* #undef HAVE_STDIO_EXT_H */
+
+/* Define to 1 if you have the <stdio.h> header file. */
+#define HAVE_STDIO_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <stdtime/tzfile.h> header file. */
+/* #undef HAVE_STDTIME_TZFILE_H */
+
+/* Define to 1 if you have the `strchr' function. */
+#define HAVE_STRCHR 1
+
+/* Define to 1 if you have the `strcspn' function. */
+#define HAVE_STRCSPN 1
+
+/* Define to 1 if you have the `strerror' function. */
+#define HAVE_STRERROR 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strlcpy' function. */
+#define HAVE_STRLCPY 1
+
+/* Define to 1 if you have the `strspn' function. */
+#define HAVE_STRSPN 1
+
+/* Have struct sockaddr_un.sun_len */
+#define HAVE_SUN_LEN 1
+
+/* Define to 1 if you have the `sysctlbyname' function. */
+#define HAVE_SYSCTLBYNAME 1
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/sysctl.h> header file. */
+#define HAVE_SYS_SYSCTL_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <threads.h> header file. */
+#define HAVE_THREADS_H 1
+
+/* thread-local setting */
+#define HAVE_THREAD_LOCAL THREAD_LOCAL_before
+
+/* Define to 1 if you have the <tzfile.h> header file. */
+/* #undef HAVE_TZFILE_H */
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `__flbf' function. */
+/* #undef HAVE___FLBF */
+
+/* Enable debugging */
+/* #undef LIBXO_DEBUG */
+
+/* Enable text-only rendering */
+/* #undef LIBXO_TEXT_ONLY */
+
+/* Version number as dotted value */
+#define LIBXO_VERSION "0.4.3"
+
+/* Version number extra information */
+#define LIBXO_VERSION_EXTRA ""
+
+/* Version number as a number */
+#define LIBXO_VERSION_NUMBER 4003
+
+/* Version number as string */
+#define LIBXO_VERSION_STRING "4003"
+
+/* Enable local wcwidth implementation */
+#define LIBXO_WCWIDTH 1
+
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
+#define LT_OBJDIR ".libs/"
+
+/* Name of package */
+#define PACKAGE "libxo"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "phil@juniper.net"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "libxo"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "libxo 0.4.3"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "libxo"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "0.4.3"
+
+/* If using the C implementation of alloca, define if you know the
+ direction of stack growth for your system; otherwise it will be
+ automatically deduced at runtime.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown */
+/* #undef STACK_DIRECTION */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "0.4.3"
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to rpl_malloc if the replacement function should be used. */
+/* #undef malloc */
+
+/* Define to rpl_realloc if the replacement function should be used. */
+/* #undef realloc */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
diff --git a/lib/libz/Makefile b/lib/libz/Makefile
index 6a372bb..8f67885 100644
--- a/lib/libz/Makefile
+++ b/lib/libz/Makefile
@@ -76,4 +76,3 @@ FILESDIR= ${LIBDATADIR}/pkgconfig
## XXX: clang integrated-as doesn't grok .intel_syntax directives yet
#ACFLAGS.gvmat64.S= ${CLANG_NO_IAS}
-#ACFLAGS+= ${ACFLAGS.${.IMPSRC:T}}
diff --git a/lib/msun/arm/Makefile.inc b/lib/msun/arm/Makefile.inc
index e86997c..535d5ea 100644
--- a/lib/msun/arm/Makefile.inc
+++ b/lib/msun/arm/Makefile.inc
@@ -8,5 +8,3 @@ ARCH_SRCS = fenv-softfp.c fenv-vfp.c
.endif
CFLAGS.fenv-vfp.c= -mfpu=vfp -mfloat-abi=softfp
-CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
-
diff --git a/lib/ncurses/ncurses/Makefile b/lib/ncurses/ncurses/Makefile
index cf9053c..6d720ed 100644
--- a/lib/ncurses/ncurses/Makefile
+++ b/lib/ncurses/ncurses/Makefile
@@ -332,7 +332,7 @@ codes.c: MKcodes.awk
${AWK} -f ${NCURSES_DIR}/ncurses/tinfo/MKcodes.awk bigstrings=${USE_BIG_STRINGS} ${NCURSES_DIR}/include/Caps > codes.c
lib_gen.c: MKlib_gen.sh curses.h
- LC_ALL=C sh ${NCURSES_DIR}/ncurses/base/MKlib_gen.sh "${CC} -E ${CFLAGS}" \
+ LC_ALL=C sh ${NCURSES_DIR}/ncurses/base/MKlib_gen.sh "${CC:N${CCACHE_BIN}} -E ${CFLAGS}" \
"${AWK}" generated < curses.h >$@
lib_keyname.c: keys.list MKkeyname.awk
@@ -347,14 +347,14 @@ comp_captab.c: MKcaptab.sh MKcaptab.awk Caps make_hash
${NCURSES_DIR}/include/Caps > comp_captab.c
expanded.c: MKexpanded.sh
- sh ${NCURSES_DIR}/ncurses/tty/MKexpanded.sh "${CC} -E" ${CFLAGS} >expanded.c
+ sh ${NCURSES_DIR}/ncurses/tty/MKexpanded.sh "${CC:N${CCACHE_BIN}} -E" ${CFLAGS} >expanded.c
fallback.c: MKfallback.sh
sh ${NCURSES_DIR}/ncurses/tinfo/MKfallback.sh > fallback.c
# Generated headers
nomacros.h: MKlib_gen.sh curses.h
- LC_ALL=C sh ${NCURSES_DIR}/ncurses/base/MKlib_gen.sh "${CC} -E ${CFLAGS}" \
+ LC_ALL=C sh ${NCURSES_DIR}/ncurses/base/MKlib_gen.sh "${CC:N${CCACHE_BIN}} -E ${CFLAGS}" \
"${AWK}" generated < curses.h | fgrep undef > $@
init_keytry.h: keys.list make_keys
OpenPOWER on IntegriCloud