public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* libgo patch committed: Use Entersyscall in os/user
@ 2012-06-13  6:09 Ian Lance Taylor
  0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2012-06-13  6:09 UTC (permalink / raw)
  To: gcc-patches, gofrontend-dev

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

This patch to libgo uses Entersyscall and Exitsyscall as appropriate in
os/user.  This is necessary if the lookup uses something like LDAP.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 948 bytes --]

diff -r 3f26ed600514 libgo/go/os/user/lookup_unix.go
--- a/libgo/go/os/user/lookup_unix.go	Tue Jun 12 21:46:14 2012 -0700
+++ b/libgo/go/os/user/lookup_unix.go	Tue Jun 12 22:54:06 2012 -0700
@@ -73,11 +73,14 @@
 	const bufSize = 1024
 	buf := make([]byte, bufSize)
 	if lookupByName {
-		rv := libc_getpwnam_r(syscall.StringBytePtr(username),
+		p := syscall.StringBytePtr(username)
+		syscall.Entersyscall()
+		rv := libc_getpwnam_r(p,
 			&pwd,
 			&buf[0],
 			bufSize,
 			&result)
+		syscall.Exitsyscall()
 		if rv != 0 {
 			return nil, fmt.Errorf("user: lookup username %s: %s", username, syscall.GetErrno())
 		}
@@ -85,11 +88,13 @@
 			return nil, UnknownUserError(username)
 		}
 	} else {
+		syscall.Entersyscall()
 		rv := libc_getpwuid_r(syscall.Uid_t(uid),
 			&pwd,
 			&buf[0],
 			bufSize,
 			&result)
+		syscall.Exitsyscall()
 		if rv != 0 {
 			return nil, fmt.Errorf("user: lookup userid %d: %s", uid, syscall.GetErrno())
 		}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-06-13  5:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-13  6:09 libgo patch committed: Use Entersyscall in os/user Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).