From owner-svn-src-all@freebsd.org Sat Nov 11 12:16:21 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17CB9E69D49; Sat, 11 Nov 2017 12:16:21 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D59BC7F74E; Sat, 11 Nov 2017 12:16:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vABCGJYs090160; Sat, 11 Nov 2017 12:16:19 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vABCGJ3b090158; Sat, 11 Nov 2017 12:16:19 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201711111216.vABCGJ3b090158@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 11 Nov 2017 12:16:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r325712 - stable/11/lib/libc/stdlib X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/lib/libc/stdlib X-SVN-Commit-Revision: 325712 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Nov 2017 12:16:21 -0000 Author: kib Date: Sat Nov 11 12:16:19 2017 New Revision: 325712 URL: https://svnweb.freebsd.org/changeset/base/325712 Log: MFC r325389: C++17 requires quick_exit(3) to be async-signal safe. Modified: stable/11/lib/libc/stdlib/quick_exit.3 stable/11/lib/libc/stdlib/quick_exit.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/stdlib/quick_exit.3 ============================================================================== --- stable/11/lib/libc/stdlib/quick_exit.3 Sat Nov 11 12:12:26 2017 (r325711) +++ stable/11/lib/libc/stdlib/quick_exit.3 Sat Nov 11 12:16:19 2017 (r325712) @@ -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 Modified: stable/11/lib/libc/stdlib/quick_exit.c ============================================================================== --- stable/11/lib/libc/stdlib/quick_exit.c Sat Nov 11 12:12:26 2017 (r325711) +++ stable/11/lib/libc/stdlib/quick_exit.c Sat Nov 11 12:16:19 2017 (r325712) @@ -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); }