Subject: Re: lib/29952
To: None <lib-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: KAMADA Ken'ichi <kamada@nanohz.org>
List: netbsd-bugs
Date: 05/02/2005 09:54:01
The following reply was made to PR lib/29952; it has been noted by GNATS.
From: KAMADA Ken'ichi <kamada@nanohz.org>
To: gnats-bugs@netbsd.org
Cc: kamada@nanohz.org
Subject: Re: lib/29952
Date: Mon, 02 May 2005 18:24:51 +0900
> >Description:
> MIT krb5-1.4 uses pthread_equal(), so could you consider
> adding pthread_equal() stub to libc (and pthread.h)? I think that
> unconditionally returning 1 is enough for non-threaded applications.
Index: libc/thread-stub/thread-stub.c
===================================================================
RCS file: /cvsroot/src/lib/libc/thread-stub/thread-stub.c,v
retrieving revision 1.12
diff -u -r1.12 thread-stub.c
--- libc/thread-stub/thread-stub.c 14 Dec 2004 00:21:40 -0000 1.12
+++ libc/thread-stub/thread-stub.c 2 May 2005 09:14:02 -0000
@@ -329,6 +329,7 @@
int __libc_thr_once_stub(once_t *, void (*)(void));
int __libc_thr_sigsetmask_stub(int, const sigset_t *, sigset_t *);
thr_t __libc_thr_self_stub(void);
+int __libc_thr_equal_stub(thr_t, thr_t);
int __libc_thr_yield_stub(void);
int __libc_thr_create_stub(thr_t *, const thrattr_t *,
void *(*)(void *), void *);
@@ -339,6 +340,7 @@
__weak_alias(__libc_thr_once,__libc_thr_once_stub)
__weak_alias(__libc_thr_sigsetmask,__libc_thr_sigsetmask_stub)
__weak_alias(__libc_thr_self,__libc_thr_self_stub)
+__weak_alias(__libc_thr_equal,__libc_thr_equal_stub)
__weak_alias(__libc_thr_yield,__libc_thr_yield_stub)
__weak_alias(__libc_thr_create,__libc_thr_create_stub)
__weak_alias(__libc_thr_exit,__libc_thr_exit_stub)
@@ -377,6 +379,18 @@
}
int
+__libc_thr_equal_stub(thr_t t1, thr_t t2)
+{
+ /* LINTED deliberate lack of effect */
+ (void)t1;
+ /* LINTED deliberate lack of effect */
+ (void)t2;
+
+ /* There is only one thread. */
+ return 1;
+}
+
+int
__libc_thr_yield_stub(void)
{
Index: libpthread/pthread.h
===================================================================
RCS file: /cvsroot/src/lib/libpthread/pthread.h,v
retrieving revision 1.21
diff -u -r1.21 pthread.h
--- libpthread/pthread.h 21 Mar 2005 17:55:07 -0000 1.21
+++ libpthread/pthread.h 2 May 2005 09:14:02 -0000
@@ -344,12 +344,14 @@
__BEGIN_DECLS
int __libc_thr_once(pthread_once_t *, void (*)(void));
pthread_t __libc_thr_self(void);
+int __libc_thr_equal(pthread_t, pthread_t);
void __libc_thr_exit(void *) __attribute__((__noreturn__));
int __libc_thr_setcancelstate(int, int *);
__END_DECLS
#define pthread_once __libc_thr_once
#define pthread_self __libc_thr_self
+#define pthread_equal __libc_thr_equal
#define pthread_exit __libc_thr_exit
#define pthread_setcancelstate __libc_thr_setcancelstate
--
KAMADA Ken'ichi