Commit a3dbf764 by Ian Lance Taylor

Support libgo on Solaris.

From Rainer Orth.

From-SVN: r170355
parent 086bb4b9
...@@ -657,6 +657,20 @@ go_netchan_files = \ ...@@ -657,6 +657,20 @@ go_netchan_files = \
go/netchan/export.go \ go/netchan/export.go \
go/netchan/import.go go/netchan/import.go
if LIBGO_IS_SOLARIS
if LIBGO_IS_386
go_os_dir_file = go/os/dir_largefile.go
else
go_os_dir_file = go/os/dir_regfile.go
endif
else
if LIBGO_IS_LINUX
go_os_dir_file = go/os/dir_largefile.go
else
go_os_dir_file = go/os/dir_regfile.go
endif
endif
if LIBGO_IS_LINUX if LIBGO_IS_LINUX
go_os_sys_file = go/os/sys_linux.go go_os_sys_file = go/os/sys_linux.go
else else
...@@ -672,6 +686,7 @@ endif ...@@ -672,6 +686,7 @@ endif
endif endif
go_os_files = \ go_os_files = \
$(go_os_dir_file) \
go/os/dir.go \ go/os/dir.go \
go/os/env.go \ go/os/env.go \
go/os/env_unix.go \ go/os/env_unix.go \
...@@ -1111,18 +1126,23 @@ endif ...@@ -1111,18 +1126,23 @@ endif
if LIBGO_IS_LINUX if LIBGO_IS_LINUX
# Always use lseek64 on GNU/Linux. # Always use lseek64 on GNU/Linux.
syscall_filesize_file = syscalls/sysfile_largefile.go syscall_filesize_file = syscalls/sysfile_largefile.go
syscall_stat_file = syscalls/sysfile_stat_largefile.go
else # !LIBGO_IS_LINUX else # !LIBGO_IS_LINUX
if LIBGO_IS_SOLARIS if LIBGO_IS_SOLARIS
# FIXME: Same for sparc vs. sparc64. Introduce new/additional conditional?
if LIBGO_IS_386 if LIBGO_IS_386
# Use lseek64 on 386 Solaris. # Use lseek64 on 386 Solaris.
syscall_filesize_file = syscalls/sysfile_largefile.go syscall_filesize_file = syscalls/sysfile_largefile.go
syscall_stat_file = syscalls/sysfile_stat_largefile.go
else # !LIBGO_IS_LINUX && LIBGO_IS_SOLARIS && !LIBGO_IS_386 else # !LIBGO_IS_LINUX && LIBGO_IS_SOLARIS && !LIBGO_IS_386
# Use lseek on amd64 Solaris. # Use lseek on amd64 Solaris.
syscall_filesize_file = syscalls/sysfile_regfile.go syscall_filesize_file = syscalls/sysfile_regfile.go
syscall_stat_file = syscalls/sysfile_stat_regfile.go
endif # !LIBGO_IS_386 endif # !LIBGO_IS_386
else # !LIBGO_IS_LINUX && !LIBGO_IS_SOLARIS else # !LIBGO_IS_LINUX && !LIBGO_IS_SOLARIS
# Use lseek by default. # Use lseek by default.
syscall_filesize_file = syscalls/sysfile_regfile.go syscall_filesize_file = syscalls/sysfile_regfile.go
syscall_stat_file = syscalls/sysfile_stat_regfile.go
endif # !LIBGO_IS_SOLARIS endif # !LIBGO_IS_SOLARIS
endif # !LIBGO_IS_LINUX endif # !LIBGO_IS_LINUX
...@@ -1195,6 +1215,7 @@ go_syscall_files = \ ...@@ -1195,6 +1215,7 @@ go_syscall_files = \
syscalls/exec_helpers.go \ syscalls/exec_helpers.go \
$(syscall_exec_os_file) \ $(syscall_exec_os_file) \
$(syscall_filesize_file) \ $(syscall_filesize_file) \
$(syscall_stat_file) \
$(syscall_sleep_file) \ $(syscall_sleep_file) \
syscalls/socket.go \ syscalls/socket.go \
$(syscall_socket_os_file) \ $(syscall_socket_os_file) \
......
...@@ -1037,11 +1037,16 @@ go_netchan_files = \ ...@@ -1037,11 +1037,16 @@ go_netchan_files = \
go/netchan/export.go \ go/netchan/export.go \
go/netchan/import.go go/netchan/import.go
@LIBGO_IS_386_FALSE@@LIBGO_IS_SOLARIS_TRUE@go_os_dir_file = go/os/dir_regfile.go
@LIBGO_IS_386_TRUE@@LIBGO_IS_SOLARIS_TRUE@go_os_dir_file = go/os/dir_largefile.go
@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_os_dir_file = go/os/dir_regfile.go
@LIBGO_IS_LINUX_TRUE@@LIBGO_IS_SOLARIS_FALSE@go_os_dir_file = go/os/dir_largefile.go
@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_RTEMS_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_os_sys_file = go/os/sys_bsd.go @LIBGO_IS_LINUX_FALSE@@LIBGO_IS_RTEMS_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_os_sys_file = go/os/sys_bsd.go
@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_RTEMS_TRUE@@LIBGO_IS_SOLARIS_FALSE@go_os_sys_file = go/os/sys_uname.go @LIBGO_IS_LINUX_FALSE@@LIBGO_IS_RTEMS_TRUE@@LIBGO_IS_SOLARIS_FALSE@go_os_sys_file = go/os/sys_uname.go
@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@go_os_sys_file = go/os/sys_uname.go @LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@go_os_sys_file = go/os/sys_uname.go
@LIBGO_IS_LINUX_TRUE@go_os_sys_file = go/os/sys_linux.go @LIBGO_IS_LINUX_TRUE@go_os_sys_file = go/os/sys_linux.go
go_os_files = \ go_os_files = \
$(go_os_dir_file) \
go/os/dir.go \ go/os/dir.go \
go/os/env.go \ go/os/env.go \
go/os/env_unix.go \ go/os/env_unix.go \
...@@ -1513,6 +1518,7 @@ go_testing_script_files = \ ...@@ -1513,6 +1518,7 @@ go_testing_script_files = \
@LIBGO_IS_RTEMS_TRUE@syscall_syscall_file = syscalls/syscall_stubs.go @LIBGO_IS_RTEMS_TRUE@syscall_syscall_file = syscalls/syscall_stubs.go
# Use lseek on amd64 Solaris. # Use lseek on amd64 Solaris.
@LIBGO_IS_386_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@syscall_filesize_file = syscalls/sysfile_regfile.go @LIBGO_IS_386_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@syscall_filesize_file = syscalls/sysfile_regfile.go
# FIXME: Same for sparc vs. sparc64. Introduce new/additional conditional?
# Use lseek64 on 386 Solaris. # Use lseek64 on 386 Solaris.
@LIBGO_IS_386_TRUE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@syscall_filesize_file = syscalls/sysfile_largefile.go @LIBGO_IS_386_TRUE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@syscall_filesize_file = syscalls/sysfile_largefile.go
# Use lseek by default. # Use lseek by default.
...@@ -1521,6 +1527,10 @@ go_testing_script_files = \ ...@@ -1521,6 +1527,10 @@ go_testing_script_files = \
# Declare libc functions that vary for largefile systems. # Declare libc functions that vary for largefile systems.
# Always use lseek64 on GNU/Linux. # Always use lseek64 on GNU/Linux.
@LIBGO_IS_LINUX_TRUE@syscall_filesize_file = syscalls/sysfile_largefile.go @LIBGO_IS_LINUX_TRUE@syscall_filesize_file = syscalls/sysfile_largefile.go
@LIBGO_IS_386_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@syscall_stat_file = syscalls/sysfile_stat_regfile.go
@LIBGO_IS_386_TRUE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@syscall_stat_file = syscalls/sysfile_stat_largefile.go
@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@syscall_stat_file = syscalls/sysfile_stat_regfile.go
@LIBGO_IS_LINUX_TRUE@syscall_stat_file = syscalls/sysfile_stat_largefile.go
@LIBGO_IS_RTEMS_FALSE@syscall_exec_os_file = syscalls/exec.go @LIBGO_IS_RTEMS_FALSE@syscall_exec_os_file = syscalls/exec.go
# Define ForkExec, PtraceForkExec, Exec, and Wait4. # Define ForkExec, PtraceForkExec, Exec, and Wait4.
...@@ -1556,6 +1566,7 @@ go_syscall_files = \ ...@@ -1556,6 +1566,7 @@ go_syscall_files = \
syscalls/exec_helpers.go \ syscalls/exec_helpers.go \
$(syscall_exec_os_file) \ $(syscall_exec_os_file) \
$(syscall_filesize_file) \ $(syscall_filesize_file) \
$(syscall_stat_file) \
$(syscall_sleep_file) \ $(syscall_sleep_file) \
syscalls/socket.go \ syscalls/socket.go \
$(syscall_socket_os_file) \ $(syscall_socket_os_file) \
......
...@@ -62,6 +62,9 @@ ...@@ -62,6 +62,9 @@
/* Define to 1 if you have the <sys/stat.h> header file. */ /* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H #undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/syscall.h> header file. */
#undef HAVE_SYS_SYSCALL_H
/* Define to 1 if you have the <sys/types.h> header file. */ /* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H #undef HAVE_SYS_TYPES_H
......
...@@ -14129,7 +14129,7 @@ no) ...@@ -14129,7 +14129,7 @@ no)
;; ;;
esac esac
for ac_header in sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/user.h sys/utsname.h for ac_header in sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h
do : do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
......
...@@ -378,7 +378,7 @@ no) ...@@ -378,7 +378,7 @@ no)
;; ;;
esac esac
AC_CHECK_HEADERS(sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/user.h sys/utsname.h) AC_CHECK_HEADERS(sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h)
AM_CONDITIONAL(HAVE_SYS_MMAN_H, test "$ac_cv_header_sys_mman_h" = yes) AM_CONDITIONAL(HAVE_SYS_MMAN_H, test "$ac_cv_header_sys_mman_h" = yes)
AC_CHECK_FUNCS(srandom random strsignal) AC_CHECK_FUNCS(srandom random strsignal)
......
...@@ -11,7 +11,6 @@ import ( ...@@ -11,7 +11,6 @@ import (
func libc_dup(fd int) int __asm__ ("dup") func libc_dup(fd int) int __asm__ ("dup")
func libc_opendir(*byte) *syscall.DIR __asm__ ("opendir") func libc_opendir(*byte) *syscall.DIR __asm__ ("opendir")
func libc_readdir_r(*syscall.DIR, *syscall.Dirent, **syscall.Dirent) int __asm__ ("readdir_r")
func libc_closedir(*syscall.DIR) int __asm__ ("closedir") func libc_closedir(*syscall.DIR) int __asm__ ("closedir")
// FIXME: pathconf returns long, not int. // FIXME: pathconf returns long, not int.
......
// dir_largefile.go -- For systems which use the large file interface for
// readdir_r.
// Copyright 2011 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.
package os
import "syscall"
func libc_readdir_r(*syscall.DIR, *syscall.Dirent, **syscall.Dirent) int __asm__ ("readdir64_r")
// dir_regfile.go -- For systems which do not use the large file interface
// for readdir_r.
// Copyright 2011 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.
package os
import "syscall"
func libc_readdir_r(*syscall.DIR, *syscall.Dirent, **syscall.Dirent) int __asm__ ("readdir_r")
...@@ -26,6 +26,9 @@ cat > sysinfo.c <<EOF ...@@ -26,6 +26,9 @@ cat > sysinfo.c <<EOF
#include "config.h" #include "config.h"
#define _GNU_SOURCE #define _GNU_SOURCE
#define _LARGEFILE_SOURCE
#define _FILE_OFFSET_BITS 64
#if defined(__sun__) && defined(__svr4__) #if defined(__sun__) && defined(__svr4__)
/* Needed by Solaris header files. */ /* Needed by Solaris header files. */
#define _XOPEN_SOURCE 600 #define _XOPEN_SOURCE 600
...@@ -42,6 +45,9 @@ cat > sysinfo.c <<EOF ...@@ -42,6 +45,9 @@ cat > sysinfo.c <<EOF
#if defined(HAVE_SYSCALL_H) #if defined(HAVE_SYSCALL_H)
#include <syscall.h> #include <syscall.h>
#endif #endif
#if defined(HAVE_SYS_SYSCALL_H)
#include <sys/syscall.h>
#endif
#if defined(HAVE_SYS_EPOLL_H) #if defined(HAVE_SYS_EPOLL_H)
#include <sys/epoll.h> #include <sys/epoll.h>
#endif #endif
...@@ -306,36 +312,47 @@ if test "$timestruc" != ""; then ...@@ -306,36 +312,47 @@ if test "$timestruc" != ""; then
fi fi
# The stat type. # The stat type.
grep 'type _stat ' gen-sysinfo.go | \ # Prefer largefile variant if available.
sed -e 's/type _stat/type Stat_t/' \ stat=`grep '^type _stat64 ' gen-sysinfo.go || true`
-e 's/st_dev/Dev/' \ if test "$stat" != ""; then
-e 's/st_ino/Ino/' \ grep '^type _stat64 ' gen-sysinfo.go
-e 's/st_nlink/Nlink/' \ else
-e 's/st_mode/Mode/' \ grep '^type _stat ' gen-sysinfo.go
-e 's/st_uid/Uid/' \ fi | sed -e 's/type _stat\(64\)\?/type Stat_t/' \
-e 's/st_gid/Gid/' \ -e 's/st_dev/Dev/' \
-e 's/st_rdev/Rdev/' \ -e 's/st_ino/Ino/g' \
-e 's/st_size/Size/' \ -e 's/st_nlink/Nlink/' \
-e 's/st_blksize/Blksize/' \ -e 's/st_mode/Mode/' \
-e 's/st_blocks/Blocks/' \ -e 's/st_uid/Uid/' \
-e 's/st_atim/Atime/' \ -e 's/st_gid/Gid/' \
-e 's/st_mtim/Mtime/' \ -e 's/st_rdev/Rdev/' \
-e 's/st_ctim/Ctime/' \ -e 's/st_size/Size/' \
-e 's/\([^a-zA-Z0-9_]\)_timeval\([^a-zA-Z0-9_]\)/\1Timeval\2/g' \ -e 's/st_blksize/Blksize/' \
-e 's/\([^a-zA-Z0-9_]\)_timespec\([^a-zA-Z0-9_]\)/\1Timespec\2/g' \ -e 's/st_blocks/Blocks/' \
-e 's/\([^a-zA-Z0-9_]\)_timestruc_t\([^a-zA-Z0-9_]\)/\1Timestruc\2/g' \ -e 's/st_atim/Atime/' \
>> ${OUT} -e 's/st_mtim/Mtime/' \
-e 's/st_ctim/Ctime/' \
-e 's/\([^a-zA-Z0-9_]\)_timeval\([^a-zA-Z0-9_]\)/\1Timeval\2/g' \
-e 's/\([^a-zA-Z0-9_]\)_timespec\([^a-zA-Z0-9_]\)/\1Timespec\2/g' \
-e 's/\([^a-zA-Z0-9_]\)_timestruc_t\([^a-zA-Z0-9_]\)/\1Timestruc\2/g' \
>> ${OUT}
# The directory searching types. # The directory searching types.
grep '^type _dirent ' gen-sysinfo.go | \ # Prefer largefile variant if available.
sed -e 's/type _dirent/type Dirent/' \ dirent=`grep '^type _dirent64 ' gen-sysinfo.go || true`
-e 's/d_name/Name/' \ if test "$dirent" != ""; then
-e 's/]int8/]byte/' \ grep '^type _dirent64 ' gen-sysinfo.go
-e 's/d_ino/Ino/' \ else
-e 's/d_off/Off/' \ grep '^type _dirent ' gen-sysinfo.go
-e 's/d_reclen/Reclen/' \ fi | sed -e 's/type _dirent\(64\)\?/type Dirent/' \
-e 's/d_type/Type/' \ -e 's/d_name \[0+1\]/d_name [0+256]/' \
>> ${OUT} -e 's/d_name/Name/' \
-e 's/]int8/]byte/' \
-e 's/d_ino/Ino/' \
-e 's/d_off/Off/' \
-e 's/d_reclen/Reclen/' \
-e 's/d_type/Type/' \
>> ${OUT}
echo "type DIR _DIR" >> ${OUT} echo "type DIR _DIR" >> ${OUT}
# The rusage struct. # The rusage struct.
......
...@@ -18,9 +18,6 @@ func libc_read(fd int, buf *byte, count Size_t) Ssize_t __asm__ ("read"); ...@@ -18,9 +18,6 @@ func libc_read(fd int, buf *byte, count Size_t) Ssize_t __asm__ ("read");
func libc_write(fd int, buf *byte, count Size_t) Ssize_t __asm__ ("write"); func libc_write(fd int, buf *byte, count Size_t) Ssize_t __asm__ ("write");
func libc_fsync(fd int) int __asm__ ("fsync") func libc_fsync(fd int) int __asm__ ("fsync")
func libc_pipe(filedes *int) int __asm__("pipe"); func libc_pipe(filedes *int) int __asm__("pipe");
func libc_stat(name *byte, buf *Stat_t) int __asm__ ("stat");
func libc_fstat(fd int, buf *Stat_t) int __asm__ ("fstat");
func libc_lstat(name *byte, buf *Stat_t) int __asm__ ("lstat");
func libc_unlink(name *byte) int __asm__ ("unlink"); func libc_unlink(name *byte) int __asm__ ("unlink");
func libc_rmdir(name *byte) int __asm__ ("rmdir"); func libc_rmdir(name *byte) int __asm__ ("rmdir");
func libc_fcntl(fd int, cmd int, arg int) int __asm__ ("fcntl"); func libc_fcntl(fd int, cmd int, arg int) int __asm__ ("fcntl");
......
// sysfile_stat_largefile.go -- For systems which use the large file interface
// for *stat.
// Copyright 2011 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.
package syscall
func libc_stat(name *byte, buf *Stat_t) int __asm__ ("stat64");
func libc_fstat(fd int, buf *Stat_t) int __asm__ ("fstat64");
func libc_lstat(name *byte, buf *Stat_t) int __asm__ ("lstat64");
// sysfile_stat_regfile.go -- For systems which do not use the large file
// interface for *stat.
// Copyright 2011 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.
package syscall
func libc_stat(name *byte, buf *Stat_t) int __asm__ ("stat");
func libc_fstat(fd int, buf *Stat_t) int __asm__ ("fstat");
func libc_lstat(name *byte, buf *Stat_t) int __asm__ ("lstat");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment