All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bruce Cran <bruce@cran.org.uk>
To: Jens Axboe <axboe@kernel.dk>
Cc: fio@vger.kernel.org
Subject: [PATCH] Use pthread_self instead of thr_self on BSD
Date: Sat, 30 Jul 2011 10:43:33 +0100	[thread overview]
Message-ID: <4E33D245.6060301@cran.org.uk> (raw)

[-- Attachment #1: Type: text/plain, Size: 151 bytes --]

The attached patch uses pthread_self to get the thread ID instead of the 
non-POSIX thr_self This fixes a compiler warning on FreeBSD.

-- 
Bruce Cran

[-- Attachment #2: fio.diff --]
[-- Type: text/plain, Size: 1108 bytes --]

diff --git a/os/os-freebsd.h b/os/os-freebsd.h
index fad051f..9da792e 100644
--- a/os/os-freebsd.h
+++ b/os/os-freebsd.h
@@ -2,6 +2,7 @@
 #define FIO_OS_FREEBSD_H

 #include <errno.h>
+#include <pthread.h>
 #include <sys/sysctl.h>
 #include <sys/disk.h>

@@ -54,10 +55,7 @@ static inline unsigned long long os_phys_mem(void)

 static inline int gettid(void)
 {
-       long lwpid;
-
-       thr_self(&lwpid);
-       return (int) lwpid;
+       return (int) pthread_self();
 }

 #ifdef MADV_FREE
diff --git a/os/os-netbsd.h b/os/os-netbsd.h
index 7f5f484..c4a923f 100644
--- a/os/os-netbsd.h
+++ b/os/os-netbsd.h
@@ -2,6 +2,7 @@
 #define FIO_OS_NETBSD_H

 #include <errno.h>
+#include <pthread.h>
 #include <sys/param.h>
 /* XXX hack to avoid confilcts between rbtree.h and <sys/rb.h> */
 #define        rb_node _rb_node
@@ -48,10 +49,7 @@ static inline unsigned long long os_phys_mem(void)

 static inline int gettid(void)
 {
-       long lwpid;
-
-       thr_self(&lwpid);
-       return (int) lwpid;
+       return (int) pthread_self();
 }

 #ifdef MADV_FREE

             reply	other threads:[~2011-07-30  9:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-30  9:43 Bruce Cran [this message]
2011-07-30 10:55 ` [PATCH] Use pthread_self instead of thr_self on BSD Jens Axboe
2011-07-30 11:17   ` Bruce Cran
2011-07-30 11:23     ` Jens Axboe
2011-07-30 12:36       ` Bruce Cran
2011-07-30 12:57         ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E33D245.6060301@cran.org.uk \
    --to=bruce@cran.org.uk \
    --cc=axboe@kernel.dk \
    --cc=fio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.