Browse Source

inet:rpc: fix build in !NPTL case

__libc_once is not available / needed when multithreading support
is not enabled, so authnone_create() calls authnone_create_once()
directly.
When LT.{old,new} is used instead of NPTL, it needs to explicitly
include <bits/libc-lock.h> to get __libc_once to be visible.

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Carmelo Amoroso 12 years ago
parent
commit
21d6091b0d
2 changed files with 7 additions and 0 deletions
  1. 6 0
      libc/inet/rpc/auth_none.c
  2. 1 0
      libc/inet/rpc/rpc_private.h

+ 6 - 0
libc/inet/rpc/auth_none.c

@@ -68,7 +68,9 @@ struct authnone_private_s {
 };
 
 static struct authnone_private_s authnone_private;
+#ifdef __UCLIBC_HAS_THREADS__
 __libc_once_define(static, authnone_private_guard);
+#endif
 
 static void authnone_create_once (void);
 
@@ -95,7 +97,11 @@ authnone_create_once (void)
 AUTH *
 authnone_create (void)
 {
+#ifdef __UCLIBC_HAS_THREADS__
   __libc_once (authnone_private_guard, authnone_create_once);
+#else
+  authnone_create_once();
+#endif
   return &authnone_private.no_client;
 }
 libc_hidden_def(authnone_create)

+ 1 - 0
libc/inet/rpc/rpc_private.h

@@ -12,6 +12,7 @@ extern u_long _create_xid (void) attribute_hidden;
  */
 #ifdef __UCLIBC_HAS_THREADS__
 #include <pthread.h>
+#include <bits/libc-lock.h>
 struct rpc_thread_variables {
 	fd_set		svc_fdset_s;		/* Global, rpc_common.c */
 	struct rpc_createerr rpc_createerr_s;	/* Global, rpc_common.c */