Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libpthread Rationalize by moving



details:   https://anonhg.NetBSD.org/src/rev/4d8fe48ef31c
branches:  trunk
changeset: 756232:4d8fe48ef31c
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Fri Jul 09 07:31:01 2010 +0000

description:
Rationalize by moving

        pthread_attr_setname_np(3) to pthread_attr_getname_np(3); and
        pthread_setname_np(3) to pthread_getname_np(3).

diffstat:

 lib/libpthread/Makefile                  |   7 +-
 lib/libpthread/pthread_attr_getname_np.3 |  59 +++++++++++++++-----
 lib/libpthread/pthread_attr_setname_np.3 |  87 ------------------------------
 lib/libpthread/pthread_getname_np.3      |  50 +++++++++++++----
 lib/libpthread/pthread_setname_np.3      |  91 --------------------------------
 5 files changed, 84 insertions(+), 210 deletions(-)

diffs (truncated from 413 to 300 lines):

diff -r 634f0f0904f6 -r 4d8fe48ef31c lib/libpthread/Makefile
--- a/lib/libpthread/Makefile   Fri Jul 09 07:04:30 2010 +0000
+++ b/lib/libpthread/Makefile   Fri Jul 09 07:31:01 2010 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.67 2010/07/08 22:19:26 jruoho Exp $
+#      $NetBSD: Makefile,v 1.68 2010/07/09 07:31:01 jruoho Exp $
 #
 
 WARNS= 4
@@ -98,7 +98,6 @@
        pthread_attr_getscope.3 \
        pthread_attr_getstack.3 \
        pthread_attr_setcreatesuspend_np.3 \
-       pthread_attr_setname_np.3 \
        pthread_barrier.3 pthread_barrierattr.3 \
        pthread_cancel.3 pthread_cleanup_push.3 \
        pthread_cond.3 pthread_condattr.3 \
@@ -110,7 +109,6 @@
        pthread_mutex.3 pthread_mutexattr.3 \
        pthread_once.3 pthread_rwlock.3 pthread_rwlockattr.3 \
        pthread_schedparam.3 pthread_self.3 \
-       pthread_setname_np.3 \
        pthread_setspecific.3 pthread_sigmask.3 pthread_spin.3 \
        pthread_suspend_np.3 pthread_testcancel.3
 
@@ -123,6 +121,7 @@
 MLINKS+=       pthread_attr_getdetachstate.3 pthread_attr_setdetachstate.3
 MLINKS+=       pthread_attr_getguardsize.3 pthread_attr_setguardsize.3
 MLINKS+=       pthread_attr_getinheritsched.3 pthread_attr_setinheritsched.3
+MLINKS+=       pthread_attr_getname_np.3 pthread_attr_setname_np.3
 
 MLINKS+=       pthread_attr_getschedparam.3 pthread_attr_setschedparam.3 \
                pthread_attr_getschedparam.3 pthread_attr_getschedpolicy.3 \
@@ -155,6 +154,8 @@
 MLINKS+=       pthread_condattr.3 pthread_condattr_init.3
 MLINKS+=       pthread_condattr.3 pthread_condattr_destroy.3
 
+MLINKS+=       pthread_getname_np.3 pthread_setname_np.3
+
 MLINKS+=       pthread_mutex.3 pthread_mutex_init.3
 MLINKS+=       pthread_mutex.3 pthread_mutex_destroy.3
 MLINKS+=       pthread_mutex.3 pthread_mutex_lock.3
diff -r 634f0f0904f6 -r 4d8fe48ef31c lib/libpthread/pthread_attr_getname_np.3
--- a/lib/libpthread/pthread_attr_getname_np.3  Fri Jul 09 07:04:30 2010 +0000
+++ b/lib/libpthread/pthread_attr_getname_np.3  Fri Jul 09 07:31:01 2010 +0000
@@ -1,4 +1,4 @@
-.\"     $NetBSD: pthread_attr_getname_np.3,v 1.3 2010/07/07 09:54:07 wiz Exp $
+.\"     $NetBSD: pthread_attr_getname_np.3,v 1.4 2010/07/09 07:31:01 jruoho Exp $
 .\"
 .\" Copyright (c)2007 YAMAMOTO Takashi,
 .\" All rights reserved.
