This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
[Patch] Submission to Linuxthreads - adding the use of CLONE_SYSVSEM flag
- From: David Wilder <wilder at us dot ibm dot com>
- To: libc-alpha at sources dot redhat dot com
- Cc: aj at suse dot de
- Date: Thu, 24 Apr 2003 16:52:30 -0700
- Subject: [Patch] Submission to Linuxthreads - adding the use of CLONE_SYSVSEM flag
Please include the following patches into glibc (linuxthreads add-on).
This is the second part of a two part change originally authored by Dave
Olien. Linus has accepted the first part into the 2.5 kernel. The kernel
change adds the flag CLONE_SYSVSEM to the clone system call. This patch
simply includes the use of this flag by the threads lib. This fixes a
buggy behavior with SEM_UNDO.
Patch to glibc-linuxthreads-2.3.1
diff -Naur linuxthreads/manager.c linuxthreads_dmccr/manager.c
--- linuxthreads/manager.c 2002-10-09 03:53:03.000000000 -0500
+++ linuxthreads_dmccr/manager.c 2003-02-20 10:43:36.000000000 -0600
@@ -711,15 +711,15 @@
pid = __clone2(pthread_start_thread_event,
(void **)new_thread_bottom,
(char *)new_thread - new_thread_bottom,
- CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND
|
+ CLONE_SYSVSEM | CLONE_VM | CLONE_FS | CLONE_FILES
| CLONE_SIGHAND |
__pthread_sig_cancel, new_thread);
#elif _STACK_GROWS_UP
pid = __clone(pthread_start_thread_event, (void **)
new_thread_bottom,
- CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND |
+ CLONE_SYSVSEM | CLONE_VM | CLONE_FS | CLONE_FILES |
CLONE_SIGHAND |
__pthread_sig_cancel, new_thread);
#else
pid = __clone(pthread_start_thread_event, (void **) new_thread,
- CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND |
+ CLONE_SYSVSEM | CLONE_VM | CLONE_FS | CLONE_FILES |
CLONE_SIGHAND |
__pthread_sig_cancel, new_thread);
#endif
saved_errno = errno;
@@ -752,15 +752,15 @@
pid = __clone2(pthread_start_thread,
(void **)new_thread_bottom,
(char *)stack_addr - new_thread_bottom,
- CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND |
+ CLONE_SYSVSEM | CLONE_VM | CLONE_FS | CLONE_FILES |
CLONE_SIGHAND |
__pthread_sig_cancel, new_thread);
#elif _STACK_GROWS_UP
pid = __clone(pthread_start_thread, (void *) new_thread_bottom,
- CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND |
+ CLONE_SYSVSEM | CLONE_VM | CLONE_FS | CLONE_FILES |
CLONE_SIGHAND |
__pthread_sig_cancel, new_thread);
#else
pid = __clone(pthread_start_thread, stack_addr,
- CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND |
+ CLONE_SYSVSEM | CLONE_VM | CLONE_FS | CLONE_FILES |
CLONE_SIGHAND |
__pthread_sig_cancel, new_thread);
#endif /* !NEED_SEPARATE_REGISTER_STACK */
saved_errno = errno;
diff -Naur linuxthreads/pthread.c linuxthreads_dmccr/pthread.c
--- linuxthreads/pthread.c 2002-10-09 03:53:03.000000000 -0500
+++ linuxthreads_dmccr/pthread.c 2003-02-20 10:46:34.000000000 -0600
@@ -603,17 +603,17 @@
pid = __clone2(__pthread_manager_event,
(void **) __pthread_manager_thread_bos,
THREAD_MANAGER_STACK_SIZE,
- CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND,
+ CLONE_SYSVSEM | CLONE_VM | CLONE_FS | CLONE_FILES
| CLONE_SIGHAND,
tcb);
#elif _STACK_GROWS_UP
pid = __clone(__pthread_manager_event,
(void **) __pthread_manager_thread_bos,
- CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND,
+ CLONE_SYSVSEM | CLONE_VM | CLONE_FS | CLONE_FILES |
CLONE_SIGHAND,
tcb);
#else
pid = __clone(__pthread_manager_event,
(void **) __pthread_manager_thread_tos,
- CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND,
+ CLONE_SYSVSEM | CLONE_VM | CLONE_FS | CLONE_FILES |
CLONE_SIGHAND,
tcb);
#endif
@@ -643,13 +643,13 @@
#ifdef NEED_SEPARATE_REGISTER_STACK
pid = __clone2(__pthread_manager, (void **)
__pthread_manager_thread_bos,
THREAD_MANAGER_STACK_SIZE,
- CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND,
tcb);
+ CLONE_SYSVSEM | CLONE_VM | CLONE_FS | CLONE_FILES |
CLONE_SIGHAND, tcb);
#elif _STACK_GROWS_UP
pid = __clone(__pthread_manager, (void **)
__pthread_manager_thread_bos,
- CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND,
tcb);
+ CLONE_SYSVSEM | CLONE_VM | CLONE_FS | CLONE_FILES |
CLONE_SIGHAND, tcb);
#else
pid = __clone(__pthread_manager, (void **)
__pthread_manager_thread_tos,
- CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND,
tcb);
+ CLONE_SYSVSEM | CLONE_VM | CLONE_FS | CLONE_FILES |
CLONE_SIGHAND, tcb);
#endif
}
if (__builtin_expect (pid, 0) == -1) {
David Wilder
IBM Global Services, Linux Change Team
wilder at us dot ibm dot com
(503) 578-3789 T/L 775-3789