[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH] pthread_atfork() is defined in both unistd.h and pthread.h



I add the update patch for NPTL 0.33.
Please apply both libc which I sent to libc-alpha and nptl.

> Both unistd.h and pthread.h have the duplicate prototype definition of
> pthread_atfork(), if __USE_POSIX199309 is enabled.  So if a program
> includes both headers pthread.h and unistd.h, and it's compiled with
> the gcc warning option "-Wsystem-headers -Wredundant-decls", then it
> gets warnings:
> 
>     gotom celesta> cat test1.c
>     #include <pthread.h>
>     #include <unistd.h>
>     void f(){}
>     gotom celesta> gcc -c -Wsystem-headers -Wredundant-decls test1.c
>     In file included from test1.c:2:
>     /usr/include/unistd.h:1003: warning: redundant redeclaration of `pthread_atfork' in same scope
>     /usr/include/pthread.h:674: warning: previous declaration of `pthread_atfork'
> 
> This patch eliminates these warnings.

Regards,
-- gotom

2003-03-31  GOTO Masanori  <gotom debian or jp>

	* sysdeps/pthread/pthread.h: Define _PTHREAD_ATFORK_DEFINED not to
	include the duplicate prototype definition of pthread_atfork().


--- nptl/sysdeps/pthread/pthread.h	2003-03-18 19:24:47.000000000 +0900
+++ nptl/sysdeps/pthread/pthread.h.new	2003-04-03 10:14:16.000000000 +0900
@@ -743,6 +743,7 @@
 #endif
 
 
+#ifndef _PTHREAD_ATFORK_DEFINED
 /* Install handlers to be called when a new process is created with FORK.
    The PREPARE handler is called in the parent process just before performing
    FORK. The PARENT handler is called in the parent process just after FORK.
@@ -757,6 +758,9 @@
 extern int pthread_atfork (void (*__prepare) (void),
 			   void (*__parent) (void),
 			   void (*__child) (void)) __THROW;
+# define _PTHREAD_ATFORK_DEFINED
+#endif
+
 
 __END_DECLS
 





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]