From nobody@FreeBSD.org  Mon May 14 01:33:34 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 0A94B37B423
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 14 May 2001 01:33:33 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.1/8.11.1) id f4E8XWm80386;
	Mon, 14 May 2001 01:33:32 -0700 (PDT)
	(envelope-from nobody)
Message-Id: <200105140833.f4E8XWm80386@freefall.freebsd.org>
Date: Mon, 14 May 2001 01:33:32 -0700 (PDT)
From: rblaze@mail.ru
To: freebsd-gnats-submit@FreeBSD.org
Subject: pthread_attr_setscope always fails
X-Send-Pr-Version: www-1.0

>Number:         27311
>Category:       misc
>Synopsis:       pthread_attr_setscope always fails
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    maxim
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon May 14 01:40:01 PDT 2001
>Closed-Date:    Thu Feb 21 03:43:35 PST 2002
>Last-Modified:  Thu Feb 21 03:44:13 PST 2002
>Originator:     Andrey Sverdlichenko
>Release:        4.2-STABLE
>Organization:
>Environment:
FreeBSD xen.infosec.ru 4.2-STABLE FreeBSD 4.2-STABLE #0: Fri Feb 23 13:33:20 MSK 2001     blaze@xen.infosec.ru:/var/tmp/src/sys/compile/XEN  i386

>Description:
This is code from /usr/src/lib/libc_r/uthread/uthread_attr_setscope.c :

int
pthread_attr_setscope(pthread_attr_t *attr, int contentionscope)
{
        int ret = 0;

        if ((attr == NULL) || (*attr == NULL)) {
                /* Return an invalid argument: */
                ret = EINVAL;
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:

From: Brian Mitchell <bem@atlanta-bsd.org>
To: freebsd-gnats-submit@FreeBSD.org
Cc: rblaze@mail.ru
Subject: Re: misc/27311: pthread_attr_setscope always fails
Date: Sat, 16 Jun 2001 00:02:33 -0400

 Something along these lines should let PTHREAD_SCOPE_PROCESS work, I believe.
 
 
 *** uthread_attr_setscope.c.old	Fri Jun 15 23:28:19 2001
 --- uthread_attr_setscope.c	Fri Jun 15 23:47:49 2001
 ***************
 *** 43,56 ****
   	int ret = 0;
   
   	if ((attr == NULL) || (*attr == NULL)) {
 ! 		/* Return an invalid argument: */
 ! 		ret = EINVAL;
 ! 	} else if ((contentionscope != PTHREAD_SCOPE_PROCESS) ||
 ! 	    (contentionscope != PTHREAD_SCOPE_SYSTEM)) {
 ! 		/* We don't support PTHREAD_SCOPE_SYSTEM. */
 ! 		ret = ENOTSUP;
 ! 	} else
 ! 		(*attr)->flags |= contentionscope;
   
 ! 	return(ret);
   }
 --- 43,62 ----
   	int ret = 0;
   
   	if ((attr == NULL) || (*attr == NULL)) {
 ! 		return EINVAL;
 ! 	}
   
 ! 	switch(contentionscope)
 ! 	{
 ! 		case PTHREAD_SCOPE_SYSTEM:
 ! 			return ENOTSUP;
 ! 		case PTHREAD_SCOPE_PROCESS:
 ! 			(*attr)->flags |= contentionscope;
 ! 			return ret;
 ! 		default:
 ! 			return ENOTSUP;
 ! 	}
 ! 	/* not reached */
 ! 	return ret;
   }
 + 
 
Responsible-Changed-From-To: freebsd-bugs->jasone 
Responsible-Changed-By: jasone 
Responsible-Changed-When: Mon Dec 17 11:38:20 PST 2001 
Responsible-Changed-Why:  
I'll take a look at this. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=27311 
State-Changed-From-To: open->analyzed 
State-Changed-By: maxim 
State-Changed-When: Thu Feb 14 07:35:26 PST 2002 
State-Changed-Why:  
Duplicated with misc/30699. The fix is committed to -current. 


Responsible-Changed-From-To: jasone->maxim 
Responsible-Changed-By: maxim 
Responsible-Changed-When: Thu Feb 14 07:35:26 PST 2002 
Responsible-Changed-Why:  
I will MFC the fix. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=27311 
State-Changed-From-To: analyzed->closed 
State-Changed-By: maxim 
State-Changed-When: Thu Feb 21 03:43:35 PST 2002 
State-Changed-Why:  
The fix committed to -current and -stable. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=27311 
>Unformatted:
 >>        } else if ((contentionscope != PTHREAD_SCOPE_PROCESS) ||
 >>            (contentionscope != PTHREAD_SCOPE_SYSTEM)) {
                 /* We don't support PTHREAD_SCOPE_SYSTEM. */
                 ret = ENOTSUP;
         } else
                 (*attr)->flags |= contentionscope;
 
         return(ret);
 }
 
 Since PTHREAD_SCOPE_PROCESS != PTHREAD_SCOPE_SYSTEM, this function 
 always fails.
 
