Bug 27311

Summary: pthread_attr_setscope always fails
Product: Base System Reporter: rblaze <rblaze>
Component: miscAssignee: Maxim Konovalov <maxim>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.2-STABLE   
Hardware: Any   
OS: Any   

Description rblaze 2001-05-14 09:40:01 UTC
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;
Comment 1 bem 2001-06-16 05:02:33 UTC
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;
  }
+ 
Comment 2 Jason Evans freebsd_committer freebsd_triage 2001-12-17 19:38:20 UTC
Responsible Changed
From-To: freebsd-bugs->jasone

I'll take a look at this.
Comment 3 Maxim Konovalov freebsd_committer freebsd_triage 2002-02-14 15:35:26 UTC
State Changed
From-To: open->analyzed

Duplicated with misc/30699. The fix is committed to -current. 


Comment 4 Maxim Konovalov freebsd_committer freebsd_triage 2002-02-14 15:35:26 UTC
Responsible Changed
From-To: jasone->maxim

I will MFC the fix.
Comment 5 Maxim Konovalov freebsd_committer freebsd_triage 2002-02-21 11:43:35 UTC
State Changed
From-To: analyzed->closed

The fix committed to -current and -stable.