@@ -30,16 +30,13 @@
 .Os
 .Sh NAME
 .Nm pthread_attr_getname_np
-.Nd set descriptive name of an attribute
+.Nd get and set descriptive name of an attribute
 .\" ------------------------------------------------------------
 .Sh LIBRARY
 .Lb libpthread
 .\" ------------------------------------------------------------
 .Sh SYNOPSIS
 .In pthread.h
-.Ft int
-.Fn pthread_attr_getname_np "const pthread_attr_t attr" "char *name" \
-    "size_t len"
 .\" ------------------------------------------------------------
 .Sh DESCRIPTION
 The
@@ -56,21 +53,51 @@
 .Fa name
 in bytes.
 .El
+.Pp
+The
+.Fn pthread_attr_setname_np
+function sets the descriptive name of a thread attribute.
+It takes the following arguments:
+.Bl -tag -width attr -offset indent
+.It Fa attr
+The attribute whose descriptive name will be set.
+.It Fa name
+The
+.Xr printf 3
+format string to be used to construct the descriptive name of the attribute.
+The resulted descriptive name should be shorter than
+.Dv PTHREAD_MAX_NAMELEN_NP .
+.It Fa arg
+The
+.Xr printf 3
+argument used with
+.Fa name .
+.El
 .\" ------------------------------------------------------------
 .Sh RETURN VALUES
-The
-.Fn pthread_attr_getname_np
-function returns 0 on success.
-Otherwise, an error number described in
-.Xr errno 2
-is returned.
+Both functions return 0 on success.
+Otherwise, an error number is returned.
 .\" ------------------------------------------------------------
 .Sh COMPATIBILITY
+Both functions are non-standard extensions.
+.\" ------------------------------------------------------------
+.Sh ERRORS
+No errors are defined for
+.Fn pthread_attr_getname_np .
+.Pp
 The
-.Fn pthread_attr_getname_np
-function is a non-standard extension.
-.\" ------------------------------------------------------------
-.\".Sh ERRORS
+.Fn pthread_attr_setname_np
+function may fail if:
+.Bl -tag -width Er
+.It Bq Er ENOMEM
+There was insufficient memory for the operation.
+.It Bq Er EINVAL
+The supplied descriptive
+.Fa name
+was longer than
+.Dv PTHREAD_MAX_NAMELEN_NP .
+.El
 .\" ------------------------------------------------------------
 .Sh SEE ALSO
