Skip site navigation (1)Skip section navigation (2)
Date:      Tue,  1 Jun 1999 10:41:08 -0700 (PDT)
From:      rse@engelschall.com
To:        freebsd-gnats-submit@freebsd.org
Subject:   advocacy/11982: Three cleanup fixes for uthreads
Message-ID:  <19990601174108.C1A3B14C0E@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         11982
>Category:       advocacy
>Synopsis:       Three cleanup fixes for uthreads
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-advocacy
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun  1 10:50:01 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator:     Ralf S. Engelschall
>Release:        3.1
>Organization:
Cable & Wireless ECRC
>Environment:
FreeBSD en1.engelschall.com 3.1-RELEASE FreeBSD 3.1-RELEASE #4: Sun Feb 28 18:55:02 CET 1999     rse@en1.engelschall.com:/usr/src/sys/compile/EN1  i386
>Description:
Below is a patch for some pthread/uthread files which I've done while I've
poked around in the FreeBSD uthread library and reading the POSIX and SUSv2
specifications.

1. "struct pthread *" -> pthread_t for consistency with other prototypes

2. pthread_rwlockattr_setpshared gets a "int" as the last argument
   and not a "int *". You can proof this by two things: First when you compare
   all get/set functions it's obvious that at least for consistency reasons it
   has to be an "int".  Second the SUSv2 under
   http://www.opengroup.org/onlinepubs/007908799/xsh/pthread_rwlockattr_getpshared.html
   explicitly shows the prototype this way, too.

3. removed prototype for "pthread_attr_setcleanup", because first
   this isn't implemented by FreeBSD's uthread and second, a search for this
   function under http://www.opengroup.org/onlinepubs/007908799/toc.htm also
   doesn't indicate that this function is an official one.

diff -ru3 uthread.orig/pthread.h uthread/pthread.h
--- uthread.orig/pthread.h  Sun May  9 09:44:53 1999
+++ uthread/pthread.h   Sat May 29 13:04:19 1999
@@ -235,7 +235,7 @@
 int        pthread_key_create __P((pthread_key_t *,
            void (*routine) (void *)));
 int        pthread_key_delete __P((pthread_key_t));
-int        pthread_kill __P((struct pthread *, int));
+int        pthread_kill __P((pthread_t, int));
 int        pthread_mutexattr_init __P((pthread_mutexattr_t *));
 int        pthread_mutexattr_destroy __P((pthread_mutexattr_t *));
 int        pthread_mutexattr_settype __P((pthread_mutexattr_t *, int));
@@ -259,7 +259,7 @@
 int        pthread_rwlockattr_getpshared __P((const pthread_rwlockattr_t *,
            int *));
 int        pthread_rwlockattr_setpshared __P((pthread_rwlockattr_t *,
-           int *));
+           int));
 int        pthread_rwlockattr_destroy __P((pthread_rwlockattr_t *));
 pthread_t  pthread_self __P((void));
 int        pthread_setcancelstate __P((int, int *));
@@ -315,8 +315,6 @@

 int        pthread_attr_setfloatstate __P((pthread_attr_t *, int));
 int        pthread_attr_getfloatstate __P((pthread_attr_t *, int *));
-int        pthread_attr_setcleanup __P((pthread_attr_t *,
-           void (*routine) (void *), void *));
 __END_DECLS

 #endif
diff -ru3 uthread.orig/uthread_rwlockattr.c uthread/uthread_rwlockattr.c
--- uthread.orig/uthread_rwlockattr.c   Mon Sep  7 21:23:55 1998
+++ uthread/uthread_rwlockattr.c    Sat May 29 13:05:05 1999
@@ -82,15 +82,13 @@

 int
 pthread_rwlockattr_setpshared (pthread_rwlockattr_t *rwlockattr,
-   int *pshared)
+   int pshared)
 {
-   int ps = *pshared;
-
    /* only PTHREAD_PROCESS_PRIVATE is supported */
-   if (ps != PTHREAD_PROCESS_PRIVATE)
+   if (pshared != PTHREAD_PROCESS_PRIVATE)
        return(EINVAL);

-   (*rwlockattr)->pshared = ps;
+   (*rwlockattr)->pshared = pshared;

    return(0);
 }


>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-advocacy" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990601174108.C1A3B14C0E>