From owner-svn-src-head@FreeBSD.ORG Sat Nov 26 15:57:10 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36D85106564A; Sat, 26 Nov 2011 15:57:10 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0CAA88FC0A; Sat, 26 Nov 2011 15:57:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAQFv9Br097895; Sat, 26 Nov 2011 15:57:09 GMT (envelope-from theraven@svn.freebsd.org) Received: (from theraven@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAQFv9s1097893; Sat, 26 Nov 2011 15:57:09 GMT (envelope-from theraven@svn.freebsd.org) Message-Id: <201111261557.pAQFv9s1097893@svn.freebsd.org> From: David Chisnall Date: Sat, 26 Nov 2011 15:57:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227999 - head/lib/libc/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Nov 2011 15:57:10 -0000 Author: theraven Date: Sat Nov 26 15:57:09 2011 New Revision: 227999 URL: http://svn.freebsd.org/changeset/base/227999 Log: Return not-implemented from pthread_once and pthread_key_create, rather than silently failing and returning success. Without this, code calls pthread_once(), receives a return value of success, and thinks that the passed function has been called. Approved by: dim (mentor) Modified: head/lib/libc/gen/_pthread_stubs.c Modified: head/lib/libc/gen/_pthread_stubs.c ============================================================================== --- head/lib/libc/gen/_pthread_stubs.c Sat Nov 26 14:26:37 2011 (r227998) +++ head/lib/libc/gen/_pthread_stubs.c Sat Nov 26 15:57:09 2011 (r227999) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "libc_private.h" @@ -53,6 +54,7 @@ static int stub_main(void); static void *stub_null(void); static struct pthread *stub_self(void); static int stub_zero(void); +static int stub_fail(void); static int stub_true(void); static void stub_exit(void); @@ -93,7 +95,7 @@ pthread_func_entry_t __thr_jtable[PJT_MA {PJT_DUAL_ENTRY(stub_exit)}, /* PJT_EXIT */ {PJT_DUAL_ENTRY(stub_null)}, /* PJT_GETSPECIFIC */ {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_JOIN */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_KEY_CREATE */ + {PJT_DUAL_ENTRY(stub_fail)}, /* PJT_KEY_CREATE */ {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_KEY_DELETE */ {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_KILL */ {PJT_DUAL_ENTRY(stub_main)}, /* PJT_MAIN_NP */ @@ -105,7 +107,7 @@ pthread_func_entry_t __thr_jtable[PJT_MA {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEX_LOCK */ {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEX_TRYLOCK */ {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEX_UNLOCK */ - {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_ONCE */ + {PJT_DUAL_ENTRY(stub_fail)}, /* PJT_ONCE */ {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_DESTROY */ {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_INIT */ {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_RWLOCK_RDLOCK */ @@ -293,6 +295,12 @@ stub_self(void) } static int +stub_fail(void) +{ + return ENOSYS; +} + +static int stub_main(void) { return (-1);