From owner-svn-src-all@FreeBSD.ORG Wed Feb 19 15:00:56 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7AD6C8B9; Wed, 19 Feb 2014 15:00:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6545E1FA7; Wed, 19 Feb 2014 15:00:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s1JF0uDK085048; Wed, 19 Feb 2014 15:00:56 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s1JF0uQ2085047; Wed, 19 Feb 2014 15:00:56 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201402191500.s1JF0uQ2085047@svn.freebsd.org> From: John Baldwin Date: Wed, 19 Feb 2014 15:00:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r262221 - in stable: 8/lib/libthr/thread 9/lib/libthr/thread X-SVN-Group: stable-8 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.17 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: Wed, 19 Feb 2014 15:00:56 -0000 Author: jhb Date: Wed Feb 19 15:00:55 2014 New Revision: 262221 URL: http://svnweb.freebsd.org/changeset/base/262221 Log: MFC 250691: Return one-based key so that user can check if the key is ever allocated in the first place. Modified: stable/8/lib/libthr/thread/thr_spec.c Directory Properties: stable/8/lib/libthr/ (props changed) Changes in other areas also in this revision: Modified: stable/9/lib/libthr/thread/thr_spec.c Directory Properties: stable/9/lib/libthr/ (props changed) Modified: stable/8/lib/libthr/thread/thr_spec.c ============================================================================== --- stable/8/lib/libthr/thread/thr_spec.c Wed Feb 19 13:06:50 2014 (r262220) +++ stable/8/lib/libthr/thread/thr_spec.c Wed Feb 19 15:00:55 2014 (r262221) @@ -69,7 +69,7 @@ _pthread_key_create(pthread_key_t *key, /* Unlock the key table: */ THR_LOCK_RELEASE(curthread, &_keytable_lock); - *key = i; + *key = i + 1; return (0); } @@ -80,9 +80,10 @@ _pthread_key_create(pthread_key_t *key, } int -_pthread_key_delete(pthread_key_t key) +_pthread_key_delete(pthread_key_t userkey) { struct pthread *curthread = _get_curthread(); + int key = userkey - 1; int ret = 0; if ((unsigned int)key < PTHREAD_KEYS_MAX) { @@ -177,9 +178,10 @@ pthread_key_allocate_data(void) } int -_pthread_setspecific(pthread_key_t key, const void *value) +_pthread_setspecific(pthread_key_t userkey, const void *value) { struct pthread *pthread; + pthread_key_t key = userkey - 1; int ret = 0; /* Point to the running thread: */ @@ -208,9 +210,10 @@ _pthread_setspecific(pthread_key_t key, } void * -_pthread_getspecific(pthread_key_t key) +_pthread_getspecific(pthread_key_t userkey) { struct pthread *pthread; + pthread_key_t key = userkey - 1; const void *data; /* Point to the running thread: */