From owner-svn-src-all@FreeBSD.ORG Thu Jun 13 18:40:45 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id BD666961; Thu, 13 Jun 2013 18:40:45 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AF1841D67; Thu, 13 Jun 2013 18:40:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5DIejZ1066195; Thu, 13 Jun 2013 18:40:45 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5DIejmx066194; Thu, 13 Jun 2013 18:40:45 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201306131840.r5DIejmx066194@svn.freebsd.org> From: Ed Schouten Date: Thu, 13 Jun 2013 18:40:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251694 - head/sys/sys X-SVN-Group: head 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.14 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: Thu, 13 Jun 2013 18:40:45 -0000 Author: ed Date: Thu Jun 13 18:40:45 2013 New Revision: 251694 URL: http://svnweb.freebsd.org/changeset/base/251694 Log: Minor improvements to . - Define __SYNC_ATOMICS in case we're using the __sync_*() API. This is not used by itself, but may be useful for some of the intrinsics code to determine whether it should build the machine-dependent intrinsic functions. - Make is_lock_free() work in kernelspace. For now, assume atomics in kernelspace are always lock free. This is a quite reasonable assumption, as we surely shouldn't implement the atomic fallbacks for arbitrary sizes. Modified: head/sys/sys/stdatomic.h Modified: head/sys/sys/stdatomic.h ============================================================================== --- head/sys/sys/stdatomic.h Thu Jun 13 18:39:17 2013 (r251693) +++ head/sys/sys/stdatomic.h Thu Jun 13 18:40:45 2013 (r251694) @@ -37,7 +37,9 @@ #define __CLANG_ATOMICS #elif __GNUC_PREREQ__(4, 7) #define __GNUC_ATOMICS -#elif !defined(__GNUC__) +#elif defined(__GNUC__) +#define __SYNC_ATOMICS +#else #error "stdatomic.h does not support your compiler" #endif @@ -156,7 +158,11 @@ enum memory_order { * 7.17.5 Lock-free property. */ -#if defined(__CLANG_ATOMICS) +#if defined(_KERNEL) +/* Atomics in kernelspace are always lock-free. */ +#define atomic_is_lock_free(obj) \ + ((void)(obj), (_Bool)1) +#elif defined(__CLANG_ATOMICS) #define atomic_is_lock_free(obj) \ __atomic_is_lock_free(sizeof(*(obj)), obj) #elif defined(__GNUC_ATOMICS)