summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libgo/Makefile.am11
-rw-r--r--libgo/Makefile.in7
-rw-r--r--libgo/go/os/user/decls_solaris.go18
-rw-r--r--libgo/go/os/user/decls_unix.go18
-rw-r--r--libgo/go/os/user/lookup_unix.go6
5 files changed, 50 insertions, 10 deletions
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
index 0851b71e02e..4f09bc30bf6 100644
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -1465,10 +1465,17 @@ go_os_signal_files = \
go/os/signal/signal.go \
go/os/signal/signal_unix.go
+if LIBGO_IS_SOLARIS
+os_user_decls_file = go/os/user/decls_solaris.go
+else
+os_user_decls_file = go/os/user/decls_unix.go
+endif
+
go_os_user_files = \
- go/os/user/user.go \
go/os/user/lookup.go \
- go/os/user/lookup_unix.go
+ go/os/user/lookup_unix.go \
+ go/os/user/user.go \
+ $(os_user_decls_file)
go_path_filepath_files = \
go/path/filepath/match.go \
diff --git a/libgo/Makefile.in b/libgo/Makefile.in
index ca9df103620..cf93938379b 100644
--- a/libgo/Makefile.in
+++ b/libgo/Makefile.in
@@ -1670,10 +1670,13 @@ go_os_signal_files = \
go/os/signal/signal.go \
go/os/signal/signal_unix.go
+@LIBGO_IS_SOLARIS_FALSE@os_user_decls_file = go/os/user/decls_unix.go
+@LIBGO_IS_SOLARIS_TRUE@os_user_decls_file = go/os/user/decls_solaris.go
go_os_user_files = \
- go/os/user/user.go \
go/os/user/lookup.go \
- go/os/user/lookup_unix.go
+ go/os/user/lookup_unix.go \
+ go/os/user/user.go \
+ $(os_user_decls_file)
go_path_filepath_files = \
go/path/filepath/match.go \
diff --git a/libgo/go/os/user/decls_solaris.go b/libgo/go/os/user/decls_solaris.go
new file mode 100644
index 00000000000..788a00f0661
--- /dev/null
+++ b/libgo/go/os/user/decls_solaris.go
@@ -0,0 +1,18 @@
+// Copyright 2014 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build solaris
+// +build cgo
+
+package user
+
+import "syscall"
+
+// Declarations for the libc functions on Solaris.
+
+//extern __posix_getpwnam_r
+func libc_getpwnam_r(name *byte, pwd *syscall.Passwd, buf *byte, buflen syscall.Size_t, result **syscall.Passwd) int
+
+//extern __posix_getpwuid_r
+func libc_getpwuid_r(uid syscall.Uid_t, pwd *syscall.Passwd, buf *byte, buflen syscall.Size_t, result **syscall.Passwd) int
diff --git a/libgo/go/os/user/decls_unix.go b/libgo/go/os/user/decls_unix.go
new file mode 100644
index 00000000000..f76e4c9bdfc
--- /dev/null
+++ b/libgo/go/os/user/decls_unix.go
@@ -0,0 +1,18 @@
+// Copyright 2014 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build darwin dragonfly freebsd linux netbsd openbsd
+// +build cgo
+
+package user
+
+import "syscall"
+
+// Declarations for the libc functions on most Unix systems.
+
+//extern getpwnam_r
+func libc_getpwnam_r(name *byte, pwd *syscall.Passwd, buf *byte, buflen syscall.Size_t, result **syscall.Passwd) int
+
+//extern getpwuid_r
+func libc_getpwuid_r(uid syscall.Uid_t, pwd *syscall.Passwd, buf *byte, buflen syscall.Size_t, result **syscall.Passwd) int
diff --git a/libgo/go/os/user/lookup_unix.go b/libgo/go/os/user/lookup_unix.go
index eca97a63d6b..2d309ed3330 100644
--- a/libgo/go/os/user/lookup_unix.go
+++ b/libgo/go/os/user/lookup_unix.go
@@ -27,12 +27,6 @@ static int mygetpwuid_r(int uid, struct passwd *pwd,
}
*/
-//extern getpwnam_r
-func libc_getpwnam_r(name *byte, pwd *syscall.Passwd, buf *byte, buflen syscall.Size_t, result **syscall.Passwd) int
-
-//extern getpwuid_r
-func libc_getpwuid_r(uid syscall.Uid_t, pwd *syscall.Passwd, buf *byte, buflen syscall.Size_t, result **syscall.Passwd) int
-
// bytePtrToString takes a NUL-terminated array of bytes and convert
// it to a Go string.
func bytePtrToString(p *byte) string {