]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR go/59430 (os/user FAILs on Solaris)
authorIan Lance Taylor <ian@gcc.gnu.org>
Wed, 8 Jan 2014 01:08:29 +0000 (01:08 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Wed, 8 Jan 2014 01:08:29 +0000 (01:08 +0000)
PR go/59430
os/user: Use POSIX functions on Solaris.

From-SVN: r206412

libgo/Makefile.am
libgo/Makefile.in
libgo/go/os/user/decls_solaris.go [new file with mode: 0644]
libgo/go/os/user/decls_unix.go [new file with mode: 0644]
libgo/go/os/user/lookup_unix.go

index 0851b71e02ed1f8c18bf714de97d4461713fc37c..4f09bc30bf613571d88086bf2ee0d71c63fd122d 100644 (file)
@@ -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 \
index ca9df103620376a33ea1144146c9948ced4127d9..cf93938379b783753dc4d87bdd5fdb888964d67e 100644 (file)
@@ -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 (file)
index 0000000..788a00f
--- /dev/null
@@ -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 (file)
index 0000000..f76e4c9
--- /dev/null
@@ -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
index eca97a63d6b780a3e20a0bff41b63eb00c4caf68..2d309ed33300fb22eb644b5be4c5e517baf340df 100644 (file)
@@ -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 {