From 6a96a39c77491f7dd40eb42db04475616a562779 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Sat, 4 Nov 2017 10:52:58 +0000 Subject: C++17 requires quick_exit(3) to be async-signal safe. Make it safe, and update man page with the useful information. Sponsored by: The FreeBSD Foundation MFC after: 1 week --- lib/libc/stdlib/quick_exit.3 | 13 ++++++++++++- lib/libc/stdlib/quick_exit.c | 7 ++++++- 2 files changed, 18 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/libc/stdlib/quick_exit.3 b/lib/libc/stdlib/quick_exit.3 index fb1e346bb106..9d316c7e46ea 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 November 4, 2017 .Dt QUICK_EXIT 3 .Os .Sh NAME @@ -44,6 +44,17 @@ with .Xr at_quick_exit 3 but not any C++ destructors or cleanup code registered with .Xr atexit 3 . +The +.Xr stdio 3 +file buffers are not flushed. +.Pp +The function +.Fn quick_exit +is +.Em async-signal safe +when the functions registered with +.Xr at_quick_exit 3 +are. .Sh RETURN VALUES The .Fn quick_exit diff --git a/lib/libc/stdlib/quick_exit.c b/lib/libc/stdlib/quick_exit.c index ef8cdb1b401a..4d81a35f5375 100644 --- a/lib/libc/stdlib/quick_exit.c +++ b/lib/libc/stdlib/quick_exit.c @@ -26,6 +26,8 @@ * $FreeBSD$ */ +#include +#include #include #include @@ -60,6 +62,7 @@ at_quick_exit(void (*func)(void)) h->cleanup = func; pthread_mutex_lock(&atexit_mutex); h->next = handlers; + __compiler_membar(); handlers = h; pthread_mutex_unlock(&atexit_mutex); return (0); @@ -74,7 +77,9 @@ quick_exit(int status) * XXX: The C++ spec requires us to call std::terminate if there is an * exception here. */ - for (h = handlers; NULL != h; h = h->next) + for (h = handlers; NULL != h; h = h->next) { + __compiler_membar(); h->cleanup(); + } _Exit(status); } -- cgit v1.3 From 95844abe537fcb15313dd6bef6a0adad12458c54 Mon Sep 17 00:00:00 2001 From: Mariusz Zaborski Date: Sat, 4 Nov 2017 15:47:18 +0000 Subject: Casper work's only as shared library - disable building static ones. Reviewed by: bdrewery@ Differential Revision: https://reviews.freebsd.org/D12917 --- ObsoleteFiles.inc | 13 +++++++++++++ lib/libcasper/libcasper/Makefile | 2 +- lib/libcasper/services/cap_dns/Makefile | 2 +- lib/libcasper/services/cap_grp/Makefile | 2 +- lib/libcasper/services/cap_pwd/Makefile | 2 +- lib/libcasper/services/cap_random/Makefile | 2 +- lib/libcasper/services/cap_sysctl/Makefile | 2 +- 7 files changed, 19 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 26a1ad7c9345..7e12fe6484a3 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -38,6 +38,19 @@ # xargs -n1 | sort | uniq -d; # done +# 20171104: Casper can work only as shared library +OLD_FILES+=usr/lib/libcasper.a +OLD_FILES+=usr/lib/libcasper_p.a +OLD_FILES+=usr/lib/libcap_dns.a +OLD_FILES+=usr/lib/libcap_dns_p.a +OLD_FILES+=usr/lib/libcap_grp.a +OLD_FILES+=usr/lib/libcap_grp_p.a +OLD_FILES+=usr/lib/libcap_pwd.a +OLD_FILES+=usr/lib/libcap_pwd_p.a +OLD_FILES+=usr/lib/libcap_random.a +OLD_FILES+=usr/lib/libcap_random_p.a +OLD_FILES+=usr/lib/libcap_sysctl.a +OLD_FILES+=usr/lib/libcap_sysctl_p.a # 20171031: Removal of obsolete man files OLD_FILES+=usr/share/man/man7/adding_user.7.gz # 20171031: Disconnected libpathconv tests diff --git a/lib/libcasper/libcasper/Makefile b/lib/libcasper/libcasper/Makefile index 75ac69bf55e8..c1af1edd75cc 100644 --- a/lib/libcasper/libcasper/Makefile +++ b/lib/libcasper/libcasper/Makefile @@ -8,7 +8,7 @@ SHLIB_MAJOR= 0 SHLIBDIR?= /lib .if ${MK_CASPER} != "no" -LIB= casper +SHLIB= casper SRCS= libcasper.c SRCS+= libcasper_impl.c diff --git a/lib/libcasper/services/cap_dns/Makefile b/lib/libcasper/services/cap_dns/Makefile index 3e2daa2cfaaa..e89be7f5396d 100644 --- a/lib/libcasper/services/cap_dns/Makefile +++ b/lib/libcasper/services/cap_dns/Makefile @@ -10,7 +10,7 @@ SHLIB_MAJOR= 0 INCSDIR?= ${INCLUDEDIR}/casper .if ${MK_CASPER} != "no" -LIB= cap_dns +SHLIB= cap_dns SRCS= cap_dns.c .endif diff --git a/lib/libcasper/services/cap_grp/Makefile b/lib/libcasper/services/cap_grp/Makefile index d15cd72c20ce..5b464774f9f5 100644 --- a/lib/libcasper/services/cap_grp/Makefile +++ b/lib/libcasper/services/cap_grp/Makefile @@ -10,7 +10,7 @@ SHLIB_MAJOR= 0 INCSDIR?= ${INCLUDEDIR}/casper .if ${MK_CASPER} != "no" -LIB= cap_grp +SHLIB= cap_grp SRCS= cap_grp.c .endif diff --git a/lib/libcasper/services/cap_pwd/Makefile b/lib/libcasper/services/cap_pwd/Makefile index fc2a32850f79..be4ae89181c7 100644 --- a/lib/libcasper/services/cap_pwd/Makefile +++ b/lib/libcasper/services/cap_pwd/Makefile @@ -10,7 +10,7 @@ SHLIB_MAJOR= 0 INCSDIR?= ${INCLUDEDIR}/casper .if ${MK_CASPER} != "no" -LIB= cap_pwd +SHLIB= cap_pwd SRCS= cap_pwd.c .endif diff --git a/lib/libcasper/services/cap_random/Makefile b/lib/libcasper/services/cap_random/Makefile index d29cd147aeb0..45141d47bca8 100644 --- a/lib/libcasper/services/cap_random/Makefile +++ b/lib/libcasper/services/cap_random/Makefile @@ -9,7 +9,7 @@ SHLIBDIR?= /lib/casper INCSDIR?= ${INCLUDEDIR}/casper .if ${MK_CASPER} != "no" -LIB= cap_random +SHLIB= cap_random SRCS= cap_random.c .endif diff --git a/lib/libcasper/services/cap_sysctl/Makefile b/lib/libcasper/services/cap_sysctl/Makefile index cd5c4b238724..14f2bd60cf97 100644 --- a/lib/libcasper/services/cap_sysctl/Makefile +++ b/lib/libcasper/services/cap_sysctl/Makefile @@ -10,7 +10,7 @@ SHLIB_MAJOR= 0 INCSDIR?= ${INCLUDEDIR}/casper .if ${MK_CASPER} != "no" -LIB= cap_sysctl +SHLIB= cap_sysctl SRCS= cap_sysctl.c .endif -- cgit v1.3 From 0dfac7ee085fe53889299020be38ee88b03df166 Mon Sep 17 00:00:00 2001 From: Mariusz Zaborski Date: Sat, 4 Nov 2017 15:50:05 +0000 Subject: The src.opts.mk sets default value for the SHLIBDIR, so our set was not respected. Please notice that libcasper is already in ObsoleteFiles so we don't add it again. Reported by: Herbert J. Skuhra Reviewed by: bdrewery@ Differential Revision: https://reviews.freebsd.org/D12918 --- ObsoleteFiles.inc | 2 ++ lib/libcasper/libcasper/Makefile | 6 +++--- lib/libcasper/services/cap_random/Makefile | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 7e12fe6484a3..979483ba44e7 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20171104: libcap_random should be in /lib not in /usr/lib +OLD_LIBS+=usr/lib/libcap_random.so.0 # 20171104: Casper can work only as shared library OLD_FILES+=usr/lib/libcasper.a OLD_FILES+=usr/lib/libcasper_p.a diff --git a/lib/libcasper/libcasper/Makefile b/lib/libcasper/libcasper/Makefile index c1af1edd75cc..729bf071846a 100644 --- a/lib/libcasper/libcasper/Makefile +++ b/lib/libcasper/libcasper/Makefile @@ -1,14 +1,14 @@ # $FreeBSD$ +SHLIBDIR?= /lib + .include PACKAGE=${LIB} -SHLIB_MAJOR= 0 -SHLIBDIR?= /lib - .if ${MK_CASPER} != "no" SHLIB= casper +SHLIB_MAJOR= 0 SRCS= libcasper.c SRCS+= libcasper_impl.c diff --git a/lib/libcasper/services/cap_random/Makefile b/lib/libcasper/services/cap_random/Makefile index 45141d47bca8..fad8e3f9cdb7 100644 --- a/lib/libcasper/services/cap_random/Makefile +++ b/lib/libcasper/services/cap_random/Makefile @@ -1,11 +1,12 @@ # $FreeBSD$ +SHLIBDIR?= /lib/casper + .include PACKAGE=libcasper SHLIB_MAJOR= 0 -SHLIBDIR?= /lib/casper INCSDIR?= ${INCLUDEDIR}/casper .if ${MK_CASPER} != "no" -- cgit v1.3 From 8ca8d252bb385afa0d43fe933dd1eecc4dbbbc5c Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Sun, 5 Nov 2017 03:02:19 +0000 Subject: posix_fallocate.2: add an EINVAL errno case As of r325320 posix_fallocate returns EINVAL on ZFS to indicate that the underlying filesystem does not support this operation, per POSIX.1-2008. Document this case in the man page. MFC after: 20 days MFC with: r325320 Sponsored by: The FreeBSD Foundation --- lib/libc/sys/posix_fallocate.2 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/libc/sys/posix_fallocate.2 b/lib/libc/sys/posix_fallocate.2 index 1bc59caf7239..4fba3dd87611 100644 --- a/lib/libc/sys/posix_fallocate.2 +++ b/lib/libc/sys/posix_fallocate.2 @@ -28,7 +28,7 @@ .\" @(#)open.2 8.2 (Berkeley) 11/16/93 .\" $FreeBSD$ .\" -.Dd October 12, 2017 +.Dd November 4, 2017 .Dt POSIX_FALLOCATE 2 .Os .Sh NAME @@ -106,9 +106,10 @@ A signal was caught during execution. .It Bq Er EINVAL The .Fa len -argument was less than or equal to zero or the +argument was less than or equal to zero, the .Fa offset -argument was less than zero. +argument was less than zero, +or the operation is not supported by the file system. .It Bq Er EIO An I/O error occurred while reading from or writing to a file system. .It Bq Er ENODEV -- cgit v1.3