This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
libgo patch committed: Add gettid on GNU/Linux
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org, gofrontend-dev at googlegroups dot com
- Date: Tue, 31 Jan 2012 12:48:52 -0800
- Subject: libgo patch committed: Add gettid on GNU/Linux
This patch to libgo adds support for syscall.Gettid on GNU/Linux. The
function is different becase it is not in libc, but must be invoked via
Syscall. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.
Ian
diff -r 351201702211 libgo/go/syscall/libcall_linux.go
--- a/libgo/go/syscall/libcall_linux.go Tue Jan 31 06:21:32 2012 -0800
+++ b/libgo/go/syscall/libcall_linux.go Tue Jan 31 11:49:40 2012 -0800
@@ -195,9 +195,10 @@
// //sys Fstatfs(fd int, buf *Statfs_t) (err error)
// //fstatfs(fd int, buf *Statfs_t) int
-// FIXME: Only available as a syscall.
-// //sysnb Gettid() (tid int)
-// //gettid() Pid_t
+func Gettid() (tid int) {
+ r1, _, _ := Syscall(SYS_GETTID, 0, 0, 0)
+ return int(r1)
+}
// FIXME: mksysinfo linux_dirent
// Or just abandon this function.