[Pvfs2-cvs] commit by robl in pvfs2-1/src/common/misc: digest.c

CVS commit program cvs at parl.clemson.edu
Fri Oct 13 14:51:45 EDT 2006


Update of /projects/cvsroot/pvfs2-1/src/common/misc
In directory parlweb1:/tmp/cvs-serv10402/src/common/misc

Modified Files:
	digest.c 
Log Message:
pete or murali might holler about this, but try to call gettid in a
more-portable way.


Index: digest.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/common/misc/digest.c,v
diff -u -w -p -u -r1.4 -r1.5
--- digest.c	14 Sep 2006 20:36:44 -0000	1.4
+++ digest.c	13 Oct 2006 18:51:45 -0000	1.5
@@ -8,6 +8,7 @@
 
 #ifdef WITH_OPENSSL
 
+
 #ifdef HAVE_OPENSSL_EVP_H
 #include <openssl/evp.h>
 #endif
@@ -20,8 +21,10 @@
 #ifdef __GEN_POSIX_LOCKING__
 #include <pthread.h>
 #include <linux/unistd.h>
+#include <sys/types.h>
+#include <sys/syscall.h>
+#include <unistd.h>
 
-static _syscall0(pid_t,gettid)
 
 static gen_mutex_t *mutex = NULL;
 static pthread_once_t once_initialize = PTHREAD_ONCE_INIT;
@@ -40,11 +43,14 @@ static void do_lock(int mode, int n, con
 
 static unsigned long get_tid(void)
 {
-	/* NOTE:
-	 * This could fail on non 2.6 kernels, since gettid()
-	 * probably does not exist?
-	 */
-	return gettid();
+	 /* If gettid syscall does not exist, fall back to getpid, which I
+	  * think will do something similar to gettid on non-ntpl
+	  * implementations */
+#if defined(__NR_gettid)
+	return syscall(__NR_gettid);
+#else
+	return getpid();
+#endif
 }
 
 static void callback_init(void)



More information about the Pvfs2-cvs mailing list