-.Xr pthread_attr_setname_np 3
+.Xr pthread_attr 3 ,
+.Xr pthread_getname_np 3
diff -r 634f0f0904f6 -r 4d8fe48ef31c lib/libpthread/pthread_attr_setname_np.3
--- a/lib/libpthread/pthread_attr_setname_np.3  Fri Jul 09 07:04:30 2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-.\"     $NetBSD: pthread_attr_setname_np.3,v 1.4 2010/07/07 09:54:07 wiz Exp $
-.\"
-.\" Copyright (c)2007 YAMAMOTO Takashi,
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" ------------------------------------------------------------
-.Dd July 7, 2010
-.Dt PTHREAD_ATTR_SETNAME_NP 3
-.Os
-.Sh NAME
-.Nm pthread_attr_setname_np
-.Nd set descriptive name of an attribute
-.\" ------------------------------------------------------------
-.Sh LIBRARY
-.Lb libpthread
-.\" ------------------------------------------------------------
-.Sh SYNOPSIS
-.In pthread.h
-.Ft int
-.Fn pthread_attr_setname_np "pthread_attr_t attr" "const char *name" \
-    "void *arg"
-.\" ------------------------------------------------------------
-.Sh DESCRIPTION
-The
-.Fn pthread_attr_setname_np
-function sets the descriptive name of a thread attribute.
-It takes the following arguments:
-.Bl -tag -width attr -offset indent
-.It Fa attr
-The attribute whose descriptive name will be set.
-.It Fa name
-The
-.Xr printf 3
-format string to be used to construct the descriptive name of the attribute.
-The resulted descriptive name should be shorter than
-.Dv PTHREAD_MAX_NAMELEN_NP .
-.It Fa arg
-The
-.Xr printf 3
-argument used with
-.Fa name .
-.El
-.\" ------------------------------------------------------------
-.Sh RETURN VALUES
-The
-.Fn pthread_attr_setname_np
-function returns 0 on success.
-Otherwise an error number is returned to indicate the error.
-.\" ------------------------------------------------------------
-.Sh COMPATIBILITY
-The
-.Fn pthread_attr_setname_np
-function is a non-standard extension.
-.\" ------------------------------------------------------------
-.Sh ERRORS
-The
-.Fn pthread_attr_setname_np
-function will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-Invalid parameter.
-.It Bq Er ENOMEM
-Insufficient memory.
-.El
-.Sh SEE ALSO
-.Xr pthread_attr_getname_np 3
diff -r 634f0f0904f6 -r 4d8fe48ef31c lib/libpthread/pthread_getname_np.3
--- a/lib/libpthread/pthread_getname_np.3       Fri Jul 09 07:04:30 2010 +0000
+++ b/lib/libpthread/pthread_getname_np.3       Fri Jul 09 07:31:01 2010 +0000
@@ -1,4 +1,4 @@
-.\"     $NetBSD: pthread_getname_np.3,v 1.3 2010/07/07 09:54:07 wiz Exp $
+.\"     $NetBSD: pthread_getname_np.3,v 1.4 2010/07/09 07:31:01 jruoho Exp $
 .\"
 .\" Copyright (c)2007 YAMAMOTO Takashi,
 .\" All rights reserved.
@@ -25,12 +25,12 @@
 .\" SUCH DAMAGE.
 .\"
 .\" ------------------------------------------------------------
-.Dd July 7, 2010
+.Dd July 9, 2010
 .Dt PTHREAD_GETNAME_NP 3
 .Os
 .Sh NAME
 .Nm pthread_getname_np
-.Nd set descriptive name of a thread
+.Nd get and set descriptive name of a thread
 .\" ------------------------------------------------------------
 .Sh LIBRARY
 .Lb libpthread
@@ -39,6 +39,8 @@
 .In pthread.h
 .Ft int
 .Fn pthread_getname_np "pthread_t thread" "char *name" "size_t len"
+.Ft int
+.Fn pthread_setname_np "pthread_t thread" "const char *name" "void *arg"
 .\" ------------------------------------------------------------
 .Sh DESCRIPTION
 The
@@ -55,22 +57,36 @@
 .Fa name
 in bytes.
 .El
+.Pp
+The
+.Fn pthread_setname_np
+function sets the descriptive name of a thread.
+It takes the following arguments:
+.Bl -tag -width target -offset indent
+.It Fa thread
+The thread whose descriptive name will be set.
+.It Fa name
+The
+.Xr printf 3
+format string to be used to construct the descriptive name of the thread.
+The resulted descriptive name should be shorter than
+.Dv PTHREAD_MAX_NAMELEN_NP .
+.It Fa arg
+The
+.Xr printf 3
+argument used with
+.Fa name .
+.El
 .\" ------------------------------------------------------------
 .Sh RETURN VALUES
-The
-.Fn pthread_getname_np
-function returns 0 on success.
+Both functions return 0 on success.
 Otherwise, an error number is returned to indicate the error.
 .\" ------------------------------------------------------------
 .Sh COMPATIBILITY
-The
-.Fn pthread_getname_np
-function is a non-standard extension.
+Both functions are non-standard extensions.
 .\" ------------------------------------------------------------
 .Sh ERRORS
-The
-.Fn pthread_getname_np
-function will fail if:
+Both functions may fail if:
 .Bl -tag -width Er



Home | Main Index | Thread Index | Old Index